@medusajs/draft-order 2.10.2-preview-20250904090151 → 2.10.2-preview-20250904120155

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.
@@ -9560,6 +9560,27 @@ const ID = () => {
9560
9560
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9561
9561
  ] });
9562
9562
  };
9563
+ const CustomItems = () => {
9564
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9565
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9566
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9567
+ ] });
9568
+ };
9569
+ const CustomItemsForm = () => {
9570
+ const form = reactHookForm.useForm({
9571
+ resolver: zod.zodResolver(schema$5)
9572
+ });
9573
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9574
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9575
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9576
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9577
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9578
+ ] }) })
9579
+ ] }) });
9580
+ };
9581
+ const schema$5 = objectType({
9582
+ email: stringType().email()
9583
+ });
9563
9584
  const BillingAddress = () => {
9564
9585
  const { id } = reactRouterDom.useParams();
9565
9586
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9592,7 +9613,7 @@ const BillingAddressForm = ({ order }) => {
9592
9613
  postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9593
9614
  phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9594
9615
  },
9595
- resolver: zod.zodResolver(schema$5)
9616
+ resolver: zod.zodResolver(schema$4)
9596
9617
  });
9597
9618
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9598
9619
  const { handleSuccess } = useRouteModal();
@@ -9749,26 +9770,73 @@ const BillingAddressForm = ({ order }) => {
9749
9770
  }
9750
9771
  ) });
9751
9772
  };
9752
- const schema$5 = addressSchema;
9753
- const CustomItems = () => {
9773
+ const schema$4 = addressSchema;
9774
+ const Email = () => {
9775
+ const { id } = reactRouterDom.useParams();
9776
+ const { order, isPending, isError, error } = useOrder(id, {
9777
+ fields: "+email"
9778
+ });
9779
+ if (isError) {
9780
+ throw error;
9781
+ }
9782
+ const isReady = !isPending && !!order;
9754
9783
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9755
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9756
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9784
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9785
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9786
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9787
+ ] }),
9788
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9757
9789
  ] });
9758
9790
  };
9759
- const CustomItemsForm = () => {
9791
+ const EmailForm = ({ order }) => {
9760
9792
  const form = reactHookForm.useForm({
9761
- resolver: zod.zodResolver(schema$4)
9793
+ defaultValues: {
9794
+ email: order.email ?? ""
9795
+ },
9796
+ resolver: zod.zodResolver(schema$3)
9762
9797
  });
9763
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9764
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9765
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9766
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9767
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9768
- ] }) })
9769
- ] }) });
9798
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9799
+ const { handleSuccess } = useRouteModal();
9800
+ const onSubmit = form.handleSubmit(async (data) => {
9801
+ await mutateAsync(
9802
+ { email: data.email },
9803
+ {
9804
+ onSuccess: () => {
9805
+ handleSuccess();
9806
+ },
9807
+ onError: (error) => {
9808
+ ui.toast.error(error.message);
9809
+ }
9810
+ }
9811
+ );
9812
+ });
9813
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9814
+ KeyboundForm,
9815
+ {
9816
+ className: "flex flex-1 flex-col overflow-hidden",
9817
+ onSubmit,
9818
+ children: [
9819
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9820
+ Form$2.Field,
9821
+ {
9822
+ control: form.control,
9823
+ name: "email",
9824
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9825
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9826
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9827
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9828
+ ] })
9829
+ }
9830
+ ) }),
9831
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9832
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9833
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9834
+ ] }) })
9835
+ ]
9836
+ }
9837
+ ) });
9770
9838
  };
9771
- const schema$4 = objectType({
9839
+ const schema$3 = objectType({
9772
9840
  email: stringType().email()
9773
9841
  });
9774
9842
  const NumberInput = React.forwardRef(
@@ -11372,6 +11440,112 @@ function getPromotionCodes(items, shippingMethods) {
11372
11440
  }
11373
11441
  return Array.from(codes);
11374
11442
  }
11443
+ const SalesChannel = () => {
11444
+ const { id } = reactRouterDom.useParams();
11445
+ const { draft_order, isPending, isError, error } = useDraftOrder(
11446
+ id,
11447
+ {
11448
+ fields: "+sales_channel_id"
11449
+ },
11450
+ {
11451
+ enabled: !!id
11452
+ }
11453
+ );
11454
+ if (isError) {
11455
+ throw error;
11456
+ }
11457
+ const ISrEADY = !!draft_order && !isPending;
11458
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11459
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11460
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11461
+ /* @__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" }) })
11462
+ ] }),
11463
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11464
+ ] });
11465
+ };
11466
+ const SalesChannelForm = ({ order }) => {
11467
+ const form = reactHookForm.useForm({
11468
+ defaultValues: {
11469
+ sales_channel_id: order.sales_channel_id || ""
11470
+ },
11471
+ resolver: zod.zodResolver(schema$2)
11472
+ });
11473
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11474
+ const { handleSuccess } = useRouteModal();
11475
+ const onSubmit = form.handleSubmit(async (data) => {
11476
+ await mutateAsync(
11477
+ {
11478
+ sales_channel_id: data.sales_channel_id
11479
+ },
11480
+ {
11481
+ onSuccess: () => {
11482
+ ui.toast.success("Sales channel updated");
11483
+ handleSuccess();
11484
+ },
11485
+ onError: (error) => {
11486
+ ui.toast.error(error.message);
11487
+ }
11488
+ }
11489
+ );
11490
+ });
11491
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11492
+ KeyboundForm,
11493
+ {
11494
+ className: "flex flex-1 flex-col overflow-hidden",
11495
+ onSubmit,
11496
+ children: [
11497
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11498
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11499
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11500
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11501
+ ] }) })
11502
+ ]
11503
+ }
11504
+ ) });
11505
+ };
11506
+ const SalesChannelField = ({ control, order }) => {
11507
+ const salesChannels = useComboboxData({
11508
+ queryFn: async (params) => {
11509
+ return await sdk.admin.salesChannel.list(params);
11510
+ },
11511
+ queryKey: ["sales-channels"],
11512
+ getOptions: (data) => {
11513
+ return data.sales_channels.map((salesChannel) => ({
11514
+ label: salesChannel.name,
11515
+ value: salesChannel.id
11516
+ }));
11517
+ },
11518
+ defaultValue: order.sales_channel_id || void 0
11519
+ });
11520
+ return /* @__PURE__ */ jsxRuntime.jsx(
11521
+ Form$2.Field,
11522
+ {
11523
+ control,
11524
+ name: "sales_channel_id",
11525
+ render: ({ field }) => {
11526
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11527
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11528
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11529
+ Combobox,
11530
+ {
11531
+ options: salesChannels.options,
11532
+ fetchNextPage: salesChannels.fetchNextPage,
11533
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
11534
+ searchValue: salesChannels.searchValue,
11535
+ onSearchValueChange: salesChannels.onSearchValueChange,
11536
+ placeholder: "Select sales channel",
11537
+ ...field
11538
+ }
11539
+ ) }),
11540
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11541
+ ] });
11542
+ }
11543
+ }
11544
+ );
11545
+ };
11546
+ const schema$2 = objectType({
11547
+ sales_channel_id: stringType().min(1)
11548
+ });
11375
11549
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11376
11550
  const Shipping = () => {
11377
11551
  var _a;
@@ -12179,112 +12353,6 @@ const CustomAmountField = ({
12179
12353
  }
12180
12354
  );
12181
12355
  };
12182
- const SalesChannel = () => {
12183
- const { id } = reactRouterDom.useParams();
12184
- const { draft_order, isPending, isError, error } = useDraftOrder(
12185
- id,
12186
- {
12187
- fields: "+sales_channel_id"
12188
- },
12189
- {
12190
- enabled: !!id
12191
- }
12192
- );
12193
- if (isError) {
12194
- throw error;
12195
- }
12196
- const ISrEADY = !!draft_order && !isPending;
12197
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12198
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12199
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
12200
- /* @__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" }) })
12201
- ] }),
12202
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
12203
- ] });
12204
- };
12205
- const SalesChannelForm = ({ order }) => {
12206
- const form = reactHookForm.useForm({
12207
- defaultValues: {
12208
- sales_channel_id: order.sales_channel_id || ""
12209
- },
12210
- resolver: zod.zodResolver(schema$3)
12211
- });
12212
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12213
- const { handleSuccess } = useRouteModal();
12214
- const onSubmit = form.handleSubmit(async (data) => {
12215
- await mutateAsync(
12216
- {
12217
- sales_channel_id: data.sales_channel_id
12218
- },
12219
- {
12220
- onSuccess: () => {
12221
- ui.toast.success("Sales channel updated");
12222
- handleSuccess();
12223
- },
12224
- onError: (error) => {
12225
- ui.toast.error(error.message);
12226
- }
12227
- }
12228
- );
12229
- });
12230
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12231
- KeyboundForm,
12232
- {
12233
- className: "flex flex-1 flex-col overflow-hidden",
12234
- onSubmit,
12235
- children: [
12236
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
12237
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12238
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12239
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12240
- ] }) })
12241
- ]
12242
- }
12243
- ) });
12244
- };
12245
- const SalesChannelField = ({ control, order }) => {
12246
- const salesChannels = useComboboxData({
12247
- queryFn: async (params) => {
12248
- return await sdk.admin.salesChannel.list(params);
12249
- },
12250
- queryKey: ["sales-channels"],
12251
- getOptions: (data) => {
12252
- return data.sales_channels.map((salesChannel) => ({
12253
- label: salesChannel.name,
12254
- value: salesChannel.id
12255
- }));
12256
- },
12257
- defaultValue: order.sales_channel_id || void 0
12258
- });
12259
- return /* @__PURE__ */ jsxRuntime.jsx(
12260
- Form$2.Field,
12261
- {
12262
- control,
12263
- name: "sales_channel_id",
12264
- render: ({ field }) => {
12265
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12266
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
12267
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12268
- Combobox,
12269
- {
12270
- options: salesChannels.options,
12271
- fetchNextPage: salesChannels.fetchNextPage,
12272
- isFetchingNextPage: salesChannels.isFetchingNextPage,
12273
- searchValue: salesChannels.searchValue,
12274
- onSearchValueChange: salesChannels.onSearchValueChange,
12275
- placeholder: "Select sales channel",
12276
- ...field
12277
- }
12278
- ) }),
12279
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12280
- ] });
12281
- }
12282
- }
12283
- );
12284
- };
12285
- const schema$3 = objectType({
12286
- sales_channel_id: stringType().min(1)
12287
- });
12288
12356
  const ShippingAddress = () => {
12289
12357
  const { id } = reactRouterDom.useParams();
12290
12358
  const { order, isPending, isError, error } = useOrder(id, {
@@ -12317,7 +12385,7 @@ const ShippingAddressForm = ({ order }) => {
12317
12385
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12318
12386
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12319
12387
  },
12320
- resolver: zod.zodResolver(schema$2)
12388
+ resolver: zod.zodResolver(schema$1)
12321
12389
  });
12322
12390
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12323
12391
  const { handleSuccess } = useRouteModal();
@@ -12487,7 +12555,7 @@ const ShippingAddressForm = ({ order }) => {
12487
12555
  }
12488
12556
  ) });
12489
12557
  };
12490
- const schema$2 = addressSchema;
12558
+ const schema$1 = addressSchema;
12491
12559
  const TransferOwnership = () => {
12492
12560
  const { id } = reactRouterDom.useParams();
12493
12561
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12511,7 +12579,7 @@ const TransferOwnershipForm = ({ order }) => {
12511
12579
  defaultValues: {
12512
12580
  customer_id: order.customer_id || ""
12513
12581
  },
12514
- resolver: zod.zodResolver(schema$1)
12582
+ resolver: zod.zodResolver(schema)
12515
12583
  });
12516
12584
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12517
12585
  const { handleSuccess } = useRouteModal();
@@ -12961,76 +13029,8 @@ const Illustration = () => {
12961
13029
  }
12962
13030
  );
12963
13031
  };
12964
- const schema$1 = objectType({
12965
- customer_id: stringType().min(1)
12966
- });
12967
- const Email = () => {
12968
- const { id } = reactRouterDom.useParams();
12969
- const { order, isPending, isError, error } = useOrder(id, {
12970
- fields: "+email"
12971
- });
12972
- if (isError) {
12973
- throw error;
12974
- }
12975
- const isReady = !isPending && !!order;
12976
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12977
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12978
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
12979
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12980
- ] }),
12981
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12982
- ] });
12983
- };
12984
- const EmailForm = ({ order }) => {
12985
- const form = reactHookForm.useForm({
12986
- defaultValues: {
12987
- email: order.email ?? ""
12988
- },
12989
- resolver: zod.zodResolver(schema)
12990
- });
12991
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12992
- const { handleSuccess } = useRouteModal();
12993
- const onSubmit = form.handleSubmit(async (data) => {
12994
- await mutateAsync(
12995
- { email: data.email },
12996
- {
12997
- onSuccess: () => {
12998
- handleSuccess();
12999
- },
13000
- onError: (error) => {
13001
- ui.toast.error(error.message);
13002
- }
13003
- }
13004
- );
13005
- });
13006
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
13007
- KeyboundForm,
13008
- {
13009
- className: "flex flex-1 flex-col overflow-hidden",
13010
- onSubmit,
13011
- children: [
13012
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
13013
- Form$2.Field,
13014
- {
13015
- control: form.control,
13016
- name: "email",
13017
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13018
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13021
- ] })
13022
- }
13023
- ) }),
13024
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13025
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13026
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13027
- ] }) })
13028
- ]
13029
- }
13030
- ) });
13031
- };
13032
13032
  const schema = objectType({
13033
- email: stringType().email()
13033
+ customer_id: stringType().min(1)
13034
13034
  });
13035
13035
  const widgetModule = { widgets: [] };
13036
13036
  const routeModule = {
@@ -13052,13 +13052,17 @@ const routeModule = {
13052
13052
  handle,
13053
13053
  loader,
13054
13054
  children: [
13055
+ {
13056
+ Component: CustomItems,
13057
+ path: "/draft-orders/:id/custom-items"
13058
+ },
13055
13059
  {
13056
13060
  Component: BillingAddress,
13057
13061
  path: "/draft-orders/:id/billing-address"
13058
13062
  },
13059
13063
  {
13060
- Component: CustomItems,
13061
- path: "/draft-orders/:id/custom-items"
13064
+ Component: Email,
13065
+ path: "/draft-orders/:id/email"
13062
13066
  },
13063
13067
  {
13064
13068
  Component: Items,
@@ -13072,14 +13076,14 @@ const routeModule = {
13072
13076
  Component: Promotions,
13073
13077
  path: "/draft-orders/:id/promotions"
13074
13078
  },
13075
- {
13076
- Component: Shipping,
13077
- path: "/draft-orders/:id/shipping"
13078
- },
13079
13079
  {
13080
13080
  Component: SalesChannel,
13081
13081
  path: "/draft-orders/:id/sales-channel"
13082
13082
  },
13083
+ {
13084
+ Component: Shipping,
13085
+ path: "/draft-orders/:id/shipping"
13086
+ },
13083
13087
  {
13084
13088
  Component: ShippingAddress,
13085
13089
  path: "/draft-orders/:id/shipping-address"
@@ -13087,10 +13091,6 @@ const routeModule = {
13087
13091
  {
13088
13092
  Component: TransferOwnership,
13089
13093
  path: "/draft-orders/:id/transfer-ownership"
13090
- },
13091
- {
13092
- Component: Email,
13093
- path: "/draft-orders/:id/email"
13094
13094
  }
13095
13095
  ]
13096
13096
  }
@@ -9554,6 +9554,27 @@ const ID = () => {
9554
9554
  /* @__PURE__ */ jsx(Outlet, {})
9555
9555
  ] });
9556
9556
  };
9557
+ const CustomItems = () => {
9558
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9559
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9560
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9561
+ ] });
9562
+ };
9563
+ const CustomItemsForm = () => {
9564
+ const form = useForm({
9565
+ resolver: zodResolver(schema$5)
9566
+ });
9567
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9568
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9569
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9570
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9571
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9572
+ ] }) })
9573
+ ] }) });
9574
+ };
9575
+ const schema$5 = objectType({
9576
+ email: stringType().email()
9577
+ });
9557
9578
  const BillingAddress = () => {
9558
9579
  const { id } = useParams();
9559
9580
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9586,7 +9607,7 @@ const BillingAddressForm = ({ order }) => {
9586
9607
  postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9587
9608
  phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9588
9609
  },
9589
- resolver: zodResolver(schema$5)
9610
+ resolver: zodResolver(schema$4)
9590
9611
  });
9591
9612
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9592
9613
  const { handleSuccess } = useRouteModal();
@@ -9743,26 +9764,73 @@ const BillingAddressForm = ({ order }) => {
9743
9764
  }
9744
9765
  ) });
9745
9766
  };
9746
- const schema$5 = addressSchema;
9747
- const CustomItems = () => {
9767
+ const schema$4 = addressSchema;
9768
+ const Email = () => {
9769
+ const { id } = useParams();
9770
+ const { order, isPending, isError, error } = useOrder(id, {
9771
+ fields: "+email"
9772
+ });
9773
+ if (isError) {
9774
+ throw error;
9775
+ }
9776
+ const isReady = !isPending && !!order;
9748
9777
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9749
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9750
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9778
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9779
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9780
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9781
+ ] }),
9782
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9751
9783
  ] });
9752
9784
  };
9753
- const CustomItemsForm = () => {
9785
+ const EmailForm = ({ order }) => {
9754
9786
  const form = useForm({
9755
- resolver: zodResolver(schema$4)
9787
+ defaultValues: {
9788
+ email: order.email ?? ""
9789
+ },
9790
+ resolver: zodResolver(schema$3)
9756
9791
  });
9757
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9758
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9759
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9760
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9761
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9762
- ] }) })
9763
- ] }) });
9792
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9793
+ const { handleSuccess } = useRouteModal();
9794
+ const onSubmit = form.handleSubmit(async (data) => {
9795
+ await mutateAsync(
9796
+ { email: data.email },
9797
+ {
9798
+ onSuccess: () => {
9799
+ handleSuccess();
9800
+ },
9801
+ onError: (error) => {
9802
+ toast.error(error.message);
9803
+ }
9804
+ }
9805
+ );
9806
+ });
9807
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9808
+ KeyboundForm,
9809
+ {
9810
+ className: "flex flex-1 flex-col overflow-hidden",
9811
+ onSubmit,
9812
+ children: [
9813
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9814
+ Form$2.Field,
9815
+ {
9816
+ control: form.control,
9817
+ name: "email",
9818
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9819
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9820
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9821
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9822
+ ] })
9823
+ }
9824
+ ) }),
9825
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9826
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9827
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9828
+ ] }) })
9829
+ ]
9830
+ }
9831
+ ) });
9764
9832
  };
9765
- const schema$4 = objectType({
9833
+ const schema$3 = objectType({
9766
9834
  email: stringType().email()
9767
9835
  });
9768
9836
  const NumberInput = forwardRef(
@@ -11366,6 +11434,112 @@ function getPromotionCodes(items, shippingMethods) {
11366
11434
  }
11367
11435
  return Array.from(codes);
11368
11436
  }
11437
+ const SalesChannel = () => {
11438
+ const { id } = useParams();
11439
+ const { draft_order, isPending, isError, error } = useDraftOrder(
11440
+ id,
11441
+ {
11442
+ fields: "+sales_channel_id"
11443
+ },
11444
+ {
11445
+ enabled: !!id
11446
+ }
11447
+ );
11448
+ if (isError) {
11449
+ throw error;
11450
+ }
11451
+ const ISrEADY = !!draft_order && !isPending;
11452
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11453
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11454
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
11455
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11456
+ ] }),
11457
+ ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
11458
+ ] });
11459
+ };
11460
+ const SalesChannelForm = ({ order }) => {
11461
+ const form = useForm({
11462
+ defaultValues: {
11463
+ sales_channel_id: order.sales_channel_id || ""
11464
+ },
11465
+ resolver: zodResolver(schema$2)
11466
+ });
11467
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11468
+ const { handleSuccess } = useRouteModal();
11469
+ const onSubmit = form.handleSubmit(async (data) => {
11470
+ await mutateAsync(
11471
+ {
11472
+ sales_channel_id: data.sales_channel_id
11473
+ },
11474
+ {
11475
+ onSuccess: () => {
11476
+ toast.success("Sales channel updated");
11477
+ handleSuccess();
11478
+ },
11479
+ onError: (error) => {
11480
+ toast.error(error.message);
11481
+ }
11482
+ }
11483
+ );
11484
+ });
11485
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11486
+ KeyboundForm,
11487
+ {
11488
+ className: "flex flex-1 flex-col overflow-hidden",
11489
+ onSubmit,
11490
+ children: [
11491
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
11492
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11493
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11494
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11495
+ ] }) })
11496
+ ]
11497
+ }
11498
+ ) });
11499
+ };
11500
+ const SalesChannelField = ({ control, order }) => {
11501
+ const salesChannels = useComboboxData({
11502
+ queryFn: async (params) => {
11503
+ return await sdk.admin.salesChannel.list(params);
11504
+ },
11505
+ queryKey: ["sales-channels"],
11506
+ getOptions: (data) => {
11507
+ return data.sales_channels.map((salesChannel) => ({
11508
+ label: salesChannel.name,
11509
+ value: salesChannel.id
11510
+ }));
11511
+ },
11512
+ defaultValue: order.sales_channel_id || void 0
11513
+ });
11514
+ return /* @__PURE__ */ jsx(
11515
+ Form$2.Field,
11516
+ {
11517
+ control,
11518
+ name: "sales_channel_id",
11519
+ render: ({ field }) => {
11520
+ return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11521
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
11522
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
11523
+ Combobox,
11524
+ {
11525
+ options: salesChannels.options,
11526
+ fetchNextPage: salesChannels.fetchNextPage,
11527
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
11528
+ searchValue: salesChannels.searchValue,
11529
+ onSearchValueChange: salesChannels.onSearchValueChange,
11530
+ placeholder: "Select sales channel",
11531
+ ...field
11532
+ }
11533
+ ) }),
11534
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11535
+ ] });
11536
+ }
11537
+ }
11538
+ );
11539
+ };
11540
+ const schema$2 = objectType({
11541
+ sales_channel_id: stringType().min(1)
11542
+ });
11369
11543
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11370
11544
  const Shipping = () => {
11371
11545
  var _a;
@@ -12173,112 +12347,6 @@ const CustomAmountField = ({
12173
12347
  }
12174
12348
  );
12175
12349
  };
12176
- const SalesChannel = () => {
12177
- const { id } = useParams();
12178
- const { draft_order, isPending, isError, error } = useDraftOrder(
12179
- id,
12180
- {
12181
- fields: "+sales_channel_id"
12182
- },
12183
- {
12184
- enabled: !!id
12185
- }
12186
- );
12187
- if (isError) {
12188
- throw error;
12189
- }
12190
- const ISrEADY = !!draft_order && !isPending;
12191
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12192
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12193
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
12194
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12195
- ] }),
12196
- ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
12197
- ] });
12198
- };
12199
- const SalesChannelForm = ({ order }) => {
12200
- const form = useForm({
12201
- defaultValues: {
12202
- sales_channel_id: order.sales_channel_id || ""
12203
- },
12204
- resolver: zodResolver(schema$3)
12205
- });
12206
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12207
- const { handleSuccess } = useRouteModal();
12208
- const onSubmit = form.handleSubmit(async (data) => {
12209
- await mutateAsync(
12210
- {
12211
- sales_channel_id: data.sales_channel_id
12212
- },
12213
- {
12214
- onSuccess: () => {
12215
- toast.success("Sales channel updated");
12216
- handleSuccess();
12217
- },
12218
- onError: (error) => {
12219
- toast.error(error.message);
12220
- }
12221
- }
12222
- );
12223
- });
12224
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12225
- KeyboundForm,
12226
- {
12227
- className: "flex flex-1 flex-col overflow-hidden",
12228
- onSubmit,
12229
- children: [
12230
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
12231
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12232
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12233
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12234
- ] }) })
12235
- ]
12236
- }
12237
- ) });
12238
- };
12239
- const SalesChannelField = ({ control, order }) => {
12240
- const salesChannels = useComboboxData({
12241
- queryFn: async (params) => {
12242
- return await sdk.admin.salesChannel.list(params);
12243
- },
12244
- queryKey: ["sales-channels"],
12245
- getOptions: (data) => {
12246
- return data.sales_channels.map((salesChannel) => ({
12247
- label: salesChannel.name,
12248
- value: salesChannel.id
12249
- }));
12250
- },
12251
- defaultValue: order.sales_channel_id || void 0
12252
- });
12253
- return /* @__PURE__ */ jsx(
12254
- Form$2.Field,
12255
- {
12256
- control,
12257
- name: "sales_channel_id",
12258
- render: ({ field }) => {
12259
- return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12260
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
12261
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12262
- Combobox,
12263
- {
12264
- options: salesChannels.options,
12265
- fetchNextPage: salesChannels.fetchNextPage,
12266
- isFetchingNextPage: salesChannels.isFetchingNextPage,
12267
- searchValue: salesChannels.searchValue,
12268
- onSearchValueChange: salesChannels.onSearchValueChange,
12269
- placeholder: "Select sales channel",
12270
- ...field
12271
- }
12272
- ) }),
12273
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12274
- ] });
12275
- }
12276
- }
12277
- );
12278
- };
12279
- const schema$3 = objectType({
12280
- sales_channel_id: stringType().min(1)
12281
- });
12282
12350
  const ShippingAddress = () => {
12283
12351
  const { id } = useParams();
12284
12352
  const { order, isPending, isError, error } = useOrder(id, {
@@ -12311,7 +12379,7 @@ const ShippingAddressForm = ({ order }) => {
12311
12379
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12312
12380
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12313
12381
  },
12314
- resolver: zodResolver(schema$2)
12382
+ resolver: zodResolver(schema$1)
12315
12383
  });
12316
12384
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12317
12385
  const { handleSuccess } = useRouteModal();
@@ -12481,7 +12549,7 @@ const ShippingAddressForm = ({ order }) => {
12481
12549
  }
12482
12550
  ) });
12483
12551
  };
12484
- const schema$2 = addressSchema;
12552
+ const schema$1 = addressSchema;
12485
12553
  const TransferOwnership = () => {
12486
12554
  const { id } = useParams();
12487
12555
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12505,7 +12573,7 @@ const TransferOwnershipForm = ({ order }) => {
12505
12573
  defaultValues: {
12506
12574
  customer_id: order.customer_id || ""
12507
12575
  },
12508
- resolver: zodResolver(schema$1)
12576
+ resolver: zodResolver(schema)
12509
12577
  });
12510
12578
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12511
12579
  const { handleSuccess } = useRouteModal();
@@ -12955,76 +13023,8 @@ const Illustration = () => {
12955
13023
  }
12956
13024
  );
12957
13025
  };
12958
- const schema$1 = objectType({
12959
- customer_id: stringType().min(1)
12960
- });
12961
- const Email = () => {
12962
- const { id } = useParams();
12963
- const { order, isPending, isError, error } = useOrder(id, {
12964
- fields: "+email"
12965
- });
12966
- if (isError) {
12967
- throw error;
12968
- }
12969
- const isReady = !isPending && !!order;
12970
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12971
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12972
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
12973
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12974
- ] }),
12975
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
12976
- ] });
12977
- };
12978
- const EmailForm = ({ order }) => {
12979
- const form = useForm({
12980
- defaultValues: {
12981
- email: order.email ?? ""
12982
- },
12983
- resolver: zodResolver(schema)
12984
- });
12985
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12986
- const { handleSuccess } = useRouteModal();
12987
- const onSubmit = form.handleSubmit(async (data) => {
12988
- await mutateAsync(
12989
- { email: data.email },
12990
- {
12991
- onSuccess: () => {
12992
- handleSuccess();
12993
- },
12994
- onError: (error) => {
12995
- toast.error(error.message);
12996
- }
12997
- }
12998
- );
12999
- });
13000
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
13001
- KeyboundForm,
13002
- {
13003
- className: "flex flex-1 flex-col overflow-hidden",
13004
- onSubmit,
13005
- children: [
13006
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
13007
- Form$2.Field,
13008
- {
13009
- control: form.control,
13010
- name: "email",
13011
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13012
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
13013
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13014
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13015
- ] })
13016
- }
13017
- ) }),
13018
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13019
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13020
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13021
- ] }) })
13022
- ]
13023
- }
13024
- ) });
13025
- };
13026
13026
  const schema = objectType({
13027
- email: stringType().email()
13027
+ customer_id: stringType().min(1)
13028
13028
  });
13029
13029
  const widgetModule = { widgets: [] };
13030
13030
  const routeModule = {
@@ -13046,13 +13046,17 @@ const routeModule = {
13046
13046
  handle,
13047
13047
  loader,
13048
13048
  children: [
13049
+ {
13050
+ Component: CustomItems,
13051
+ path: "/draft-orders/:id/custom-items"
13052
+ },
13049
13053
  {
13050
13054
  Component: BillingAddress,
13051
13055
  path: "/draft-orders/:id/billing-address"
13052
13056
  },
13053
13057
  {
13054
- Component: CustomItems,
13055
- path: "/draft-orders/:id/custom-items"
13058
+ Component: Email,
13059
+ path: "/draft-orders/:id/email"
13056
13060
  },
13057
13061
  {
13058
13062
  Component: Items,
@@ -13066,14 +13070,14 @@ const routeModule = {
13066
13070
  Component: Promotions,
13067
13071
  path: "/draft-orders/:id/promotions"
13068
13072
  },
13069
- {
13070
- Component: Shipping,
13071
- path: "/draft-orders/:id/shipping"
13072
- },
13073
13073
  {
13074
13074
  Component: SalesChannel,
13075
13075
  path: "/draft-orders/:id/sales-channel"
13076
13076
  },
13077
+ {
13078
+ Component: Shipping,
13079
+ path: "/draft-orders/:id/shipping"
13080
+ },
13077
13081
  {
13078
13082
  Component: ShippingAddress,
13079
13083
  path: "/draft-orders/:id/shipping-address"
@@ -13081,10 +13085,6 @@ const routeModule = {
13081
13085
  {
13082
13086
  Component: TransferOwnership,
13083
13087
  path: "/draft-orders/:id/transfer-ownership"
13084
- },
13085
- {
13086
- Component: Email,
13087
- path: "/draft-orders/:id/email"
13088
13088
  }
13089
13089
  ]
13090
13090
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.2-preview-20250904090151",
3
+ "version": "2.10.2-preview-20250904120155",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@hookform/resolvers": "3.4.2",
39
- "@medusajs/js-sdk": "2.10.2-preview-20250904090151",
39
+ "@medusajs/js-sdk": "2.10.2-preview-20250904120155",
40
40
  "@tanstack/react-query": "5.64.2",
41
41
  "@uiw/react-json-view": "^2.0.0-alpha.17",
42
42
  "date-fns": "^3.6.0",
@@ -45,14 +45,14 @@
45
45
  "react-hook-form": "7.49.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.10.2-preview-20250904090151",
49
- "@medusajs/cli": "2.10.2-preview-20250904090151",
50
- "@medusajs/framework": "2.10.2-preview-20250904090151",
51
- "@medusajs/icons": "2.10.2-preview-20250904090151",
52
- "@medusajs/test-utils": "2.10.2-preview-20250904090151",
53
- "@medusajs/types": "2.10.2-preview-20250904090151",
54
- "@medusajs/ui": "4.0.22-preview-20250904090151",
55
- "@medusajs/ui-preset": "2.10.2-preview-20250904090151",
48
+ "@medusajs/admin-sdk": "2.10.2-preview-20250904120155",
49
+ "@medusajs/cli": "2.10.2-preview-20250904120155",
50
+ "@medusajs/framework": "2.10.2-preview-20250904120155",
51
+ "@medusajs/icons": "2.10.2-preview-20250904120155",
52
+ "@medusajs/test-utils": "2.10.2-preview-20250904120155",
53
+ "@medusajs/types": "2.10.2-preview-20250904120155",
54
+ "@medusajs/ui": "4.0.22-preview-20250904120155",
55
+ "@medusajs/ui-preset": "2.10.2-preview-20250904120155",
56
56
  "@mikro-orm/cli": "6.4.3",
57
57
  "@mikro-orm/core": "6.4.3",
58
58
  "@mikro-orm/knex": "6.4.3",
@@ -76,12 +76,12 @@
76
76
  "yalc": "^1.0.0-pre.53"
77
77
  },
78
78
  "peerDependencies": {
79
- "@medusajs/admin-sdk": "2.10.2-preview-20250904090151",
80
- "@medusajs/cli": "2.10.2-preview-20250904090151",
81
- "@medusajs/framework": "2.10.2-preview-20250904090151",
82
- "@medusajs/icons": "2.10.2-preview-20250904090151",
83
- "@medusajs/test-utils": "2.10.2-preview-20250904090151",
84
- "@medusajs/ui": "4.0.22-preview-20250904090151",
79
+ "@medusajs/admin-sdk": "2.10.2-preview-20250904120155",
80
+ "@medusajs/cli": "2.10.2-preview-20250904120155",
81
+ "@medusajs/framework": "2.10.2-preview-20250904120155",
82
+ "@medusajs/icons": "2.10.2-preview-20250904120155",
83
+ "@medusajs/test-utils": "2.10.2-preview-20250904120155",
84
+ "@medusajs/ui": "4.0.22-preview-20250904120155",
85
85
  "@mikro-orm/cli": "6.4.3",
86
86
  "@mikro-orm/core": "6.4.3",
87
87
  "@mikro-orm/knex": "6.4.3",