@medusajs/draft-order 2.11.2-preview-20251028060159 → 2.11.2-preview-20251028100508
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 +458 -458
- package/.medusa/server/src/admin/index.mjs +458 -458
- package/package.json +16 -16
|
@@ -9586,6 +9586,74 @@ const CustomItemsForm = () => {
|
|
|
9586
9586
|
const schema$5 = objectType({
|
|
9587
9587
|
email: stringType().email()
|
|
9588
9588
|
});
|
|
9589
|
+
const Email = () => {
|
|
9590
|
+
const { id } = useParams();
|
|
9591
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9592
|
+
fields: "+email"
|
|
9593
|
+
});
|
|
9594
|
+
if (isError) {
|
|
9595
|
+
throw error;
|
|
9596
|
+
}
|
|
9597
|
+
const isReady = !isPending && !!order;
|
|
9598
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9599
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9600
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9601
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9602
|
+
] }),
|
|
9603
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9604
|
+
] });
|
|
9605
|
+
};
|
|
9606
|
+
const EmailForm = ({ order }) => {
|
|
9607
|
+
const form = useForm({
|
|
9608
|
+
defaultValues: {
|
|
9609
|
+
email: order.email ?? ""
|
|
9610
|
+
},
|
|
9611
|
+
resolver: zodResolver(schema$4)
|
|
9612
|
+
});
|
|
9613
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9614
|
+
const { handleSuccess } = useRouteModal();
|
|
9615
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9616
|
+
await mutateAsync(
|
|
9617
|
+
{ email: data.email },
|
|
9618
|
+
{
|
|
9619
|
+
onSuccess: () => {
|
|
9620
|
+
handleSuccess();
|
|
9621
|
+
},
|
|
9622
|
+
onError: (error) => {
|
|
9623
|
+
toast.error(error.message);
|
|
9624
|
+
}
|
|
9625
|
+
}
|
|
9626
|
+
);
|
|
9627
|
+
});
|
|
9628
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9629
|
+
KeyboundForm,
|
|
9630
|
+
{
|
|
9631
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9632
|
+
onSubmit,
|
|
9633
|
+
children: [
|
|
9634
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9635
|
+
Form$2.Field,
|
|
9636
|
+
{
|
|
9637
|
+
control: form.control,
|
|
9638
|
+
name: "email",
|
|
9639
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9640
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9641
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9642
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9643
|
+
] })
|
|
9644
|
+
}
|
|
9645
|
+
) }),
|
|
9646
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9647
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9648
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9649
|
+
] }) })
|
|
9650
|
+
]
|
|
9651
|
+
}
|
|
9652
|
+
) });
|
|
9653
|
+
};
|
|
9654
|
+
const schema$4 = objectType({
|
|
9655
|
+
email: stringType().email()
|
|
9656
|
+
});
|
|
9589
9657
|
const NumberInput = forwardRef(
|
|
9590
9658
|
({
|
|
9591
9659
|
value,
|
|
@@ -10560,54 +10628,10 @@ const customItemSchema = objectType({
|
|
|
10560
10628
|
quantity: numberType(),
|
|
10561
10629
|
unit_price: unionType([numberType(), stringType()])
|
|
10562
10630
|
});
|
|
10563
|
-
const
|
|
10564
|
-
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10565
|
-
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
10566
|
-
return /* @__PURE__ */ jsxs(
|
|
10567
|
-
"div",
|
|
10568
|
-
{
|
|
10569
|
-
ref,
|
|
10570
|
-
className: clx(
|
|
10571
|
-
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
10572
|
-
className
|
|
10573
|
-
),
|
|
10574
|
-
...props,
|
|
10575
|
-
children: [
|
|
10576
|
-
/* @__PURE__ */ jsx(
|
|
10577
|
-
"div",
|
|
10578
|
-
{
|
|
10579
|
-
role: "presentation",
|
|
10580
|
-
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
10581
|
-
"bg-ui-tag-orange-icon": variant === "warning"
|
|
10582
|
-
})
|
|
10583
|
-
}
|
|
10584
|
-
),
|
|
10585
|
-
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
10586
|
-
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
10587
|
-
labelValue,
|
|
10588
|
-
":"
|
|
10589
|
-
] }),
|
|
10590
|
-
" ",
|
|
10591
|
-
children
|
|
10592
|
-
] })
|
|
10593
|
-
]
|
|
10594
|
-
}
|
|
10595
|
-
);
|
|
10596
|
-
}
|
|
10597
|
-
);
|
|
10598
|
-
InlineTip.displayName = "InlineTip";
|
|
10599
|
-
const MetadataFieldSchema = objectType({
|
|
10600
|
-
key: stringType(),
|
|
10601
|
-
disabled: booleanType().optional(),
|
|
10602
|
-
value: anyType()
|
|
10603
|
-
});
|
|
10604
|
-
const MetadataSchema = objectType({
|
|
10605
|
-
metadata: arrayType(MetadataFieldSchema)
|
|
10606
|
-
});
|
|
10607
|
-
const Metadata = () => {
|
|
10631
|
+
const BillingAddress = () => {
|
|
10608
10632
|
const { id } = useParams();
|
|
10609
10633
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
10610
|
-
fields: "
|
|
10634
|
+
fields: "+billing_address"
|
|
10611
10635
|
});
|
|
10612
10636
|
if (isError) {
|
|
10613
10637
|
throw error;
|
|
@@ -10615,33 +10639,36 @@ const Metadata = () => {
|
|
|
10615
10639
|
const isReady = !isPending && !!order;
|
|
10616
10640
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10617
10641
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10618
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
10619
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
10642
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
10643
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
10620
10644
|
] }),
|
|
10621
|
-
|
|
10645
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
10622
10646
|
] });
|
|
10623
10647
|
};
|
|
10624
|
-
const
|
|
10625
|
-
|
|
10626
|
-
const MetadataForm = ({ orderId, metadata }) => {
|
|
10627
|
-
const { handleSuccess } = useRouteModal();
|
|
10628
|
-
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
10629
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
10648
|
+
const BillingAddressForm = ({ order }) => {
|
|
10649
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
10630
10650
|
const form = useForm({
|
|
10631
10651
|
defaultValues: {
|
|
10632
|
-
|
|
10652
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
10653
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
10654
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
10655
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
10656
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
10657
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
10658
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
10659
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
10660
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
10661
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
10633
10662
|
},
|
|
10634
|
-
resolver: zodResolver(
|
|
10663
|
+
resolver: zodResolver(schema$3)
|
|
10635
10664
|
});
|
|
10636
|
-
const
|
|
10637
|
-
|
|
10665
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10666
|
+
const { handleSuccess } = useRouteModal();
|
|
10667
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10638
10668
|
await mutateAsync(
|
|
10639
|
-
{
|
|
10640
|
-
metadata: parsedData
|
|
10641
|
-
},
|
|
10669
|
+
{ billing_address: data },
|
|
10642
10670
|
{
|
|
10643
10671
|
onSuccess: () => {
|
|
10644
|
-
toast.success("Metadata updated");
|
|
10645
10672
|
handleSuccess();
|
|
10646
10673
|
},
|
|
10647
10674
|
onError: (error) => {
|
|
@@ -10650,80 +10677,311 @@ const MetadataForm = ({ orderId, metadata }) => {
|
|
|
10650
10677
|
}
|
|
10651
10678
|
);
|
|
10652
10679
|
});
|
|
10653
|
-
const { fields, insert, remove } = useFieldArray({
|
|
10654
|
-
control: form.control,
|
|
10655
|
-
name: "metadata"
|
|
10656
|
-
});
|
|
10657
|
-
function deleteRow(index) {
|
|
10658
|
-
remove(index);
|
|
10659
|
-
if (fields.length === 1) {
|
|
10660
|
-
insert(0, {
|
|
10661
|
-
key: "",
|
|
10662
|
-
value: "",
|
|
10663
|
-
disabled: false
|
|
10664
|
-
});
|
|
10665
|
-
}
|
|
10666
|
-
}
|
|
10667
|
-
function insertRow(index, position) {
|
|
10668
|
-
insert(index + (position === "above" ? 0 : 1), {
|
|
10669
|
-
key: "",
|
|
10670
|
-
value: "",
|
|
10671
|
-
disabled: false
|
|
10672
|
-
});
|
|
10673
|
-
}
|
|
10674
10680
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10675
10681
|
KeyboundForm,
|
|
10676
10682
|
{
|
|
10677
|
-
onSubmit: handleSubmit,
|
|
10678
10683
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
10684
|
+
onSubmit,
|
|
10679
10685
|
children: [
|
|
10680
|
-
/* @__PURE__ */
|
|
10681
|
-
/* @__PURE__ */
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10686
|
+
/* @__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: [
|
|
10687
|
+
/* @__PURE__ */ jsx(
|
|
10688
|
+
Form$2.Field,
|
|
10689
|
+
{
|
|
10690
|
+
control: form.control,
|
|
10691
|
+
name: "country_code",
|
|
10692
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10693
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
10694
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
10695
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10696
|
+
] })
|
|
10697
|
+
}
|
|
10698
|
+
),
|
|
10699
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10700
|
+
/* @__PURE__ */ jsx(
|
|
10701
|
+
Form$2.Field,
|
|
10702
|
+
{
|
|
10703
|
+
control: form.control,
|
|
10704
|
+
name: "first_name",
|
|
10705
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10706
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
10707
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10708
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10709
|
+
] })
|
|
10691
10710
|
}
|
|
10692
|
-
|
|
10693
|
-
|
|
10711
|
+
),
|
|
10712
|
+
/* @__PURE__ */ jsx(
|
|
10713
|
+
Form$2.Field,
|
|
10714
|
+
{
|
|
10715
|
+
control: form.control,
|
|
10716
|
+
name: "last_name",
|
|
10717
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10718
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
10719
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10720
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10721
|
+
] })
|
|
10694
10722
|
}
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10723
|
+
)
|
|
10724
|
+
] }),
|
|
10725
|
+
/* @__PURE__ */ jsx(
|
|
10726
|
+
Form$2.Field,
|
|
10727
|
+
{
|
|
10728
|
+
control: form.control,
|
|
10729
|
+
name: "company",
|
|
10730
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10731
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
10732
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10733
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10734
|
+
] })
|
|
10735
|
+
}
|
|
10736
|
+
),
|
|
10737
|
+
/* @__PURE__ */ jsx(
|
|
10738
|
+
Form$2.Field,
|
|
10739
|
+
{
|
|
10740
|
+
control: form.control,
|
|
10741
|
+
name: "address_1",
|
|
10742
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10743
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
10744
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10745
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10746
|
+
] })
|
|
10747
|
+
}
|
|
10748
|
+
),
|
|
10749
|
+
/* @__PURE__ */ jsx(
|
|
10750
|
+
Form$2.Field,
|
|
10751
|
+
{
|
|
10752
|
+
control: form.control,
|
|
10753
|
+
name: "address_2",
|
|
10754
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10755
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10756
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10757
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10758
|
+
] })
|
|
10759
|
+
}
|
|
10760
|
+
),
|
|
10761
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10762
|
+
/* @__PURE__ */ jsx(
|
|
10763
|
+
Form$2.Field,
|
|
10764
|
+
{
|
|
10765
|
+
control: form.control,
|
|
10766
|
+
name: "postal_code",
|
|
10767
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10768
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
10769
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10770
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10771
|
+
] })
|
|
10772
|
+
}
|
|
10773
|
+
),
|
|
10774
|
+
/* @__PURE__ */ jsx(
|
|
10775
|
+
Form$2.Field,
|
|
10776
|
+
{
|
|
10777
|
+
control: form.control,
|
|
10778
|
+
name: "city",
|
|
10779
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10780
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
10781
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10782
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10783
|
+
] })
|
|
10784
|
+
}
|
|
10785
|
+
)
|
|
10786
|
+
] }),
|
|
10787
|
+
/* @__PURE__ */ jsx(
|
|
10788
|
+
Form$2.Field,
|
|
10789
|
+
{
|
|
10790
|
+
control: form.control,
|
|
10791
|
+
name: "province",
|
|
10792
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10793
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10794
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10795
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10796
|
+
] })
|
|
10797
|
+
}
|
|
10798
|
+
),
|
|
10799
|
+
/* @__PURE__ */ jsx(
|
|
10800
|
+
Form$2.Field,
|
|
10801
|
+
{
|
|
10802
|
+
control: form.control,
|
|
10803
|
+
name: "phone",
|
|
10804
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10805
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
10806
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10807
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10808
|
+
] })
|
|
10809
|
+
}
|
|
10810
|
+
)
|
|
10811
|
+
] }) }),
|
|
10812
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10813
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10814
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10815
|
+
] }) })
|
|
10816
|
+
]
|
|
10817
|
+
}
|
|
10818
|
+
) });
|
|
10819
|
+
};
|
|
10820
|
+
const schema$3 = addressSchema;
|
|
10821
|
+
const InlineTip = forwardRef(
|
|
10822
|
+
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10823
|
+
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
10824
|
+
return /* @__PURE__ */ jsxs(
|
|
10825
|
+
"div",
|
|
10826
|
+
{
|
|
10827
|
+
ref,
|
|
10828
|
+
className: clx(
|
|
10829
|
+
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
10830
|
+
className
|
|
10831
|
+
),
|
|
10832
|
+
...props,
|
|
10833
|
+
children: [
|
|
10834
|
+
/* @__PURE__ */ jsx(
|
|
10835
|
+
"div",
|
|
10836
|
+
{
|
|
10837
|
+
role: "presentation",
|
|
10838
|
+
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
10839
|
+
"bg-ui-tag-orange-icon": variant === "warning"
|
|
10840
|
+
})
|
|
10841
|
+
}
|
|
10842
|
+
),
|
|
10843
|
+
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
10844
|
+
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
10845
|
+
labelValue,
|
|
10846
|
+
":"
|
|
10847
|
+
] }),
|
|
10848
|
+
" ",
|
|
10849
|
+
children
|
|
10850
|
+
] })
|
|
10851
|
+
]
|
|
10852
|
+
}
|
|
10853
|
+
);
|
|
10854
|
+
}
|
|
10855
|
+
);
|
|
10856
|
+
InlineTip.displayName = "InlineTip";
|
|
10857
|
+
const MetadataFieldSchema = objectType({
|
|
10858
|
+
key: stringType(),
|
|
10859
|
+
disabled: booleanType().optional(),
|
|
10860
|
+
value: anyType()
|
|
10861
|
+
});
|
|
10862
|
+
const MetadataSchema = objectType({
|
|
10863
|
+
metadata: arrayType(MetadataFieldSchema)
|
|
10864
|
+
});
|
|
10865
|
+
const Metadata = () => {
|
|
10866
|
+
const { id } = useParams();
|
|
10867
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10868
|
+
fields: "metadata"
|
|
10869
|
+
});
|
|
10870
|
+
if (isError) {
|
|
10871
|
+
throw error;
|
|
10872
|
+
}
|
|
10873
|
+
const isReady = !isPending && !!order;
|
|
10874
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10875
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10876
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
|
|
10877
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
10878
|
+
] }),
|
|
10879
|
+
!isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
10880
|
+
] });
|
|
10881
|
+
};
|
|
10882
|
+
const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
|
|
10883
|
+
const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
|
|
10884
|
+
const MetadataForm = ({ orderId, metadata }) => {
|
|
10885
|
+
const { handleSuccess } = useRouteModal();
|
|
10886
|
+
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
10887
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
10888
|
+
const form = useForm({
|
|
10889
|
+
defaultValues: {
|
|
10890
|
+
metadata: getDefaultValues(metadata)
|
|
10891
|
+
},
|
|
10892
|
+
resolver: zodResolver(MetadataSchema)
|
|
10893
|
+
});
|
|
10894
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
10895
|
+
const parsedData = parseValues(data);
|
|
10896
|
+
await mutateAsync(
|
|
10897
|
+
{
|
|
10898
|
+
metadata: parsedData
|
|
10899
|
+
},
|
|
10900
|
+
{
|
|
10901
|
+
onSuccess: () => {
|
|
10902
|
+
toast.success("Metadata updated");
|
|
10903
|
+
handleSuccess();
|
|
10904
|
+
},
|
|
10905
|
+
onError: (error) => {
|
|
10906
|
+
toast.error(error.message);
|
|
10907
|
+
}
|
|
10908
|
+
}
|
|
10909
|
+
);
|
|
10910
|
+
});
|
|
10911
|
+
const { fields, insert, remove } = useFieldArray({
|
|
10912
|
+
control: form.control,
|
|
10913
|
+
name: "metadata"
|
|
10914
|
+
});
|
|
10915
|
+
function deleteRow(index) {
|
|
10916
|
+
remove(index);
|
|
10917
|
+
if (fields.length === 1) {
|
|
10918
|
+
insert(0, {
|
|
10919
|
+
key: "",
|
|
10920
|
+
value: "",
|
|
10921
|
+
disabled: false
|
|
10922
|
+
});
|
|
10923
|
+
}
|
|
10924
|
+
}
|
|
10925
|
+
function insertRow(index, position) {
|
|
10926
|
+
insert(index + (position === "above" ? 0 : 1), {
|
|
10927
|
+
key: "",
|
|
10928
|
+
value: "",
|
|
10929
|
+
disabled: false
|
|
10930
|
+
});
|
|
10931
|
+
}
|
|
10932
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10933
|
+
KeyboundForm,
|
|
10934
|
+
{
|
|
10935
|
+
onSubmit: handleSubmit,
|
|
10936
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10937
|
+
children: [
|
|
10938
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
|
|
10939
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
|
|
10940
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
|
|
10941
|
+
/* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
|
|
10942
|
+
/* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
|
|
10943
|
+
] }),
|
|
10944
|
+
fields.map((field, index) => {
|
|
10945
|
+
const isDisabled = field.disabled || false;
|
|
10946
|
+
let placeholder = "-";
|
|
10947
|
+
if (typeof field.value === "object") {
|
|
10948
|
+
placeholder = "{ ... }";
|
|
10949
|
+
}
|
|
10950
|
+
if (Array.isArray(field.value)) {
|
|
10951
|
+
placeholder = "[ ... ]";
|
|
10952
|
+
}
|
|
10953
|
+
return /* @__PURE__ */ jsx(
|
|
10954
|
+
ConditionalTooltip,
|
|
10955
|
+
{
|
|
10956
|
+
showTooltip: isDisabled,
|
|
10957
|
+
content: "This row is disabled because it contains non-primitive data.",
|
|
10958
|
+
children: /* @__PURE__ */ jsxs("div", { className: "group/table relative", children: [
|
|
10959
|
+
/* @__PURE__ */ jsxs(
|
|
10960
|
+
"div",
|
|
10961
|
+
{
|
|
10962
|
+
className: clx("grid grid-cols-2 divide-x", {
|
|
10963
|
+
"overflow-hidden rounded-b-lg": index === fields.length - 1
|
|
10964
|
+
}),
|
|
10965
|
+
children: [
|
|
10966
|
+
/* @__PURE__ */ jsx(
|
|
10967
|
+
Form$2.Field,
|
|
10968
|
+
{
|
|
10969
|
+
control: form.control,
|
|
10970
|
+
name: `metadata.${index}.key`,
|
|
10971
|
+
render: ({ field: field2 }) => {
|
|
10972
|
+
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10973
|
+
GridInput,
|
|
10974
|
+
{
|
|
10975
|
+
"aria-labelledby": METADATA_KEY_LABEL_ID,
|
|
10976
|
+
...field2,
|
|
10977
|
+
disabled: isDisabled,
|
|
10978
|
+
placeholder: "Key"
|
|
10979
|
+
}
|
|
10980
|
+
) }) });
|
|
10981
|
+
}
|
|
10982
|
+
}
|
|
10983
|
+
),
|
|
10984
|
+
/* @__PURE__ */ jsx(
|
|
10727
10985
|
Form$2.Field,
|
|
10728
10986
|
{
|
|
10729
10987
|
control: form.control,
|
|
@@ -11215,7 +11473,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11215
11473
|
defaultValues: {
|
|
11216
11474
|
sales_channel_id: order.sales_channel_id || ""
|
|
11217
11475
|
},
|
|
11218
|
-
resolver: zodResolver(schema$
|
|
11476
|
+
resolver: zodResolver(schema$2)
|
|
11219
11477
|
});
|
|
11220
11478
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11221
11479
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11290,7 +11548,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11290
11548
|
}
|
|
11291
11549
|
);
|
|
11292
11550
|
};
|
|
11293
|
-
const schema$
|
|
11551
|
+
const schema$2 = objectType({
|
|
11294
11552
|
sales_channel_id: stringType().min(1)
|
|
11295
11553
|
});
|
|
11296
11554
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12132,7 +12390,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12132
12390
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12133
12391
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12134
12392
|
},
|
|
12135
|
-
resolver: zodResolver(schema$
|
|
12393
|
+
resolver: zodResolver(schema$1)
|
|
12136
12394
|
});
|
|
12137
12395
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12138
12396
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12302,7 +12560,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12302
12560
|
}
|
|
12303
12561
|
) });
|
|
12304
12562
|
};
|
|
12305
|
-
const schema$
|
|
12563
|
+
const schema$1 = addressSchema;
|
|
12306
12564
|
const TransferOwnership = () => {
|
|
12307
12565
|
const { id } = useParams();
|
|
12308
12566
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12326,7 +12584,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12326
12584
|
defaultValues: {
|
|
12327
12585
|
customer_id: order.customer_id || ""
|
|
12328
12586
|
},
|
|
12329
|
-
resolver: zodResolver(schema
|
|
12587
|
+
resolver: zodResolver(schema)
|
|
12330
12588
|
});
|
|
12331
12589
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12332
12590
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12705,337 +12963,79 @@ const Illustration = () => {
|
|
|
12705
12963
|
strokeLinecap: "round",
|
|
12706
12964
|
strokeLinejoin: "round"
|
|
12707
12965
|
}
|
|
12708
|
-
) }),
|
|
12709
|
-
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12710
|
-
"path",
|
|
12711
|
-
{
|
|
12712
|
-
d: "M146.894 101.198L139.51 101.155L139.486 105.365",
|
|
12713
|
-
stroke: "#A1A1AA",
|
|
12714
|
-
strokeWidth: "1.5",
|
|
12715
|
-
strokeLinecap: "round",
|
|
12716
|
-
strokeLinejoin: "round"
|
|
12717
|
-
}
|
|
12718
|
-
) }),
|
|
12719
|
-
/* @__PURE__ */ jsxs("defs", { children: [
|
|
12720
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12721
|
-
"rect",
|
|
12722
|
-
{
|
|
12723
|
-
width: "12",
|
|
12724
|
-
height: "12",
|
|
12725
|
-
fill: "white",
|
|
12726
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
|
|
12727
|
-
}
|
|
12728
|
-
) }),
|
|
12729
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12730
|
-
"rect",
|
|
12731
|
-
{
|
|
12732
|
-
width: "12",
|
|
12733
|
-
height: "12",
|
|
12734
|
-
fill: "white",
|
|
12735
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
|
|
12736
|
-
}
|
|
12737
|
-
) }),
|
|
12738
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12739
|
-
"rect",
|
|
12740
|
-
{
|
|
12741
|
-
width: "12",
|
|
12742
|
-
height: "12",
|
|
12743
|
-
fill: "white",
|
|
12744
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
|
|
12745
|
-
}
|
|
12746
|
-
) }),
|
|
12747
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12748
|
-
"rect",
|
|
12749
|
-
{
|
|
12750
|
-
width: "12",
|
|
12751
|
-
height: "12",
|
|
12752
|
-
fill: "white",
|
|
12753
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
|
|
12754
|
-
}
|
|
12755
|
-
) }),
|
|
12756
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12757
|
-
"rect",
|
|
12758
|
-
{
|
|
12759
|
-
width: "12",
|
|
12760
|
-
height: "12",
|
|
12761
|
-
fill: "white",
|
|
12762
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
|
|
12763
|
-
}
|
|
12764
|
-
) }),
|
|
12765
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12766
|
-
"rect",
|
|
12767
|
-
{
|
|
12768
|
-
width: "12",
|
|
12769
|
-
height: "12",
|
|
12770
|
-
fill: "white",
|
|
12771
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
|
|
12772
|
-
}
|
|
12773
|
-
) })
|
|
12774
|
-
] })
|
|
12775
|
-
]
|
|
12776
|
-
}
|
|
12777
|
-
);
|
|
12778
|
-
};
|
|
12779
|
-
const schema$2 = objectType({
|
|
12780
|
-
customer_id: stringType().min(1)
|
|
12781
|
-
});
|
|
12782
|
-
const BillingAddress = () => {
|
|
12783
|
-
const { id } = useParams();
|
|
12784
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12785
|
-
fields: "+billing_address"
|
|
12786
|
-
});
|
|
12787
|
-
if (isError) {
|
|
12788
|
-
throw error;
|
|
12789
|
-
}
|
|
12790
|
-
const isReady = !isPending && !!order;
|
|
12791
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12792
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12793
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
12794
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12795
|
-
] }),
|
|
12796
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
12797
|
-
] });
|
|
12798
|
-
};
|
|
12799
|
-
const BillingAddressForm = ({ order }) => {
|
|
12800
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12801
|
-
const form = useForm({
|
|
12802
|
-
defaultValues: {
|
|
12803
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12804
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12805
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12806
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12807
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12808
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12809
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12810
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12811
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12812
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12813
|
-
},
|
|
12814
|
-
resolver: zodResolver(schema$1)
|
|
12815
|
-
});
|
|
12816
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12817
|
-
const { handleSuccess } = useRouteModal();
|
|
12818
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12819
|
-
await mutateAsync(
|
|
12820
|
-
{ billing_address: data },
|
|
12821
|
-
{
|
|
12822
|
-
onSuccess: () => {
|
|
12823
|
-
handleSuccess();
|
|
12824
|
-
},
|
|
12825
|
-
onError: (error) => {
|
|
12826
|
-
toast.error(error.message);
|
|
12827
|
-
}
|
|
12828
|
-
}
|
|
12829
|
-
);
|
|
12830
|
-
});
|
|
12831
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12832
|
-
KeyboundForm,
|
|
12833
|
-
{
|
|
12834
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12835
|
-
onSubmit,
|
|
12836
|
-
children: [
|
|
12837
|
-
/* @__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: [
|
|
12838
|
-
/* @__PURE__ */ jsx(
|
|
12839
|
-
Form$2.Field,
|
|
12966
|
+
) }),
|
|
12967
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12968
|
+
"path",
|
|
12969
|
+
{
|
|
12970
|
+
d: "M146.894 101.198L139.51 101.155L139.486 105.365",
|
|
12971
|
+
stroke: "#A1A1AA",
|
|
12972
|
+
strokeWidth: "1.5",
|
|
12973
|
+
strokeLinecap: "round",
|
|
12974
|
+
strokeLinejoin: "round"
|
|
12975
|
+
}
|
|
12976
|
+
) }),
|
|
12977
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
12978
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12979
|
+
"rect",
|
|
12840
12980
|
{
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12846
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12847
|
-
] })
|
|
12981
|
+
width: "12",
|
|
12982
|
+
height: "12",
|
|
12983
|
+
fill: "white",
|
|
12984
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
|
|
12848
12985
|
}
|
|
12849
|
-
),
|
|
12850
|
-
/* @__PURE__ */
|
|
12851
|
-
|
|
12852
|
-
Form$2.Field,
|
|
12853
|
-
{
|
|
12854
|
-
control: form.control,
|
|
12855
|
-
name: "first_name",
|
|
12856
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12857
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12858
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12859
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12860
|
-
] })
|
|
12861
|
-
}
|
|
12862
|
-
),
|
|
12863
|
-
/* @__PURE__ */ jsx(
|
|
12864
|
-
Form$2.Field,
|
|
12865
|
-
{
|
|
12866
|
-
control: form.control,
|
|
12867
|
-
name: "last_name",
|
|
12868
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12869
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12870
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12871
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12872
|
-
] })
|
|
12873
|
-
}
|
|
12874
|
-
)
|
|
12875
|
-
] }),
|
|
12876
|
-
/* @__PURE__ */ jsx(
|
|
12877
|
-
Form$2.Field,
|
|
12986
|
+
) }),
|
|
12987
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12988
|
+
"rect",
|
|
12878
12989
|
{
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12884
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12885
|
-
] })
|
|
12990
|
+
width: "12",
|
|
12991
|
+
height: "12",
|
|
12992
|
+
fill: "white",
|
|
12993
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
|
|
12886
12994
|
}
|
|
12887
|
-
),
|
|
12888
|
-
/* @__PURE__ */ jsx(
|
|
12889
|
-
|
|
12995
|
+
) }),
|
|
12996
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12997
|
+
"rect",
|
|
12890
12998
|
{
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12896
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12897
|
-
] })
|
|
12999
|
+
width: "12",
|
|
13000
|
+
height: "12",
|
|
13001
|
+
fill: "white",
|
|
13002
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
|
|
12898
13003
|
}
|
|
12899
|
-
),
|
|
12900
|
-
/* @__PURE__ */ jsx(
|
|
12901
|
-
|
|
13004
|
+
) }),
|
|
13005
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
|
|
13006
|
+
"rect",
|
|
12902
13007
|
{
|
|
12903
|
-
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12908
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12909
|
-
] })
|
|
13008
|
+
width: "12",
|
|
13009
|
+
height: "12",
|
|
13010
|
+
fill: "white",
|
|
13011
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
|
|
12910
13012
|
}
|
|
12911
|
-
),
|
|
12912
|
-
/* @__PURE__ */
|
|
12913
|
-
|
|
12914
|
-
Form$2.Field,
|
|
12915
|
-
{
|
|
12916
|
-
control: form.control,
|
|
12917
|
-
name: "postal_code",
|
|
12918
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12919
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12920
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12921
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12922
|
-
] })
|
|
12923
|
-
}
|
|
12924
|
-
),
|
|
12925
|
-
/* @__PURE__ */ jsx(
|
|
12926
|
-
Form$2.Field,
|
|
12927
|
-
{
|
|
12928
|
-
control: form.control,
|
|
12929
|
-
name: "city",
|
|
12930
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12931
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12932
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12933
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12934
|
-
] })
|
|
12935
|
-
}
|
|
12936
|
-
)
|
|
12937
|
-
] }),
|
|
12938
|
-
/* @__PURE__ */ jsx(
|
|
12939
|
-
Form$2.Field,
|
|
13013
|
+
) }),
|
|
13014
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
|
|
13015
|
+
"rect",
|
|
12940
13016
|
{
|
|
12941
|
-
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12946
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12947
|
-
] })
|
|
13017
|
+
width: "12",
|
|
13018
|
+
height: "12",
|
|
13019
|
+
fill: "white",
|
|
13020
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
|
|
12948
13021
|
}
|
|
12949
|
-
),
|
|
12950
|
-
/* @__PURE__ */ jsx(
|
|
12951
|
-
|
|
13022
|
+
) }),
|
|
13023
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
|
|
13024
|
+
"rect",
|
|
12952
13025
|
{
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12958
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12959
|
-
] })
|
|
13026
|
+
width: "12",
|
|
13027
|
+
height: "12",
|
|
13028
|
+
fill: "white",
|
|
13029
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
|
|
12960
13030
|
}
|
|
12961
|
-
)
|
|
12962
|
-
] })
|
|
12963
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12964
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12965
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12966
|
-
] }) })
|
|
12967
|
-
]
|
|
12968
|
-
}
|
|
12969
|
-
) });
|
|
12970
|
-
};
|
|
12971
|
-
const schema$1 = addressSchema;
|
|
12972
|
-
const Email = () => {
|
|
12973
|
-
const { id } = useParams();
|
|
12974
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12975
|
-
fields: "+email"
|
|
12976
|
-
});
|
|
12977
|
-
if (isError) {
|
|
12978
|
-
throw error;
|
|
12979
|
-
}
|
|
12980
|
-
const isReady = !isPending && !!order;
|
|
12981
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12982
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12983
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12984
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12985
|
-
] }),
|
|
12986
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12987
|
-
] });
|
|
12988
|
-
};
|
|
12989
|
-
const EmailForm = ({ order }) => {
|
|
12990
|
-
const form = useForm({
|
|
12991
|
-
defaultValues: {
|
|
12992
|
-
email: order.email ?? ""
|
|
12993
|
-
},
|
|
12994
|
-
resolver: zodResolver(schema)
|
|
12995
|
-
});
|
|
12996
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12997
|
-
const { handleSuccess } = useRouteModal();
|
|
12998
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12999
|
-
await mutateAsync(
|
|
13000
|
-
{ email: data.email },
|
|
13001
|
-
{
|
|
13002
|
-
onSuccess: () => {
|
|
13003
|
-
handleSuccess();
|
|
13004
|
-
},
|
|
13005
|
-
onError: (error) => {
|
|
13006
|
-
toast.error(error.message);
|
|
13007
|
-
}
|
|
13008
|
-
}
|
|
13009
|
-
);
|
|
13010
|
-
});
|
|
13011
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13012
|
-
KeyboundForm,
|
|
13013
|
-
{
|
|
13014
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
13015
|
-
onSubmit,
|
|
13016
|
-
children: [
|
|
13017
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13018
|
-
Form$2.Field,
|
|
13019
|
-
{
|
|
13020
|
-
control: form.control,
|
|
13021
|
-
name: "email",
|
|
13022
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13023
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13024
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13025
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13026
|
-
] })
|
|
13027
|
-
}
|
|
13028
|
-
) }),
|
|
13029
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13030
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13031
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13032
|
-
] }) })
|
|
13031
|
+
) })
|
|
13032
|
+
] })
|
|
13033
13033
|
]
|
|
13034
13034
|
}
|
|
13035
|
-
)
|
|
13035
|
+
);
|
|
13036
13036
|
};
|
|
13037
13037
|
const schema = objectType({
|
|
13038
|
-
|
|
13038
|
+
customer_id: stringType().min(1)
|
|
13039
13039
|
});
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
@@ -13061,10 +13061,18 @@ const routeModule = {
|
|
|
13061
13061
|
Component: CustomItems,
|
|
13062
13062
|
path: "/draft-orders/:id/custom-items"
|
|
13063
13063
|
},
|
|
13064
|
+
{
|
|
13065
|
+
Component: Email,
|
|
13066
|
+
path: "/draft-orders/:id/email"
|
|
13067
|
+
},
|
|
13064
13068
|
{
|
|
13065
13069
|
Component: Items,
|
|
13066
13070
|
path: "/draft-orders/:id/items"
|
|
13067
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: BillingAddress,
|
|
13074
|
+
path: "/draft-orders/:id/billing-address"
|
|
13075
|
+
},
|
|
13068
13076
|
{
|
|
13069
13077
|
Component: Metadata,
|
|
13070
13078
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13088,14 +13096,6 @@ const routeModule = {
|
|
|
13088
13096
|
{
|
|
13089
13097
|
Component: TransferOwnership,
|
|
13090
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13091
|
-
},
|
|
13092
|
-
{
|
|
13093
|
-
Component: BillingAddress,
|
|
13094
|
-
path: "/draft-orders/:id/billing-address"
|
|
13095
|
-
},
|
|
13096
|
-
{
|
|
13097
|
-
Component: Email,
|
|
13098
|
-
path: "/draft-orders/:id/email"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|