@medusajs/draft-order 2.10.4-preview-20251005060154 → 2.10.4-preview-20251005120155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9573,196 +9573,27 @@ const ID = () => {
9573
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9574
9574
  ] });
9575
9575
  };
9576
- const BillingAddress = () => {
9577
- const { id } = reactRouterDom.useParams();
9578
- const { order, isPending, isError, error } = useOrder(id, {
9579
- fields: "+billing_address"
9580
- });
9581
- if (isError) {
9582
- throw error;
9583
- }
9584
- const isReady = !isPending && !!order;
9576
+ const CustomItems = () => {
9585
9577
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9586
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9587
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9588
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9589
- ] }),
9590
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9578
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9579
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9591
9580
  ] });
9592
9581
  };
9593
- const BillingAddressForm = ({ order }) => {
9594
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9582
+ const CustomItemsForm = () => {
9595
9583
  const form = reactHookForm.useForm({
9596
- defaultValues: {
9597
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9598
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9599
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9600
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9601
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9602
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9603
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9604
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9605
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9606
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9607
- },
9608
9584
  resolver: zod.zodResolver(schema$5)
9609
9585
  });
9610
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9611
- const { handleSuccess } = useRouteModal();
9612
- const onSubmit = form.handleSubmit(async (data) => {
9613
- await mutateAsync(
9614
- { billing_address: data },
9615
- {
9616
- onSuccess: () => {
9617
- handleSuccess();
9618
- },
9619
- onError: (error) => {
9620
- ui.toast.error(error.message);
9621
- }
9622
- }
9623
- );
9624
- });
9625
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9626
- KeyboundForm,
9627
- {
9628
- className: "flex flex-1 flex-col overflow-hidden",
9629
- onSubmit,
9630
- children: [
9631
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
9632
- /* @__PURE__ */ jsxRuntime.jsx(
9633
- Form$2.Field,
9634
- {
9635
- control: form.control,
9636
- name: "country_code",
9637
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9639
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9640
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
- ] })
9642
- }
9643
- ),
9644
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9645
- /* @__PURE__ */ jsxRuntime.jsx(
9646
- Form$2.Field,
9647
- {
9648
- control: form.control,
9649
- name: "first_name",
9650
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9651
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9652
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9653
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9654
- ] })
9655
- }
9656
- ),
9657
- /* @__PURE__ */ jsxRuntime.jsx(
9658
- Form$2.Field,
9659
- {
9660
- control: form.control,
9661
- name: "last_name",
9662
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9664
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9665
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9666
- ] })
9667
- }
9668
- )
9669
- ] }),
9670
- /* @__PURE__ */ jsxRuntime.jsx(
9671
- Form$2.Field,
9672
- {
9673
- control: form.control,
9674
- name: "company",
9675
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9676
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9677
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9678
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9679
- ] })
9680
- }
9681
- ),
9682
- /* @__PURE__ */ jsxRuntime.jsx(
9683
- Form$2.Field,
9684
- {
9685
- control: form.control,
9686
- name: "address_1",
9687
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9688
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9689
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9690
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9691
- ] })
9692
- }
9693
- ),
9694
- /* @__PURE__ */ jsxRuntime.jsx(
9695
- Form$2.Field,
9696
- {
9697
- control: form.control,
9698
- name: "address_2",
9699
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9701
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9702
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9703
- ] })
9704
- }
9705
- ),
9706
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9707
- /* @__PURE__ */ jsxRuntime.jsx(
9708
- Form$2.Field,
9709
- {
9710
- control: form.control,
9711
- name: "postal_code",
9712
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9713
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9714
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9715
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9716
- ] })
9717
- }
9718
- ),
9719
- /* @__PURE__ */ jsxRuntime.jsx(
9720
- Form$2.Field,
9721
- {
9722
- control: form.control,
9723
- name: "city",
9724
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9726
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9727
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9728
- ] })
9729
- }
9730
- )
9731
- ] }),
9732
- /* @__PURE__ */ jsxRuntime.jsx(
9733
- Form$2.Field,
9734
- {
9735
- control: form.control,
9736
- name: "province",
9737
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9738
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9739
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9740
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9741
- ] })
9742
- }
9743
- ),
9744
- /* @__PURE__ */ jsxRuntime.jsx(
9745
- Form$2.Field,
9746
- {
9747
- control: form.control,
9748
- name: "phone",
9749
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9750
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9751
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9752
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9753
- ] })
9754
- }
9755
- )
9756
- ] }) }),
9757
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9758
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9759
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9760
- ] }) })
9761
- ]
9762
- }
9763
- ) });
9586
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9587
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9588
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9589
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9590
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9591
+ ] }) })
9592
+ ] }) });
9764
9593
  };
9765
- const schema$5 = addressSchema;
9594
+ const schema$5 = objectType({
9595
+ email: stringType().email()
9596
+ });
9766
9597
  const Email = () => {
9767
9598
  const { id } = reactRouterDom.useParams();
9768
9599
  const { order, isPending, isError, error } = useOrder(id, {
@@ -11432,160 +11263,54 @@ function getPromotionIds(items, shippingMethods) {
11432
11263
  }
11433
11264
  return Array.from(promotionIds);
11434
11265
  }
11435
- const SalesChannel = () => {
11266
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11267
+ const Shipping = () => {
11268
+ var _a;
11436
11269
  const { id } = reactRouterDom.useParams();
11437
- const { draft_order, isPending, isError, error } = useDraftOrder(
11438
- id,
11270
+ const { order, isPending, isError, error } = useOrder(id, {
11271
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11272
+ });
11273
+ const {
11274
+ order: preview,
11275
+ isPending: isPreviewPending,
11276
+ isError: isPreviewError,
11277
+ error: previewError
11278
+ } = useOrderPreview(id);
11279
+ useInitiateOrderEdit({ preview });
11280
+ const { onCancel } = useCancelOrderEdit({ preview });
11281
+ if (isError) {
11282
+ throw error;
11283
+ }
11284
+ if (isPreviewError) {
11285
+ throw previewError;
11286
+ }
11287
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11288
+ const isReady = preview && !isPreviewPending && order && !isPending;
11289
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11290
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
11291
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
11292
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
11293
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11294
+ ] }) }) }),
11295
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11296
+ ] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11297
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11298
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11299
+ ] }) });
11300
+ };
11301
+ const ShippingForm = ({ preview, order }) => {
11302
+ var _a;
11303
+ const { setIsOpen } = useStackedModal();
11304
+ const [isSubmitting, setIsSubmitting] = React.useState(false);
11305
+ const [data, setData] = React.useState(null);
11306
+ const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11307
+ const { shipping_options } = useShippingOptions(
11439
11308
  {
11440
- fields: "+sales_channel_id"
11309
+ id: appliedShippingOptionIds,
11310
+ fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11441
11311
  },
11442
11312
  {
11443
- enabled: !!id
11444
- }
11445
- );
11446
- if (isError) {
11447
- throw error;
11448
- }
11449
- const ISrEADY = !!draft_order && !isPending;
11450
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11451
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11452
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11453
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11454
- ] }),
11455
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11456
- ] });
11457
- };
11458
- const SalesChannelForm = ({ order }) => {
11459
- const form = reactHookForm.useForm({
11460
- defaultValues: {
11461
- sales_channel_id: order.sales_channel_id || ""
11462
- },
11463
- resolver: zod.zodResolver(schema$3)
11464
- });
11465
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11466
- const { handleSuccess } = useRouteModal();
11467
- const onSubmit = form.handleSubmit(async (data) => {
11468
- await mutateAsync(
11469
- {
11470
- sales_channel_id: data.sales_channel_id
11471
- },
11472
- {
11473
- onSuccess: () => {
11474
- ui.toast.success("Sales channel updated");
11475
- handleSuccess();
11476
- },
11477
- onError: (error) => {
11478
- ui.toast.error(error.message);
11479
- }
11480
- }
11481
- );
11482
- });
11483
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11484
- KeyboundForm,
11485
- {
11486
- className: "flex flex-1 flex-col overflow-hidden",
11487
- onSubmit,
11488
- children: [
11489
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11490
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11491
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11492
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11493
- ] }) })
11494
- ]
11495
- }
11496
- ) });
11497
- };
11498
- const SalesChannelField = ({ control, order }) => {
11499
- const salesChannels = useComboboxData({
11500
- queryFn: async (params) => {
11501
- return await sdk.admin.salesChannel.list(params);
11502
- },
11503
- queryKey: ["sales-channels"],
11504
- getOptions: (data) => {
11505
- return data.sales_channels.map((salesChannel) => ({
11506
- label: salesChannel.name,
11507
- value: salesChannel.id
11508
- }));
11509
- },
11510
- defaultValue: order.sales_channel_id || void 0
11511
- });
11512
- return /* @__PURE__ */ jsxRuntime.jsx(
11513
- Form$2.Field,
11514
- {
11515
- control,
11516
- name: "sales_channel_id",
11517
- render: ({ field }) => {
11518
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11519
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11520
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11521
- Combobox,
11522
- {
11523
- options: salesChannels.options,
11524
- fetchNextPage: salesChannels.fetchNextPage,
11525
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11526
- searchValue: salesChannels.searchValue,
11527
- onSearchValueChange: salesChannels.onSearchValueChange,
11528
- placeholder: "Select sales channel",
11529
- ...field
11530
- }
11531
- ) }),
11532
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11533
- ] });
11534
- }
11535
- }
11536
- );
11537
- };
11538
- const schema$3 = objectType({
11539
- sales_channel_id: stringType().min(1)
11540
- });
11541
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11542
- const Shipping = () => {
11543
- var _a;
11544
- const { id } = reactRouterDom.useParams();
11545
- const { order, isPending, isError, error } = useOrder(id, {
11546
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11547
- });
11548
- const {
11549
- order: preview,
11550
- isPending: isPreviewPending,
11551
- isError: isPreviewError,
11552
- error: previewError
11553
- } = useOrderPreview(id);
11554
- useInitiateOrderEdit({ preview });
11555
- const { onCancel } = useCancelOrderEdit({ preview });
11556
- if (isError) {
11557
- throw error;
11558
- }
11559
- if (isPreviewError) {
11560
- throw previewError;
11561
- }
11562
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11563
- const isReady = preview && !isPreviewPending && order && !isPending;
11564
- return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11565
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
11566
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
11567
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
11568
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11569
- ] }) }) }),
11570
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11571
- ] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11572
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11573
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11574
- ] }) });
11575
- };
11576
- const ShippingForm = ({ preview, order }) => {
11577
- var _a;
11578
- const { setIsOpen } = useStackedModal();
11579
- const [isSubmitting, setIsSubmitting] = React.useState(false);
11580
- const [data, setData] = React.useState(null);
11581
- const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11582
- const { shipping_options } = useShippingOptions(
11583
- {
11584
- id: appliedShippingOptionIds,
11585
- fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11586
- },
11587
- {
11588
- enabled: appliedShippingOptionIds.length > 0
11313
+ enabled: appliedShippingOptionIds.length > 0
11589
11314
  }
11590
11315
  );
11591
11316
  const uniqueShippingProfiles = React.useMemo(() => {
@@ -12377,7 +12102,7 @@ const ShippingAddressForm = ({ order }) => {
12377
12102
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12378
12103
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12379
12104
  },
12380
- resolver: zod.zodResolver(schema$2)
12105
+ resolver: zod.zodResolver(schema$3)
12381
12106
  });
12382
12107
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12383
12108
  const { handleSuccess } = useRouteModal();
@@ -12547,7 +12272,7 @@ const ShippingAddressForm = ({ order }) => {
12547
12272
  }
12548
12273
  ) });
12549
12274
  };
12550
- const schema$2 = addressSchema;
12275
+ const schema$3 = addressSchema;
12551
12276
  const TransferOwnership = () => {
12552
12277
  const { id } = reactRouterDom.useParams();
12553
12278
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12571,7 +12296,7 @@ const TransferOwnershipForm = ({ order }) => {
12571
12296
  defaultValues: {
12572
12297
  customer_id: order.customer_id || ""
12573
12298
  },
12574
- resolver: zod.zodResolver(schema$1)
12299
+ resolver: zod.zodResolver(schema$2)
12575
12300
  });
12576
12301
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12577
12302
  const { handleSuccess } = useRouteModal();
@@ -13021,29 +12746,304 @@ const Illustration = () => {
13021
12746
  }
13022
12747
  );
13023
12748
  };
13024
- const schema$1 = objectType({
12749
+ const schema$2 = objectType({
13025
12750
  customer_id: stringType().min(1)
13026
12751
  });
13027
- const CustomItems = () => {
12752
+ const BillingAddress = () => {
12753
+ const { id } = reactRouterDom.useParams();
12754
+ const { order, isPending, isError, error } = useOrder(id, {
12755
+ fields: "+billing_address"
12756
+ });
12757
+ if (isError) {
12758
+ throw error;
12759
+ }
12760
+ const isReady = !isPending && !!order;
13028
12761
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
13029
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
13030
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12762
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12763
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
12764
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12765
+ ] }),
12766
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
13031
12767
  ] });
13032
12768
  };
13033
- const CustomItemsForm = () => {
12769
+ const BillingAddressForm = ({ order }) => {
12770
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12771
+ const form = reactHookForm.useForm({
12772
+ defaultValues: {
12773
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12774
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12775
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12776
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12777
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12778
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12779
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12780
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12781
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12782
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12783
+ },
12784
+ resolver: zod.zodResolver(schema$1)
12785
+ });
12786
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12787
+ const { handleSuccess } = useRouteModal();
12788
+ const onSubmit = form.handleSubmit(async (data) => {
12789
+ await mutateAsync(
12790
+ { billing_address: data },
12791
+ {
12792
+ onSuccess: () => {
12793
+ handleSuccess();
12794
+ },
12795
+ onError: (error) => {
12796
+ ui.toast.error(error.message);
12797
+ }
12798
+ }
12799
+ );
12800
+ });
12801
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12802
+ KeyboundForm,
12803
+ {
12804
+ className: "flex flex-1 flex-col overflow-hidden",
12805
+ onSubmit,
12806
+ children: [
12807
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12808
+ /* @__PURE__ */ jsxRuntime.jsx(
12809
+ Form$2.Field,
12810
+ {
12811
+ control: form.control,
12812
+ name: "country_code",
12813
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12814
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12815
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12816
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12817
+ ] })
12818
+ }
12819
+ ),
12820
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12821
+ /* @__PURE__ */ jsxRuntime.jsx(
12822
+ Form$2.Field,
12823
+ {
12824
+ control: form.control,
12825
+ name: "first_name",
12826
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12827
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12828
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12829
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12830
+ ] })
12831
+ }
12832
+ ),
12833
+ /* @__PURE__ */ jsxRuntime.jsx(
12834
+ Form$2.Field,
12835
+ {
12836
+ control: form.control,
12837
+ name: "last_name",
12838
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12839
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12840
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12841
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12842
+ ] })
12843
+ }
12844
+ )
12845
+ ] }),
12846
+ /* @__PURE__ */ jsxRuntime.jsx(
12847
+ Form$2.Field,
12848
+ {
12849
+ control: form.control,
12850
+ name: "company",
12851
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12852
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12853
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12854
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12855
+ ] })
12856
+ }
12857
+ ),
12858
+ /* @__PURE__ */ jsxRuntime.jsx(
12859
+ Form$2.Field,
12860
+ {
12861
+ control: form.control,
12862
+ name: "address_1",
12863
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12864
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12865
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12866
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12867
+ ] })
12868
+ }
12869
+ ),
12870
+ /* @__PURE__ */ jsxRuntime.jsx(
12871
+ Form$2.Field,
12872
+ {
12873
+ control: form.control,
12874
+ name: "address_2",
12875
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12876
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12877
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12878
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12879
+ ] })
12880
+ }
12881
+ ),
12882
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12883
+ /* @__PURE__ */ jsxRuntime.jsx(
12884
+ Form$2.Field,
12885
+ {
12886
+ control: form.control,
12887
+ name: "postal_code",
12888
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12889
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12890
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12891
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12892
+ ] })
12893
+ }
12894
+ ),
12895
+ /* @__PURE__ */ jsxRuntime.jsx(
12896
+ Form$2.Field,
12897
+ {
12898
+ control: form.control,
12899
+ name: "city",
12900
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12901
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12902
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12903
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12904
+ ] })
12905
+ }
12906
+ )
12907
+ ] }),
12908
+ /* @__PURE__ */ jsxRuntime.jsx(
12909
+ Form$2.Field,
12910
+ {
12911
+ control: form.control,
12912
+ name: "province",
12913
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12914
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12915
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12916
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12917
+ ] })
12918
+ }
12919
+ ),
12920
+ /* @__PURE__ */ jsxRuntime.jsx(
12921
+ Form$2.Field,
12922
+ {
12923
+ control: form.control,
12924
+ name: "phone",
12925
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12926
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12927
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12928
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12929
+ ] })
12930
+ }
12931
+ )
12932
+ ] }) }),
12933
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12934
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12935
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12936
+ ] }) })
12937
+ ]
12938
+ }
12939
+ ) });
12940
+ };
12941
+ const schema$1 = addressSchema;
12942
+ const SalesChannel = () => {
12943
+ const { id } = reactRouterDom.useParams();
12944
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12945
+ id,
12946
+ {
12947
+ fields: "+sales_channel_id"
12948
+ },
12949
+ {
12950
+ enabled: !!id
12951
+ }
12952
+ );
12953
+ if (isError) {
12954
+ throw error;
12955
+ }
12956
+ const ISrEADY = !!draft_order && !isPending;
12957
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12958
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12959
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
12960
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12961
+ ] }),
12962
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
12963
+ ] });
12964
+ };
12965
+ const SalesChannelForm = ({ order }) => {
13034
12966
  const form = reactHookForm.useForm({
12967
+ defaultValues: {
12968
+ sales_channel_id: order.sales_channel_id || ""
12969
+ },
13035
12970
  resolver: zod.zodResolver(schema)
13036
12971
  });
13037
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
13042
- ] }) })
13043
- ] }) });
12972
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12973
+ const { handleSuccess } = useRouteModal();
12974
+ const onSubmit = form.handleSubmit(async (data) => {
12975
+ await mutateAsync(
12976
+ {
12977
+ sales_channel_id: data.sales_channel_id
12978
+ },
12979
+ {
12980
+ onSuccess: () => {
12981
+ ui.toast.success("Sales channel updated");
12982
+ handleSuccess();
12983
+ },
12984
+ onError: (error) => {
12985
+ ui.toast.error(error.message);
12986
+ }
12987
+ }
12988
+ );
12989
+ });
12990
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12991
+ KeyboundForm,
12992
+ {
12993
+ className: "flex flex-1 flex-col overflow-hidden",
12994
+ onSubmit,
12995
+ children: [
12996
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
12997
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12998
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12999
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13000
+ ] }) })
13001
+ ]
13002
+ }
13003
+ ) });
13004
+ };
13005
+ const SalesChannelField = ({ control, order }) => {
13006
+ const salesChannels = useComboboxData({
13007
+ queryFn: async (params) => {
13008
+ return await sdk.admin.salesChannel.list(params);
13009
+ },
13010
+ queryKey: ["sales-channels"],
13011
+ getOptions: (data) => {
13012
+ return data.sales_channels.map((salesChannel) => ({
13013
+ label: salesChannel.name,
13014
+ value: salesChannel.id
13015
+ }));
13016
+ },
13017
+ defaultValue: order.sales_channel_id || void 0
13018
+ });
13019
+ return /* @__PURE__ */ jsxRuntime.jsx(
13020
+ Form$2.Field,
13021
+ {
13022
+ control,
13023
+ name: "sales_channel_id",
13024
+ render: ({ field }) => {
13025
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13026
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
13027
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
13028
+ Combobox,
13029
+ {
13030
+ options: salesChannels.options,
13031
+ fetchNextPage: salesChannels.fetchNextPage,
13032
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
13033
+ searchValue: salesChannels.searchValue,
13034
+ onSearchValueChange: salesChannels.onSearchValueChange,
13035
+ placeholder: "Select sales channel",
13036
+ ...field
13037
+ }
13038
+ ) }),
13039
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13040
+ ] });
13041
+ }
13042
+ }
13043
+ );
13044
13044
  };
13045
13045
  const schema = objectType({
13046
- email: stringType().email()
13046
+ sales_channel_id: stringType().min(1)
13047
13047
  });
13048
13048
  const widgetModule = { widgets: [] };
13049
13049
  const routeModule = {
@@ -13066,8 +13066,8 @@ const routeModule = {
13066
13066
  loader,
13067
13067
  children: [
13068
13068
  {
13069
- Component: BillingAddress,
13070
- path: "/draft-orders/:id/billing-address"
13069
+ Component: CustomItems,
13070
+ path: "/draft-orders/:id/custom-items"
13071
13071
  },
13072
13072
  {
13073
13073
  Component: Email,
@@ -13085,10 +13085,6 @@ const routeModule = {
13085
13085
  Component: Promotions,
13086
13086
  path: "/draft-orders/:id/promotions"
13087
13087
  },
13088
- {
13089
- Component: SalesChannel,
13090
- path: "/draft-orders/:id/sales-channel"
13091
- },
13092
13088
  {
13093
13089
  Component: Shipping,
13094
13090
  path: "/draft-orders/:id/shipping"
@@ -13102,8 +13098,12 @@ const routeModule = {
13102
13098
  path: "/draft-orders/:id/transfer-ownership"
13103
13099
  },
13104
13100
  {
13105
- Component: CustomItems,
13106
- path: "/draft-orders/:id/custom-items"
13101
+ Component: BillingAddress,
13102
+ path: "/draft-orders/:id/billing-address"
13103
+ },
13104
+ {
13105
+ Component: SalesChannel,
13106
+ path: "/draft-orders/:id/sales-channel"
13107
13107
  }
13108
13108
  ]
13109
13109
  }