@medusajs/draft-order 2.10.4-preview-20250924210149 → 2.10.4-preview-20250925031439

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.
@@ -9763,23 +9763,70 @@ const BillingAddressForm = ({ order }) => {
9763
9763
  ) });
9764
9764
  };
9765
9765
  const schema$5 = addressSchema;
9766
- const CustomItems = () => {
9766
+ const Email = () => {
9767
+ const { id } = reactRouterDom.useParams();
9768
+ const { order, isPending, isError, error } = useOrder(id, {
9769
+ fields: "+email"
9770
+ });
9771
+ if (isError) {
9772
+ throw error;
9773
+ }
9774
+ const isReady = !isPending && !!order;
9767
9775
  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, {})
9776
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9777
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9778
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9779
+ ] }),
9780
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9770
9781
  ] });
9771
9782
  };
9772
- const CustomItemsForm = () => {
9783
+ const EmailForm = ({ order }) => {
9773
9784
  const form = reactHookForm.useForm({
9785
+ defaultValues: {
9786
+ email: order.email ?? ""
9787
+ },
9774
9788
  resolver: zod.zodResolver(schema$4)
9775
9789
  });
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
- ] }) });
9790
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9791
+ const { handleSuccess } = useRouteModal();
9792
+ const onSubmit = form.handleSubmit(async (data) => {
9793
+ await mutateAsync(
9794
+ { email: data.email },
9795
+ {
9796
+ onSuccess: () => {
9797
+ handleSuccess();
9798
+ },
9799
+ onError: (error) => {
9800
+ ui.toast.error(error.message);
9801
+ }
9802
+ }
9803
+ );
9804
+ });
9805
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9806
+ KeyboundForm,
9807
+ {
9808
+ className: "flex flex-1 flex-col overflow-hidden",
9809
+ onSubmit,
9810
+ children: [
9811
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9812
+ Form$2.Field,
9813
+ {
9814
+ control: form.control,
9815
+ name: "email",
9816
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9817
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9818
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9819
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9820
+ ] })
9821
+ }
9822
+ ) }),
9823
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9824
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9825
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9826
+ ] }) })
9827
+ ]
9828
+ }
9829
+ ) });
9783
9830
  };
9784
9831
  const schema$4 = objectType({
9785
9832
  email: stringType().email()
@@ -11385,112 +11432,6 @@ function getPromotionIds(items, shippingMethods) {
11385
11432
  }
11386
11433
  return Array.from(promotionIds);
11387
11434
  }
11388
- const SalesChannel = () => {
11389
- 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
- );
11399
- if (isError) {
11400
- throw error;
11401
- }
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
- ] });
11410
- };
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
11435
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11495
11436
  const Shipping = () => {
11496
11437
  var _a;
@@ -12298,60 +12239,44 @@ const CustomAmountField = ({
12298
12239
  }
12299
12240
  );
12300
12241
  };
12301
- const ShippingAddress = () => {
12242
+ const TransferOwnership = () => {
12302
12243
  const { id } = reactRouterDom.useParams();
12303
- const { order, isPending, isError, error } = useOrder(id, {
12304
- fields: "+shipping_address"
12244
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12245
+ fields: "id,customer_id,customer.*"
12305
12246
  });
12306
12247
  if (isError) {
12307
12248
  throw error;
12308
12249
  }
12309
- const isReady = !isPending && !!order;
12250
+ const isReady = !isPending && !!draft_order;
12310
12251
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12311
12252
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12312
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12313
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12253
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Transfer Ownership" }) }),
12254
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12314
12255
  ] }),
12315
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12256
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(TransferOwnershipForm, { order: draft_order })
12316
12257
  ] });
12317
12258
  };
12318
- const ShippingAddressForm = ({ order }) => {
12319
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12259
+ const TransferOwnershipForm = ({ order }) => {
12260
+ var _a, _b;
12320
12261
  const form = reactHookForm.useForm({
12321
12262
  defaultValues: {
12322
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12323
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12324
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12325
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12326
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12327
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12328
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12329
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12330
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12331
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12263
+ customer_id: order.customer_id || ""
12332
12264
  },
12333
- resolver: zod.zodResolver(schema$2)
12265
+ resolver: zod.zodResolver(schema$3)
12334
12266
  });
12335
12267
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12336
12268
  const { handleSuccess } = useRouteModal();
12269
+ const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12270
+ const currentCustomer = order.customer ? {
12271
+ label: name ? `${name} (${order.customer.email})` : order.customer.email,
12272
+ value: order.customer.id
12273
+ } : null;
12337
12274
  const onSubmit = form.handleSubmit(async (data) => {
12338
12275
  await mutateAsync(
12339
- {
12340
- shipping_address: {
12341
- first_name: data.first_name,
12342
- last_name: data.last_name,
12343
- company: data.company,
12344
- address_1: data.address_1,
12345
- address_2: data.address_2,
12346
- city: data.city,
12347
- province: data.province,
12348
- country_code: data.country_code,
12349
- postal_code: data.postal_code,
12350
- phone: data.phone
12351
- }
12352
- },
12276
+ { customer_id: data.customer_id },
12353
12277
  {
12354
12278
  onSuccess: () => {
12279
+ ui.toast.success("Customer updated");
12355
12280
  handleSuccess();
12356
12281
  },
12357
12282
  onError: (error) => {
@@ -12366,210 +12291,23 @@ const ShippingAddressForm = ({ order }) => {
12366
12291
  className: "flex flex-1 flex-col overflow-hidden",
12367
12292
  onSubmit,
12368
12293
  children: [
12369
- /* @__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: [
12294
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
12295
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx(Illustration, {}) }),
12296
+ currentCustomer && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-3", children: [
12297
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
12298
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
12299
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { children: "The customer that is currently associated with this draft order." })
12300
+ ] }),
12301
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { disabled: true, value: currentCustomer.value, children: [
12302
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
12303
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
12304
+ ] })
12305
+ ] }),
12370
12306
  /* @__PURE__ */ jsxRuntime.jsx(
12371
- Form$2.Field,
12307
+ CustomerField,
12372
12308
  {
12373
12309
  control: form.control,
12374
- name: "country_code",
12375
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12376
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12377
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12378
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12379
- ] })
12380
- }
12381
- ),
12382
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12383
- /* @__PURE__ */ jsxRuntime.jsx(
12384
- Form$2.Field,
12385
- {
12386
- control: form.control,
12387
- name: "first_name",
12388
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12389
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12390
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12391
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12392
- ] })
12393
- }
12394
- ),
12395
- /* @__PURE__ */ jsxRuntime.jsx(
12396
- Form$2.Field,
12397
- {
12398
- control: form.control,
12399
- name: "last_name",
12400
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12401
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12402
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12403
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12404
- ] })
12405
- }
12406
- )
12407
- ] }),
12408
- /* @__PURE__ */ jsxRuntime.jsx(
12409
- Form$2.Field,
12410
- {
12411
- control: form.control,
12412
- name: "company",
12413
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12414
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12415
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12416
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12417
- ] })
12418
- }
12419
- ),
12420
- /* @__PURE__ */ jsxRuntime.jsx(
12421
- Form$2.Field,
12422
- {
12423
- control: form.control,
12424
- name: "address_1",
12425
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12426
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12427
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12428
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12429
- ] })
12430
- }
12431
- ),
12432
- /* @__PURE__ */ jsxRuntime.jsx(
12433
- Form$2.Field,
12434
- {
12435
- control: form.control,
12436
- name: "address_2",
12437
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12438
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12439
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12440
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12441
- ] })
12442
- }
12443
- ),
12444
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12445
- /* @__PURE__ */ jsxRuntime.jsx(
12446
- Form$2.Field,
12447
- {
12448
- control: form.control,
12449
- name: "postal_code",
12450
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12451
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12452
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12453
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12454
- ] })
12455
- }
12456
- ),
12457
- /* @__PURE__ */ jsxRuntime.jsx(
12458
- Form$2.Field,
12459
- {
12460
- control: form.control,
12461
- name: "city",
12462
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12463
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12464
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12465
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12466
- ] })
12467
- }
12468
- )
12469
- ] }),
12470
- /* @__PURE__ */ jsxRuntime.jsx(
12471
- Form$2.Field,
12472
- {
12473
- control: form.control,
12474
- name: "province",
12475
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12476
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12477
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12478
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12479
- ] })
12480
- }
12481
- ),
12482
- /* @__PURE__ */ jsxRuntime.jsx(
12483
- Form$2.Field,
12484
- {
12485
- control: form.control,
12486
- name: "phone",
12487
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12488
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12489
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12490
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12491
- ] })
12492
- }
12493
- )
12494
- ] }) }),
12495
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12496
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12497
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12498
- ] }) })
12499
- ]
12500
- }
12501
- ) });
12502
- };
12503
- const schema$2 = addressSchema;
12504
- const TransferOwnership = () => {
12505
- const { id } = reactRouterDom.useParams();
12506
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12507
- fields: "id,customer_id,customer.*"
12508
- });
12509
- if (isError) {
12510
- throw error;
12511
- }
12512
- const isReady = !isPending && !!draft_order;
12513
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12514
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12515
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Transfer Ownership" }) }),
12516
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12517
- ] }),
12518
- isReady && /* @__PURE__ */ jsxRuntime.jsx(TransferOwnershipForm, { order: draft_order })
12519
- ] });
12520
- };
12521
- const TransferOwnershipForm = ({ order }) => {
12522
- var _a, _b;
12523
- const form = reactHookForm.useForm({
12524
- defaultValues: {
12525
- customer_id: order.customer_id || ""
12526
- },
12527
- resolver: zod.zodResolver(schema$1)
12528
- });
12529
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12530
- const { handleSuccess } = useRouteModal();
12531
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12532
- const currentCustomer = order.customer ? {
12533
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12534
- value: order.customer.id
12535
- } : null;
12536
- const onSubmit = form.handleSubmit(async (data) => {
12537
- await mutateAsync(
12538
- { customer_id: data.customer_id },
12539
- {
12540
- onSuccess: () => {
12541
- ui.toast.success("Customer updated");
12542
- handleSuccess();
12543
- },
12544
- onError: (error) => {
12545
- ui.toast.error(error.message);
12546
- }
12547
- }
12548
- );
12549
- });
12550
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12551
- KeyboundForm,
12552
- {
12553
- className: "flex flex-1 flex-col overflow-hidden",
12554
- onSubmit,
12555
- children: [
12556
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
12557
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx(Illustration, {}) }),
12558
- currentCustomer && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-3", children: [
12559
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
12560
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
12561
- /* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { children: "The customer that is currently associated with this draft order." })
12562
- ] }),
12563
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { disabled: true, value: currentCustomer.value, children: [
12564
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
12565
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
12566
- ] })
12567
- ] }),
12568
- /* @__PURE__ */ jsxRuntime.jsx(
12569
- CustomerField,
12570
- {
12571
- control: form.control,
12572
- currentCustomerId: order.customer_id
12310
+ currentCustomerId: order.customer_id
12573
12311
  }
12574
12312
  )
12575
12313
  ] }),
@@ -12974,13 +12712,119 @@ const Illustration = () => {
12974
12712
  }
12975
12713
  );
12976
12714
  };
12977
- const schema$1 = objectType({
12715
+ const schema$3 = objectType({
12978
12716
  customer_id: stringType().min(1)
12979
12717
  });
12980
- const Email = () => {
12718
+ const SalesChannel = () => {
12719
+ const { id } = reactRouterDom.useParams();
12720
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12721
+ id,
12722
+ {
12723
+ fields: "+sales_channel_id"
12724
+ },
12725
+ {
12726
+ enabled: !!id
12727
+ }
12728
+ );
12729
+ if (isError) {
12730
+ throw error;
12731
+ }
12732
+ const ISrEADY = !!draft_order && !isPending;
12733
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12734
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12735
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
12736
+ /* @__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" }) })
12737
+ ] }),
12738
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
12739
+ ] });
12740
+ };
12741
+ const SalesChannelForm = ({ order }) => {
12742
+ const form = reactHookForm.useForm({
12743
+ defaultValues: {
12744
+ sales_channel_id: order.sales_channel_id || ""
12745
+ },
12746
+ resolver: zod.zodResolver(schema$2)
12747
+ });
12748
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12749
+ const { handleSuccess } = useRouteModal();
12750
+ const onSubmit = form.handleSubmit(async (data) => {
12751
+ await mutateAsync(
12752
+ {
12753
+ sales_channel_id: data.sales_channel_id
12754
+ },
12755
+ {
12756
+ onSuccess: () => {
12757
+ ui.toast.success("Sales channel updated");
12758
+ handleSuccess();
12759
+ },
12760
+ onError: (error) => {
12761
+ ui.toast.error(error.message);
12762
+ }
12763
+ }
12764
+ );
12765
+ });
12766
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12767
+ KeyboundForm,
12768
+ {
12769
+ className: "flex flex-1 flex-col overflow-hidden",
12770
+ onSubmit,
12771
+ children: [
12772
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
12773
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12774
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12775
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12776
+ ] }) })
12777
+ ]
12778
+ }
12779
+ ) });
12780
+ };
12781
+ const SalesChannelField = ({ control, order }) => {
12782
+ const salesChannels = useComboboxData({
12783
+ queryFn: async (params) => {
12784
+ return await sdk.admin.salesChannel.list(params);
12785
+ },
12786
+ queryKey: ["sales-channels"],
12787
+ getOptions: (data) => {
12788
+ return data.sales_channels.map((salesChannel) => ({
12789
+ label: salesChannel.name,
12790
+ value: salesChannel.id
12791
+ }));
12792
+ },
12793
+ defaultValue: order.sales_channel_id || void 0
12794
+ });
12795
+ return /* @__PURE__ */ jsxRuntime.jsx(
12796
+ Form$2.Field,
12797
+ {
12798
+ control,
12799
+ name: "sales_channel_id",
12800
+ render: ({ field }) => {
12801
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12802
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
12803
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12804
+ Combobox,
12805
+ {
12806
+ options: salesChannels.options,
12807
+ fetchNextPage: salesChannels.fetchNextPage,
12808
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
12809
+ searchValue: salesChannels.searchValue,
12810
+ onSearchValueChange: salesChannels.onSearchValueChange,
12811
+ placeholder: "Select sales channel",
12812
+ ...field
12813
+ }
12814
+ ) }),
12815
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12816
+ ] });
12817
+ }
12818
+ }
12819
+ );
12820
+ };
12821
+ const schema$2 = objectType({
12822
+ sales_channel_id: stringType().min(1)
12823
+ });
12824
+ const ShippingAddress = () => {
12981
12825
  const { id } = reactRouterDom.useParams();
12982
12826
  const { order, isPending, isError, error } = useOrder(id, {
12983
- fields: "+email"
12827
+ fields: "+shipping_address"
12984
12828
  });
12985
12829
  if (isError) {
12986
12830
  throw error;
@@ -12988,24 +12832,47 @@ const Email = () => {
12988
12832
  const isReady = !isPending && !!order;
12989
12833
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12990
12834
  /* @__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" }) })
12835
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12836
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12993
12837
  ] }),
12994
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12838
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12995
12839
  ] });
12996
12840
  };
12997
- const EmailForm = ({ order }) => {
12841
+ const ShippingAddressForm = ({ order }) => {
12842
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12998
12843
  const form = reactHookForm.useForm({
12999
12844
  defaultValues: {
13000
- email: order.email ?? ""
12845
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12846
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12847
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12848
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12849
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12850
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12851
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12852
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12853
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12854
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
13001
12855
  },
13002
- resolver: zod.zodResolver(schema)
12856
+ resolver: zod.zodResolver(schema$1)
13003
12857
  });
13004
12858
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
13005
12859
  const { handleSuccess } = useRouteModal();
13006
12860
  const onSubmit = form.handleSubmit(async (data) => {
13007
12861
  await mutateAsync(
13008
- { email: data.email },
12862
+ {
12863
+ shipping_address: {
12864
+ first_name: data.first_name,
12865
+ last_name: data.last_name,
12866
+ company: data.company,
12867
+ address_1: data.address_1,
12868
+ address_2: data.address_2,
12869
+ city: data.city,
12870
+ province: data.province,
12871
+ country_code: data.country_code,
12872
+ postal_code: data.postal_code,
12873
+ phone: data.phone
12874
+ }
12875
+ },
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
  });
@@ -13070,8 +13070,8 @@ const routeModule = {
13070
13070
  path: "/draft-orders/:id/billing-address"
13071
13071
  },
13072
13072
  {
13073
- Component: CustomItems,
13074
- path: "/draft-orders/:id/custom-items"
13073
+ Component: Email,
13074
+ path: "/draft-orders/:id/email"
13075
13075
  },
13076
13076
  {
13077
13077
  Component: Items,
@@ -13085,25 +13085,25 @@ 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"
13095
13091
  },
13096
- {
13097
- Component: ShippingAddress,
13098
- path: "/draft-orders/:id/shipping-address"
13099
- },
13100
13092
  {
13101
13093
  Component: TransferOwnership,
13102
13094
  path: "/draft-orders/:id/transfer-ownership"
13103
13095
  },
13104
13096
  {
13105
- Component: Email,
13106
- path: "/draft-orders/:id/email"
13097
+ Component: SalesChannel,
13098
+ path: "/draft-orders/:id/sales-channel"
13099
+ },
13100
+ {
13101
+ Component: ShippingAddress,
13102
+ path: "/draft-orders/:id/shipping-address"
13103
+ },
13104
+ {
13105
+ Component: CustomItems,
13106
+ path: "/draft-orders/:id/custom-items"
13107
13107
  }
13108
13108
  ]
13109
13109
  }