@medusajs/draft-order 2.10.4-preview-20250925000313 → 2.10.4-preview-20250925060158
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 +317 -317
- package/.medusa/server/src/admin/index.mjs +317 -317
- package/package.json +16 -16
|
@@ -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 CustomItems = () => {
|
|
9761
9571
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9762
9572
|
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9765,7 +9575,7 @@ const CustomItems = () => {
|
|
|
9765
9575
|
};
|
|
9766
9576
|
const CustomItemsForm = () => {
|
|
9767
9577
|
const form = useForm({
|
|
9768
|
-
resolver: zodResolver(schema$
|
|
9578
|
+
resolver: zodResolver(schema$5)
|
|
9769
9579
|
});
|
|
9770
9580
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9771
9581
|
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
@@ -9775,7 +9585,7 @@ const CustomItemsForm = () => {
|
|
|
9775
9585
|
] }) })
|
|
9776
9586
|
] }) });
|
|
9777
9587
|
};
|
|
9778
|
-
const schema$
|
|
9588
|
+
const schema$5 = objectType({
|
|
9779
9589
|
email: stringType().email()
|
|
9780
9590
|
});
|
|
9781
9591
|
const Email = () => {
|
|
@@ -9800,7 +9610,7 @@ const EmailForm = ({ order }) => {
|
|
|
9800
9610
|
defaultValues: {
|
|
9801
9611
|
email: order.email ?? ""
|
|
9802
9612
|
},
|
|
9803
|
-
resolver: zodResolver(schema$
|
|
9613
|
+
resolver: zodResolver(schema$4)
|
|
9804
9614
|
});
|
|
9805
9615
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9806
9616
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9843,7 +9653,7 @@ const EmailForm = ({ order }) => {
|
|
|
9843
9653
|
}
|
|
9844
9654
|
) });
|
|
9845
9655
|
};
|
|
9846
|
-
const schema$
|
|
9656
|
+
const schema$4 = objectType({
|
|
9847
9657
|
email: stringType().email()
|
|
9848
9658
|
});
|
|
9849
9659
|
const NumberInput = forwardRef(
|
|
@@ -10815,11 +10625,201 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
|
|
|
10815
10625
|
] }) })
|
|
10816
10626
|
] }) }) });
|
|
10817
10627
|
};
|
|
10818
|
-
const customItemSchema = objectType({
|
|
10819
|
-
title: stringType().min(1),
|
|
10820
|
-
quantity: numberType(),
|
|
10821
|
-
unit_price: unionType([numberType(), stringType()])
|
|
10822
|
-
});
|
|
10628
|
+
const customItemSchema = objectType({
|
|
10629
|
+
title: stringType().min(1),
|
|
10630
|
+
quantity: numberType(),
|
|
10631
|
+
unit_price: unionType([numberType(), stringType()])
|
|
10632
|
+
});
|
|
10633
|
+
const BillingAddress = () => {
|
|
10634
|
+
const { id } = useParams();
|
|
10635
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10636
|
+
fields: "+billing_address"
|
|
10637
|
+
});
|
|
10638
|
+
if (isError) {
|
|
10639
|
+
throw error;
|
|
10640
|
+
}
|
|
10641
|
+
const isReady = !isPending && !!order;
|
|
10642
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10643
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10644
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
10645
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
10646
|
+
] }),
|
|
10647
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
10648
|
+
] });
|
|
10649
|
+
};
|
|
10650
|
+
const BillingAddressForm = ({ order }) => {
|
|
10651
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
10652
|
+
const form = useForm({
|
|
10653
|
+
defaultValues: {
|
|
10654
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
10655
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
10656
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
10657
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
10658
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
10659
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
10660
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
10661
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
10662
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
10663
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
10664
|
+
},
|
|
10665
|
+
resolver: zodResolver(schema$3)
|
|
10666
|
+
});
|
|
10667
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10668
|
+
const { handleSuccess } = useRouteModal();
|
|
10669
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10670
|
+
await mutateAsync(
|
|
10671
|
+
{ billing_address: data },
|
|
10672
|
+
{
|
|
10673
|
+
onSuccess: () => {
|
|
10674
|
+
handleSuccess();
|
|
10675
|
+
},
|
|
10676
|
+
onError: (error) => {
|
|
10677
|
+
toast.error(error.message);
|
|
10678
|
+
}
|
|
10679
|
+
}
|
|
10680
|
+
);
|
|
10681
|
+
});
|
|
10682
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10683
|
+
KeyboundForm,
|
|
10684
|
+
{
|
|
10685
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10686
|
+
onSubmit,
|
|
10687
|
+
children: [
|
|
10688
|
+
/* @__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: [
|
|
10689
|
+
/* @__PURE__ */ jsx(
|
|
10690
|
+
Form$2.Field,
|
|
10691
|
+
{
|
|
10692
|
+
control: form.control,
|
|
10693
|
+
name: "country_code",
|
|
10694
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10695
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
10696
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
10697
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10698
|
+
] })
|
|
10699
|
+
}
|
|
10700
|
+
),
|
|
10701
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10702
|
+
/* @__PURE__ */ jsx(
|
|
10703
|
+
Form$2.Field,
|
|
10704
|
+
{
|
|
10705
|
+
control: form.control,
|
|
10706
|
+
name: "first_name",
|
|
10707
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10708
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
10709
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10710
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10711
|
+
] })
|
|
10712
|
+
}
|
|
10713
|
+
),
|
|
10714
|
+
/* @__PURE__ */ jsx(
|
|
10715
|
+
Form$2.Field,
|
|
10716
|
+
{
|
|
10717
|
+
control: form.control,
|
|
10718
|
+
name: "last_name",
|
|
10719
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10720
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
10721
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10722
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10723
|
+
] })
|
|
10724
|
+
}
|
|
10725
|
+
)
|
|
10726
|
+
] }),
|
|
10727
|
+
/* @__PURE__ */ jsx(
|
|
10728
|
+
Form$2.Field,
|
|
10729
|
+
{
|
|
10730
|
+
control: form.control,
|
|
10731
|
+
name: "company",
|
|
10732
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10733
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
10734
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10735
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10736
|
+
] })
|
|
10737
|
+
}
|
|
10738
|
+
),
|
|
10739
|
+
/* @__PURE__ */ jsx(
|
|
10740
|
+
Form$2.Field,
|
|
10741
|
+
{
|
|
10742
|
+
control: form.control,
|
|
10743
|
+
name: "address_1",
|
|
10744
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10745
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
10746
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10747
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10748
|
+
] })
|
|
10749
|
+
}
|
|
10750
|
+
),
|
|
10751
|
+
/* @__PURE__ */ jsx(
|
|
10752
|
+
Form$2.Field,
|
|
10753
|
+
{
|
|
10754
|
+
control: form.control,
|
|
10755
|
+
name: "address_2",
|
|
10756
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10757
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10758
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10759
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10760
|
+
] })
|
|
10761
|
+
}
|
|
10762
|
+
),
|
|
10763
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10764
|
+
/* @__PURE__ */ jsx(
|
|
10765
|
+
Form$2.Field,
|
|
10766
|
+
{
|
|
10767
|
+
control: form.control,
|
|
10768
|
+
name: "postal_code",
|
|
10769
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10770
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
10771
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10772
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10773
|
+
] })
|
|
10774
|
+
}
|
|
10775
|
+
),
|
|
10776
|
+
/* @__PURE__ */ jsx(
|
|
10777
|
+
Form$2.Field,
|
|
10778
|
+
{
|
|
10779
|
+
control: form.control,
|
|
10780
|
+
name: "city",
|
|
10781
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10782
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
10783
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10784
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10785
|
+
] })
|
|
10786
|
+
}
|
|
10787
|
+
)
|
|
10788
|
+
] }),
|
|
10789
|
+
/* @__PURE__ */ jsx(
|
|
10790
|
+
Form$2.Field,
|
|
10791
|
+
{
|
|
10792
|
+
control: form.control,
|
|
10793
|
+
name: "province",
|
|
10794
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10795
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10796
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10797
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10798
|
+
] })
|
|
10799
|
+
}
|
|
10800
|
+
),
|
|
10801
|
+
/* @__PURE__ */ jsx(
|
|
10802
|
+
Form$2.Field,
|
|
10803
|
+
{
|
|
10804
|
+
control: form.control,
|
|
10805
|
+
name: "phone",
|
|
10806
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10807
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
10808
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10809
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10810
|
+
] })
|
|
10811
|
+
}
|
|
10812
|
+
)
|
|
10813
|
+
] }) }),
|
|
10814
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10815
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10816
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10817
|
+
] }) })
|
|
10818
|
+
]
|
|
10819
|
+
}
|
|
10820
|
+
) });
|
|
10821
|
+
};
|
|
10822
|
+
const schema$3 = addressSchema;
|
|
10823
10823
|
const InlineTip = forwardRef(
|
|
10824
10824
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10825
10825
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11447,6 +11447,112 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11447
11447
|
}
|
|
11448
11448
|
return Array.from(promotionIds);
|
|
11449
11449
|
}
|
|
11450
|
+
const SalesChannel = () => {
|
|
11451
|
+
const { id } = useParams();
|
|
11452
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11453
|
+
id,
|
|
11454
|
+
{
|
|
11455
|
+
fields: "+sales_channel_id"
|
|
11456
|
+
},
|
|
11457
|
+
{
|
|
11458
|
+
enabled: !!id
|
|
11459
|
+
}
|
|
11460
|
+
);
|
|
11461
|
+
if (isError) {
|
|
11462
|
+
throw error;
|
|
11463
|
+
}
|
|
11464
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11465
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11466
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11467
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11468
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11469
|
+
] }),
|
|
11470
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11471
|
+
] });
|
|
11472
|
+
};
|
|
11473
|
+
const SalesChannelForm = ({ order }) => {
|
|
11474
|
+
const form = useForm({
|
|
11475
|
+
defaultValues: {
|
|
11476
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11477
|
+
},
|
|
11478
|
+
resolver: zodResolver(schema$2)
|
|
11479
|
+
});
|
|
11480
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11481
|
+
const { handleSuccess } = useRouteModal();
|
|
11482
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11483
|
+
await mutateAsync(
|
|
11484
|
+
{
|
|
11485
|
+
sales_channel_id: data.sales_channel_id
|
|
11486
|
+
},
|
|
11487
|
+
{
|
|
11488
|
+
onSuccess: () => {
|
|
11489
|
+
toast.success("Sales channel updated");
|
|
11490
|
+
handleSuccess();
|
|
11491
|
+
},
|
|
11492
|
+
onError: (error) => {
|
|
11493
|
+
toast.error(error.message);
|
|
11494
|
+
}
|
|
11495
|
+
}
|
|
11496
|
+
);
|
|
11497
|
+
});
|
|
11498
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11499
|
+
KeyboundForm,
|
|
11500
|
+
{
|
|
11501
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11502
|
+
onSubmit,
|
|
11503
|
+
children: [
|
|
11504
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11505
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11506
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11507
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11508
|
+
] }) })
|
|
11509
|
+
]
|
|
11510
|
+
}
|
|
11511
|
+
) });
|
|
11512
|
+
};
|
|
11513
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11514
|
+
const salesChannels = useComboboxData({
|
|
11515
|
+
queryFn: async (params) => {
|
|
11516
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11517
|
+
},
|
|
11518
|
+
queryKey: ["sales-channels"],
|
|
11519
|
+
getOptions: (data) => {
|
|
11520
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11521
|
+
label: salesChannel.name,
|
|
11522
|
+
value: salesChannel.id
|
|
11523
|
+
}));
|
|
11524
|
+
},
|
|
11525
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11526
|
+
});
|
|
11527
|
+
return /* @__PURE__ */ jsx(
|
|
11528
|
+
Form$2.Field,
|
|
11529
|
+
{
|
|
11530
|
+
control,
|
|
11531
|
+
name: "sales_channel_id",
|
|
11532
|
+
render: ({ field }) => {
|
|
11533
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11534
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11535
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11536
|
+
Combobox,
|
|
11537
|
+
{
|
|
11538
|
+
options: salesChannels.options,
|
|
11539
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11540
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11541
|
+
searchValue: salesChannels.searchValue,
|
|
11542
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11543
|
+
placeholder: "Select sales channel",
|
|
11544
|
+
...field
|
|
11545
|
+
}
|
|
11546
|
+
) }),
|
|
11547
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11548
|
+
] });
|
|
11549
|
+
}
|
|
11550
|
+
}
|
|
11551
|
+
);
|
|
11552
|
+
};
|
|
11553
|
+
const schema$2 = objectType({
|
|
11554
|
+
sales_channel_id: stringType().min(1)
|
|
11555
|
+
});
|
|
11450
11556
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11451
11557
|
const Shipping = () => {
|
|
11452
11558
|
var _a;
|
|
@@ -12286,7 +12392,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12286
12392
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12287
12393
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12288
12394
|
},
|
|
12289
|
-
resolver: zodResolver(schema$
|
|
12395
|
+
resolver: zodResolver(schema$1)
|
|
12290
12396
|
});
|
|
12291
12397
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12292
12398
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12456,7 +12562,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12456
12562
|
}
|
|
12457
12563
|
) });
|
|
12458
12564
|
};
|
|
12459
|
-
const schema$
|
|
12565
|
+
const schema$1 = addressSchema;
|
|
12460
12566
|
const TransferOwnership = () => {
|
|
12461
12567
|
const { id } = useParams();
|
|
12462
12568
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12480,7 +12586,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12480
12586
|
defaultValues: {
|
|
12481
12587
|
customer_id: order.customer_id || ""
|
|
12482
12588
|
},
|
|
12483
|
-
resolver: zodResolver(schema
|
|
12589
|
+
resolver: zodResolver(schema)
|
|
12484
12590
|
});
|
|
12485
12591
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12486
12592
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12930,114 +13036,8 @@ const Illustration = () => {
|
|
|
12930
13036
|
}
|
|
12931
13037
|
);
|
|
12932
13038
|
};
|
|
12933
|
-
const schema$1 = objectType({
|
|
12934
|
-
customer_id: stringType().min(1)
|
|
12935
|
-
});
|
|
12936
|
-
const SalesChannel = () => {
|
|
12937
|
-
const { id } = useParams();
|
|
12938
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12939
|
-
id,
|
|
12940
|
-
{
|
|
12941
|
-
fields: "+sales_channel_id"
|
|
12942
|
-
},
|
|
12943
|
-
{
|
|
12944
|
-
enabled: !!id
|
|
12945
|
-
}
|
|
12946
|
-
);
|
|
12947
|
-
if (isError) {
|
|
12948
|
-
throw error;
|
|
12949
|
-
}
|
|
12950
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12951
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12952
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12953
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12954
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12955
|
-
] }),
|
|
12956
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12957
|
-
] });
|
|
12958
|
-
};
|
|
12959
|
-
const SalesChannelForm = ({ order }) => {
|
|
12960
|
-
const form = useForm({
|
|
12961
|
-
defaultValues: {
|
|
12962
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12963
|
-
},
|
|
12964
|
-
resolver: zodResolver(schema)
|
|
12965
|
-
});
|
|
12966
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12967
|
-
const { handleSuccess } = useRouteModal();
|
|
12968
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12969
|
-
await mutateAsync(
|
|
12970
|
-
{
|
|
12971
|
-
sales_channel_id: data.sales_channel_id
|
|
12972
|
-
},
|
|
12973
|
-
{
|
|
12974
|
-
onSuccess: () => {
|
|
12975
|
-
toast.success("Sales channel updated");
|
|
12976
|
-
handleSuccess();
|
|
12977
|
-
},
|
|
12978
|
-
onError: (error) => {
|
|
12979
|
-
toast.error(error.message);
|
|
12980
|
-
}
|
|
12981
|
-
}
|
|
12982
|
-
);
|
|
12983
|
-
});
|
|
12984
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12985
|
-
KeyboundForm,
|
|
12986
|
-
{
|
|
12987
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12988
|
-
onSubmit,
|
|
12989
|
-
children: [
|
|
12990
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12991
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12992
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12993
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12994
|
-
] }) })
|
|
12995
|
-
]
|
|
12996
|
-
}
|
|
12997
|
-
) });
|
|
12998
|
-
};
|
|
12999
|
-
const SalesChannelField = ({ control, order }) => {
|
|
13000
|
-
const salesChannels = useComboboxData({
|
|
13001
|
-
queryFn: async (params) => {
|
|
13002
|
-
return await sdk.admin.salesChannel.list(params);
|
|
13003
|
-
},
|
|
13004
|
-
queryKey: ["sales-channels"],
|
|
13005
|
-
getOptions: (data) => {
|
|
13006
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
13007
|
-
label: salesChannel.name,
|
|
13008
|
-
value: salesChannel.id
|
|
13009
|
-
}));
|
|
13010
|
-
},
|
|
13011
|
-
defaultValue: order.sales_channel_id || void 0
|
|
13012
|
-
});
|
|
13013
|
-
return /* @__PURE__ */ jsx(
|
|
13014
|
-
Form$2.Field,
|
|
13015
|
-
{
|
|
13016
|
-
control,
|
|
13017
|
-
name: "sales_channel_id",
|
|
13018
|
-
render: ({ field }) => {
|
|
13019
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13020
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
13021
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
13022
|
-
Combobox,
|
|
13023
|
-
{
|
|
13024
|
-
options: salesChannels.options,
|
|
13025
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
13026
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
13027
|
-
searchValue: salesChannels.searchValue,
|
|
13028
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
13029
|
-
placeholder: "Select sales channel",
|
|
13030
|
-
...field
|
|
13031
|
-
}
|
|
13032
|
-
) }),
|
|
13033
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13034
|
-
] });
|
|
13035
|
-
}
|
|
13036
|
-
}
|
|
13037
|
-
);
|
|
13038
|
-
};
|
|
13039
13039
|
const schema = objectType({
|
|
13040
|
-
|
|
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: CustomItems,
|
|
13068
13064
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13075,6 +13071,10 @@ const routeModule = {
|
|
|
13075
13071
|
Component: Items,
|
|
13076
13072
|
path: "/draft-orders/:id/items"
|
|
13077
13073
|
},
|
|
13074
|
+
{
|
|
13075
|
+
Component: BillingAddress,
|
|
13076
|
+
path: "/draft-orders/:id/billing-address"
|
|
13077
|
+
},
|
|
13078
13078
|
{
|
|
13079
13079
|
Component: Metadata,
|
|
13080
13080
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13083,6 +13083,10 @@ const routeModule = {
|
|
|
13083
13083
|
Component: Promotions,
|
|
13084
13084
|
path: "/draft-orders/:id/promotions"
|
|
13085
13085
|
},
|
|
13086
|
+
{
|
|
13087
|
+
Component: SalesChannel,
|
|
13088
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13089
|
+
},
|
|
13086
13090
|
{
|
|
13087
13091
|
Component: Shipping,
|
|
13088
13092
|
path: "/draft-orders/:id/shipping"
|
|
@@ -13094,10 +13098,6 @@ const routeModule = {
|
|
|
13094
13098
|
{
|
|
13095
13099
|
Component: TransferOwnership,
|
|
13096
13100
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
|
-
},
|
|
13098
|
-
{
|
|
13099
|
-
Component: SalesChannel,
|
|
13100
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|