@medusajs/draft-order 2.11.3-preview-20251103032410 → 2.11.3-preview-20251103090143
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 +472 -472
- package/.medusa/server/src/admin/index.mjs +472 -472
- package/package.json +16 -16
|
@@ -9565,196 +9565,6 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
-
const BillingAddress = () => {
|
|
9569
|
-
const { id } = useParams();
|
|
9570
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9571
|
-
fields: "+billing_address"
|
|
9572
|
-
});
|
|
9573
|
-
if (isError) {
|
|
9574
|
-
throw error;
|
|
9575
|
-
}
|
|
9576
|
-
const isReady = !isPending && !!order;
|
|
9577
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9578
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9579
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9580
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9581
|
-
] }),
|
|
9582
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9583
|
-
] });
|
|
9584
|
-
};
|
|
9585
|
-
const BillingAddressForm = ({ order }) => {
|
|
9586
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9587
|
-
const form = useForm({
|
|
9588
|
-
defaultValues: {
|
|
9589
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9590
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9591
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9592
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9593
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9594
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9595
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9596
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9597
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9599
|
-
},
|
|
9600
|
-
resolver: zodResolver(schema$5)
|
|
9601
|
-
});
|
|
9602
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9603
|
-
const { handleSuccess } = useRouteModal();
|
|
9604
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9605
|
-
await mutateAsync(
|
|
9606
|
-
{ billing_address: data },
|
|
9607
|
-
{
|
|
9608
|
-
onSuccess: () => {
|
|
9609
|
-
handleSuccess();
|
|
9610
|
-
},
|
|
9611
|
-
onError: (error) => {
|
|
9612
|
-
toast.error(error.message);
|
|
9613
|
-
}
|
|
9614
|
-
}
|
|
9615
|
-
);
|
|
9616
|
-
});
|
|
9617
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9618
|
-
KeyboundForm,
|
|
9619
|
-
{
|
|
9620
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9621
|
-
onSubmit,
|
|
9622
|
-
children: [
|
|
9623
|
-
/* @__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: [
|
|
9624
|
-
/* @__PURE__ */ jsx(
|
|
9625
|
-
Form$2.Field,
|
|
9626
|
-
{
|
|
9627
|
-
control: form.control,
|
|
9628
|
-
name: "country_code",
|
|
9629
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9630
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9631
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9632
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9633
|
-
] })
|
|
9634
|
-
}
|
|
9635
|
-
),
|
|
9636
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9637
|
-
/* @__PURE__ */ jsx(
|
|
9638
|
-
Form$2.Field,
|
|
9639
|
-
{
|
|
9640
|
-
control: form.control,
|
|
9641
|
-
name: "first_name",
|
|
9642
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9643
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9644
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9645
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9646
|
-
] })
|
|
9647
|
-
}
|
|
9648
|
-
),
|
|
9649
|
-
/* @__PURE__ */ jsx(
|
|
9650
|
-
Form$2.Field,
|
|
9651
|
-
{
|
|
9652
|
-
control: form.control,
|
|
9653
|
-
name: "last_name",
|
|
9654
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9655
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9656
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9657
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9658
|
-
] })
|
|
9659
|
-
}
|
|
9660
|
-
)
|
|
9661
|
-
] }),
|
|
9662
|
-
/* @__PURE__ */ jsx(
|
|
9663
|
-
Form$2.Field,
|
|
9664
|
-
{
|
|
9665
|
-
control: form.control,
|
|
9666
|
-
name: "company",
|
|
9667
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9668
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9669
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9670
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9671
|
-
] })
|
|
9672
|
-
}
|
|
9673
|
-
),
|
|
9674
|
-
/* @__PURE__ */ jsx(
|
|
9675
|
-
Form$2.Field,
|
|
9676
|
-
{
|
|
9677
|
-
control: form.control,
|
|
9678
|
-
name: "address_1",
|
|
9679
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9680
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9681
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9682
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9683
|
-
] })
|
|
9684
|
-
}
|
|
9685
|
-
),
|
|
9686
|
-
/* @__PURE__ */ jsx(
|
|
9687
|
-
Form$2.Field,
|
|
9688
|
-
{
|
|
9689
|
-
control: form.control,
|
|
9690
|
-
name: "address_2",
|
|
9691
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9692
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9693
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9694
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9695
|
-
] })
|
|
9696
|
-
}
|
|
9697
|
-
),
|
|
9698
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9699
|
-
/* @__PURE__ */ jsx(
|
|
9700
|
-
Form$2.Field,
|
|
9701
|
-
{
|
|
9702
|
-
control: form.control,
|
|
9703
|
-
name: "postal_code",
|
|
9704
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9705
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9706
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9707
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9708
|
-
] })
|
|
9709
|
-
}
|
|
9710
|
-
),
|
|
9711
|
-
/* @__PURE__ */ jsx(
|
|
9712
|
-
Form$2.Field,
|
|
9713
|
-
{
|
|
9714
|
-
control: form.control,
|
|
9715
|
-
name: "city",
|
|
9716
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9717
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9718
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9719
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9720
|
-
] })
|
|
9721
|
-
}
|
|
9722
|
-
)
|
|
9723
|
-
] }),
|
|
9724
|
-
/* @__PURE__ */ jsx(
|
|
9725
|
-
Form$2.Field,
|
|
9726
|
-
{
|
|
9727
|
-
control: form.control,
|
|
9728
|
-
name: "province",
|
|
9729
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9730
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9731
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9732
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9733
|
-
] })
|
|
9734
|
-
}
|
|
9735
|
-
),
|
|
9736
|
-
/* @__PURE__ */ jsx(
|
|
9737
|
-
Form$2.Field,
|
|
9738
|
-
{
|
|
9739
|
-
control: form.control,
|
|
9740
|
-
name: "phone",
|
|
9741
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9742
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9743
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9744
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9745
|
-
] })
|
|
9746
|
-
}
|
|
9747
|
-
)
|
|
9748
|
-
] }) }),
|
|
9749
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9750
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9751
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9752
|
-
] }) })
|
|
9753
|
-
]
|
|
9754
|
-
}
|
|
9755
|
-
) });
|
|
9756
|
-
};
|
|
9757
|
-
const schema$5 = addressSchema;
|
|
9758
9568
|
const CustomItems = () => {
|
|
9759
9569
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9760
9570
|
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9763,7 +9573,7 @@ const CustomItems = () => {
|
|
|
9763
9573
|
};
|
|
9764
9574
|
const CustomItemsForm = () => {
|
|
9765
9575
|
const form = useForm({
|
|
9766
|
-
resolver: zodResolver(schema$
|
|
9576
|
+
resolver: zodResolver(schema$5)
|
|
9767
9577
|
});
|
|
9768
9578
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9769
9579
|
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
@@ -9773,7 +9583,7 @@ const CustomItemsForm = () => {
|
|
|
9773
9583
|
] }) })
|
|
9774
9584
|
] }) });
|
|
9775
9585
|
};
|
|
9776
|
-
const schema$
|
|
9586
|
+
const schema$5 = objectType({
|
|
9777
9587
|
email: stringType().email()
|
|
9778
9588
|
});
|
|
9779
9589
|
const Email = () => {
|
|
@@ -9798,7 +9608,7 @@ const EmailForm = ({ order }) => {
|
|
|
9798
9608
|
defaultValues: {
|
|
9799
9609
|
email: order.email ?? ""
|
|
9800
9610
|
},
|
|
9801
|
-
resolver: zodResolver(schema$
|
|
9611
|
+
resolver: zodResolver(schema$4)
|
|
9802
9612
|
});
|
|
9803
9613
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9804
9614
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9841,7 +9651,7 @@ const EmailForm = ({ order }) => {
|
|
|
9841
9651
|
}
|
|
9842
9652
|
) });
|
|
9843
9653
|
};
|
|
9844
|
-
const schema$
|
|
9654
|
+
const schema$4 = objectType({
|
|
9845
9655
|
email: stringType().email()
|
|
9846
9656
|
});
|
|
9847
9657
|
const NumberInput = forwardRef(
|
|
@@ -10818,54 +10628,10 @@ const customItemSchema = objectType({
|
|
|
10818
10628
|
quantity: numberType(),
|
|
10819
10629
|
unit_price: unionType([numberType(), stringType()])
|
|
10820
10630
|
});
|
|
10821
|
-
const
|
|
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 = () => {
|
|
10631
|
+
const BillingAddress = () => {
|
|
10866
10632
|
const { id } = useParams();
|
|
10867
10633
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
10868
|
-
fields: "
|
|
10634
|
+
fields: "+billing_address"
|
|
10869
10635
|
});
|
|
10870
10636
|
if (isError) {
|
|
10871
10637
|
throw error;
|
|
@@ -10873,19 +10639,253 @@ const Metadata = () => {
|
|
|
10873
10639
|
const isReady = !isPending && !!order;
|
|
10874
10640
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10875
10641
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10876
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
10877
|
-
/* @__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" }) })
|
|
10878
10644
|
] }),
|
|
10879
|
-
|
|
10645
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
10880
10646
|
] });
|
|
10881
10647
|
};
|
|
10882
|
-
const
|
|
10883
|
-
|
|
10884
|
-
const
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10648
|
+
const BillingAddressForm = ({ order }) => {
|
|
10649
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
10650
|
+
const form = useForm({
|
|
10651
|
+
defaultValues: {
|
|
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) ?? ""
|
|
10662
|
+
},
|
|
10663
|
+
resolver: zodResolver(schema$3)
|
|
10664
|
+
});
|
|
10665
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10666
|
+
const { handleSuccess } = useRouteModal();
|
|
10667
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10668
|
+
await mutateAsync(
|
|
10669
|
+
{ billing_address: data },
|
|
10670
|
+
{
|
|
10671
|
+
onSuccess: () => {
|
|
10672
|
+
handleSuccess();
|
|
10673
|
+
},
|
|
10674
|
+
onError: (error) => {
|
|
10675
|
+
toast.error(error.message);
|
|
10676
|
+
}
|
|
10677
|
+
}
|
|
10678
|
+
);
|
|
10679
|
+
});
|
|
10680
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10681
|
+
KeyboundForm,
|
|
10682
|
+
{
|
|
10683
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10684
|
+
onSubmit,
|
|
10685
|
+
children: [
|
|
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
|
+
] })
|
|
10710
|
+
}
|
|
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
|
+
] })
|
|
10722
|
+
}
|
|
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
10889
|
defaultValues: {
|
|
10890
10890
|
metadata: getDefaultValues(metadata)
|
|
10891
10891
|
},
|
|
@@ -12358,33 +12358,236 @@ const CustomAmountField = ({
|
|
|
12358
12358
|
}
|
|
12359
12359
|
);
|
|
12360
12360
|
};
|
|
12361
|
-
const
|
|
12361
|
+
const ShippingAddress = () => {
|
|
12362
12362
|
const { id } = useParams();
|
|
12363
|
-
const {
|
|
12364
|
-
fields: "
|
|
12363
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12364
|
+
fields: "+shipping_address"
|
|
12365
12365
|
});
|
|
12366
12366
|
if (isError) {
|
|
12367
12367
|
throw error;
|
|
12368
12368
|
}
|
|
12369
|
-
const isReady = !isPending && !!
|
|
12369
|
+
const isReady = !isPending && !!order;
|
|
12370
12370
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12371
12371
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12372
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
12373
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
12372
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12373
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12374
12374
|
] }),
|
|
12375
|
-
isReady && /* @__PURE__ */ jsx(
|
|
12375
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12376
12376
|
] });
|
|
12377
12377
|
};
|
|
12378
|
-
const
|
|
12379
|
-
var _a, _b;
|
|
12378
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12379
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12380
12380
|
const form = useForm({
|
|
12381
12381
|
defaultValues: {
|
|
12382
|
-
|
|
12382
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12383
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12384
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12385
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12386
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12387
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12388
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12389
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12390
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12391
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12383
12392
|
},
|
|
12384
12393
|
resolver: zodResolver(schema$1)
|
|
12385
12394
|
});
|
|
12386
12395
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12387
12396
|
const { handleSuccess } = useRouteModal();
|
|
12397
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12398
|
+
await mutateAsync(
|
|
12399
|
+
{
|
|
12400
|
+
shipping_address: {
|
|
12401
|
+
first_name: data.first_name,
|
|
12402
|
+
last_name: data.last_name,
|
|
12403
|
+
company: data.company,
|
|
12404
|
+
address_1: data.address_1,
|
|
12405
|
+
address_2: data.address_2,
|
|
12406
|
+
city: data.city,
|
|
12407
|
+
province: data.province,
|
|
12408
|
+
country_code: data.country_code,
|
|
12409
|
+
postal_code: data.postal_code,
|
|
12410
|
+
phone: data.phone
|
|
12411
|
+
}
|
|
12412
|
+
},
|
|
12413
|
+
{
|
|
12414
|
+
onSuccess: () => {
|
|
12415
|
+
handleSuccess();
|
|
12416
|
+
},
|
|
12417
|
+
onError: (error) => {
|
|
12418
|
+
toast.error(error.message);
|
|
12419
|
+
}
|
|
12420
|
+
}
|
|
12421
|
+
);
|
|
12422
|
+
});
|
|
12423
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12424
|
+
KeyboundForm,
|
|
12425
|
+
{
|
|
12426
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12427
|
+
onSubmit,
|
|
12428
|
+
children: [
|
|
12429
|
+
/* @__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: [
|
|
12430
|
+
/* @__PURE__ */ jsx(
|
|
12431
|
+
Form$2.Field,
|
|
12432
|
+
{
|
|
12433
|
+
control: form.control,
|
|
12434
|
+
name: "country_code",
|
|
12435
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12436
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12437
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12438
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12439
|
+
] })
|
|
12440
|
+
}
|
|
12441
|
+
),
|
|
12442
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12443
|
+
/* @__PURE__ */ jsx(
|
|
12444
|
+
Form$2.Field,
|
|
12445
|
+
{
|
|
12446
|
+
control: form.control,
|
|
12447
|
+
name: "first_name",
|
|
12448
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12449
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12450
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12451
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12452
|
+
] })
|
|
12453
|
+
}
|
|
12454
|
+
),
|
|
12455
|
+
/* @__PURE__ */ jsx(
|
|
12456
|
+
Form$2.Field,
|
|
12457
|
+
{
|
|
12458
|
+
control: form.control,
|
|
12459
|
+
name: "last_name",
|
|
12460
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12461
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12462
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12463
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12464
|
+
] })
|
|
12465
|
+
}
|
|
12466
|
+
)
|
|
12467
|
+
] }),
|
|
12468
|
+
/* @__PURE__ */ jsx(
|
|
12469
|
+
Form$2.Field,
|
|
12470
|
+
{
|
|
12471
|
+
control: form.control,
|
|
12472
|
+
name: "company",
|
|
12473
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12474
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12475
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12476
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12477
|
+
] })
|
|
12478
|
+
}
|
|
12479
|
+
),
|
|
12480
|
+
/* @__PURE__ */ jsx(
|
|
12481
|
+
Form$2.Field,
|
|
12482
|
+
{
|
|
12483
|
+
control: form.control,
|
|
12484
|
+
name: "address_1",
|
|
12485
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12486
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12487
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12488
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12489
|
+
] })
|
|
12490
|
+
}
|
|
12491
|
+
),
|
|
12492
|
+
/* @__PURE__ */ jsx(
|
|
12493
|
+
Form$2.Field,
|
|
12494
|
+
{
|
|
12495
|
+
control: form.control,
|
|
12496
|
+
name: "address_2",
|
|
12497
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12498
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12499
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12500
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12501
|
+
] })
|
|
12502
|
+
}
|
|
12503
|
+
),
|
|
12504
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12505
|
+
/* @__PURE__ */ jsx(
|
|
12506
|
+
Form$2.Field,
|
|
12507
|
+
{
|
|
12508
|
+
control: form.control,
|
|
12509
|
+
name: "postal_code",
|
|
12510
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12511
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12512
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12513
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12514
|
+
] })
|
|
12515
|
+
}
|
|
12516
|
+
),
|
|
12517
|
+
/* @__PURE__ */ jsx(
|
|
12518
|
+
Form$2.Field,
|
|
12519
|
+
{
|
|
12520
|
+
control: form.control,
|
|
12521
|
+
name: "city",
|
|
12522
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12523
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12524
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12525
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12526
|
+
] })
|
|
12527
|
+
}
|
|
12528
|
+
)
|
|
12529
|
+
] }),
|
|
12530
|
+
/* @__PURE__ */ jsx(
|
|
12531
|
+
Form$2.Field,
|
|
12532
|
+
{
|
|
12533
|
+
control: form.control,
|
|
12534
|
+
name: "province",
|
|
12535
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12536
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12537
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12538
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12539
|
+
] })
|
|
12540
|
+
}
|
|
12541
|
+
),
|
|
12542
|
+
/* @__PURE__ */ jsx(
|
|
12543
|
+
Form$2.Field,
|
|
12544
|
+
{
|
|
12545
|
+
control: form.control,
|
|
12546
|
+
name: "phone",
|
|
12547
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12548
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12549
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12550
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12551
|
+
] })
|
|
12552
|
+
}
|
|
12553
|
+
)
|
|
12554
|
+
] }) }),
|
|
12555
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12556
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12557
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12558
|
+
] }) })
|
|
12559
|
+
]
|
|
12560
|
+
}
|
|
12561
|
+
) });
|
|
12562
|
+
};
|
|
12563
|
+
const schema$1 = addressSchema;
|
|
12564
|
+
const TransferOwnership = () => {
|
|
12565
|
+
const { id } = useParams();
|
|
12566
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
12567
|
+
fields: "id,customer_id,customer.*"
|
|
12568
|
+
});
|
|
12569
|
+
if (isError) {
|
|
12570
|
+
throw error;
|
|
12571
|
+
}
|
|
12572
|
+
const isReady = !isPending && !!draft_order;
|
|
12573
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12574
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12575
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
|
|
12576
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
|
|
12577
|
+
] }),
|
|
12578
|
+
isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
|
|
12579
|
+
] });
|
|
12580
|
+
};
|
|
12581
|
+
const TransferOwnershipForm = ({ order }) => {
|
|
12582
|
+
var _a, _b;
|
|
12583
|
+
const form = useForm({
|
|
12584
|
+
defaultValues: {
|
|
12585
|
+
customer_id: order.customer_id || ""
|
|
12586
|
+
},
|
|
12587
|
+
resolver: zodResolver(schema)
|
|
12588
|
+
});
|
|
12589
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12590
|
+
const { handleSuccess } = useRouteModal();
|
|
12388
12591
|
const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
|
|
12389
12592
|
const currentCustomer = order.customer ? {
|
|
12390
12593
|
label: name ? `${name} (${order.customer.email})` : order.customer.email,
|
|
@@ -12831,212 +13034,9 @@ const Illustration = () => {
|
|
|
12831
13034
|
}
|
|
12832
13035
|
);
|
|
12833
13036
|
};
|
|
12834
|
-
const schema
|
|
13037
|
+
const schema = objectType({
|
|
12835
13038
|
customer_id: stringType().min(1)
|
|
12836
13039
|
});
|
|
12837
|
-
const ShippingAddress = () => {
|
|
12838
|
-
const { id } = useParams();
|
|
12839
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12840
|
-
fields: "+shipping_address"
|
|
12841
|
-
});
|
|
12842
|
-
if (isError) {
|
|
12843
|
-
throw error;
|
|
12844
|
-
}
|
|
12845
|
-
const isReady = !isPending && !!order;
|
|
12846
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12847
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12848
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12849
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12850
|
-
] }),
|
|
12851
|
-
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12852
|
-
] });
|
|
12853
|
-
};
|
|
12854
|
-
const ShippingAddressForm = ({ order }) => {
|
|
12855
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12856
|
-
const form = useForm({
|
|
12857
|
-
defaultValues: {
|
|
12858
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12859
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12860
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12861
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12862
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12863
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12864
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12865
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12866
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12867
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12868
|
-
},
|
|
12869
|
-
resolver: zodResolver(schema)
|
|
12870
|
-
});
|
|
12871
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12872
|
-
const { handleSuccess } = useRouteModal();
|
|
12873
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12874
|
-
await mutateAsync(
|
|
12875
|
-
{
|
|
12876
|
-
shipping_address: {
|
|
12877
|
-
first_name: data.first_name,
|
|
12878
|
-
last_name: data.last_name,
|
|
12879
|
-
company: data.company,
|
|
12880
|
-
address_1: data.address_1,
|
|
12881
|
-
address_2: data.address_2,
|
|
12882
|
-
city: data.city,
|
|
12883
|
-
province: data.province,
|
|
12884
|
-
country_code: data.country_code,
|
|
12885
|
-
postal_code: data.postal_code,
|
|
12886
|
-
phone: data.phone
|
|
12887
|
-
}
|
|
12888
|
-
},
|
|
12889
|
-
{
|
|
12890
|
-
onSuccess: () => {
|
|
12891
|
-
handleSuccess();
|
|
12892
|
-
},
|
|
12893
|
-
onError: (error) => {
|
|
12894
|
-
toast.error(error.message);
|
|
12895
|
-
}
|
|
12896
|
-
}
|
|
12897
|
-
);
|
|
12898
|
-
});
|
|
12899
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12900
|
-
KeyboundForm,
|
|
12901
|
-
{
|
|
12902
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12903
|
-
onSubmit,
|
|
12904
|
-
children: [
|
|
12905
|
-
/* @__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: [
|
|
12906
|
-
/* @__PURE__ */ jsx(
|
|
12907
|
-
Form$2.Field,
|
|
12908
|
-
{
|
|
12909
|
-
control: form.control,
|
|
12910
|
-
name: "country_code",
|
|
12911
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12912
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12913
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12914
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12915
|
-
] })
|
|
12916
|
-
}
|
|
12917
|
-
),
|
|
12918
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12919
|
-
/* @__PURE__ */ jsx(
|
|
12920
|
-
Form$2.Field,
|
|
12921
|
-
{
|
|
12922
|
-
control: form.control,
|
|
12923
|
-
name: "first_name",
|
|
12924
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12925
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12926
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12927
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12928
|
-
] })
|
|
12929
|
-
}
|
|
12930
|
-
),
|
|
12931
|
-
/* @__PURE__ */ jsx(
|
|
12932
|
-
Form$2.Field,
|
|
12933
|
-
{
|
|
12934
|
-
control: form.control,
|
|
12935
|
-
name: "last_name",
|
|
12936
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12937
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12938
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12939
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12940
|
-
] })
|
|
12941
|
-
}
|
|
12942
|
-
)
|
|
12943
|
-
] }),
|
|
12944
|
-
/* @__PURE__ */ jsx(
|
|
12945
|
-
Form$2.Field,
|
|
12946
|
-
{
|
|
12947
|
-
control: form.control,
|
|
12948
|
-
name: "company",
|
|
12949
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12950
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12951
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12952
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12953
|
-
] })
|
|
12954
|
-
}
|
|
12955
|
-
),
|
|
12956
|
-
/* @__PURE__ */ jsx(
|
|
12957
|
-
Form$2.Field,
|
|
12958
|
-
{
|
|
12959
|
-
control: form.control,
|
|
12960
|
-
name: "address_1",
|
|
12961
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12962
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12963
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12964
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12965
|
-
] })
|
|
12966
|
-
}
|
|
12967
|
-
),
|
|
12968
|
-
/* @__PURE__ */ jsx(
|
|
12969
|
-
Form$2.Field,
|
|
12970
|
-
{
|
|
12971
|
-
control: form.control,
|
|
12972
|
-
name: "address_2",
|
|
12973
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12974
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12975
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12976
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12977
|
-
] })
|
|
12978
|
-
}
|
|
12979
|
-
),
|
|
12980
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12981
|
-
/* @__PURE__ */ jsx(
|
|
12982
|
-
Form$2.Field,
|
|
12983
|
-
{
|
|
12984
|
-
control: form.control,
|
|
12985
|
-
name: "postal_code",
|
|
12986
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12987
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12988
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12989
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12990
|
-
] })
|
|
12991
|
-
}
|
|
12992
|
-
),
|
|
12993
|
-
/* @__PURE__ */ jsx(
|
|
12994
|
-
Form$2.Field,
|
|
12995
|
-
{
|
|
12996
|
-
control: form.control,
|
|
12997
|
-
name: "city",
|
|
12998
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12999
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
13000
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13001
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13002
|
-
] })
|
|
13003
|
-
}
|
|
13004
|
-
)
|
|
13005
|
-
] }),
|
|
13006
|
-
/* @__PURE__ */ jsx(
|
|
13007
|
-
Form$2.Field,
|
|
13008
|
-
{
|
|
13009
|
-
control: form.control,
|
|
13010
|
-
name: "province",
|
|
13011
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13012
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13013
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13014
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13015
|
-
] })
|
|
13016
|
-
}
|
|
13017
|
-
),
|
|
13018
|
-
/* @__PURE__ */ jsx(
|
|
13019
|
-
Form$2.Field,
|
|
13020
|
-
{
|
|
13021
|
-
control: form.control,
|
|
13022
|
-
name: "phone",
|
|
13023
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13024
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13025
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13026
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13027
|
-
] })
|
|
13028
|
-
}
|
|
13029
|
-
)
|
|
13030
|
-
] }) }),
|
|
13031
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13032
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13033
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13034
|
-
] }) })
|
|
13035
|
-
]
|
|
13036
|
-
}
|
|
13037
|
-
) });
|
|
13038
|
-
};
|
|
13039
|
-
const schema = addressSchema;
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
13042
13042
|
routes: [
|
|
@@ -13057,10 +13057,6 @@ const routeModule = {
|
|
|
13057
13057
|
handle,
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
|
-
{
|
|
13061
|
-
Component: BillingAddress,
|
|
13062
|
-
path: "/draft-orders/:id/billing-address"
|
|
13063
|
-
},
|
|
13064
13060
|
{
|
|
13065
13061
|
Component: CustomItems,
|
|
13066
13062
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13073,6 +13069,10 @@ const routeModule = {
|
|
|
13073
13069
|
Component: Items,
|
|
13074
13070
|
path: "/draft-orders/:id/items"
|
|
13075
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: BillingAddress,
|
|
13074
|
+
path: "/draft-orders/:id/billing-address"
|
|
13075
|
+
},
|
|
13076
13076
|
{
|
|
13077
13077
|
Component: Metadata,
|
|
13078
13078
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13089,13 +13089,13 @@ const routeModule = {
|
|
|
13089
13089
|
Component: Shipping,
|
|
13090
13090
|
path: "/draft-orders/:id/shipping"
|
|
13091
13091
|
},
|
|
13092
|
-
{
|
|
13093
|
-
Component: TransferOwnership,
|
|
13094
|
-
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
|
-
},
|
|
13096
13092
|
{
|
|
13097
13093
|
Component: ShippingAddress,
|
|
13098
13094
|
path: "/draft-orders/:id/shipping-address"
|
|
13095
|
+
},
|
|
13096
|
+
{
|
|
13097
|
+
Component: TransferOwnership,
|
|
13098
|
+
path: "/draft-orders/:id/transfer-ownership"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|