@medusajs/draft-order 2.10.2-preview-20250905090156 → 2.10.2-preview-20250905150153

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,10 +9573,10 @@ const ID = () => {
9573
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9574
9574
  ] });
9575
9575
  };
9576
- const BillingAddress = () => {
9576
+ const Email = () => {
9577
9577
  const { id } = reactRouterDom.useParams();
9578
9578
  const { order, isPending, isError, error } = useOrder(id, {
9579
- fields: "+billing_address"
9579
+ fields: "+email"
9580
9580
  });
9581
9581
  if (isError) {
9582
9582
  throw error;
@@ -9584,26 +9584,16 @@ const BillingAddress = () => {
9584
9584
  const isReady = !isPending && !!order;
9585
9585
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9586
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" }) })
9587
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9588
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9589
9589
  ] }),
9590
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9590
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9591
9591
  ] });
9592
9592
  };
9593
- const BillingAddressForm = ({ order }) => {
9594
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9593
+ const EmailForm = ({ order }) => {
9595
9594
  const form = reactHookForm.useForm({
9596
9595
  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) ?? ""
9596
+ email: order.email ?? ""
9607
9597
  },
9608
9598
  resolver: zod.zodResolver(schema$5)
9609
9599
  });
@@ -9611,7 +9601,7 @@ const BillingAddressForm = ({ order }) => {
9611
9601
  const { handleSuccess } = useRouteModal();
9612
9602
  const onSubmit = form.handleSubmit(async (data) => {
9613
9603
  await mutateAsync(
9614
- { billing_address: data },
9604
+ { email: data.email },
9615
9605
  {
9616
9606
  onSuccess: () => {
9617
9607
  handleSuccess();
@@ -9628,132 +9618,18 @@ const BillingAddressForm = ({ order }) => {
9628
9618
  className: "flex flex-1 flex-col overflow-hidden",
9629
9619
  onSubmit,
9630
9620
  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
- ] }) }),
9621
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9622
+ Form$2.Field,
9623
+ {
9624
+ control: form.control,
9625
+ name: "email",
9626
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9627
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9628
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9629
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9630
+ ] })
9631
+ }
9632
+ ) }),
9757
9633
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9758
9634
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9759
9635
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -9762,26 +9638,7 @@ const BillingAddressForm = ({ order }) => {
9762
9638
  }
9763
9639
  ) });
9764
9640
  };
9765
- const schema$5 = addressSchema;
9766
- const CustomItems = () => {
9767
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9768
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9769
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9770
- ] });
9771
- };
9772
- const CustomItemsForm = () => {
9773
- const form = reactHookForm.useForm({
9774
- resolver: zod.zodResolver(schema$4)
9775
- });
9776
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9777
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9778
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9779
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9780
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9781
- ] }) })
9782
- ] }) });
9783
- };
9784
- const schema$4 = objectType({
9641
+ const schema$5 = objectType({
9785
9642
  email: stringType().email()
9786
9643
  });
9787
9644
  const NumberInput = React.forwardRef(
@@ -11385,157 +11242,51 @@ function getPromotionIds(items, shippingMethods) {
11385
11242
  }
11386
11243
  return Array.from(promotionIds);
11387
11244
  }
11388
- const SalesChannel = () => {
11245
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11246
+ const Shipping = () => {
11247
+ var _a;
11389
11248
  const { id } = reactRouterDom.useParams();
11390
- const { draft_order, isPending, isError, error } = useDraftOrder(
11391
- id,
11392
- {
11393
- fields: "+sales_channel_id"
11394
- },
11395
- {
11396
- enabled: !!id
11397
- }
11398
- );
11249
+ const { order, isPending, isError, error } = useOrder(id, {
11250
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11251
+ });
11252
+ const {
11253
+ order: preview,
11254
+ isPending: isPreviewPending,
11255
+ isError: isPreviewError,
11256
+ error: previewError
11257
+ } = useOrderPreview(id);
11258
+ useInitiateOrderEdit({ preview });
11259
+ const { onCancel } = useCancelOrderEdit({ preview });
11399
11260
  if (isError) {
11400
11261
  throw error;
11401
11262
  }
11402
- const ISrEADY = !!draft_order && !isPending;
11403
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11404
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11405
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11406
- /* @__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" }) })
11407
- ] }),
11408
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11409
- ] });
11263
+ if (isPreviewError) {
11264
+ throw previewError;
11265
+ }
11266
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11267
+ const isReady = preview && !isPreviewPending && order && !isPending;
11268
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11269
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
11270
+ /* @__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: [
11271
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
11272
+ /* @__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." }) })
11273
+ ] }) }) }),
11274
+ /* @__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" }) }) })
11275
+ ] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11276
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11277
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11278
+ ] }) });
11410
11279
  };
11411
- const SalesChannelForm = ({ order }) => {
11412
- const form = reactHookForm.useForm({
11413
- defaultValues: {
11414
- sales_channel_id: order.sales_channel_id || ""
11415
- },
11416
- resolver: zod.zodResolver(schema$3)
11417
- });
11418
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11419
- const { handleSuccess } = useRouteModal();
11420
- const onSubmit = form.handleSubmit(async (data) => {
11421
- await mutateAsync(
11422
- {
11423
- sales_channel_id: data.sales_channel_id
11424
- },
11425
- {
11426
- onSuccess: () => {
11427
- ui.toast.success("Sales channel updated");
11428
- handleSuccess();
11429
- },
11430
- onError: (error) => {
11431
- ui.toast.error(error.message);
11432
- }
11433
- }
11434
- );
11435
- });
11436
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11437
- KeyboundForm,
11438
- {
11439
- className: "flex flex-1 flex-col overflow-hidden",
11440
- onSubmit,
11441
- children: [
11442
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11443
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11444
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11445
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11446
- ] }) })
11447
- ]
11448
- }
11449
- ) });
11450
- };
11451
- const SalesChannelField = ({ control, order }) => {
11452
- const salesChannels = useComboboxData({
11453
- queryFn: async (params) => {
11454
- return await sdk.admin.salesChannel.list(params);
11455
- },
11456
- queryKey: ["sales-channels"],
11457
- getOptions: (data) => {
11458
- return data.sales_channels.map((salesChannel) => ({
11459
- label: salesChannel.name,
11460
- value: salesChannel.id
11461
- }));
11462
- },
11463
- defaultValue: order.sales_channel_id || void 0
11464
- });
11465
- return /* @__PURE__ */ jsxRuntime.jsx(
11466
- Form$2.Field,
11467
- {
11468
- control,
11469
- name: "sales_channel_id",
11470
- render: ({ field }) => {
11471
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11472
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11473
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11474
- Combobox,
11475
- {
11476
- options: salesChannels.options,
11477
- fetchNextPage: salesChannels.fetchNextPage,
11478
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11479
- searchValue: salesChannels.searchValue,
11480
- onSearchValueChange: salesChannels.onSearchValueChange,
11481
- placeholder: "Select sales channel",
11482
- ...field
11483
- }
11484
- ) }),
11485
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11486
- ] });
11487
- }
11488
- }
11489
- );
11490
- };
11491
- const schema$3 = objectType({
11492
- sales_channel_id: stringType().min(1)
11493
- });
11494
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11495
- const Shipping = () => {
11496
- var _a;
11497
- const { id } = reactRouterDom.useParams();
11498
- const { order, isPending, isError, error } = useOrder(id, {
11499
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11500
- });
11501
- const {
11502
- order: preview,
11503
- isPending: isPreviewPending,
11504
- isError: isPreviewError,
11505
- error: previewError
11506
- } = useOrderPreview(id);
11507
- useInitiateOrderEdit({ preview });
11508
- const { onCancel } = useCancelOrderEdit({ preview });
11509
- if (isError) {
11510
- throw error;
11511
- }
11512
- if (isPreviewError) {
11513
- throw previewError;
11514
- }
11515
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11516
- const isReady = preview && !isPreviewPending && order && !isPending;
11517
- return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11518
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
11519
- /* @__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: [
11520
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
11521
- /* @__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." }) })
11522
- ] }) }) }),
11523
- /* @__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" }) }) })
11524
- ] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11525
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11526
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11527
- ] }) });
11528
- };
11529
- const ShippingForm = ({ preview, order }) => {
11530
- var _a;
11531
- const { setIsOpen } = useStackedModal();
11532
- const [isSubmitting, setIsSubmitting] = React.useState(false);
11533
- const [data, setData] = React.useState(null);
11534
- const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11535
- const { shipping_options } = useShippingOptions(
11536
- {
11537
- id: appliedShippingOptionIds,
11538
- fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11280
+ const ShippingForm = ({ preview, order }) => {
11281
+ var _a;
11282
+ const { setIsOpen } = useStackedModal();
11283
+ const [isSubmitting, setIsSubmitting] = React.useState(false);
11284
+ const [data, setData] = React.useState(null);
11285
+ const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11286
+ const { shipping_options } = useShippingOptions(
11287
+ {
11288
+ id: appliedShippingOptionIds,
11289
+ fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11539
11290
  },
11540
11291
  {
11541
11292
  enabled: appliedShippingOptionIds.length > 0
@@ -12298,6 +12049,112 @@ const CustomAmountField = ({
12298
12049
  }
12299
12050
  );
12300
12051
  };
12052
+ const SalesChannel = () => {
12053
+ const { id } = reactRouterDom.useParams();
12054
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12055
+ id,
12056
+ {
12057
+ fields: "+sales_channel_id"
12058
+ },
12059
+ {
12060
+ enabled: !!id
12061
+ }
12062
+ );
12063
+ if (isError) {
12064
+ throw error;
12065
+ }
12066
+ const ISrEADY = !!draft_order && !isPending;
12067
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12068
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12069
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
12070
+ /* @__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" }) })
12071
+ ] }),
12072
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
12073
+ ] });
12074
+ };
12075
+ const SalesChannelForm = ({ order }) => {
12076
+ const form = reactHookForm.useForm({
12077
+ defaultValues: {
12078
+ sales_channel_id: order.sales_channel_id || ""
12079
+ },
12080
+ resolver: zod.zodResolver(schema$4)
12081
+ });
12082
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12083
+ const { handleSuccess } = useRouteModal();
12084
+ const onSubmit = form.handleSubmit(async (data) => {
12085
+ await mutateAsync(
12086
+ {
12087
+ sales_channel_id: data.sales_channel_id
12088
+ },
12089
+ {
12090
+ onSuccess: () => {
12091
+ ui.toast.success("Sales channel updated");
12092
+ handleSuccess();
12093
+ },
12094
+ onError: (error) => {
12095
+ ui.toast.error(error.message);
12096
+ }
12097
+ }
12098
+ );
12099
+ });
12100
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12101
+ KeyboundForm,
12102
+ {
12103
+ className: "flex flex-1 flex-col overflow-hidden",
12104
+ onSubmit,
12105
+ children: [
12106
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
12107
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12108
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12109
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12110
+ ] }) })
12111
+ ]
12112
+ }
12113
+ ) });
12114
+ };
12115
+ const SalesChannelField = ({ control, order }) => {
12116
+ const salesChannels = useComboboxData({
12117
+ queryFn: async (params) => {
12118
+ return await sdk.admin.salesChannel.list(params);
12119
+ },
12120
+ queryKey: ["sales-channels"],
12121
+ getOptions: (data) => {
12122
+ return data.sales_channels.map((salesChannel) => ({
12123
+ label: salesChannel.name,
12124
+ value: salesChannel.id
12125
+ }));
12126
+ },
12127
+ defaultValue: order.sales_channel_id || void 0
12128
+ });
12129
+ return /* @__PURE__ */ jsxRuntime.jsx(
12130
+ Form$2.Field,
12131
+ {
12132
+ control,
12133
+ name: "sales_channel_id",
12134
+ render: ({ field }) => {
12135
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12136
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
12137
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12138
+ Combobox,
12139
+ {
12140
+ options: salesChannels.options,
12141
+ fetchNextPage: salesChannels.fetchNextPage,
12142
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
12143
+ searchValue: salesChannels.searchValue,
12144
+ onSearchValueChange: salesChannels.onSearchValueChange,
12145
+ placeholder: "Select sales channel",
12146
+ ...field
12147
+ }
12148
+ ) }),
12149
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12150
+ ] });
12151
+ }
12152
+ }
12153
+ );
12154
+ };
12155
+ const schema$4 = objectType({
12156
+ sales_channel_id: stringType().min(1)
12157
+ });
12301
12158
  const ShippingAddress = () => {
12302
12159
  const { id } = reactRouterDom.useParams();
12303
12160
  const { order, isPending, isError, error } = useOrder(id, {
@@ -12330,7 +12187,7 @@ const ShippingAddressForm = ({ order }) => {
12330
12187
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12331
12188
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12332
12189
  },
12333
- resolver: zod.zodResolver(schema$2)
12190
+ resolver: zod.zodResolver(schema$3)
12334
12191
  });
12335
12192
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12336
12193
  const { handleSuccess } = useRouteModal();
@@ -12500,7 +12357,7 @@ const ShippingAddressForm = ({ order }) => {
12500
12357
  }
12501
12358
  ) });
12502
12359
  };
12503
- const schema$2 = addressSchema;
12360
+ const schema$3 = addressSchema;
12504
12361
  const TransferOwnership = () => {
12505
12362
  const { id } = reactRouterDom.useParams();
12506
12363
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12524,7 +12381,7 @@ const TransferOwnershipForm = ({ order }) => {
12524
12381
  defaultValues: {
12525
12382
  customer_id: order.customer_id || ""
12526
12383
  },
12527
- resolver: zod.zodResolver(schema$1)
12384
+ resolver: zod.zodResolver(schema$2)
12528
12385
  });
12529
12386
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12530
12387
  const { handleSuccess } = useRouteModal();
@@ -12974,13 +12831,13 @@ const Illustration = () => {
12974
12831
  }
12975
12832
  );
12976
12833
  };
12977
- const schema$1 = objectType({
12834
+ const schema$2 = objectType({
12978
12835
  customer_id: stringType().min(1)
12979
12836
  });
12980
- const Email = () => {
12837
+ const BillingAddress = () => {
12981
12838
  const { id } = reactRouterDom.useParams();
12982
12839
  const { order, isPending, isError, error } = useOrder(id, {
12983
- fields: "+email"
12840
+ fields: "+billing_address"
12984
12841
  });
12985
12842
  if (isError) {
12986
12843
  throw error;
@@ -12988,24 +12845,34 @@ const Email = () => {
12988
12845
  const isReady = !isPending && !!order;
12989
12846
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12990
12847
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12991
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
12992
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12848
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
12849
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12993
12850
  ] }),
12994
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12851
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
12995
12852
  ] });
12996
12853
  };
12997
- const EmailForm = ({ order }) => {
12854
+ const BillingAddressForm = ({ order }) => {
12855
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12998
12856
  const form = reactHookForm.useForm({
12999
12857
  defaultValues: {
13000
- email: order.email ?? ""
12858
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12859
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12860
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12861
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12862
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12863
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12864
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12865
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12866
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12867
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
13001
12868
  },
13002
- resolver: zod.zodResolver(schema)
12869
+ resolver: zod.zodResolver(schema$1)
13003
12870
  });
13004
12871
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
13005
12872
  const { handleSuccess } = useRouteModal();
13006
12873
  const onSubmit = form.handleSubmit(async (data) => {
13007
12874
  await mutateAsync(
13008
- { email: data.email },
12875
+ { billing_address: data },
13009
12876
  {
13010
12877
  onSuccess: () => {
13011
12878
  handleSuccess();
@@ -13022,18 +12889,132 @@ const EmailForm = ({ order }) => {
13022
12889
  className: "flex flex-1 flex-col overflow-hidden",
13023
12890
  onSubmit,
13024
12891
  children: [
13025
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
13026
- Form$2.Field,
13027
- {
13028
- control: form.control,
13029
- name: "email",
13030
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13031
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13033
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13034
- ] })
13035
- }
13036
- ) }),
12892
+ /* @__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: [
12893
+ /* @__PURE__ */ jsxRuntime.jsx(
12894
+ Form$2.Field,
12895
+ {
12896
+ control: form.control,
12897
+ name: "country_code",
12898
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12899
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12900
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12901
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12902
+ ] })
12903
+ }
12904
+ ),
12905
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12906
+ /* @__PURE__ */ jsxRuntime.jsx(
12907
+ Form$2.Field,
12908
+ {
12909
+ control: form.control,
12910
+ name: "first_name",
12911
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12912
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12913
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12914
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12915
+ ] })
12916
+ }
12917
+ ),
12918
+ /* @__PURE__ */ jsxRuntime.jsx(
12919
+ Form$2.Field,
12920
+ {
12921
+ control: form.control,
12922
+ name: "last_name",
12923
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12924
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12925
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12926
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12927
+ ] })
12928
+ }
12929
+ )
12930
+ ] }),
12931
+ /* @__PURE__ */ jsxRuntime.jsx(
12932
+ Form$2.Field,
12933
+ {
12934
+ control: form.control,
12935
+ name: "company",
12936
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12937
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12938
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12939
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12940
+ ] })
12941
+ }
12942
+ ),
12943
+ /* @__PURE__ */ jsxRuntime.jsx(
12944
+ Form$2.Field,
12945
+ {
12946
+ control: form.control,
12947
+ name: "address_1",
12948
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12949
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12950
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12951
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12952
+ ] })
12953
+ }
12954
+ ),
12955
+ /* @__PURE__ */ jsxRuntime.jsx(
12956
+ Form$2.Field,
12957
+ {
12958
+ control: form.control,
12959
+ name: "address_2",
12960
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12961
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12962
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12963
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12964
+ ] })
12965
+ }
12966
+ ),
12967
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12968
+ /* @__PURE__ */ jsxRuntime.jsx(
12969
+ Form$2.Field,
12970
+ {
12971
+ control: form.control,
12972
+ name: "postal_code",
12973
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12974
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12975
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12976
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12977
+ ] })
12978
+ }
12979
+ ),
12980
+ /* @__PURE__ */ jsxRuntime.jsx(
12981
+ Form$2.Field,
12982
+ {
12983
+ control: form.control,
12984
+ name: "city",
12985
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12986
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12987
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12988
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12989
+ ] })
12990
+ }
12991
+ )
12992
+ ] }),
12993
+ /* @__PURE__ */ jsxRuntime.jsx(
12994
+ Form$2.Field,
12995
+ {
12996
+ control: form.control,
12997
+ name: "province",
12998
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12999
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13000
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13001
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13002
+ ] })
13003
+ }
13004
+ ),
13005
+ /* @__PURE__ */ jsxRuntime.jsx(
13006
+ Form$2.Field,
13007
+ {
13008
+ control: form.control,
13009
+ name: "phone",
13010
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13011
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13012
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13013
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13014
+ ] })
13015
+ }
13016
+ )
13017
+ ] }) }),
13037
13018
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13038
13019
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13039
13020
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -13042,6 +13023,25 @@ const EmailForm = ({ order }) => {
13042
13023
  }
13043
13024
  ) });
13044
13025
  };
13026
+ const schema$1 = addressSchema;
13027
+ const CustomItems = () => {
13028
+ 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, {})
13031
+ ] });
13032
+ };
13033
+ const CustomItemsForm = () => {
13034
+ const form = reactHookForm.useForm({
13035
+ resolver: zod.zodResolver(schema)
13036
+ });
13037
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13038
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
13039
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
13042
+ ] }) })
13043
+ ] }) });
13044
+ };
13045
13045
  const schema = objectType({
13046
13046
  email: stringType().email()
13047
13047
  });
@@ -13066,12 +13066,8 @@ const routeModule = {
13066
13066
  loader,
13067
13067
  children: [
13068
13068
  {
13069
- Component: BillingAddress,
13070
- path: "/draft-orders/:id/billing-address"
13071
- },
13072
- {
13073
- Component: CustomItems,
13074
- path: "/draft-orders/:id/custom-items"
13069
+ Component: Email,
13070
+ path: "/draft-orders/:id/email"
13075
13071
  },
13076
13072
  {
13077
13073
  Component: Items,
@@ -13085,14 +13081,14 @@ const routeModule = {
13085
13081
  Component: Promotions,
13086
13082
  path: "/draft-orders/:id/promotions"
13087
13083
  },
13088
- {
13089
- Component: SalesChannel,
13090
- path: "/draft-orders/:id/sales-channel"
13091
- },
13092
13084
  {
13093
13085
  Component: Shipping,
13094
13086
  path: "/draft-orders/:id/shipping"
13095
13087
  },
13088
+ {
13089
+ Component: SalesChannel,
13090
+ path: "/draft-orders/:id/sales-channel"
13091
+ },
13096
13092
  {
13097
13093
  Component: ShippingAddress,
13098
13094
  path: "/draft-orders/:id/shipping-address"
@@ -13102,8 +13098,12 @@ const routeModule = {
13102
13098
  path: "/draft-orders/:id/transfer-ownership"
13103
13099
  },
13104
13100
  {
13105
- Component: Email,
13106
- path: "/draft-orders/:id/email"
13101
+ Component: BillingAddress,
13102
+ path: "/draft-orders/:id/billing-address"
13103
+ },
13104
+ {
13105
+ Component: CustomItems,
13106
+ path: "/draft-orders/:id/custom-items"
13107
13107
  }
13108
13108
  ]
13109
13109
  }