@medusajs/draft-order 2.10.4-snapshot-20251009074418 → 2.10.4-snapshot-20251009080820

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.
@@ -9567,6 +9567,196 @@ const ID = () => {
9567
9567
  /* @__PURE__ */ jsx(Outlet, {})
9568
9568
  ] });
9569
9569
  };
9570
+ const BillingAddress = () => {
9571
+ const { id } = useParams();
9572
+ const { order, isPending, isError, error } = useOrder(id, {
9573
+ fields: "+billing_address"
9574
+ });
9575
+ if (isError) {
9576
+ throw error;
9577
+ }
9578
+ const isReady = !isPending && !!order;
9579
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9580
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9581
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9582
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9583
+ ] }),
9584
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9585
+ ] });
9586
+ };
9587
+ const BillingAddressForm = ({ order }) => {
9588
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9589
+ const form = useForm({
9590
+ defaultValues: {
9591
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9592
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9593
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9594
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9595
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9596
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9597
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9598
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9599
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9600
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9601
+ },
9602
+ resolver: zodResolver(schema$5)
9603
+ });
9604
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9605
+ const { handleSuccess } = useRouteModal();
9606
+ const onSubmit = form.handleSubmit(async (data) => {
9607
+ await mutateAsync(
9608
+ { billing_address: data },
9609
+ {
9610
+ onSuccess: () => {
9611
+ handleSuccess();
9612
+ },
9613
+ onError: (error) => {
9614
+ toast.error(error.message);
9615
+ }
9616
+ }
9617
+ );
9618
+ });
9619
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9620
+ KeyboundForm,
9621
+ {
9622
+ className: "flex flex-1 flex-col overflow-hidden",
9623
+ onSubmit,
9624
+ children: [
9625
+ /* @__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: [
9626
+ /* @__PURE__ */ jsx(
9627
+ Form$2.Field,
9628
+ {
9629
+ control: form.control,
9630
+ name: "country_code",
9631
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9632
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9633
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9634
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9635
+ ] })
9636
+ }
9637
+ ),
9638
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9639
+ /* @__PURE__ */ jsx(
9640
+ Form$2.Field,
9641
+ {
9642
+ control: form.control,
9643
+ name: "first_name",
9644
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9645
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9646
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9647
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9648
+ ] })
9649
+ }
9650
+ ),
9651
+ /* @__PURE__ */ jsx(
9652
+ Form$2.Field,
9653
+ {
9654
+ control: form.control,
9655
+ name: "last_name",
9656
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9657
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9658
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9659
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9660
+ ] })
9661
+ }
9662
+ )
9663
+ ] }),
9664
+ /* @__PURE__ */ jsx(
9665
+ Form$2.Field,
9666
+ {
9667
+ control: form.control,
9668
+ name: "company",
9669
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9670
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9671
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9672
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9673
+ ] })
9674
+ }
9675
+ ),
9676
+ /* @__PURE__ */ jsx(
9677
+ Form$2.Field,
9678
+ {
9679
+ control: form.control,
9680
+ name: "address_1",
9681
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9682
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9683
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9684
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9685
+ ] })
9686
+ }
9687
+ ),
9688
+ /* @__PURE__ */ jsx(
9689
+ Form$2.Field,
9690
+ {
9691
+ control: form.control,
9692
+ name: "address_2",
9693
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9694
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9695
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9696
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9697
+ ] })
9698
+ }
9699
+ ),
9700
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9701
+ /* @__PURE__ */ jsx(
9702
+ Form$2.Field,
9703
+ {
9704
+ control: form.control,
9705
+ name: "postal_code",
9706
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9707
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9708
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9709
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9710
+ ] })
9711
+ }
9712
+ ),
9713
+ /* @__PURE__ */ jsx(
9714
+ Form$2.Field,
9715
+ {
9716
+ control: form.control,
9717
+ name: "city",
9718
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9720
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9721
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
+ ] })
9723
+ }
9724
+ )
9725
+ ] }),
9726
+ /* @__PURE__ */ jsx(
9727
+ Form$2.Field,
9728
+ {
9729
+ control: form.control,
9730
+ name: "province",
9731
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9732
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9733
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9734
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9735
+ ] })
9736
+ }
9737
+ ),
9738
+ /* @__PURE__ */ jsx(
9739
+ Form$2.Field,
9740
+ {
9741
+ control: form.control,
9742
+ name: "phone",
9743
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9744
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9745
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9746
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9747
+ ] })
9748
+ }
9749
+ )
9750
+ ] }) }),
9751
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9752
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9753
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9754
+ ] }) })
9755
+ ]
9756
+ }
9757
+ ) });
9758
+ };
9759
+ const schema$5 = addressSchema;
9570
9760
  const CustomItems = () => {
9571
9761
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9572
9762
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9575,7 +9765,7 @@ const CustomItems = () => {
9575
9765
  };
9576
9766
  const CustomItemsForm = () => {
9577
9767
  const form = useForm({
9578
- resolver: zodResolver(schema$5)
9768
+ resolver: zodResolver(schema$4)
9579
9769
  });
9580
9770
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9581
9771
  /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
@@ -9585,7 +9775,7 @@ const CustomItemsForm = () => {
9585
9775
  ] }) })
9586
9776
  ] }) });
9587
9777
  };
9588
- const schema$5 = objectType({
9778
+ const schema$4 = objectType({
9589
9779
  email: stringType().email()
9590
9780
  });
9591
9781
  const Email = () => {
@@ -9610,7 +9800,7 @@ const EmailForm = ({ order }) => {
9610
9800
  defaultValues: {
9611
9801
  email: order.email ?? ""
9612
9802
  },
9613
- resolver: zodResolver(schema$4)
9803
+ resolver: zodResolver(schema$3)
9614
9804
  });
9615
9805
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9616
9806
  const { handleSuccess } = useRouteModal();
@@ -9653,7 +9843,7 @@ const EmailForm = ({ order }) => {
9653
9843
  }
9654
9844
  ) });
9655
9845
  };
9656
- const schema$4 = objectType({
9846
+ const schema$3 = objectType({
9657
9847
  email: stringType().email()
9658
9848
  });
9659
9849
  const NumberInput = forwardRef(
@@ -11257,46 +11447,60 @@ function getPromotionIds(items, shippingMethods) {
11257
11447
  }
11258
11448
  return Array.from(promotionIds);
11259
11449
  }
11260
- const SalesChannel = () => {
11450
+ const ShippingAddress = () => {
11261
11451
  const { id } = useParams();
11262
- const { draft_order, isPending, isError, error } = useDraftOrder(
11263
- id,
11264
- {
11265
- fields: "+sales_channel_id"
11266
- },
11267
- {
11268
- enabled: !!id
11269
- }
11270
- );
11452
+ const { order, isPending, isError, error } = useOrder(id, {
11453
+ fields: "+shipping_address"
11454
+ });
11271
11455
  if (isError) {
11272
11456
  throw error;
11273
11457
  }
11274
- const ISrEADY = !!draft_order && !isPending;
11458
+ const isReady = !isPending && !!order;
11275
11459
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11276
11460
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11277
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
11278
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11461
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11462
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11279
11463
  ] }),
11280
- ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
11464
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11281
11465
  ] });
11282
11466
  };
11283
- const SalesChannelForm = ({ order }) => {
11467
+ const ShippingAddressForm = ({ order }) => {
11468
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11284
11469
  const form = useForm({
11285
11470
  defaultValues: {
11286
- sales_channel_id: order.sales_channel_id || ""
11471
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11472
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11473
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11474
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11475
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11476
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11477
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11478
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11479
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11480
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11287
11481
  },
11288
- resolver: zodResolver(schema$3)
11482
+ resolver: zodResolver(schema$2)
11289
11483
  });
11290
11484
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11291
11485
  const { handleSuccess } = useRouteModal();
11292
11486
  const onSubmit = form.handleSubmit(async (data) => {
11293
11487
  await mutateAsync(
11294
11488
  {
11295
- sales_channel_id: data.sales_channel_id
11489
+ shipping_address: {
11490
+ first_name: data.first_name,
11491
+ last_name: data.last_name,
11492
+ company: data.company,
11493
+ address_1: data.address_1,
11494
+ address_2: data.address_2,
11495
+ city: data.city,
11496
+ province: data.province,
11497
+ country_code: data.country_code,
11498
+ postal_code: data.postal_code,
11499
+ phone: data.phone
11500
+ }
11296
11501
  },
11297
11502
  {
11298
11503
  onSuccess: () => {
11299
- toast.success("Sales channel updated");
11300
11504
  handleSuccess();
11301
11505
  },
11302
11506
  onError: (error) => {
@@ -11311,58 +11515,141 @@ const SalesChannelForm = ({ order }) => {
11311
11515
  className: "flex flex-1 flex-col overflow-hidden",
11312
11516
  onSubmit,
11313
11517
  children: [
11314
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
11315
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11316
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11317
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11318
- ] }) })
11319
- ]
11320
- }
11321
- ) });
11322
- };
11323
- const SalesChannelField = ({ control, order }) => {
11324
- const salesChannels = useComboboxData({
11325
- queryFn: async (params) => {
11326
- return await sdk.admin.salesChannel.list(params);
11327
- },
11328
- queryKey: ["sales-channels"],
11329
- getOptions: (data) => {
11330
- return data.sales_channels.map((salesChannel) => ({
11331
- label: salesChannel.name,
11332
- value: salesChannel.id
11333
- }));
11334
- },
11335
- defaultValue: order.sales_channel_id || void 0
11336
- });
11337
- return /* @__PURE__ */ jsx(
11338
- Form$2.Field,
11339
- {
11340
- control,
11341
- name: "sales_channel_id",
11342
- render: ({ field }) => {
11343
- return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11344
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
11345
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
11346
- Combobox,
11518
+ /* @__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: [
11519
+ /* @__PURE__ */ jsx(
11520
+ Form$2.Field,
11347
11521
  {
11348
- options: salesChannels.options,
11349
- fetchNextPage: salesChannels.fetchNextPage,
11350
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11351
- searchValue: salesChannels.searchValue,
11352
- onSearchValueChange: salesChannels.onSearchValueChange,
11353
- placeholder: "Select sales channel",
11354
- ...field
11522
+ control: form.control,
11523
+ name: "country_code",
11524
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11525
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11526
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11527
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11528
+ ] })
11355
11529
  }
11356
- ) }),
11357
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11358
- ] });
11359
- }
11530
+ ),
11531
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11532
+ /* @__PURE__ */ jsx(
11533
+ Form$2.Field,
11534
+ {
11535
+ control: form.control,
11536
+ name: "first_name",
11537
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11538
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11539
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11540
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11541
+ ] })
11542
+ }
11543
+ ),
11544
+ /* @__PURE__ */ jsx(
11545
+ Form$2.Field,
11546
+ {
11547
+ control: form.control,
11548
+ name: "last_name",
11549
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11550
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11551
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11552
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11553
+ ] })
11554
+ }
11555
+ )
11556
+ ] }),
11557
+ /* @__PURE__ */ jsx(
11558
+ Form$2.Field,
11559
+ {
11560
+ control: form.control,
11561
+ name: "company",
11562
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11563
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11564
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11565
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11566
+ ] })
11567
+ }
11568
+ ),
11569
+ /* @__PURE__ */ jsx(
11570
+ Form$2.Field,
11571
+ {
11572
+ control: form.control,
11573
+ name: "address_1",
11574
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11575
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11576
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11577
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11578
+ ] })
11579
+ }
11580
+ ),
11581
+ /* @__PURE__ */ jsx(
11582
+ Form$2.Field,
11583
+ {
11584
+ control: form.control,
11585
+ name: "address_2",
11586
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11587
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11588
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11589
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11590
+ ] })
11591
+ }
11592
+ ),
11593
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11594
+ /* @__PURE__ */ jsx(
11595
+ Form$2.Field,
11596
+ {
11597
+ control: form.control,
11598
+ name: "postal_code",
11599
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11600
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11601
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11602
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11603
+ ] })
11604
+ }
11605
+ ),
11606
+ /* @__PURE__ */ jsx(
11607
+ Form$2.Field,
11608
+ {
11609
+ control: form.control,
11610
+ name: "city",
11611
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11612
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11613
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11614
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11615
+ ] })
11616
+ }
11617
+ )
11618
+ ] }),
11619
+ /* @__PURE__ */ jsx(
11620
+ Form$2.Field,
11621
+ {
11622
+ control: form.control,
11623
+ name: "province",
11624
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11625
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11626
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11627
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11628
+ ] })
11629
+ }
11630
+ ),
11631
+ /* @__PURE__ */ jsx(
11632
+ Form$2.Field,
11633
+ {
11634
+ control: form.control,
11635
+ name: "phone",
11636
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11637
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11638
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11639
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11640
+ ] })
11641
+ }
11642
+ )
11643
+ ] }) }),
11644
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11645
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11646
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11647
+ ] }) })
11648
+ ]
11360
11649
  }
11361
- );
11650
+ ) });
11362
11651
  };
11363
- const schema$3 = objectType({
11364
- sales_channel_id: stringType().min(1)
11365
- });
11652
+ const schema$2 = addressSchema;
11366
11653
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11367
11654
  const Shipping = () => {
11368
11655
  var _a;
@@ -12170,60 +12457,46 @@ const CustomAmountField = ({
12170
12457
  }
12171
12458
  );
12172
12459
  };
12173
- const ShippingAddress = () => {
12460
+ const SalesChannel = () => {
12174
12461
  const { id } = useParams();
12175
- const { order, isPending, isError, error } = useOrder(id, {
12176
- fields: "+shipping_address"
12177
- });
12462
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12463
+ id,
12464
+ {
12465
+ fields: "+sales_channel_id"
12466
+ },
12467
+ {
12468
+ enabled: !!id
12469
+ }
12470
+ );
12178
12471
  if (isError) {
12179
12472
  throw error;
12180
12473
  }
12181
- const isReady = !isPending && !!order;
12474
+ const ISrEADY = !!draft_order && !isPending;
12182
12475
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12183
12476
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12184
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12185
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12477
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
12478
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12186
12479
  ] }),
12187
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12480
+ ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
12188
12481
  ] });
12189
12482
  };
12190
- const ShippingAddressForm = ({ order }) => {
12191
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12483
+ const SalesChannelForm = ({ order }) => {
12192
12484
  const form = useForm({
12193
12485
  defaultValues: {
12194
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12195
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12196
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12197
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12198
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12199
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12200
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12201
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12202
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12203
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12486
+ sales_channel_id: order.sales_channel_id || ""
12204
12487
  },
12205
- resolver: zodResolver(schema$2)
12488
+ resolver: zodResolver(schema$1)
12206
12489
  });
12207
12490
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12208
12491
  const { handleSuccess } = useRouteModal();
12209
12492
  const onSubmit = form.handleSubmit(async (data) => {
12210
12493
  await mutateAsync(
12211
12494
  {
12212
- shipping_address: {
12213
- first_name: data.first_name,
12214
- last_name: data.last_name,
12215
- company: data.company,
12216
- address_1: data.address_1,
12217
- address_2: data.address_2,
12218
- city: data.city,
12219
- province: data.province,
12220
- country_code: data.country_code,
12221
- postal_code: data.postal_code,
12222
- phone: data.phone
12223
- }
12495
+ sales_channel_id: data.sales_channel_id
12224
12496
  },
12225
12497
  {
12226
12498
  onSuccess: () => {
12499
+ toast.success("Sales channel updated");
12227
12500
  handleSuccess();
12228
12501
  },
12229
12502
  onError: (error) => {
@@ -12238,132 +12511,7 @@ const ShippingAddressForm = ({ order }) => {
12238
12511
  className: "flex flex-1 flex-col overflow-hidden",
12239
12512
  onSubmit,
12240
12513
  children: [
12241
- /* @__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: [
12242
- /* @__PURE__ */ jsx(
12243
- Form$2.Field,
12244
- {
12245
- control: form.control,
12246
- name: "country_code",
12247
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12248
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12249
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12250
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12251
- ] })
12252
- }
12253
- ),
12254
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12255
- /* @__PURE__ */ jsx(
12256
- Form$2.Field,
12257
- {
12258
- control: form.control,
12259
- name: "first_name",
12260
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12261
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12262
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12263
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12264
- ] })
12265
- }
12266
- ),
12267
- /* @__PURE__ */ jsx(
12268
- Form$2.Field,
12269
- {
12270
- control: form.control,
12271
- name: "last_name",
12272
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12273
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12274
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12275
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12276
- ] })
12277
- }
12278
- )
12279
- ] }),
12280
- /* @__PURE__ */ jsx(
12281
- Form$2.Field,
12282
- {
12283
- control: form.control,
12284
- name: "company",
12285
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12286
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12287
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12288
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12289
- ] })
12290
- }
12291
- ),
12292
- /* @__PURE__ */ jsx(
12293
- Form$2.Field,
12294
- {
12295
- control: form.control,
12296
- name: "address_1",
12297
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12298
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12299
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12300
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12301
- ] })
12302
- }
12303
- ),
12304
- /* @__PURE__ */ jsx(
12305
- Form$2.Field,
12306
- {
12307
- control: form.control,
12308
- name: "address_2",
12309
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12310
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12311
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12312
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12313
- ] })
12314
- }
12315
- ),
12316
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12317
- /* @__PURE__ */ jsx(
12318
- Form$2.Field,
12319
- {
12320
- control: form.control,
12321
- name: "postal_code",
12322
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12323
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12324
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12325
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12326
- ] })
12327
- }
12328
- ),
12329
- /* @__PURE__ */ jsx(
12330
- Form$2.Field,
12331
- {
12332
- control: form.control,
12333
- name: "city",
12334
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12335
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12336
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12337
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12338
- ] })
12339
- }
12340
- )
12341
- ] }),
12342
- /* @__PURE__ */ jsx(
12343
- Form$2.Field,
12344
- {
12345
- control: form.control,
12346
- name: "province",
12347
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12348
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12349
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12350
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12351
- ] })
12352
- }
12353
- ),
12354
- /* @__PURE__ */ jsx(
12355
- Form$2.Field,
12356
- {
12357
- control: form.control,
12358
- name: "phone",
12359
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12360
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12361
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12362
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12363
- ] })
12364
- }
12365
- )
12366
- ] }) }),
12514
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
12367
12515
  /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12368
12516
  /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12369
12517
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -12372,7 +12520,49 @@ const ShippingAddressForm = ({ order }) => {
12372
12520
  }
12373
12521
  ) });
12374
12522
  };
12375
- const schema$2 = addressSchema;
12523
+ const SalesChannelField = ({ control, order }) => {
12524
+ const salesChannels = useComboboxData({
12525
+ queryFn: async (params) => {
12526
+ return await sdk.admin.salesChannel.list(params);
12527
+ },
12528
+ queryKey: ["sales-channels"],
12529
+ getOptions: (data) => {
12530
+ return data.sales_channels.map((salesChannel) => ({
12531
+ label: salesChannel.name,
12532
+ value: salesChannel.id
12533
+ }));
12534
+ },
12535
+ defaultValue: order.sales_channel_id || void 0
12536
+ });
12537
+ return /* @__PURE__ */ jsx(
12538
+ Form$2.Field,
12539
+ {
12540
+ control,
12541
+ name: "sales_channel_id",
12542
+ render: ({ field }) => {
12543
+ return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12544
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
12545
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12546
+ Combobox,
12547
+ {
12548
+ options: salesChannels.options,
12549
+ fetchNextPage: salesChannels.fetchNextPage,
12550
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
12551
+ searchValue: salesChannels.searchValue,
12552
+ onSearchValueChange: salesChannels.onSearchValueChange,
12553
+ placeholder: "Select sales channel",
12554
+ ...field
12555
+ }
12556
+ ) }),
12557
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12558
+ ] });
12559
+ }
12560
+ }
12561
+ );
12562
+ };
12563
+ const schema$1 = objectType({
12564
+ sales_channel_id: stringType().min(1)
12565
+ });
12376
12566
  const TransferOwnership = () => {
12377
12567
  const { id } = useParams();
12378
12568
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12396,7 +12586,7 @@ const TransferOwnershipForm = ({ order }) => {
12396
12586
  defaultValues: {
12397
12587
  customer_id: order.customer_id || ""
12398
12588
  },
12399
- resolver: zodResolver(schema$1)
12589
+ resolver: zodResolver(schema)
12400
12590
  });
12401
12591
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12402
12592
  const { handleSuccess } = useRouteModal();
@@ -12846,199 +13036,9 @@ const Illustration = () => {
12846
13036
  }
12847
13037
  );
12848
13038
  };
12849
- const schema$1 = objectType({
13039
+ const schema = objectType({
12850
13040
  customer_id: stringType().min(1)
12851
13041
  });
12852
- const BillingAddress = () => {
12853
- const { id } = useParams();
12854
- const { order, isPending, isError, error } = useOrder(id, {
12855
- fields: "+billing_address"
12856
- });
12857
- if (isError) {
12858
- throw error;
12859
- }
12860
- const isReady = !isPending && !!order;
12861
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12862
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12863
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12864
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12865
- ] }),
12866
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12867
- ] });
12868
- };
12869
- const BillingAddressForm = ({ order }) => {
12870
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12871
- const form = useForm({
12872
- defaultValues: {
12873
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12874
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12875
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12876
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12877
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12878
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12879
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12880
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12881
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12882
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12883
- },
12884
- resolver: zodResolver(schema)
12885
- });
12886
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12887
- const { handleSuccess } = useRouteModal();
12888
- const onSubmit = form.handleSubmit(async (data) => {
12889
- await mutateAsync(
12890
- { billing_address: data },
12891
- {
12892
- onSuccess: () => {
12893
- handleSuccess();
12894
- },
12895
- onError: (error) => {
12896
- toast.error(error.message);
12897
- }
12898
- }
12899
- );
12900
- });
12901
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12902
- KeyboundForm,
12903
- {
12904
- className: "flex flex-1 flex-col overflow-hidden",
12905
- onSubmit,
12906
- children: [
12907
- /* @__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: [
12908
- /* @__PURE__ */ jsx(
12909
- Form$2.Field,
12910
- {
12911
- control: form.control,
12912
- name: "country_code",
12913
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12914
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12915
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12916
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12917
- ] })
12918
- }
12919
- ),
12920
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12921
- /* @__PURE__ */ jsx(
12922
- Form$2.Field,
12923
- {
12924
- control: form.control,
12925
- name: "first_name",
12926
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12927
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12928
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12929
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12930
- ] })
12931
- }
12932
- ),
12933
- /* @__PURE__ */ jsx(
12934
- Form$2.Field,
12935
- {
12936
- control: form.control,
12937
- name: "last_name",
12938
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12939
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12940
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12941
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12942
- ] })
12943
- }
12944
- )
12945
- ] }),
12946
- /* @__PURE__ */ jsx(
12947
- Form$2.Field,
12948
- {
12949
- control: form.control,
12950
- name: "company",
12951
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12952
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12953
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12954
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12955
- ] })
12956
- }
12957
- ),
12958
- /* @__PURE__ */ jsx(
12959
- Form$2.Field,
12960
- {
12961
- control: form.control,
12962
- name: "address_1",
12963
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12964
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12965
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12966
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12967
- ] })
12968
- }
12969
- ),
12970
- /* @__PURE__ */ jsx(
12971
- Form$2.Field,
12972
- {
12973
- control: form.control,
12974
- name: "address_2",
12975
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12976
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12977
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12978
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12979
- ] })
12980
- }
12981
- ),
12982
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12983
- /* @__PURE__ */ jsx(
12984
- Form$2.Field,
12985
- {
12986
- control: form.control,
12987
- name: "postal_code",
12988
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12989
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12990
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12991
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12992
- ] })
12993
- }
12994
- ),
12995
- /* @__PURE__ */ jsx(
12996
- Form$2.Field,
12997
- {
12998
- control: form.control,
12999
- name: "city",
13000
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13001
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
13002
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13003
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13004
- ] })
13005
- }
13006
- )
13007
- ] }),
13008
- /* @__PURE__ */ jsx(
13009
- Form$2.Field,
13010
- {
13011
- control: form.control,
13012
- name: "province",
13013
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13014
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13015
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13016
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13017
- ] })
13018
- }
13019
- ),
13020
- /* @__PURE__ */ jsx(
13021
- Form$2.Field,
13022
- {
13023
- control: form.control,
13024
- name: "phone",
13025
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13026
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13027
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13028
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13029
- ] })
13030
- }
13031
- )
13032
- ] }) }),
13033
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13034
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13035
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13036
- ] }) })
13037
- ]
13038
- }
13039
- ) });
13040
- };
13041
- const schema = addressSchema;
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
13044
13044
  routes: [
@@ -13059,6 +13059,10 @@ const routeModule = {
13059
13059
  handle,
13060
13060
  loader,
13061
13061
  children: [
13062
+ {
13063
+ Component: BillingAddress,
13064
+ path: "/draft-orders/:id/billing-address"
13065
+ },
13062
13066
  {
13063
13067
  Component: CustomItems,
13064
13068
  path: "/draft-orders/:id/custom-items"
@@ -13080,24 +13084,20 @@ const routeModule = {
13080
13084
  path: "/draft-orders/:id/promotions"
13081
13085
  },
13082
13086
  {
13083
- Component: SalesChannel,
13084
- path: "/draft-orders/:id/sales-channel"
13087
+ Component: ShippingAddress,
13088
+ path: "/draft-orders/:id/shipping-address"
13085
13089
  },
13086
13090
  {
13087
13091
  Component: Shipping,
13088
13092
  path: "/draft-orders/:id/shipping"
13089
13093
  },
13090
13094
  {
13091
- Component: ShippingAddress,
13092
- path: "/draft-orders/:id/shipping-address"
13095
+ Component: SalesChannel,
13096
+ path: "/draft-orders/:id/sales-channel"
13093
13097
  },
13094
13098
  {
13095
13099
  Component: TransferOwnership,
13096
13100
  path: "/draft-orders/:id/transfer-ownership"
13097
- },
13098
- {
13099
- Component: BillingAddress,
13100
- path: "/draft-orders/:id/billing-address"
13101
13101
  }
13102
13102
  ]
13103
13103
  }