@medusajs/draft-order 2.11.1-preview-20251024060204 → 2.11.1-preview-20251024120210
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 +478 -478
- package/.medusa/server/src/admin/index.mjs +478 -478
- 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
|
},
|
|
@@ -11533,24 +11533,227 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11533
11533
|
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11534
11534
|
Combobox,
|
|
11535
11535
|
{
|
|
11536
|
-
options: salesChannels.options,
|
|
11537
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11538
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11539
|
-
searchValue: salesChannels.searchValue,
|
|
11540
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11541
|
-
placeholder: "Select sales channel",
|
|
11542
|
-
...field
|
|
11536
|
+
options: salesChannels.options,
|
|
11537
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11538
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11539
|
+
searchValue: salesChannels.searchValue,
|
|
11540
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11541
|
+
placeholder: "Select sales channel",
|
|
11542
|
+
...field
|
|
11543
|
+
}
|
|
11544
|
+
) }),
|
|
11545
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11546
|
+
] });
|
|
11547
|
+
}
|
|
11548
|
+
}
|
|
11549
|
+
);
|
|
11550
|
+
};
|
|
11551
|
+
const schema$2 = objectType({
|
|
11552
|
+
sales_channel_id: stringType().min(1)
|
|
11553
|
+
});
|
|
11554
|
+
const ShippingAddress = () => {
|
|
11555
|
+
const { id } = useParams();
|
|
11556
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11557
|
+
fields: "+shipping_address"
|
|
11558
|
+
});
|
|
11559
|
+
if (isError) {
|
|
11560
|
+
throw error;
|
|
11561
|
+
}
|
|
11562
|
+
const isReady = !isPending && !!order;
|
|
11563
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11564
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11565
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
11566
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11567
|
+
] }),
|
|
11568
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
11569
|
+
] });
|
|
11570
|
+
};
|
|
11571
|
+
const ShippingAddressForm = ({ order }) => {
|
|
11572
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11573
|
+
const form = useForm({
|
|
11574
|
+
defaultValues: {
|
|
11575
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11576
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11577
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11578
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11579
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11580
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11581
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11582
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11583
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11584
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11585
|
+
},
|
|
11586
|
+
resolver: zodResolver(schema$1)
|
|
11587
|
+
});
|
|
11588
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11589
|
+
const { handleSuccess } = useRouteModal();
|
|
11590
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11591
|
+
await mutateAsync(
|
|
11592
|
+
{
|
|
11593
|
+
shipping_address: {
|
|
11594
|
+
first_name: data.first_name,
|
|
11595
|
+
last_name: data.last_name,
|
|
11596
|
+
company: data.company,
|
|
11597
|
+
address_1: data.address_1,
|
|
11598
|
+
address_2: data.address_2,
|
|
11599
|
+
city: data.city,
|
|
11600
|
+
province: data.province,
|
|
11601
|
+
country_code: data.country_code,
|
|
11602
|
+
postal_code: data.postal_code,
|
|
11603
|
+
phone: data.phone
|
|
11604
|
+
}
|
|
11605
|
+
},
|
|
11606
|
+
{
|
|
11607
|
+
onSuccess: () => {
|
|
11608
|
+
handleSuccess();
|
|
11609
|
+
},
|
|
11610
|
+
onError: (error) => {
|
|
11611
|
+
toast.error(error.message);
|
|
11612
|
+
}
|
|
11613
|
+
}
|
|
11614
|
+
);
|
|
11615
|
+
});
|
|
11616
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11617
|
+
KeyboundForm,
|
|
11618
|
+
{
|
|
11619
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11620
|
+
onSubmit,
|
|
11621
|
+
children: [
|
|
11622
|
+
/* @__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: [
|
|
11623
|
+
/* @__PURE__ */ jsx(
|
|
11624
|
+
Form$2.Field,
|
|
11625
|
+
{
|
|
11626
|
+
control: form.control,
|
|
11627
|
+
name: "country_code",
|
|
11628
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11629
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11630
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11631
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11632
|
+
] })
|
|
11633
|
+
}
|
|
11634
|
+
),
|
|
11635
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11636
|
+
/* @__PURE__ */ jsx(
|
|
11637
|
+
Form$2.Field,
|
|
11638
|
+
{
|
|
11639
|
+
control: form.control,
|
|
11640
|
+
name: "first_name",
|
|
11641
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11642
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11643
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11644
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11645
|
+
] })
|
|
11646
|
+
}
|
|
11647
|
+
),
|
|
11648
|
+
/* @__PURE__ */ jsx(
|
|
11649
|
+
Form$2.Field,
|
|
11650
|
+
{
|
|
11651
|
+
control: form.control,
|
|
11652
|
+
name: "last_name",
|
|
11653
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11654
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11655
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11656
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11657
|
+
] })
|
|
11658
|
+
}
|
|
11659
|
+
)
|
|
11660
|
+
] }),
|
|
11661
|
+
/* @__PURE__ */ jsx(
|
|
11662
|
+
Form$2.Field,
|
|
11663
|
+
{
|
|
11664
|
+
control: form.control,
|
|
11665
|
+
name: "company",
|
|
11666
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11667
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11668
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11669
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11670
|
+
] })
|
|
11671
|
+
}
|
|
11672
|
+
),
|
|
11673
|
+
/* @__PURE__ */ jsx(
|
|
11674
|
+
Form$2.Field,
|
|
11675
|
+
{
|
|
11676
|
+
control: form.control,
|
|
11677
|
+
name: "address_1",
|
|
11678
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11679
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11680
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11681
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11682
|
+
] })
|
|
11683
|
+
}
|
|
11684
|
+
),
|
|
11685
|
+
/* @__PURE__ */ jsx(
|
|
11686
|
+
Form$2.Field,
|
|
11687
|
+
{
|
|
11688
|
+
control: form.control,
|
|
11689
|
+
name: "address_2",
|
|
11690
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11691
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11692
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11693
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11694
|
+
] })
|
|
11695
|
+
}
|
|
11696
|
+
),
|
|
11697
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11698
|
+
/* @__PURE__ */ jsx(
|
|
11699
|
+
Form$2.Field,
|
|
11700
|
+
{
|
|
11701
|
+
control: form.control,
|
|
11702
|
+
name: "postal_code",
|
|
11703
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11704
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11705
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11706
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11707
|
+
] })
|
|
11708
|
+
}
|
|
11709
|
+
),
|
|
11710
|
+
/* @__PURE__ */ jsx(
|
|
11711
|
+
Form$2.Field,
|
|
11712
|
+
{
|
|
11713
|
+
control: form.control,
|
|
11714
|
+
name: "city",
|
|
11715
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11716
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11717
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11718
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11719
|
+
] })
|
|
11720
|
+
}
|
|
11721
|
+
)
|
|
11722
|
+
] }),
|
|
11723
|
+
/* @__PURE__ */ jsx(
|
|
11724
|
+
Form$2.Field,
|
|
11725
|
+
{
|
|
11726
|
+
control: form.control,
|
|
11727
|
+
name: "province",
|
|
11728
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11729
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11730
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11731
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11732
|
+
] })
|
|
11733
|
+
}
|
|
11734
|
+
),
|
|
11735
|
+
/* @__PURE__ */ jsx(
|
|
11736
|
+
Form$2.Field,
|
|
11737
|
+
{
|
|
11738
|
+
control: form.control,
|
|
11739
|
+
name: "phone",
|
|
11740
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11741
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11742
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11743
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11744
|
+
] })
|
|
11543
11745
|
}
|
|
11544
|
-
)
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11746
|
+
)
|
|
11747
|
+
] }) }),
|
|
11748
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11749
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11750
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11751
|
+
] }) })
|
|
11752
|
+
]
|
|
11548
11753
|
}
|
|
11549
|
-
);
|
|
11754
|
+
) });
|
|
11550
11755
|
};
|
|
11551
|
-
const schema$
|
|
11552
|
-
sales_channel_id: stringType().min(1)
|
|
11553
|
-
});
|
|
11756
|
+
const schema$1 = addressSchema;
|
|
11554
11757
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11555
11758
|
const Shipping = () => {
|
|
11556
11759
|
var _a;
|
|
@@ -12381,7 +12584,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12381
12584
|
defaultValues: {
|
|
12382
12585
|
customer_id: order.customer_id || ""
|
|
12383
12586
|
},
|
|
12384
|
-
resolver: zodResolver(schema
|
|
12587
|
+
resolver: zodResolver(schema)
|
|
12385
12588
|
});
|
|
12386
12589
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12387
12590
|
const { handleSuccess } = useRouteModal();
|
|
@@ -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"
|
|
@@ -13085,6 +13085,10 @@ const routeModule = {
|
|
|
13085
13085
|
Component: SalesChannel,
|
|
13086
13086
|
path: "/draft-orders/:id/sales-channel"
|
|
13087
13087
|
},
|
|
13088
|
+
{
|
|
13089
|
+
Component: ShippingAddress,
|
|
13090
|
+
path: "/draft-orders/:id/shipping-address"
|
|
13091
|
+
},
|
|
13088
13092
|
{
|
|
13089
13093
|
Component: Shipping,
|
|
13090
13094
|
path: "/draft-orders/:id/shipping"
|
|
@@ -13092,10 +13096,6 @@ const routeModule = {
|
|
|
13092
13096
|
{
|
|
13093
13097
|
Component: TransferOwnership,
|
|
13094
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
|
-
},
|
|
13096
|
-
{
|
|
13097
|
-
Component: ShippingAddress,
|
|
13098
|
-
path: "/draft-orders/:id/shipping-address"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|