@medusajs/draft-order 2.10.4-preview-20250922000330 → 2.10.4-preview-20250922060202

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9573,196 +9573,6 @@ const ID = () => {
9573
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9574
9574
  ] });
9575
9575
  };
9576
- const BillingAddress = () => {
9577
- const { id } = reactRouterDom.useParams();
9578
- const { order, isPending, isError, error } = useOrder(id, {
9579
- fields: "+billing_address"
9580
- });
9581
- if (isError) {
9582
- throw error;
9583
- }
9584
- const isReady = !isPending && !!order;
9585
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9586
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9587
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9588
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9589
- ] }),
9590
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9591
- ] });
9592
- };
9593
- const BillingAddressForm = ({ order }) => {
9594
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9595
- const form = reactHookForm.useForm({
9596
- defaultValues: {
9597
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9598
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9599
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9600
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9601
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9602
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9603
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9604
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9605
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9606
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9607
- },
9608
- resolver: zod.zodResolver(schema$5)
9609
- });
9610
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9611
- const { handleSuccess } = useRouteModal();
9612
- const onSubmit = form.handleSubmit(async (data) => {
9613
- await mutateAsync(
9614
- { billing_address: data },
9615
- {
9616
- onSuccess: () => {
9617
- handleSuccess();
9618
- },
9619
- onError: (error) => {
9620
- ui.toast.error(error.message);
9621
- }
9622
- }
9623
- );
9624
- });
9625
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9626
- KeyboundForm,
9627
- {
9628
- className: "flex flex-1 flex-col overflow-hidden",
9629
- onSubmit,
9630
- children: [
9631
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
9632
- /* @__PURE__ */ jsxRuntime.jsx(
9633
- Form$2.Field,
9634
- {
9635
- control: form.control,
9636
- name: "country_code",
9637
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9639
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9640
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
- ] })
9642
- }
9643
- ),
9644
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9645
- /* @__PURE__ */ jsxRuntime.jsx(
9646
- Form$2.Field,
9647
- {
9648
- control: form.control,
9649
- name: "first_name",
9650
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9651
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9652
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9653
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9654
- ] })
9655
- }
9656
- ),
9657
- /* @__PURE__ */ jsxRuntime.jsx(
9658
- Form$2.Field,
9659
- {
9660
- control: form.control,
9661
- name: "last_name",
9662
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9664
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9665
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9666
- ] })
9667
- }
9668
- )
9669
- ] }),
9670
- /* @__PURE__ */ jsxRuntime.jsx(
9671
- Form$2.Field,
9672
- {
9673
- control: form.control,
9674
- name: "company",
9675
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9676
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9677
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9678
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9679
- ] })
9680
- }
9681
- ),
9682
- /* @__PURE__ */ jsxRuntime.jsx(
9683
- Form$2.Field,
9684
- {
9685
- control: form.control,
9686
- name: "address_1",
9687
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9688
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9689
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9690
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9691
- ] })
9692
- }
9693
- ),
9694
- /* @__PURE__ */ jsxRuntime.jsx(
9695
- Form$2.Field,
9696
- {
9697
- control: form.control,
9698
- name: "address_2",
9699
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9701
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9702
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9703
- ] })
9704
- }
9705
- ),
9706
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9707
- /* @__PURE__ */ jsxRuntime.jsx(
9708
- Form$2.Field,
9709
- {
9710
- control: form.control,
9711
- name: "postal_code",
9712
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9713
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9714
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9715
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9716
- ] })
9717
- }
9718
- ),
9719
- /* @__PURE__ */ jsxRuntime.jsx(
9720
- Form$2.Field,
9721
- {
9722
- control: form.control,
9723
- name: "city",
9724
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9726
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9727
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9728
- ] })
9729
- }
9730
- )
9731
- ] }),
9732
- /* @__PURE__ */ jsxRuntime.jsx(
9733
- Form$2.Field,
9734
- {
9735
- control: form.control,
9736
- name: "province",
9737
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9738
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9739
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9740
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9741
- ] })
9742
- }
9743
- ),
9744
- /* @__PURE__ */ jsxRuntime.jsx(
9745
- Form$2.Field,
9746
- {
9747
- control: form.control,
9748
- name: "phone",
9749
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9750
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9751
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9752
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9753
- ] })
9754
- }
9755
- )
9756
- ] }) }),
9757
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9758
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9759
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9760
- ] }) })
9761
- ]
9762
- }
9763
- ) });
9764
- };
9765
- const schema$5 = addressSchema;
9766
9576
  const Email = () => {
9767
9577
  const { id } = reactRouterDom.useParams();
9768
9578
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9785,7 +9595,7 @@ const EmailForm = ({ order }) => {
9785
9595
  defaultValues: {
9786
9596
  email: order.email ?? ""
9787
9597
  },
9788
- resolver: zod.zodResolver(schema$4)
9598
+ resolver: zod.zodResolver(schema$5)
9789
9599
  });
9790
9600
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9791
9601
  const { handleSuccess } = useRouteModal();
@@ -9828,7 +9638,7 @@ const EmailForm = ({ order }) => {
9828
9638
  }
9829
9639
  ) });
9830
9640
  };
9831
- const schema$4 = objectType({
9641
+ const schema$5 = objectType({
9832
9642
  email: stringType().email()
9833
9643
  });
9834
9644
  const NumberInput = React.forwardRef(
@@ -11432,6 +11242,196 @@ function getPromotionIds(items, shippingMethods) {
11432
11242
  }
11433
11243
  return Array.from(promotionIds);
11434
11244
  }
11245
+ const BillingAddress = () => {
11246
+ const { id } = reactRouterDom.useParams();
11247
+ const { order, isPending, isError, error } = useOrder(id, {
11248
+ fields: "+billing_address"
11249
+ });
11250
+ if (isError) {
11251
+ throw error;
11252
+ }
11253
+ const isReady = !isPending && !!order;
11254
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11255
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11256
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
11257
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
11258
+ ] }),
11259
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
11260
+ ] });
11261
+ };
11262
+ const BillingAddressForm = ({ order }) => {
11263
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11264
+ const form = reactHookForm.useForm({
11265
+ defaultValues: {
11266
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
11267
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
11268
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
11269
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
11270
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
11271
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
11272
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
11273
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
11274
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
11275
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
11276
+ },
11277
+ resolver: zod.zodResolver(schema$4)
11278
+ });
11279
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11280
+ const { handleSuccess } = useRouteModal();
11281
+ const onSubmit = form.handleSubmit(async (data) => {
11282
+ await mutateAsync(
11283
+ { billing_address: data },
11284
+ {
11285
+ onSuccess: () => {
11286
+ handleSuccess();
11287
+ },
11288
+ onError: (error) => {
11289
+ ui.toast.error(error.message);
11290
+ }
11291
+ }
11292
+ );
11293
+ });
11294
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11295
+ KeyboundForm,
11296
+ {
11297
+ className: "flex flex-1 flex-col overflow-hidden",
11298
+ onSubmit,
11299
+ children: [
11300
+ /* @__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: [
11301
+ /* @__PURE__ */ jsxRuntime.jsx(
11302
+ Form$2.Field,
11303
+ {
11304
+ control: form.control,
11305
+ name: "country_code",
11306
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11307
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11308
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11309
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11310
+ ] })
11311
+ }
11312
+ ),
11313
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11314
+ /* @__PURE__ */ jsxRuntime.jsx(
11315
+ Form$2.Field,
11316
+ {
11317
+ control: form.control,
11318
+ name: "first_name",
11319
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11320
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11321
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11322
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11323
+ ] })
11324
+ }
11325
+ ),
11326
+ /* @__PURE__ */ jsxRuntime.jsx(
11327
+ Form$2.Field,
11328
+ {
11329
+ control: form.control,
11330
+ name: "last_name",
11331
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11332
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
11333
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11334
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11335
+ ] })
11336
+ }
11337
+ )
11338
+ ] }),
11339
+ /* @__PURE__ */ jsxRuntime.jsx(
11340
+ Form$2.Field,
11341
+ {
11342
+ control: form.control,
11343
+ name: "company",
11344
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11345
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11346
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11347
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11348
+ ] })
11349
+ }
11350
+ ),
11351
+ /* @__PURE__ */ jsxRuntime.jsx(
11352
+ Form$2.Field,
11353
+ {
11354
+ control: form.control,
11355
+ name: "address_1",
11356
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11357
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11358
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11359
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11360
+ ] })
11361
+ }
11362
+ ),
11363
+ /* @__PURE__ */ jsxRuntime.jsx(
11364
+ Form$2.Field,
11365
+ {
11366
+ control: form.control,
11367
+ name: "address_2",
11368
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11369
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11370
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11371
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11372
+ ] })
11373
+ }
11374
+ ),
11375
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11376
+ /* @__PURE__ */ jsxRuntime.jsx(
11377
+ Form$2.Field,
11378
+ {
11379
+ control: form.control,
11380
+ name: "postal_code",
11381
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11382
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11383
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11384
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11385
+ ] })
11386
+ }
11387
+ ),
11388
+ /* @__PURE__ */ jsxRuntime.jsx(
11389
+ Form$2.Field,
11390
+ {
11391
+ control: form.control,
11392
+ name: "city",
11393
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11394
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
11395
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11396
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11397
+ ] })
11398
+ }
11399
+ )
11400
+ ] }),
11401
+ /* @__PURE__ */ jsxRuntime.jsx(
11402
+ Form$2.Field,
11403
+ {
11404
+ control: form.control,
11405
+ name: "province",
11406
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11407
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11408
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11409
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11410
+ ] })
11411
+ }
11412
+ ),
11413
+ /* @__PURE__ */ jsxRuntime.jsx(
11414
+ Form$2.Field,
11415
+ {
11416
+ control: form.control,
11417
+ name: "phone",
11418
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11419
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11420
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11421
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11422
+ ] })
11423
+ }
11424
+ )
11425
+ ] }) }),
11426
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11427
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11428
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11429
+ ] }) })
11430
+ ]
11431
+ }
11432
+ ) });
11433
+ };
11434
+ const schema$4 = addressSchema;
11435
11435
  const SalesChannel = () => {
11436
11436
  const { id } = reactRouterDom.useParams();
11437
11437
  const { draft_order, isPending, isError, error } = useDraftOrder(
@@ -12548,6 +12548,27 @@ const ShippingAddressForm = ({ order }) => {
12548
12548
  ) });
12549
12549
  };
12550
12550
  const schema$2 = addressSchema;
12551
+ const CustomItems = () => {
12552
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12553
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
12554
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12555
+ ] });
12556
+ };
12557
+ const CustomItemsForm = () => {
12558
+ const form = reactHookForm.useForm({
12559
+ resolver: zod.zodResolver(schema$1)
12560
+ });
12561
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12562
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
12563
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12564
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12565
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
12566
+ ] }) })
12567
+ ] }) });
12568
+ };
12569
+ const schema$1 = objectType({
12570
+ email: stringType().email()
12571
+ });
12551
12572
  const TransferOwnership = () => {
12552
12573
  const { id } = reactRouterDom.useParams();
12553
12574
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12571,7 +12592,7 @@ const TransferOwnershipForm = ({ order }) => {
12571
12592
  defaultValues: {
12572
12593
  customer_id: order.customer_id || ""
12573
12594
  },
12574
- resolver: zod.zodResolver(schema$1)
12595
+ resolver: zod.zodResolver(schema)
12575
12596
  });
12576
12597
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12577
12598
  const { handleSuccess } = useRouteModal();
@@ -13021,29 +13042,8 @@ const Illustration = () => {
13021
13042
  }
13022
13043
  );
13023
13044
  };
13024
- const schema$1 = objectType({
13025
- customer_id: stringType().min(1)
13026
- });
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
- email: stringType().email()
13046
+ customer_id: stringType().min(1)
13047
13047
  });
13048
13048
  const widgetModule = { widgets: [] };
13049
13049
  const routeModule = {
@@ -13065,10 +13065,6 @@ const routeModule = {
13065
13065
  handle,
13066
13066
  loader,
13067
13067
  children: [
13068
- {
13069
- Component: BillingAddress,
13070
- path: "/draft-orders/:id/billing-address"
13071
- },
13072
13068
  {
13073
13069
  Component: Email,
13074
13070
  path: "/draft-orders/:id/email"
@@ -13085,6 +13081,10 @@ const routeModule = {
13085
13081
  Component: Promotions,
13086
13082
  path: "/draft-orders/:id/promotions"
13087
13083
  },
13084
+ {
13085
+ Component: BillingAddress,
13086
+ path: "/draft-orders/:id/billing-address"
13087
+ },
13088
13088
  {
13089
13089
  Component: SalesChannel,
13090
13090
  path: "/draft-orders/:id/sales-channel"
@@ -13097,13 +13097,13 @@ const routeModule = {
13097
13097
  Component: ShippingAddress,
13098
13098
  path: "/draft-orders/:id/shipping-address"
13099
13099
  },
13100
- {
13101
- Component: TransferOwnership,
13102
- path: "/draft-orders/:id/transfer-ownership"
13103
- },
13104
13100
  {
13105
13101
  Component: CustomItems,
13106
13102
  path: "/draft-orders/:id/custom-items"
13103
+ },
13104
+ {
13105
+ Component: TransferOwnership,
13106
+ path: "/draft-orders/:id/transfer-ownership"
13107
13107
  }
13108
13108
  ]
13109
13109
  }
@@ -9567,196 +9567,6 @@ const ID = () => {
9567
9567
  /* @__PURE__ */ jsx(Outlet, {})
9568
9568
  ] });
9569
9569
  };
9570
- const BillingAddress = () => {
9571
- const { id } = useParams();
9572
- const { order, isPending, isError, error } = useOrder(id, {
9573
- fields: "+billing_address"
9574
- });
9575
- if (isError) {
9576
- throw error;
9577
- }
9578
- const isReady = !isPending && !!order;
9579
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9580
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9581
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9582
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9583
- ] }),
9584
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9585
- ] });
9586
- };
9587
- const BillingAddressForm = ({ order }) => {
9588
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9589
- const form = useForm({
9590
- defaultValues: {
9591
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9592
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9593
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9594
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9595
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9596
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9597
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9598
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9599
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9600
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9601
- },
9602
- resolver: zodResolver(schema$5)
9603
- });
9604
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9605
- const { handleSuccess } = useRouteModal();
9606
- const onSubmit = form.handleSubmit(async (data) => {
9607
- await mutateAsync(
9608
- { billing_address: data },
9609
- {
9610
- onSuccess: () => {
9611
- handleSuccess();
9612
- },
9613
- onError: (error) => {
9614
- toast.error(error.message);
9615
- }
9616
- }
9617
- );
9618
- });
9619
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9620
- KeyboundForm,
9621
- {
9622
- className: "flex flex-1 flex-col overflow-hidden",
9623
- onSubmit,
9624
- children: [
9625
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
9626
- /* @__PURE__ */ jsx(
9627
- Form$2.Field,
9628
- {
9629
- control: form.control,
9630
- name: "country_code",
9631
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9632
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9633
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9634
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9635
- ] })
9636
- }
9637
- ),
9638
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9639
- /* @__PURE__ */ jsx(
9640
- Form$2.Field,
9641
- {
9642
- control: form.control,
9643
- name: "first_name",
9644
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9645
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9646
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9647
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9648
- ] })
9649
- }
9650
- ),
9651
- /* @__PURE__ */ jsx(
9652
- Form$2.Field,
9653
- {
9654
- control: form.control,
9655
- name: "last_name",
9656
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9657
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9658
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9659
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9660
- ] })
9661
- }
9662
- )
9663
- ] }),
9664
- /* @__PURE__ */ jsx(
9665
- Form$2.Field,
9666
- {
9667
- control: form.control,
9668
- name: "company",
9669
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9670
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9671
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9672
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9673
- ] })
9674
- }
9675
- ),
9676
- /* @__PURE__ */ jsx(
9677
- Form$2.Field,
9678
- {
9679
- control: form.control,
9680
- name: "address_1",
9681
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9682
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9683
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9684
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9685
- ] })
9686
- }
9687
- ),
9688
- /* @__PURE__ */ jsx(
9689
- Form$2.Field,
9690
- {
9691
- control: form.control,
9692
- name: "address_2",
9693
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9694
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9695
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9696
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9697
- ] })
9698
- }
9699
- ),
9700
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9701
- /* @__PURE__ */ jsx(
9702
- Form$2.Field,
9703
- {
9704
- control: form.control,
9705
- name: "postal_code",
9706
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9707
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9708
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9709
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9710
- ] })
9711
- }
9712
- ),
9713
- /* @__PURE__ */ jsx(
9714
- Form$2.Field,
9715
- {
9716
- control: form.control,
9717
- name: "city",
9718
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9720
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9721
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
- ] })
9723
- }
9724
- )
9725
- ] }),
9726
- /* @__PURE__ */ jsx(
9727
- Form$2.Field,
9728
- {
9729
- control: form.control,
9730
- name: "province",
9731
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9732
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9733
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9734
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9735
- ] })
9736
- }
9737
- ),
9738
- /* @__PURE__ */ jsx(
9739
- Form$2.Field,
9740
- {
9741
- control: form.control,
9742
- name: "phone",
9743
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9744
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9745
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9746
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9747
- ] })
9748
- }
9749
- )
9750
- ] }) }),
9751
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9752
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9753
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9754
- ] }) })
9755
- ]
9756
- }
9757
- ) });
9758
- };
9759
- const schema$5 = addressSchema;
9760
9570
  const Email = () => {
9761
9571
  const { id } = useParams();
9762
9572
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9779,7 +9589,7 @@ const EmailForm = ({ order }) => {
9779
9589
  defaultValues: {
9780
9590
  email: order.email ?? ""
9781
9591
  },
9782
- resolver: zodResolver(schema$4)
9592
+ resolver: zodResolver(schema$5)
9783
9593
  });
9784
9594
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9785
9595
  const { handleSuccess } = useRouteModal();
@@ -9822,7 +9632,7 @@ const EmailForm = ({ order }) => {
9822
9632
  }
9823
9633
  ) });
9824
9634
  };
9825
- const schema$4 = objectType({
9635
+ const schema$5 = objectType({
9826
9636
  email: stringType().email()
9827
9637
  });
9828
9638
  const NumberInput = forwardRef(
@@ -11426,6 +11236,196 @@ function getPromotionIds(items, shippingMethods) {
11426
11236
  }
11427
11237
  return Array.from(promotionIds);
11428
11238
  }
11239
+ const BillingAddress = () => {
11240
+ const { id } = useParams();
11241
+ const { order, isPending, isError, error } = useOrder(id, {
11242
+ fields: "+billing_address"
11243
+ });
11244
+ if (isError) {
11245
+ throw error;
11246
+ }
11247
+ const isReady = !isPending && !!order;
11248
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11249
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11250
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
11251
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
11252
+ ] }),
11253
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
11254
+ ] });
11255
+ };
11256
+ const BillingAddressForm = ({ order }) => {
11257
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11258
+ const form = useForm({
11259
+ defaultValues: {
11260
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
11261
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
11262
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
11263
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
11264
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
11265
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
11266
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
11267
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
11268
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
11269
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
11270
+ },
11271
+ resolver: zodResolver(schema$4)
11272
+ });
11273
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11274
+ const { handleSuccess } = useRouteModal();
11275
+ const onSubmit = form.handleSubmit(async (data) => {
11276
+ await mutateAsync(
11277
+ { billing_address: data },
11278
+ {
11279
+ onSuccess: () => {
11280
+ handleSuccess();
11281
+ },
11282
+ onError: (error) => {
11283
+ toast.error(error.message);
11284
+ }
11285
+ }
11286
+ );
11287
+ });
11288
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11289
+ KeyboundForm,
11290
+ {
11291
+ className: "flex flex-1 flex-col overflow-hidden",
11292
+ onSubmit,
11293
+ children: [
11294
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
11295
+ /* @__PURE__ */ jsx(
11296
+ Form$2.Field,
11297
+ {
11298
+ control: form.control,
11299
+ name: "country_code",
11300
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11301
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11302
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11303
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11304
+ ] })
11305
+ }
11306
+ ),
11307
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11308
+ /* @__PURE__ */ jsx(
11309
+ Form$2.Field,
11310
+ {
11311
+ control: form.control,
11312
+ name: "first_name",
11313
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11314
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11315
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11316
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11317
+ ] })
11318
+ }
11319
+ ),
11320
+ /* @__PURE__ */ jsx(
11321
+ Form$2.Field,
11322
+ {
11323
+ control: form.control,
11324
+ name: "last_name",
11325
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11326
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11327
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11328
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11329
+ ] })
11330
+ }
11331
+ )
11332
+ ] }),
11333
+ /* @__PURE__ */ jsx(
11334
+ Form$2.Field,
11335
+ {
11336
+ control: form.control,
11337
+ name: "company",
11338
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11339
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11340
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11341
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11342
+ ] })
11343
+ }
11344
+ ),
11345
+ /* @__PURE__ */ jsx(
11346
+ Form$2.Field,
11347
+ {
11348
+ control: form.control,
11349
+ name: "address_1",
11350
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11351
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11352
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11353
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11354
+ ] })
11355
+ }
11356
+ ),
11357
+ /* @__PURE__ */ jsx(
11358
+ Form$2.Field,
11359
+ {
11360
+ control: form.control,
11361
+ name: "address_2",
11362
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11363
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11364
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11365
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11366
+ ] })
11367
+ }
11368
+ ),
11369
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11370
+ /* @__PURE__ */ jsx(
11371
+ Form$2.Field,
11372
+ {
11373
+ control: form.control,
11374
+ name: "postal_code",
11375
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11376
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11377
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11378
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11379
+ ] })
11380
+ }
11381
+ ),
11382
+ /* @__PURE__ */ jsx(
11383
+ Form$2.Field,
11384
+ {
11385
+ control: form.control,
11386
+ name: "city",
11387
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11388
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11389
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11390
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11391
+ ] })
11392
+ }
11393
+ )
11394
+ ] }),
11395
+ /* @__PURE__ */ jsx(
11396
+ Form$2.Field,
11397
+ {
11398
+ control: form.control,
11399
+ name: "province",
11400
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11401
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11402
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11403
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11404
+ ] })
11405
+ }
11406
+ ),
11407
+ /* @__PURE__ */ jsx(
11408
+ Form$2.Field,
11409
+ {
11410
+ control: form.control,
11411
+ name: "phone",
11412
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11413
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11414
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11415
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11416
+ ] })
11417
+ }
11418
+ )
11419
+ ] }) }),
11420
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11421
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11422
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11423
+ ] }) })
11424
+ ]
11425
+ }
11426
+ ) });
11427
+ };
11428
+ const schema$4 = addressSchema;
11429
11429
  const SalesChannel = () => {
11430
11430
  const { id } = useParams();
11431
11431
  const { draft_order, isPending, isError, error } = useDraftOrder(
@@ -12542,6 +12542,27 @@ const ShippingAddressForm = ({ order }) => {
12542
12542
  ) });
12543
12543
  };
12544
12544
  const schema$2 = addressSchema;
12545
+ const CustomItems = () => {
12546
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12547
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
12548
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
12549
+ ] });
12550
+ };
12551
+ const CustomItemsForm = () => {
12552
+ const form = useForm({
12553
+ resolver: zodResolver(schema$1)
12554
+ });
12555
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12556
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
12557
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12558
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12559
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
12560
+ ] }) })
12561
+ ] }) });
12562
+ };
12563
+ const schema$1 = objectType({
12564
+ email: stringType().email()
12565
+ });
12545
12566
  const TransferOwnership = () => {
12546
12567
  const { id } = useParams();
12547
12568
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12565,7 +12586,7 @@ const TransferOwnershipForm = ({ order }) => {
12565
12586
  defaultValues: {
12566
12587
  customer_id: order.customer_id || ""
12567
12588
  },
12568
- resolver: zodResolver(schema$1)
12589
+ resolver: zodResolver(schema)
12569
12590
  });
12570
12591
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12571
12592
  const { handleSuccess } = useRouteModal();
@@ -13015,29 +13036,8 @@ const Illustration = () => {
13015
13036
  }
13016
13037
  );
13017
13038
  };
13018
- const schema$1 = objectType({
13019
- customer_id: stringType().min(1)
13020
- });
13021
- const CustomItems = () => {
13022
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
13023
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13024
- /* @__PURE__ */ jsx(CustomItemsForm, {})
13025
- ] });
13026
- };
13027
- const CustomItemsForm = () => {
13028
- const form = useForm({
13029
- resolver: zodResolver(schema)
13030
- });
13031
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13032
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
13033
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13034
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13035
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
13036
- ] }) })
13037
- ] }) });
13038
- };
13039
13039
  const schema = objectType({
13040
- email: stringType().email()
13040
+ customer_id: stringType().min(1)
13041
13041
  });
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
@@ -13059,10 +13059,6 @@ const routeModule = {
13059
13059
  handle,
13060
13060
  loader,
13061
13061
  children: [
13062
- {
13063
- Component: BillingAddress,
13064
- path: "/draft-orders/:id/billing-address"
13065
- },
13066
13062
  {
13067
13063
  Component: Email,
13068
13064
  path: "/draft-orders/:id/email"
@@ -13079,6 +13075,10 @@ const routeModule = {
13079
13075
  Component: Promotions,
13080
13076
  path: "/draft-orders/:id/promotions"
13081
13077
  },
13078
+ {
13079
+ Component: BillingAddress,
13080
+ path: "/draft-orders/:id/billing-address"
13081
+ },
13082
13082
  {
13083
13083
  Component: SalesChannel,
13084
13084
  path: "/draft-orders/:id/sales-channel"
@@ -13091,13 +13091,13 @@ const routeModule = {
13091
13091
  Component: ShippingAddress,
13092
13092
  path: "/draft-orders/:id/shipping-address"
13093
13093
  },
13094
- {
13095
- Component: TransferOwnership,
13096
- path: "/draft-orders/:id/transfer-ownership"
13097
- },
13098
13094
  {
13099
13095
  Component: CustomItems,
13100
13096
  path: "/draft-orders/:id/custom-items"
13097
+ },
13098
+ {
13099
+ Component: TransferOwnership,
13100
+ path: "/draft-orders/:id/transfer-ownership"
13101
13101
  }
13102
13102
  ]
13103
13103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.4-preview-20250922000330",
3
+ "version": "2.10.4-preview-20250922060202",
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.4-preview-20250922000330",
39
+ "@medusajs/js-sdk": "2.10.4-preview-20250922060202",
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.4-preview-20250922000330",
49
- "@medusajs/cli": "2.10.4-preview-20250922000330",
50
- "@medusajs/framework": "2.10.4-preview-20250922000330",
51
- "@medusajs/icons": "2.10.4-preview-20250922000330",
52
- "@medusajs/test-utils": "2.10.4-preview-20250922000330",
53
- "@medusajs/types": "2.10.4-preview-20250922000330",
54
- "@medusajs/ui": "4.0.24-preview-20250922000330",
55
- "@medusajs/ui-preset": "2.10.4-preview-20250922000330",
48
+ "@medusajs/admin-sdk": "2.10.4-preview-20250922060202",
49
+ "@medusajs/cli": "2.10.4-preview-20250922060202",
50
+ "@medusajs/framework": "2.10.4-preview-20250922060202",
51
+ "@medusajs/icons": "2.10.4-preview-20250922060202",
52
+ "@medusajs/test-utils": "2.10.4-preview-20250922060202",
53
+ "@medusajs/types": "2.10.4-preview-20250922060202",
54
+ "@medusajs/ui": "4.0.24-preview-20250922060202",
55
+ "@medusajs/ui-preset": "2.10.4-preview-20250922060202",
56
56
  "@mikro-orm/cli": "6.5.4",
57
57
  "@mikro-orm/core": "6.5.4",
58
58
  "@mikro-orm/knex": "6.5.4",
@@ -76,12 +76,12 @@
76
76
  "yalc": "^1.0.0-pre.53"
77
77
  },
78
78
  "peerDependencies": {
79
- "@medusajs/admin-sdk": "2.10.4-preview-20250922000330",
80
- "@medusajs/cli": "2.10.4-preview-20250922000330",
81
- "@medusajs/framework": "2.10.4-preview-20250922000330",
82
- "@medusajs/icons": "2.10.4-preview-20250922000330",
83
- "@medusajs/test-utils": "2.10.4-preview-20250922000330",
84
- "@medusajs/ui": "4.0.24-preview-20250922000330",
79
+ "@medusajs/admin-sdk": "2.10.4-preview-20250922060202",
80
+ "@medusajs/cli": "2.10.4-preview-20250922060202",
81
+ "@medusajs/framework": "2.10.4-preview-20250922060202",
82
+ "@medusajs/icons": "2.10.4-preview-20250922060202",
83
+ "@medusajs/test-utils": "2.10.4-preview-20250922060202",
84
+ "@medusajs/ui": "4.0.24-preview-20250922060202",
85
85
  "@mikro-orm/cli": "6.5.4",
86
86
  "@mikro-orm/core": "6.5.4",
87
87
  "@mikro-orm/knex": "6.5.4",