@medusajs/draft-order 2.10.4-preview-20250928210151 → 2.10.4-preview-20250929031655
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.
- package/.medusa/server/src/admin/index.js +210 -210
- package/.medusa/server/src/admin/index.mjs +210 -210
- package/package.json +16 -16
|
@@ -9573,27 +9573,196 @@ const ID = () => {
|
|
|
9573
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9574
9574
|
] });
|
|
9575
9575
|
};
|
|
9576
|
-
const
|
|
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;
|
|
9577
9585
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9578
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9579
|
-
|
|
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 })
|
|
9580
9591
|
] });
|
|
9581
9592
|
};
|
|
9582
|
-
const
|
|
9593
|
+
const BillingAddressForm = ({ order }) => {
|
|
9594
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9583
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
|
+
},
|
|
9584
9608
|
resolver: zod.zodResolver(schema$5)
|
|
9585
9609
|
});
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
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
|
+
) });
|
|
9593
9764
|
};
|
|
9594
|
-
const schema$5 =
|
|
9595
|
-
email: stringType().email()
|
|
9596
|
-
});
|
|
9765
|
+
const schema$5 = addressSchema;
|
|
9597
9766
|
const Email = () => {
|
|
9598
9767
|
const { id } = reactRouterDom.useParams();
|
|
9599
9768
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9662,6 +9831,27 @@ const EmailForm = ({ order }) => {
|
|
|
9662
9831
|
const schema$4 = objectType({
|
|
9663
9832
|
email: stringType().email()
|
|
9664
9833
|
});
|
|
9834
|
+
const CustomItems = () => {
|
|
9835
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9836
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9837
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9838
|
+
] });
|
|
9839
|
+
};
|
|
9840
|
+
const CustomItemsForm = () => {
|
|
9841
|
+
const form = reactHookForm.useForm({
|
|
9842
|
+
resolver: zod.zodResolver(schema$3)
|
|
9843
|
+
});
|
|
9844
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9845
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9846
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9847
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9848
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9849
|
+
] }) })
|
|
9850
|
+
] }) });
|
|
9851
|
+
};
|
|
9852
|
+
const schema$3 = objectType({
|
|
9853
|
+
email: stringType().email()
|
|
9854
|
+
});
|
|
9665
9855
|
const NumberInput = React.forwardRef(
|
|
9666
9856
|
({
|
|
9667
9857
|
value,
|
|
@@ -11263,196 +11453,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11263
11453
|
}
|
|
11264
11454
|
return Array.from(promotionIds);
|
|
11265
11455
|
}
|
|
11266
|
-
const BillingAddress = () => {
|
|
11267
|
-
const { id } = reactRouterDom.useParams();
|
|
11268
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11269
|
-
fields: "+billing_address"
|
|
11270
|
-
});
|
|
11271
|
-
if (isError) {
|
|
11272
|
-
throw error;
|
|
11273
|
-
}
|
|
11274
|
-
const isReady = !isPending && !!order;
|
|
11275
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11276
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11277
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
11278
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11279
|
-
] }),
|
|
11280
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
11281
|
-
] });
|
|
11282
|
-
};
|
|
11283
|
-
const BillingAddressForm = ({ order }) => {
|
|
11284
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11285
|
-
const form = reactHookForm.useForm({
|
|
11286
|
-
defaultValues: {
|
|
11287
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11288
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11289
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11290
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11291
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11292
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11293
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11294
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11295
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11296
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11297
|
-
},
|
|
11298
|
-
resolver: zod.zodResolver(schema$3)
|
|
11299
|
-
});
|
|
11300
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11301
|
-
const { handleSuccess } = useRouteModal();
|
|
11302
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11303
|
-
await mutateAsync(
|
|
11304
|
-
{ billing_address: data },
|
|
11305
|
-
{
|
|
11306
|
-
onSuccess: () => {
|
|
11307
|
-
handleSuccess();
|
|
11308
|
-
},
|
|
11309
|
-
onError: (error) => {
|
|
11310
|
-
ui.toast.error(error.message);
|
|
11311
|
-
}
|
|
11312
|
-
}
|
|
11313
|
-
);
|
|
11314
|
-
});
|
|
11315
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11316
|
-
KeyboundForm,
|
|
11317
|
-
{
|
|
11318
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11319
|
-
onSubmit,
|
|
11320
|
-
children: [
|
|
11321
|
-
/* @__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: [
|
|
11322
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11323
|
-
Form$2.Field,
|
|
11324
|
-
{
|
|
11325
|
-
control: form.control,
|
|
11326
|
-
name: "country_code",
|
|
11327
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11328
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11329
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11330
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11331
|
-
] })
|
|
11332
|
-
}
|
|
11333
|
-
),
|
|
11334
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11335
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11336
|
-
Form$2.Field,
|
|
11337
|
-
{
|
|
11338
|
-
control: form.control,
|
|
11339
|
-
name: "first_name",
|
|
11340
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11341
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11342
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11343
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11344
|
-
] })
|
|
11345
|
-
}
|
|
11346
|
-
),
|
|
11347
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11348
|
-
Form$2.Field,
|
|
11349
|
-
{
|
|
11350
|
-
control: form.control,
|
|
11351
|
-
name: "last_name",
|
|
11352
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11353
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11354
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11355
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11356
|
-
] })
|
|
11357
|
-
}
|
|
11358
|
-
)
|
|
11359
|
-
] }),
|
|
11360
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11361
|
-
Form$2.Field,
|
|
11362
|
-
{
|
|
11363
|
-
control: form.control,
|
|
11364
|
-
name: "company",
|
|
11365
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11366
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11367
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11368
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11369
|
-
] })
|
|
11370
|
-
}
|
|
11371
|
-
),
|
|
11372
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11373
|
-
Form$2.Field,
|
|
11374
|
-
{
|
|
11375
|
-
control: form.control,
|
|
11376
|
-
name: "address_1",
|
|
11377
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11378
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11379
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11380
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11381
|
-
] })
|
|
11382
|
-
}
|
|
11383
|
-
),
|
|
11384
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11385
|
-
Form$2.Field,
|
|
11386
|
-
{
|
|
11387
|
-
control: form.control,
|
|
11388
|
-
name: "address_2",
|
|
11389
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11390
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11391
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11392
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11393
|
-
] })
|
|
11394
|
-
}
|
|
11395
|
-
),
|
|
11396
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11397
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11398
|
-
Form$2.Field,
|
|
11399
|
-
{
|
|
11400
|
-
control: form.control,
|
|
11401
|
-
name: "postal_code",
|
|
11402
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11403
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11404
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11405
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11406
|
-
] })
|
|
11407
|
-
}
|
|
11408
|
-
),
|
|
11409
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11410
|
-
Form$2.Field,
|
|
11411
|
-
{
|
|
11412
|
-
control: form.control,
|
|
11413
|
-
name: "city",
|
|
11414
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11415
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11416
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11417
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11418
|
-
] })
|
|
11419
|
-
}
|
|
11420
|
-
)
|
|
11421
|
-
] }),
|
|
11422
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11423
|
-
Form$2.Field,
|
|
11424
|
-
{
|
|
11425
|
-
control: form.control,
|
|
11426
|
-
name: "province",
|
|
11427
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11428
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11429
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11430
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11431
|
-
] })
|
|
11432
|
-
}
|
|
11433
|
-
),
|
|
11434
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11435
|
-
Form$2.Field,
|
|
11436
|
-
{
|
|
11437
|
-
control: form.control,
|
|
11438
|
-
name: "phone",
|
|
11439
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11440
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11441
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11442
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11443
|
-
] })
|
|
11444
|
-
}
|
|
11445
|
-
)
|
|
11446
|
-
] }) }),
|
|
11447
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11448
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11449
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11450
|
-
] }) })
|
|
11451
|
-
]
|
|
11452
|
-
}
|
|
11453
|
-
) });
|
|
11454
|
-
};
|
|
11455
|
-
const schema$3 = addressSchema;
|
|
11456
11456
|
const SalesChannel = () => {
|
|
11457
11457
|
const { id } = reactRouterDom.useParams();
|
|
11458
11458
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13066,13 +13066,17 @@ const routeModule = {
|
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
13068
|
{
|
|
13069
|
-
Component:
|
|
13070
|
-
path: "/draft-orders/:id/
|
|
13069
|
+
Component: BillingAddress,
|
|
13070
|
+
path: "/draft-orders/:id/billing-address"
|
|
13071
13071
|
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Email,
|
|
13074
13074
|
path: "/draft-orders/:id/email"
|
|
13075
13075
|
},
|
|
13076
|
+
{
|
|
13077
|
+
Component: CustomItems,
|
|
13078
|
+
path: "/draft-orders/:id/custom-items"
|
|
13079
|
+
},
|
|
13076
13080
|
{
|
|
13077
13081
|
Component: Items,
|
|
13078
13082
|
path: "/draft-orders/:id/items"
|
|
@@ -13085,10 +13089,6 @@ const routeModule = {
|
|
|
13085
13089
|
Component: Promotions,
|
|
13086
13090
|
path: "/draft-orders/:id/promotions"
|
|
13087
13091
|
},
|
|
13088
|
-
{
|
|
13089
|
-
Component: BillingAddress,
|
|
13090
|
-
path: "/draft-orders/:id/billing-address"
|
|
13091
|
-
},
|
|
13092
13092
|
{
|
|
13093
13093
|
Component: SalesChannel,
|
|
13094
13094
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -9567,27 +9567,196 @@ const ID = () => {
|
|
|
9567
9567
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9568
9568
|
] });
|
|
9569
9569
|
};
|
|
9570
|
-
const
|
|
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;
|
|
9571
9579
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9572
|
-
/* @__PURE__ */
|
|
9573
|
-
|
|
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 })
|
|
9574
9585
|
] });
|
|
9575
9586
|
};
|
|
9576
|
-
const
|
|
9587
|
+
const BillingAddressForm = ({ order }) => {
|
|
9588
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9577
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
|
+
},
|
|
9578
9602
|
resolver: zodResolver(schema$5)
|
|
9579
9603
|
});
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
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
|
+
) });
|
|
9587
9758
|
};
|
|
9588
|
-
const schema$5 =
|
|
9589
|
-
email: stringType().email()
|
|
9590
|
-
});
|
|
9759
|
+
const schema$5 = addressSchema;
|
|
9591
9760
|
const Email = () => {
|
|
9592
9761
|
const { id } = useParams();
|
|
9593
9762
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9656,6 +9825,27 @@ const EmailForm = ({ order }) => {
|
|
|
9656
9825
|
const schema$4 = objectType({
|
|
9657
9826
|
email: stringType().email()
|
|
9658
9827
|
});
|
|
9828
|
+
const CustomItems = () => {
|
|
9829
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9830
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9831
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9832
|
+
] });
|
|
9833
|
+
};
|
|
9834
|
+
const CustomItemsForm = () => {
|
|
9835
|
+
const form = useForm({
|
|
9836
|
+
resolver: zodResolver(schema$3)
|
|
9837
|
+
});
|
|
9838
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9839
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9840
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9841
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9842
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9843
|
+
] }) })
|
|
9844
|
+
] }) });
|
|
9845
|
+
};
|
|
9846
|
+
const schema$3 = objectType({
|
|
9847
|
+
email: stringType().email()
|
|
9848
|
+
});
|
|
9659
9849
|
const NumberInput = forwardRef(
|
|
9660
9850
|
({
|
|
9661
9851
|
value,
|
|
@@ -11257,196 +11447,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11257
11447
|
}
|
|
11258
11448
|
return Array.from(promotionIds);
|
|
11259
11449
|
}
|
|
11260
|
-
const BillingAddress = () => {
|
|
11261
|
-
const { id } = useParams();
|
|
11262
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11263
|
-
fields: "+billing_address"
|
|
11264
|
-
});
|
|
11265
|
-
if (isError) {
|
|
11266
|
-
throw error;
|
|
11267
|
-
}
|
|
11268
|
-
const isReady = !isPending && !!order;
|
|
11269
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11270
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11271
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
11272
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11273
|
-
] }),
|
|
11274
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
11275
|
-
] });
|
|
11276
|
-
};
|
|
11277
|
-
const BillingAddressForm = ({ order }) => {
|
|
11278
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11279
|
-
const form = useForm({
|
|
11280
|
-
defaultValues: {
|
|
11281
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11282
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11283
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11284
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11285
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11286
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11287
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11288
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11289
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11290
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11291
|
-
},
|
|
11292
|
-
resolver: zodResolver(schema$3)
|
|
11293
|
-
});
|
|
11294
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11295
|
-
const { handleSuccess } = useRouteModal();
|
|
11296
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11297
|
-
await mutateAsync(
|
|
11298
|
-
{ billing_address: data },
|
|
11299
|
-
{
|
|
11300
|
-
onSuccess: () => {
|
|
11301
|
-
handleSuccess();
|
|
11302
|
-
},
|
|
11303
|
-
onError: (error) => {
|
|
11304
|
-
toast.error(error.message);
|
|
11305
|
-
}
|
|
11306
|
-
}
|
|
11307
|
-
);
|
|
11308
|
-
});
|
|
11309
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11310
|
-
KeyboundForm,
|
|
11311
|
-
{
|
|
11312
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11313
|
-
onSubmit,
|
|
11314
|
-
children: [
|
|
11315
|
-
/* @__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: [
|
|
11316
|
-
/* @__PURE__ */ jsx(
|
|
11317
|
-
Form$2.Field,
|
|
11318
|
-
{
|
|
11319
|
-
control: form.control,
|
|
11320
|
-
name: "country_code",
|
|
11321
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11322
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11323
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11324
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11325
|
-
] })
|
|
11326
|
-
}
|
|
11327
|
-
),
|
|
11328
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11329
|
-
/* @__PURE__ */ jsx(
|
|
11330
|
-
Form$2.Field,
|
|
11331
|
-
{
|
|
11332
|
-
control: form.control,
|
|
11333
|
-
name: "first_name",
|
|
11334
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11335
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11336
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11337
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11338
|
-
] })
|
|
11339
|
-
}
|
|
11340
|
-
),
|
|
11341
|
-
/* @__PURE__ */ jsx(
|
|
11342
|
-
Form$2.Field,
|
|
11343
|
-
{
|
|
11344
|
-
control: form.control,
|
|
11345
|
-
name: "last_name",
|
|
11346
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11347
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11348
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11349
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11350
|
-
] })
|
|
11351
|
-
}
|
|
11352
|
-
)
|
|
11353
|
-
] }),
|
|
11354
|
-
/* @__PURE__ */ jsx(
|
|
11355
|
-
Form$2.Field,
|
|
11356
|
-
{
|
|
11357
|
-
control: form.control,
|
|
11358
|
-
name: "company",
|
|
11359
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11360
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11361
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11362
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11363
|
-
] })
|
|
11364
|
-
}
|
|
11365
|
-
),
|
|
11366
|
-
/* @__PURE__ */ jsx(
|
|
11367
|
-
Form$2.Field,
|
|
11368
|
-
{
|
|
11369
|
-
control: form.control,
|
|
11370
|
-
name: "address_1",
|
|
11371
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11372
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11373
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11374
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11375
|
-
] })
|
|
11376
|
-
}
|
|
11377
|
-
),
|
|
11378
|
-
/* @__PURE__ */ jsx(
|
|
11379
|
-
Form$2.Field,
|
|
11380
|
-
{
|
|
11381
|
-
control: form.control,
|
|
11382
|
-
name: "address_2",
|
|
11383
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11384
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11385
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11386
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11387
|
-
] })
|
|
11388
|
-
}
|
|
11389
|
-
),
|
|
11390
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11391
|
-
/* @__PURE__ */ jsx(
|
|
11392
|
-
Form$2.Field,
|
|
11393
|
-
{
|
|
11394
|
-
control: form.control,
|
|
11395
|
-
name: "postal_code",
|
|
11396
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11397
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11398
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11399
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11400
|
-
] })
|
|
11401
|
-
}
|
|
11402
|
-
),
|
|
11403
|
-
/* @__PURE__ */ jsx(
|
|
11404
|
-
Form$2.Field,
|
|
11405
|
-
{
|
|
11406
|
-
control: form.control,
|
|
11407
|
-
name: "city",
|
|
11408
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11409
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11410
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11411
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11412
|
-
] })
|
|
11413
|
-
}
|
|
11414
|
-
)
|
|
11415
|
-
] }),
|
|
11416
|
-
/* @__PURE__ */ jsx(
|
|
11417
|
-
Form$2.Field,
|
|
11418
|
-
{
|
|
11419
|
-
control: form.control,
|
|
11420
|
-
name: "province",
|
|
11421
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11422
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11423
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11424
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11425
|
-
] })
|
|
11426
|
-
}
|
|
11427
|
-
),
|
|
11428
|
-
/* @__PURE__ */ jsx(
|
|
11429
|
-
Form$2.Field,
|
|
11430
|
-
{
|
|
11431
|
-
control: form.control,
|
|
11432
|
-
name: "phone",
|
|
11433
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11434
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11435
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11436
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11437
|
-
] })
|
|
11438
|
-
}
|
|
11439
|
-
)
|
|
11440
|
-
] }) }),
|
|
11441
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11442
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11443
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11444
|
-
] }) })
|
|
11445
|
-
]
|
|
11446
|
-
}
|
|
11447
|
-
) });
|
|
11448
|
-
};
|
|
11449
|
-
const schema$3 = addressSchema;
|
|
11450
11450
|
const SalesChannel = () => {
|
|
11451
11451
|
const { id } = useParams();
|
|
11452
11452
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13060,13 +13060,17 @@ const routeModule = {
|
|
|
13060
13060
|
loader,
|
|
13061
13061
|
children: [
|
|
13062
13062
|
{
|
|
13063
|
-
Component:
|
|
13064
|
-
path: "/draft-orders/:id/
|
|
13063
|
+
Component: BillingAddress,
|
|
13064
|
+
path: "/draft-orders/:id/billing-address"
|
|
13065
13065
|
},
|
|
13066
13066
|
{
|
|
13067
13067
|
Component: Email,
|
|
13068
13068
|
path: "/draft-orders/:id/email"
|
|
13069
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: CustomItems,
|
|
13072
|
+
path: "/draft-orders/:id/custom-items"
|
|
13073
|
+
},
|
|
13070
13074
|
{
|
|
13071
13075
|
Component: Items,
|
|
13072
13076
|
path: "/draft-orders/:id/items"
|
|
@@ -13079,10 +13083,6 @@ const routeModule = {
|
|
|
13079
13083
|
Component: Promotions,
|
|
13080
13084
|
path: "/draft-orders/:id/promotions"
|
|
13081
13085
|
},
|
|
13082
|
-
{
|
|
13083
|
-
Component: BillingAddress,
|
|
13084
|
-
path: "/draft-orders/:id/billing-address"
|
|
13085
|
-
},
|
|
13086
13086
|
{
|
|
13087
13087
|
Component: SalesChannel,
|
|
13088
13088
|
path: "/draft-orders/:id/sales-channel"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.4-preview-
|
|
3
|
+
"version": "2.10.4-preview-20250929031655",
|
|
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-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.4-preview-20250929031655",
|
|
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-
|
|
49
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
53
|
-
"@medusajs/types": "2.10.4-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.4-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20250929031655",
|
|
49
|
+
"@medusajs/cli": "2.10.4-preview-20250929031655",
|
|
50
|
+
"@medusajs/framework": "2.10.4-preview-20250929031655",
|
|
51
|
+
"@medusajs/icons": "2.10.4-preview-20250929031655",
|
|
52
|
+
"@medusajs/test-utils": "2.10.4-preview-20250929031655",
|
|
53
|
+
"@medusajs/types": "2.10.4-preview-20250929031655",
|
|
54
|
+
"@medusajs/ui": "4.0.24-preview-20250929031655",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.4-preview-20250929031655",
|
|
56
56
|
"@swc/core": "1.5.7",
|
|
57
57
|
"@types/lodash": "^4.17.15",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"yalc": "^1.0.0-pre.53"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@medusajs/admin-sdk": "2.10.4-preview-
|
|
73
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
74
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
75
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20250929031655",
|
|
73
|
+
"@medusajs/cli": "2.10.4-preview-20250929031655",
|
|
74
|
+
"@medusajs/framework": "2.10.4-preview-20250929031655",
|
|
75
|
+
"@medusajs/icons": "2.10.4-preview-20250929031655",
|
|
76
|
+
"@medusajs/test-utils": "2.10.4-preview-20250929031655",
|
|
77
|
+
"@medusajs/ui": "4.0.24-preview-20250929031655",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|