@medusajs/draft-order 2.21.2 → 2.22.0-preview-20261002093930
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 +373 -373
- package/.medusa/server/src/admin/index.mjs +373 -373
- package/package.json +19 -19
|
@@ -6161,27 +6161,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
6161
6161
|
) });
|
|
6162
6162
|
};
|
|
6163
6163
|
const schema$5 = addressSchema;
|
|
6164
|
-
const CustomItems = () => {
|
|
6165
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
6166
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
6167
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
6168
|
-
] });
|
|
6169
|
-
};
|
|
6170
|
-
const CustomItemsForm = () => {
|
|
6171
|
-
const form = useForm({
|
|
6172
|
-
resolver: zodResolver(schema$4)
|
|
6173
|
-
});
|
|
6174
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
6175
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
6176
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
6177
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
6178
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
6179
|
-
] }) })
|
|
6180
|
-
] }) });
|
|
6181
|
-
};
|
|
6182
|
-
const schema$4 = z.object({
|
|
6183
|
-
email: z.string().email()
|
|
6184
|
-
});
|
|
6185
6164
|
const Email = () => {
|
|
6186
6165
|
const { id } = useParams();
|
|
6187
6166
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -6204,7 +6183,7 @@ const EmailForm = ({ order }) => {
|
|
|
6204
6183
|
defaultValues: {
|
|
6205
6184
|
email: order.email ?? ""
|
|
6206
6185
|
},
|
|
6207
|
-
resolver: zodResolver(schema$
|
|
6186
|
+
resolver: zodResolver(schema$4)
|
|
6208
6187
|
});
|
|
6209
6188
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
6210
6189
|
const { handleSuccess } = useRouteModal();
|
|
@@ -6247,7 +6226,7 @@ const EmailForm = ({ order }) => {
|
|
|
6247
6226
|
}
|
|
6248
6227
|
) });
|
|
6249
6228
|
};
|
|
6250
|
-
const schema$
|
|
6229
|
+
const schema$4 = z.object({
|
|
6251
6230
|
email: z.string().email()
|
|
6252
6231
|
});
|
|
6253
6232
|
const NumberInput = forwardRef(
|
|
@@ -7269,6 +7248,27 @@ const customItemSchema = z.object({
|
|
|
7269
7248
|
quantity: z.number(),
|
|
7270
7249
|
unit_price: z.union([z.number(), z.string()])
|
|
7271
7250
|
});
|
|
7251
|
+
const CustomItems = () => {
|
|
7252
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
7253
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
7254
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
7255
|
+
] });
|
|
7256
|
+
};
|
|
7257
|
+
const CustomItemsForm = () => {
|
|
7258
|
+
const form = useForm({
|
|
7259
|
+
resolver: zodResolver(schema$3)
|
|
7260
|
+
});
|
|
7261
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
7262
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
7263
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
7264
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
7265
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
7266
|
+
] }) })
|
|
7267
|
+
] }) });
|
|
7268
|
+
};
|
|
7269
|
+
const schema$3 = z.object({
|
|
7270
|
+
email: z.string().email()
|
|
7271
|
+
});
|
|
7272
7272
|
const InlineTip = forwardRef(
|
|
7273
7273
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
7274
7274
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -7894,6 +7894,112 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
7894
7894
|
}
|
|
7895
7895
|
return Array.from(promotionIds);
|
|
7896
7896
|
}
|
|
7897
|
+
const SalesChannel = () => {
|
|
7898
|
+
const { id } = useParams();
|
|
7899
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
7900
|
+
id,
|
|
7901
|
+
{
|
|
7902
|
+
fields: "+sales_channel_id"
|
|
7903
|
+
},
|
|
7904
|
+
{
|
|
7905
|
+
enabled: !!id
|
|
7906
|
+
}
|
|
7907
|
+
);
|
|
7908
|
+
if (isError) {
|
|
7909
|
+
throw error;
|
|
7910
|
+
}
|
|
7911
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
7912
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
7913
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
7914
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
7915
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
7916
|
+
] }),
|
|
7917
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
7918
|
+
] });
|
|
7919
|
+
};
|
|
7920
|
+
const SalesChannelForm = ({ order }) => {
|
|
7921
|
+
const form = useForm({
|
|
7922
|
+
defaultValues: {
|
|
7923
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
7924
|
+
},
|
|
7925
|
+
resolver: zodResolver(schema$2)
|
|
7926
|
+
});
|
|
7927
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
7928
|
+
const { handleSuccess } = useRouteModal();
|
|
7929
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
7930
|
+
await mutateAsync(
|
|
7931
|
+
{
|
|
7932
|
+
sales_channel_id: data.sales_channel_id
|
|
7933
|
+
},
|
|
7934
|
+
{
|
|
7935
|
+
onSuccess: () => {
|
|
7936
|
+
toast.success("Sales channel updated");
|
|
7937
|
+
handleSuccess();
|
|
7938
|
+
},
|
|
7939
|
+
onError: (error) => {
|
|
7940
|
+
toast.error(error.message);
|
|
7941
|
+
}
|
|
7942
|
+
}
|
|
7943
|
+
);
|
|
7944
|
+
});
|
|
7945
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
7946
|
+
KeyboundForm,
|
|
7947
|
+
{
|
|
7948
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
7949
|
+
onSubmit,
|
|
7950
|
+
children: [
|
|
7951
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
7952
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
7953
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
7954
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
7955
|
+
] }) })
|
|
7956
|
+
]
|
|
7957
|
+
}
|
|
7958
|
+
) });
|
|
7959
|
+
};
|
|
7960
|
+
const SalesChannelField = ({ control, order }) => {
|
|
7961
|
+
const salesChannels = useComboboxData({
|
|
7962
|
+
queryFn: async (params) => {
|
|
7963
|
+
return await sdk.admin.salesChannel.list(params);
|
|
7964
|
+
},
|
|
7965
|
+
queryKey: ["sales-channels"],
|
|
7966
|
+
getOptions: (data) => {
|
|
7967
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
7968
|
+
label: salesChannel.name,
|
|
7969
|
+
value: salesChannel.id
|
|
7970
|
+
}));
|
|
7971
|
+
},
|
|
7972
|
+
defaultValue: order.sales_channel_id || void 0
|
|
7973
|
+
});
|
|
7974
|
+
return /* @__PURE__ */ jsx(
|
|
7975
|
+
Form$2.Field,
|
|
7976
|
+
{
|
|
7977
|
+
control,
|
|
7978
|
+
name: "sales_channel_id",
|
|
7979
|
+
render: ({ field }) => {
|
|
7980
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
7981
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
7982
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
7983
|
+
Combobox,
|
|
7984
|
+
{
|
|
7985
|
+
options: salesChannels.options,
|
|
7986
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
7987
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
7988
|
+
searchValue: salesChannels.searchValue,
|
|
7989
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
7990
|
+
placeholder: "Select sales channel",
|
|
7991
|
+
...field
|
|
7992
|
+
}
|
|
7993
|
+
) }),
|
|
7994
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
7995
|
+
] });
|
|
7996
|
+
}
|
|
7997
|
+
}
|
|
7998
|
+
);
|
|
7999
|
+
};
|
|
8000
|
+
const schema$2 = z.object({
|
|
8001
|
+
sales_channel_id: z.string().min(1)
|
|
8002
|
+
});
|
|
7897
8003
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
7898
8004
|
const Shipping = () => {
|
|
7899
8005
|
const { id } = useParams();
|
|
@@ -8688,59 +8794,43 @@ const CustomAmountField = ({
|
|
|
8688
8794
|
}
|
|
8689
8795
|
);
|
|
8690
8796
|
};
|
|
8691
|
-
const
|
|
8797
|
+
const TransferOwnership = () => {
|
|
8692
8798
|
const { id } = useParams();
|
|
8693
|
-
const {
|
|
8694
|
-
fields: "
|
|
8799
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
8800
|
+
fields: "id,customer_id,customer.*"
|
|
8695
8801
|
});
|
|
8696
8802
|
if (isError) {
|
|
8697
8803
|
throw error;
|
|
8698
8804
|
}
|
|
8699
|
-
const isReady = !isPending && !!
|
|
8805
|
+
const isReady = !isPending && !!draft_order;
|
|
8700
8806
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
8701
8807
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
8702
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
8703
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
8808
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
|
|
8809
|
+
/* @__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" }) })
|
|
8704
8810
|
] }),
|
|
8705
|
-
isReady && /* @__PURE__ */ jsx(
|
|
8811
|
+
isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
|
|
8706
8812
|
] });
|
|
8707
8813
|
};
|
|
8708
|
-
const
|
|
8814
|
+
const TransferOwnershipForm = ({ order }) => {
|
|
8709
8815
|
const form = useForm({
|
|
8710
8816
|
defaultValues: {
|
|
8711
|
-
|
|
8712
|
-
last_name: order.shipping_address?.last_name ?? "",
|
|
8713
|
-
company: order.shipping_address?.company ?? "",
|
|
8714
|
-
address_1: order.shipping_address?.address_1 ?? "",
|
|
8715
|
-
address_2: order.shipping_address?.address_2 ?? "",
|
|
8716
|
-
city: order.shipping_address?.city ?? "",
|
|
8717
|
-
province: order.shipping_address?.province ?? "",
|
|
8718
|
-
country_code: order.shipping_address?.country_code ?? "",
|
|
8719
|
-
postal_code: order.shipping_address?.postal_code ?? "",
|
|
8720
|
-
phone: order.shipping_address?.phone ?? ""
|
|
8817
|
+
customer_id: order.customer_id || ""
|
|
8721
8818
|
},
|
|
8722
|
-
resolver: zodResolver(schema$
|
|
8819
|
+
resolver: zodResolver(schema$1)
|
|
8723
8820
|
});
|
|
8724
8821
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
8725
8822
|
const { handleSuccess } = useRouteModal();
|
|
8823
|
+
const name = [order.customer?.first_name, order.customer?.last_name].filter(Boolean).join(" ");
|
|
8824
|
+
const currentCustomer = order.customer ? {
|
|
8825
|
+
label: name ? `${name} (${order.customer.email})` : order.customer.email,
|
|
8826
|
+
value: order.customer.id
|
|
8827
|
+
} : null;
|
|
8726
8828
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
8727
8829
|
await mutateAsync(
|
|
8728
|
-
{
|
|
8729
|
-
shipping_address: {
|
|
8730
|
-
first_name: data.first_name,
|
|
8731
|
-
last_name: data.last_name,
|
|
8732
|
-
company: data.company,
|
|
8733
|
-
address_1: data.address_1,
|
|
8734
|
-
address_2: data.address_2,
|
|
8735
|
-
city: data.city,
|
|
8736
|
-
province: data.province,
|
|
8737
|
-
country_code: data.country_code,
|
|
8738
|
-
postal_code: data.postal_code,
|
|
8739
|
-
phone: data.phone
|
|
8740
|
-
}
|
|
8741
|
-
},
|
|
8830
|
+
{ customer_id: data.customer_id },
|
|
8742
8831
|
{
|
|
8743
8832
|
onSuccess: () => {
|
|
8833
|
+
toast.success("Customer updated");
|
|
8744
8834
|
handleSuccess();
|
|
8745
8835
|
},
|
|
8746
8836
|
onError: (error) => {
|
|
@@ -8755,312 +8845,20 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
8755
8845
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
8756
8846
|
onSubmit,
|
|
8757
8847
|
children: [
|
|
8758
|
-
/* @__PURE__ */
|
|
8759
|
-
/* @__PURE__ */ jsx(
|
|
8760
|
-
|
|
8761
|
-
{
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
}
|
|
8770
|
-
),
|
|
8771
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
8772
|
-
/* @__PURE__ */ jsx(
|
|
8773
|
-
Form$2.Field,
|
|
8774
|
-
{
|
|
8775
|
-
control: form.control,
|
|
8776
|
-
name: "first_name",
|
|
8777
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8778
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
8779
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8780
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8781
|
-
] })
|
|
8782
|
-
}
|
|
8783
|
-
),
|
|
8784
|
-
/* @__PURE__ */ jsx(
|
|
8785
|
-
Form$2.Field,
|
|
8786
|
-
{
|
|
8787
|
-
control: form.control,
|
|
8788
|
-
name: "last_name",
|
|
8789
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8790
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
8791
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8792
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8793
|
-
] })
|
|
8794
|
-
}
|
|
8795
|
-
)
|
|
8848
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
8849
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsx(Illustration, {}) }),
|
|
8850
|
+
currentCustomer && /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-3", children: [
|
|
8851
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
8852
|
+
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
|
|
8853
|
+
/* @__PURE__ */ jsx(Hint$1, { children: "The customer that is currently associated with this draft order." })
|
|
8854
|
+
] }),
|
|
8855
|
+
/* @__PURE__ */ jsxs(Select, { disabled: true, value: currentCustomer.value, children: [
|
|
8856
|
+
/* @__PURE__ */ jsx(Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
8857
|
+
/* @__PURE__ */ jsx(Select.Content, { children: /* @__PURE__ */ jsx(Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
|
|
8858
|
+
] })
|
|
8796
8859
|
] }),
|
|
8797
8860
|
/* @__PURE__ */ jsx(
|
|
8798
|
-
|
|
8799
|
-
{
|
|
8800
|
-
control: form.control,
|
|
8801
|
-
name: "company",
|
|
8802
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8803
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
8804
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8805
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8806
|
-
] })
|
|
8807
|
-
}
|
|
8808
|
-
),
|
|
8809
|
-
/* @__PURE__ */ jsx(
|
|
8810
|
-
Form$2.Field,
|
|
8811
|
-
{
|
|
8812
|
-
control: form.control,
|
|
8813
|
-
name: "address_1",
|
|
8814
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8815
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
8816
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8817
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8818
|
-
] })
|
|
8819
|
-
}
|
|
8820
|
-
),
|
|
8821
|
-
/* @__PURE__ */ jsx(
|
|
8822
|
-
Form$2.Field,
|
|
8823
|
-
{
|
|
8824
|
-
control: form.control,
|
|
8825
|
-
name: "address_2",
|
|
8826
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8827
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
8828
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8829
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8830
|
-
] })
|
|
8831
|
-
}
|
|
8832
|
-
),
|
|
8833
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
8834
|
-
/* @__PURE__ */ jsx(
|
|
8835
|
-
Form$2.Field,
|
|
8836
|
-
{
|
|
8837
|
-
control: form.control,
|
|
8838
|
-
name: "postal_code",
|
|
8839
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8840
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
8841
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8842
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8843
|
-
] })
|
|
8844
|
-
}
|
|
8845
|
-
),
|
|
8846
|
-
/* @__PURE__ */ jsx(
|
|
8847
|
-
Form$2.Field,
|
|
8848
|
-
{
|
|
8849
|
-
control: form.control,
|
|
8850
|
-
name: "city",
|
|
8851
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8852
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
8853
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8854
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8855
|
-
] })
|
|
8856
|
-
}
|
|
8857
|
-
)
|
|
8858
|
-
] }),
|
|
8859
|
-
/* @__PURE__ */ jsx(
|
|
8860
|
-
Form$2.Field,
|
|
8861
|
-
{
|
|
8862
|
-
control: form.control,
|
|
8863
|
-
name: "province",
|
|
8864
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8865
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
8866
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8867
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8868
|
-
] })
|
|
8869
|
-
}
|
|
8870
|
-
),
|
|
8871
|
-
/* @__PURE__ */ jsx(
|
|
8872
|
-
Form$2.Field,
|
|
8873
|
-
{
|
|
8874
|
-
control: form.control,
|
|
8875
|
-
name: "phone",
|
|
8876
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8877
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
8878
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
8879
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8880
|
-
] })
|
|
8881
|
-
}
|
|
8882
|
-
)
|
|
8883
|
-
] }) }),
|
|
8884
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
8885
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
8886
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
8887
|
-
] }) })
|
|
8888
|
-
]
|
|
8889
|
-
}
|
|
8890
|
-
) });
|
|
8891
|
-
};
|
|
8892
|
-
const schema$2 = addressSchema;
|
|
8893
|
-
const SalesChannel = () => {
|
|
8894
|
-
const { id } = useParams();
|
|
8895
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
8896
|
-
id,
|
|
8897
|
-
{
|
|
8898
|
-
fields: "+sales_channel_id"
|
|
8899
|
-
},
|
|
8900
|
-
{
|
|
8901
|
-
enabled: !!id
|
|
8902
|
-
}
|
|
8903
|
-
);
|
|
8904
|
-
if (isError) {
|
|
8905
|
-
throw error;
|
|
8906
|
-
}
|
|
8907
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
8908
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
8909
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
8910
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
8911
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
8912
|
-
] }),
|
|
8913
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
8914
|
-
] });
|
|
8915
|
-
};
|
|
8916
|
-
const SalesChannelForm = ({ order }) => {
|
|
8917
|
-
const form = useForm({
|
|
8918
|
-
defaultValues: {
|
|
8919
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
8920
|
-
},
|
|
8921
|
-
resolver: zodResolver(schema$1)
|
|
8922
|
-
});
|
|
8923
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
8924
|
-
const { handleSuccess } = useRouteModal();
|
|
8925
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
8926
|
-
await mutateAsync(
|
|
8927
|
-
{
|
|
8928
|
-
sales_channel_id: data.sales_channel_id
|
|
8929
|
-
},
|
|
8930
|
-
{
|
|
8931
|
-
onSuccess: () => {
|
|
8932
|
-
toast.success("Sales channel updated");
|
|
8933
|
-
handleSuccess();
|
|
8934
|
-
},
|
|
8935
|
-
onError: (error) => {
|
|
8936
|
-
toast.error(error.message);
|
|
8937
|
-
}
|
|
8938
|
-
}
|
|
8939
|
-
);
|
|
8940
|
-
});
|
|
8941
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
8942
|
-
KeyboundForm,
|
|
8943
|
-
{
|
|
8944
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
8945
|
-
onSubmit,
|
|
8946
|
-
children: [
|
|
8947
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
8948
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
8949
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
8950
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
8951
|
-
] }) })
|
|
8952
|
-
]
|
|
8953
|
-
}
|
|
8954
|
-
) });
|
|
8955
|
-
};
|
|
8956
|
-
const SalesChannelField = ({ control, order }) => {
|
|
8957
|
-
const salesChannels = useComboboxData({
|
|
8958
|
-
queryFn: async (params) => {
|
|
8959
|
-
return await sdk.admin.salesChannel.list(params);
|
|
8960
|
-
},
|
|
8961
|
-
queryKey: ["sales-channels"],
|
|
8962
|
-
getOptions: (data) => {
|
|
8963
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
8964
|
-
label: salesChannel.name,
|
|
8965
|
-
value: salesChannel.id
|
|
8966
|
-
}));
|
|
8967
|
-
},
|
|
8968
|
-
defaultValue: order.sales_channel_id || void 0
|
|
8969
|
-
});
|
|
8970
|
-
return /* @__PURE__ */ jsx(
|
|
8971
|
-
Form$2.Field,
|
|
8972
|
-
{
|
|
8973
|
-
control,
|
|
8974
|
-
name: "sales_channel_id",
|
|
8975
|
-
render: ({ field }) => {
|
|
8976
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
8977
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
8978
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
8979
|
-
Combobox,
|
|
8980
|
-
{
|
|
8981
|
-
options: salesChannels.options,
|
|
8982
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
8983
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
8984
|
-
searchValue: salesChannels.searchValue,
|
|
8985
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
8986
|
-
placeholder: "Select sales channel",
|
|
8987
|
-
...field
|
|
8988
|
-
}
|
|
8989
|
-
) }),
|
|
8990
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
8991
|
-
] });
|
|
8992
|
-
}
|
|
8993
|
-
}
|
|
8994
|
-
);
|
|
8995
|
-
};
|
|
8996
|
-
const schema$1 = z.object({
|
|
8997
|
-
sales_channel_id: z.string().min(1)
|
|
8998
|
-
});
|
|
8999
|
-
const TransferOwnership = () => {
|
|
9000
|
-
const { id } = useParams();
|
|
9001
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
9002
|
-
fields: "id,customer_id,customer.*"
|
|
9003
|
-
});
|
|
9004
|
-
if (isError) {
|
|
9005
|
-
throw error;
|
|
9006
|
-
}
|
|
9007
|
-
const isReady = !isPending && !!draft_order;
|
|
9008
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9009
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9010
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
|
|
9011
|
-
/* @__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" }) })
|
|
9012
|
-
] }),
|
|
9013
|
-
isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
|
|
9014
|
-
] });
|
|
9015
|
-
};
|
|
9016
|
-
const TransferOwnershipForm = ({ order }) => {
|
|
9017
|
-
const form = useForm({
|
|
9018
|
-
defaultValues: {
|
|
9019
|
-
customer_id: order.customer_id || ""
|
|
9020
|
-
},
|
|
9021
|
-
resolver: zodResolver(schema)
|
|
9022
|
-
});
|
|
9023
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9024
|
-
const { handleSuccess } = useRouteModal();
|
|
9025
|
-
const name = [order.customer?.first_name, order.customer?.last_name].filter(Boolean).join(" ");
|
|
9026
|
-
const currentCustomer = order.customer ? {
|
|
9027
|
-
label: name ? `${name} (${order.customer.email})` : order.customer.email,
|
|
9028
|
-
value: order.customer.id
|
|
9029
|
-
} : null;
|
|
9030
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9031
|
-
await mutateAsync(
|
|
9032
|
-
{ customer_id: data.customer_id },
|
|
9033
|
-
{
|
|
9034
|
-
onSuccess: () => {
|
|
9035
|
-
toast.success("Customer updated");
|
|
9036
|
-
handleSuccess();
|
|
9037
|
-
},
|
|
9038
|
-
onError: (error) => {
|
|
9039
|
-
toast.error(error.message);
|
|
9040
|
-
}
|
|
9041
|
-
}
|
|
9042
|
-
);
|
|
9043
|
-
});
|
|
9044
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9045
|
-
KeyboundForm,
|
|
9046
|
-
{
|
|
9047
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9048
|
-
onSubmit,
|
|
9049
|
-
children: [
|
|
9050
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
9051
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsx(Illustration, {}) }),
|
|
9052
|
-
currentCustomer && /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-3", children: [
|
|
9053
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
9054
|
-
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
|
|
9055
|
-
/* @__PURE__ */ jsx(Hint$1, { children: "The customer that is currently associated with this draft order." })
|
|
9056
|
-
] }),
|
|
9057
|
-
/* @__PURE__ */ jsxs(Select, { disabled: true, value: currentCustomer.value, children: [
|
|
9058
|
-
/* @__PURE__ */ jsx(Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
9059
|
-
/* @__PURE__ */ jsx(Select.Content, { children: /* @__PURE__ */ jsx(Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
|
|
9060
|
-
] })
|
|
9061
|
-
] }),
|
|
9062
|
-
/* @__PURE__ */ jsx(
|
|
9063
|
-
CustomerField,
|
|
8861
|
+
CustomerField,
|
|
9064
8862
|
{
|
|
9065
8863
|
control: form.control,
|
|
9066
8864
|
currentCustomerId: order.customer_id
|
|
@@ -9468,9 +9266,211 @@ const Illustration = () => {
|
|
|
9468
9266
|
}
|
|
9469
9267
|
);
|
|
9470
9268
|
};
|
|
9471
|
-
const schema = z.object({
|
|
9269
|
+
const schema$1 = z.object({
|
|
9472
9270
|
customer_id: z.string().min(1)
|
|
9473
9271
|
});
|
|
9272
|
+
const ShippingAddress = () => {
|
|
9273
|
+
const { id } = useParams();
|
|
9274
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9275
|
+
fields: "+shipping_address"
|
|
9276
|
+
});
|
|
9277
|
+
if (isError) {
|
|
9278
|
+
throw error;
|
|
9279
|
+
}
|
|
9280
|
+
const isReady = !isPending && !!order;
|
|
9281
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9282
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9283
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
9284
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
9285
|
+
] }),
|
|
9286
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
9287
|
+
] });
|
|
9288
|
+
};
|
|
9289
|
+
const ShippingAddressForm = ({ order }) => {
|
|
9290
|
+
const form = useForm({
|
|
9291
|
+
defaultValues: {
|
|
9292
|
+
first_name: order.shipping_address?.first_name ?? "",
|
|
9293
|
+
last_name: order.shipping_address?.last_name ?? "",
|
|
9294
|
+
company: order.shipping_address?.company ?? "",
|
|
9295
|
+
address_1: order.shipping_address?.address_1 ?? "",
|
|
9296
|
+
address_2: order.shipping_address?.address_2 ?? "",
|
|
9297
|
+
city: order.shipping_address?.city ?? "",
|
|
9298
|
+
province: order.shipping_address?.province ?? "",
|
|
9299
|
+
country_code: order.shipping_address?.country_code ?? "",
|
|
9300
|
+
postal_code: order.shipping_address?.postal_code ?? "",
|
|
9301
|
+
phone: order.shipping_address?.phone ?? ""
|
|
9302
|
+
},
|
|
9303
|
+
resolver: zodResolver(schema)
|
|
9304
|
+
});
|
|
9305
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9306
|
+
const { handleSuccess } = useRouteModal();
|
|
9307
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9308
|
+
await mutateAsync(
|
|
9309
|
+
{
|
|
9310
|
+
shipping_address: {
|
|
9311
|
+
first_name: data.first_name,
|
|
9312
|
+
last_name: data.last_name,
|
|
9313
|
+
company: data.company,
|
|
9314
|
+
address_1: data.address_1,
|
|
9315
|
+
address_2: data.address_2,
|
|
9316
|
+
city: data.city,
|
|
9317
|
+
province: data.province,
|
|
9318
|
+
country_code: data.country_code,
|
|
9319
|
+
postal_code: data.postal_code,
|
|
9320
|
+
phone: data.phone
|
|
9321
|
+
}
|
|
9322
|
+
},
|
|
9323
|
+
{
|
|
9324
|
+
onSuccess: () => {
|
|
9325
|
+
handleSuccess();
|
|
9326
|
+
},
|
|
9327
|
+
onError: (error) => {
|
|
9328
|
+
toast.error(error.message);
|
|
9329
|
+
}
|
|
9330
|
+
}
|
|
9331
|
+
);
|
|
9332
|
+
});
|
|
9333
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9334
|
+
KeyboundForm,
|
|
9335
|
+
{
|
|
9336
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9337
|
+
onSubmit,
|
|
9338
|
+
children: [
|
|
9339
|
+
/* @__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: [
|
|
9340
|
+
/* @__PURE__ */ jsx(
|
|
9341
|
+
Form$2.Field,
|
|
9342
|
+
{
|
|
9343
|
+
control: form.control,
|
|
9344
|
+
name: "country_code",
|
|
9345
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9346
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9347
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9348
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9349
|
+
] })
|
|
9350
|
+
}
|
|
9351
|
+
),
|
|
9352
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9353
|
+
/* @__PURE__ */ jsx(
|
|
9354
|
+
Form$2.Field,
|
|
9355
|
+
{
|
|
9356
|
+
control: form.control,
|
|
9357
|
+
name: "first_name",
|
|
9358
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9359
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9360
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9361
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9362
|
+
] })
|
|
9363
|
+
}
|
|
9364
|
+
),
|
|
9365
|
+
/* @__PURE__ */ jsx(
|
|
9366
|
+
Form$2.Field,
|
|
9367
|
+
{
|
|
9368
|
+
control: form.control,
|
|
9369
|
+
name: "last_name",
|
|
9370
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9371
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9372
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9373
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9374
|
+
] })
|
|
9375
|
+
}
|
|
9376
|
+
)
|
|
9377
|
+
] }),
|
|
9378
|
+
/* @__PURE__ */ jsx(
|
|
9379
|
+
Form$2.Field,
|
|
9380
|
+
{
|
|
9381
|
+
control: form.control,
|
|
9382
|
+
name: "company",
|
|
9383
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9384
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9385
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9386
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9387
|
+
] })
|
|
9388
|
+
}
|
|
9389
|
+
),
|
|
9390
|
+
/* @__PURE__ */ jsx(
|
|
9391
|
+
Form$2.Field,
|
|
9392
|
+
{
|
|
9393
|
+
control: form.control,
|
|
9394
|
+
name: "address_1",
|
|
9395
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9396
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9397
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9398
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9399
|
+
] })
|
|
9400
|
+
}
|
|
9401
|
+
),
|
|
9402
|
+
/* @__PURE__ */ jsx(
|
|
9403
|
+
Form$2.Field,
|
|
9404
|
+
{
|
|
9405
|
+
control: form.control,
|
|
9406
|
+
name: "address_2",
|
|
9407
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9408
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9409
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9410
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9411
|
+
] })
|
|
9412
|
+
}
|
|
9413
|
+
),
|
|
9414
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9415
|
+
/* @__PURE__ */ jsx(
|
|
9416
|
+
Form$2.Field,
|
|
9417
|
+
{
|
|
9418
|
+
control: form.control,
|
|
9419
|
+
name: "postal_code",
|
|
9420
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9421
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9422
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9423
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9424
|
+
] })
|
|
9425
|
+
}
|
|
9426
|
+
),
|
|
9427
|
+
/* @__PURE__ */ jsx(
|
|
9428
|
+
Form$2.Field,
|
|
9429
|
+
{
|
|
9430
|
+
control: form.control,
|
|
9431
|
+
name: "city",
|
|
9432
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9433
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9434
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9435
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9436
|
+
] })
|
|
9437
|
+
}
|
|
9438
|
+
)
|
|
9439
|
+
] }),
|
|
9440
|
+
/* @__PURE__ */ jsx(
|
|
9441
|
+
Form$2.Field,
|
|
9442
|
+
{
|
|
9443
|
+
control: form.control,
|
|
9444
|
+
name: "province",
|
|
9445
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9446
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9447
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9448
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9449
|
+
] })
|
|
9450
|
+
}
|
|
9451
|
+
),
|
|
9452
|
+
/* @__PURE__ */ jsx(
|
|
9453
|
+
Form$2.Field,
|
|
9454
|
+
{
|
|
9455
|
+
control: form.control,
|
|
9456
|
+
name: "phone",
|
|
9457
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9458
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9459
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9460
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9461
|
+
] })
|
|
9462
|
+
}
|
|
9463
|
+
)
|
|
9464
|
+
] }) }),
|
|
9465
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9466
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9467
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9468
|
+
] }) })
|
|
9469
|
+
]
|
|
9470
|
+
}
|
|
9471
|
+
) });
|
|
9472
|
+
};
|
|
9473
|
+
const schema = addressSchema;
|
|
9474
9474
|
const widgetModule = { widgets: [] };
|
|
9475
9475
|
const routeModule = {
|
|
9476
9476
|
routes: [
|
|
@@ -9495,10 +9495,6 @@ const routeModule = {
|
|
|
9495
9495
|
Component: BillingAddress,
|
|
9496
9496
|
path: "/draft-orders/:id/billing-address"
|
|
9497
9497
|
},
|
|
9498
|
-
{
|
|
9499
|
-
Component: CustomItems,
|
|
9500
|
-
path: "/draft-orders/:id/custom-items"
|
|
9501
|
-
},
|
|
9502
9498
|
{
|
|
9503
9499
|
Component: Email,
|
|
9504
9500
|
path: "/draft-orders/:id/email"
|
|
@@ -9507,6 +9503,10 @@ const routeModule = {
|
|
|
9507
9503
|
Component: Items,
|
|
9508
9504
|
path: "/draft-orders/:id/items"
|
|
9509
9505
|
},
|
|
9506
|
+
{
|
|
9507
|
+
Component: CustomItems,
|
|
9508
|
+
path: "/draft-orders/:id/custom-items"
|
|
9509
|
+
},
|
|
9510
9510
|
{
|
|
9511
9511
|
Component: Metadata,
|
|
9512
9512
|
path: "/draft-orders/:id/metadata"
|
|
@@ -9515,21 +9515,21 @@ const routeModule = {
|
|
|
9515
9515
|
Component: Promotions,
|
|
9516
9516
|
path: "/draft-orders/:id/promotions"
|
|
9517
9517
|
},
|
|
9518
|
-
{
|
|
9519
|
-
Component: Shipping,
|
|
9520
|
-
path: "/draft-orders/:id/shipping"
|
|
9521
|
-
},
|
|
9522
|
-
{
|
|
9523
|
-
Component: ShippingAddress,
|
|
9524
|
-
path: "/draft-orders/:id/shipping-address"
|
|
9525
|
-
},
|
|
9526
9518
|
{
|
|
9527
9519
|
Component: SalesChannel,
|
|
9528
9520
|
path: "/draft-orders/:id/sales-channel"
|
|
9529
9521
|
},
|
|
9522
|
+
{
|
|
9523
|
+
Component: Shipping,
|
|
9524
|
+
path: "/draft-orders/:id/shipping"
|
|
9525
|
+
},
|
|
9530
9526
|
{
|
|
9531
9527
|
Component: TransferOwnership,
|
|
9532
9528
|
path: "/draft-orders/:id/transfer-ownership"
|
|
9529
|
+
},
|
|
9530
|
+
{
|
|
9531
|
+
Component: ShippingAddress,
|
|
9532
|
+
path: "/draft-orders/:id/shipping-address"
|
|
9533
9533
|
}
|
|
9534
9534
|
]
|
|
9535
9535
|
}
|