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