@medusajs/draft-order 2.10.4-snapshot-20250926124023 → 2.10.4-snapshot-20250926180407
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 +354 -354
- package/.medusa/server/src/admin/index.mjs +354 -354
- package/package.json +16 -16
|
@@ -9573,10 +9573,31 @@ const ID = () => {
|
|
|
9573
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9574
9574
|
] });
|
|
9575
9575
|
};
|
|
9576
|
-
const
|
|
9576
|
+
const CustomItems = () => {
|
|
9577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9578
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9579
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9580
|
+
] });
|
|
9581
|
+
};
|
|
9582
|
+
const CustomItemsForm = () => {
|
|
9583
|
+
const form = reactHookForm.useForm({
|
|
9584
|
+
resolver: zod.zodResolver(schema$5)
|
|
9585
|
+
});
|
|
9586
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9587
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9588
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9589
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9590
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9591
|
+
] }) })
|
|
9592
|
+
] }) });
|
|
9593
|
+
};
|
|
9594
|
+
const schema$5 = objectType({
|
|
9595
|
+
email: stringType().email()
|
|
9596
|
+
});
|
|
9597
|
+
const Email = () => {
|
|
9577
9598
|
const { id } = reactRouterDom.useParams();
|
|
9578
9599
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9579
|
-
fields: "+
|
|
9600
|
+
fields: "+email"
|
|
9580
9601
|
});
|
|
9581
9602
|
if (isError) {
|
|
9582
9603
|
throw error;
|
|
@@ -9584,34 +9605,24 @@ const BillingAddress = () => {
|
|
|
9584
9605
|
const isReady = !isPending && !!order;
|
|
9585
9606
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9586
9607
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9587
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
9588
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the
|
|
9608
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9609
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9589
9610
|
] }),
|
|
9590
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9611
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9591
9612
|
] });
|
|
9592
9613
|
};
|
|
9593
|
-
const
|
|
9594
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9614
|
+
const EmailForm = ({ order }) => {
|
|
9595
9615
|
const form = reactHookForm.useForm({
|
|
9596
9616
|
defaultValues: {
|
|
9597
|
-
|
|
9598
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9599
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9600
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9601
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9602
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9603
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9604
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9605
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9606
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9617
|
+
email: order.email ?? ""
|
|
9607
9618
|
},
|
|
9608
|
-
resolver: zod.zodResolver(schema$
|
|
9619
|
+
resolver: zod.zodResolver(schema$4)
|
|
9609
9620
|
});
|
|
9610
9621
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9611
9622
|
const { handleSuccess } = useRouteModal();
|
|
9612
9623
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
9613
9624
|
await mutateAsync(
|
|
9614
|
-
{
|
|
9625
|
+
{ email: data.email },
|
|
9615
9626
|
{
|
|
9616
9627
|
onSuccess: () => {
|
|
9617
9628
|
handleSuccess();
|
|
@@ -9628,132 +9639,18 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9628
9639
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9629
9640
|
onSubmit,
|
|
9630
9641
|
children: [
|
|
9631
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
),
|
|
9644
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9645
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9646
|
-
Form$2.Field,
|
|
9647
|
-
{
|
|
9648
|
-
control: form.control,
|
|
9649
|
-
name: "first_name",
|
|
9650
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9652
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9653
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9654
|
-
] })
|
|
9655
|
-
}
|
|
9656
|
-
),
|
|
9657
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9658
|
-
Form$2.Field,
|
|
9659
|
-
{
|
|
9660
|
-
control: form.control,
|
|
9661
|
-
name: "last_name",
|
|
9662
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9664
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9665
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9666
|
-
] })
|
|
9667
|
-
}
|
|
9668
|
-
)
|
|
9669
|
-
] }),
|
|
9670
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9671
|
-
Form$2.Field,
|
|
9672
|
-
{
|
|
9673
|
-
control: form.control,
|
|
9674
|
-
name: "company",
|
|
9675
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9677
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9678
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9679
|
-
] })
|
|
9680
|
-
}
|
|
9681
|
-
),
|
|
9682
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9683
|
-
Form$2.Field,
|
|
9684
|
-
{
|
|
9685
|
-
control: form.control,
|
|
9686
|
-
name: "address_1",
|
|
9687
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9689
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9690
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9691
|
-
] })
|
|
9692
|
-
}
|
|
9693
|
-
),
|
|
9694
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9695
|
-
Form$2.Field,
|
|
9696
|
-
{
|
|
9697
|
-
control: form.control,
|
|
9698
|
-
name: "address_2",
|
|
9699
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9701
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9702
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9703
|
-
] })
|
|
9704
|
-
}
|
|
9705
|
-
),
|
|
9706
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9707
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9708
|
-
Form$2.Field,
|
|
9709
|
-
{
|
|
9710
|
-
control: form.control,
|
|
9711
|
-
name: "postal_code",
|
|
9712
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
9714
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9715
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9716
|
-
] })
|
|
9717
|
-
}
|
|
9718
|
-
),
|
|
9719
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9720
|
-
Form$2.Field,
|
|
9721
|
-
{
|
|
9722
|
-
control: form.control,
|
|
9723
|
-
name: "city",
|
|
9724
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9726
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9727
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9728
|
-
] })
|
|
9729
|
-
}
|
|
9730
|
-
)
|
|
9731
|
-
] }),
|
|
9732
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9733
|
-
Form$2.Field,
|
|
9734
|
-
{
|
|
9735
|
-
control: form.control,
|
|
9736
|
-
name: "province",
|
|
9737
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9739
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9740
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9741
|
-
] })
|
|
9742
|
-
}
|
|
9743
|
-
),
|
|
9744
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9745
|
-
Form$2.Field,
|
|
9746
|
-
{
|
|
9747
|
-
control: form.control,
|
|
9748
|
-
name: "phone",
|
|
9749
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9750
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9751
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9752
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9753
|
-
] })
|
|
9754
|
-
}
|
|
9755
|
-
)
|
|
9756
|
-
] }) }),
|
|
9642
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9643
|
+
Form$2.Field,
|
|
9644
|
+
{
|
|
9645
|
+
control: form.control,
|
|
9646
|
+
name: "email",
|
|
9647
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9648
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9649
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9650
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9651
|
+
] })
|
|
9652
|
+
}
|
|
9653
|
+
) }),
|
|
9757
9654
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9758
9655
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9759
9656
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -9762,25 +9659,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9659
|
}
|
|
9763
9660
|
) });
|
|
9764
9661
|
};
|
|
9765
|
-
const schema$5 = addressSchema;
|
|
9766
|
-
const CustomItems = () => {
|
|
9767
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9768
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9769
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9770
|
-
] });
|
|
9771
|
-
};
|
|
9772
|
-
const CustomItemsForm = () => {
|
|
9773
|
-
const form = reactHookForm.useForm({
|
|
9774
|
-
resolver: zod.zodResolver(schema$4)
|
|
9775
|
-
});
|
|
9776
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9779
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9780
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9781
|
-
] }) })
|
|
9782
|
-
] }) });
|
|
9783
|
-
};
|
|
9784
9662
|
const schema$4 = objectType({
|
|
9785
9663
|
email: stringType().email()
|
|
9786
9664
|
});
|
|
@@ -11385,59 +11263,165 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11385
11263
|
}
|
|
11386
11264
|
return Array.from(promotionIds);
|
|
11387
11265
|
}
|
|
11388
|
-
const
|
|
11389
|
-
const Shipping = () => {
|
|
11390
|
-
var _a;
|
|
11266
|
+
const SalesChannel = () => {
|
|
11391
11267
|
const { id } = reactRouterDom.useParams();
|
|
11392
|
-
const {
|
|
11393
|
-
|
|
11394
|
-
});
|
|
11395
|
-
const {
|
|
11396
|
-
order: preview,
|
|
11397
|
-
isPending: isPreviewPending,
|
|
11398
|
-
isError: isPreviewError,
|
|
11399
|
-
error: previewError
|
|
11400
|
-
} = useOrderPreview(id);
|
|
11401
|
-
useInitiateOrderEdit({ preview });
|
|
11402
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11403
|
-
if (isError) {
|
|
11404
|
-
throw error;
|
|
11405
|
-
}
|
|
11406
|
-
if (isPreviewError) {
|
|
11407
|
-
throw previewError;
|
|
11408
|
-
}
|
|
11409
|
-
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11410
|
-
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11411
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11412
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11413
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
11414
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11415
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11416
|
-
] }) }) }),
|
|
11417
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11418
|
-
] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11419
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11420
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11421
|
-
] }) });
|
|
11422
|
-
};
|
|
11423
|
-
const ShippingForm = ({ preview, order }) => {
|
|
11424
|
-
var _a;
|
|
11425
|
-
const { setIsOpen } = useStackedModal();
|
|
11426
|
-
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11427
|
-
const [data, setData] = React.useState(null);
|
|
11428
|
-
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11429
|
-
const { shipping_options } = useShippingOptions(
|
|
11268
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11269
|
+
id,
|
|
11430
11270
|
{
|
|
11431
|
-
|
|
11432
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11271
|
+
fields: "+sales_channel_id"
|
|
11433
11272
|
},
|
|
11434
11273
|
{
|
|
11435
|
-
enabled:
|
|
11274
|
+
enabled: !!id
|
|
11436
11275
|
}
|
|
11437
11276
|
);
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11277
|
+
if (isError) {
|
|
11278
|
+
throw error;
|
|
11279
|
+
}
|
|
11280
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11281
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11282
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11283
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11284
|
+
/* @__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" }) })
|
|
11285
|
+
] }),
|
|
11286
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11287
|
+
] });
|
|
11288
|
+
};
|
|
11289
|
+
const SalesChannelForm = ({ order }) => {
|
|
11290
|
+
const form = reactHookForm.useForm({
|
|
11291
|
+
defaultValues: {
|
|
11292
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11293
|
+
},
|
|
11294
|
+
resolver: zod.zodResolver(schema$3)
|
|
11295
|
+
});
|
|
11296
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11297
|
+
const { handleSuccess } = useRouteModal();
|
|
11298
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11299
|
+
await mutateAsync(
|
|
11300
|
+
{
|
|
11301
|
+
sales_channel_id: data.sales_channel_id
|
|
11302
|
+
},
|
|
11303
|
+
{
|
|
11304
|
+
onSuccess: () => {
|
|
11305
|
+
ui.toast.success("Sales channel updated");
|
|
11306
|
+
handleSuccess();
|
|
11307
|
+
},
|
|
11308
|
+
onError: (error) => {
|
|
11309
|
+
ui.toast.error(error.message);
|
|
11310
|
+
}
|
|
11311
|
+
}
|
|
11312
|
+
);
|
|
11313
|
+
});
|
|
11314
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11315
|
+
KeyboundForm,
|
|
11316
|
+
{
|
|
11317
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11318
|
+
onSubmit,
|
|
11319
|
+
children: [
|
|
11320
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11321
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11322
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11323
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11324
|
+
] }) })
|
|
11325
|
+
]
|
|
11326
|
+
}
|
|
11327
|
+
) });
|
|
11328
|
+
};
|
|
11329
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11330
|
+
const salesChannels = useComboboxData({
|
|
11331
|
+
queryFn: async (params) => {
|
|
11332
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11333
|
+
},
|
|
11334
|
+
queryKey: ["sales-channels"],
|
|
11335
|
+
getOptions: (data) => {
|
|
11336
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11337
|
+
label: salesChannel.name,
|
|
11338
|
+
value: salesChannel.id
|
|
11339
|
+
}));
|
|
11340
|
+
},
|
|
11341
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11342
|
+
});
|
|
11343
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11344
|
+
Form$2.Field,
|
|
11345
|
+
{
|
|
11346
|
+
control,
|
|
11347
|
+
name: "sales_channel_id",
|
|
11348
|
+
render: ({ field }) => {
|
|
11349
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11350
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11351
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11352
|
+
Combobox,
|
|
11353
|
+
{
|
|
11354
|
+
options: salesChannels.options,
|
|
11355
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11356
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11357
|
+
searchValue: salesChannels.searchValue,
|
|
11358
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11359
|
+
placeholder: "Select sales channel",
|
|
11360
|
+
...field
|
|
11361
|
+
}
|
|
11362
|
+
) }),
|
|
11363
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11364
|
+
] });
|
|
11365
|
+
}
|
|
11366
|
+
}
|
|
11367
|
+
);
|
|
11368
|
+
};
|
|
11369
|
+
const schema$3 = objectType({
|
|
11370
|
+
sales_channel_id: stringType().min(1)
|
|
11371
|
+
});
|
|
11372
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11373
|
+
const Shipping = () => {
|
|
11374
|
+
var _a;
|
|
11375
|
+
const { id } = reactRouterDom.useParams();
|
|
11376
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11377
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11378
|
+
});
|
|
11379
|
+
const {
|
|
11380
|
+
order: preview,
|
|
11381
|
+
isPending: isPreviewPending,
|
|
11382
|
+
isError: isPreviewError,
|
|
11383
|
+
error: previewError
|
|
11384
|
+
} = useOrderPreview(id);
|
|
11385
|
+
useInitiateOrderEdit({ preview });
|
|
11386
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11387
|
+
if (isError) {
|
|
11388
|
+
throw error;
|
|
11389
|
+
}
|
|
11390
|
+
if (isPreviewError) {
|
|
11391
|
+
throw previewError;
|
|
11392
|
+
}
|
|
11393
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11394
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11395
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11396
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11397
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
11398
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11399
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11400
|
+
] }) }) }),
|
|
11401
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11402
|
+
] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11403
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11404
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11405
|
+
] }) });
|
|
11406
|
+
};
|
|
11407
|
+
const ShippingForm = ({ preview, order }) => {
|
|
11408
|
+
var _a;
|
|
11409
|
+
const { setIsOpen } = useStackedModal();
|
|
11410
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11411
|
+
const [data, setData] = React.useState(null);
|
|
11412
|
+
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11413
|
+
const { shipping_options } = useShippingOptions(
|
|
11414
|
+
{
|
|
11415
|
+
id: appliedShippingOptionIds,
|
|
11416
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11417
|
+
},
|
|
11418
|
+
{
|
|
11419
|
+
enabled: appliedShippingOptionIds.length > 0
|
|
11420
|
+
}
|
|
11421
|
+
);
|
|
11422
|
+
const uniqueShippingProfiles = React.useMemo(() => {
|
|
11423
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
11424
|
+
getUniqueShippingProfiles(order.items).forEach((profile) => {
|
|
11441
11425
|
profiles.set(profile.id, profile);
|
|
11442
11426
|
});
|
|
11443
11427
|
shipping_options == null ? void 0 : shipping_options.forEach((option) => {
|
|
@@ -12224,7 +12208,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12224
12208
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12225
12209
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12226
12210
|
},
|
|
12227
|
-
resolver: zod.zodResolver(schema$
|
|
12211
|
+
resolver: zod.zodResolver(schema$2)
|
|
12228
12212
|
});
|
|
12229
12213
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12230
12214
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12394,7 +12378,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12394
12378
|
}
|
|
12395
12379
|
) });
|
|
12396
12380
|
};
|
|
12397
|
-
const schema$
|
|
12381
|
+
const schema$2 = addressSchema;
|
|
12398
12382
|
const TransferOwnership = () => {
|
|
12399
12383
|
const { id } = reactRouterDom.useParams();
|
|
12400
12384
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12418,7 +12402,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12418
12402
|
defaultValues: {
|
|
12419
12403
|
customer_id: order.customer_id || ""
|
|
12420
12404
|
},
|
|
12421
|
-
resolver: zod.zodResolver(schema$
|
|
12405
|
+
resolver: zod.zodResolver(schema$1)
|
|
12422
12406
|
});
|
|
12423
12407
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12424
12408
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12868,13 +12852,13 @@ const Illustration = () => {
|
|
|
12868
12852
|
}
|
|
12869
12853
|
);
|
|
12870
12854
|
};
|
|
12871
|
-
const schema$
|
|
12855
|
+
const schema$1 = objectType({
|
|
12872
12856
|
customer_id: stringType().min(1)
|
|
12873
12857
|
});
|
|
12874
|
-
const
|
|
12858
|
+
const BillingAddress = () => {
|
|
12875
12859
|
const { id } = reactRouterDom.useParams();
|
|
12876
12860
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12877
|
-
fields: "+
|
|
12861
|
+
fields: "+billing_address"
|
|
12878
12862
|
});
|
|
12879
12863
|
if (isError) {
|
|
12880
12864
|
throw error;
|
|
@@ -12882,90 +12866,26 @@ const Email = () => {
|
|
|
12882
12866
|
const isReady = !isPending && !!order;
|
|
12883
12867
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12884
12868
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12885
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
12886
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the
|
|
12887
|
-
] }),
|
|
12888
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12889
|
-
] });
|
|
12890
|
-
};
|
|
12891
|
-
const EmailForm = ({ order }) => {
|
|
12892
|
-
const form = reactHookForm.useForm({
|
|
12893
|
-
defaultValues: {
|
|
12894
|
-
email: order.email ?? ""
|
|
12895
|
-
},
|
|
12896
|
-
resolver: zod.zodResolver(schema$1)
|
|
12897
|
-
});
|
|
12898
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12899
|
-
const { handleSuccess } = useRouteModal();
|
|
12900
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12901
|
-
await mutateAsync(
|
|
12902
|
-
{ email: data.email },
|
|
12903
|
-
{
|
|
12904
|
-
onSuccess: () => {
|
|
12905
|
-
handleSuccess();
|
|
12906
|
-
},
|
|
12907
|
-
onError: (error) => {
|
|
12908
|
-
ui.toast.error(error.message);
|
|
12909
|
-
}
|
|
12910
|
-
}
|
|
12911
|
-
);
|
|
12912
|
-
});
|
|
12913
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12914
|
-
KeyboundForm,
|
|
12915
|
-
{
|
|
12916
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12917
|
-
onSubmit,
|
|
12918
|
-
children: [
|
|
12919
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12920
|
-
Form$2.Field,
|
|
12921
|
-
{
|
|
12922
|
-
control: form.control,
|
|
12923
|
-
name: "email",
|
|
12924
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12925
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
12926
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12927
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12928
|
-
] })
|
|
12929
|
-
}
|
|
12930
|
-
) }),
|
|
12931
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12932
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12933
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12934
|
-
] }) })
|
|
12935
|
-
]
|
|
12936
|
-
}
|
|
12937
|
-
) });
|
|
12938
|
-
};
|
|
12939
|
-
const schema$1 = objectType({
|
|
12940
|
-
email: stringType().email()
|
|
12941
|
-
});
|
|
12942
|
-
const SalesChannel = () => {
|
|
12943
|
-
const { id } = reactRouterDom.useParams();
|
|
12944
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12945
|
-
id,
|
|
12946
|
-
{
|
|
12947
|
-
fields: "+sales_channel_id"
|
|
12948
|
-
},
|
|
12949
|
-
{
|
|
12950
|
-
enabled: !!id
|
|
12951
|
-
}
|
|
12952
|
-
);
|
|
12953
|
-
if (isError) {
|
|
12954
|
-
throw error;
|
|
12955
|
-
}
|
|
12956
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12957
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12958
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12959
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12960
|
-
/* @__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" }) })
|
|
12869
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
12870
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12961
12871
|
] }),
|
|
12962
|
-
|
|
12872
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
12963
12873
|
] });
|
|
12964
12874
|
};
|
|
12965
|
-
const
|
|
12875
|
+
const BillingAddressForm = ({ order }) => {
|
|
12876
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12966
12877
|
const form = reactHookForm.useForm({
|
|
12967
12878
|
defaultValues: {
|
|
12968
|
-
|
|
12879
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12880
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12881
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12882
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12883
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12884
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12885
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12886
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12887
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12888
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12969
12889
|
},
|
|
12970
12890
|
resolver: zod.zodResolver(schema)
|
|
12971
12891
|
});
|
|
@@ -12973,12 +12893,9 @@ const SalesChannelForm = ({ order }) => {
|
|
|
12973
12893
|
const { handleSuccess } = useRouteModal();
|
|
12974
12894
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12975
12895
|
await mutateAsync(
|
|
12976
|
-
{
|
|
12977
|
-
sales_channel_id: data.sales_channel_id
|
|
12978
|
-
},
|
|
12896
|
+
{ billing_address: data },
|
|
12979
12897
|
{
|
|
12980
12898
|
onSuccess: () => {
|
|
12981
|
-
ui.toast.success("Sales channel updated");
|
|
12982
12899
|
handleSuccess();
|
|
12983
12900
|
},
|
|
12984
12901
|
onError: (error) => {
|
|
@@ -12993,7 +12910,132 @@ const SalesChannelForm = ({ order }) => {
|
|
|
12993
12910
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
12994
12911
|
onSubmit,
|
|
12995
12912
|
children: [
|
|
12996
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.
|
|
12913
|
+
/* @__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: [
|
|
12914
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12915
|
+
Form$2.Field,
|
|
12916
|
+
{
|
|
12917
|
+
control: form.control,
|
|
12918
|
+
name: "country_code",
|
|
12919
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12920
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12921
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12922
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12923
|
+
] })
|
|
12924
|
+
}
|
|
12925
|
+
),
|
|
12926
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12927
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12928
|
+
Form$2.Field,
|
|
12929
|
+
{
|
|
12930
|
+
control: form.control,
|
|
12931
|
+
name: "first_name",
|
|
12932
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12933
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12934
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12935
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12936
|
+
] })
|
|
12937
|
+
}
|
|
12938
|
+
),
|
|
12939
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12940
|
+
Form$2.Field,
|
|
12941
|
+
{
|
|
12942
|
+
control: form.control,
|
|
12943
|
+
name: "last_name",
|
|
12944
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12945
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12946
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12947
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12948
|
+
] })
|
|
12949
|
+
}
|
|
12950
|
+
)
|
|
12951
|
+
] }),
|
|
12952
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12953
|
+
Form$2.Field,
|
|
12954
|
+
{
|
|
12955
|
+
control: form.control,
|
|
12956
|
+
name: "company",
|
|
12957
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12958
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12959
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12960
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12961
|
+
] })
|
|
12962
|
+
}
|
|
12963
|
+
),
|
|
12964
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12965
|
+
Form$2.Field,
|
|
12966
|
+
{
|
|
12967
|
+
control: form.control,
|
|
12968
|
+
name: "address_1",
|
|
12969
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12970
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12971
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12972
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12973
|
+
] })
|
|
12974
|
+
}
|
|
12975
|
+
),
|
|
12976
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12977
|
+
Form$2.Field,
|
|
12978
|
+
{
|
|
12979
|
+
control: form.control,
|
|
12980
|
+
name: "address_2",
|
|
12981
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12982
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12983
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12984
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12985
|
+
] })
|
|
12986
|
+
}
|
|
12987
|
+
),
|
|
12988
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12989
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12990
|
+
Form$2.Field,
|
|
12991
|
+
{
|
|
12992
|
+
control: form.control,
|
|
12993
|
+
name: "postal_code",
|
|
12994
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12995
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12996
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12997
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12998
|
+
] })
|
|
12999
|
+
}
|
|
13000
|
+
),
|
|
13001
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13002
|
+
Form$2.Field,
|
|
13003
|
+
{
|
|
13004
|
+
control: form.control,
|
|
13005
|
+
name: "city",
|
|
13006
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13007
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
13008
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13009
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13010
|
+
] })
|
|
13011
|
+
}
|
|
13012
|
+
)
|
|
13013
|
+
] }),
|
|
13014
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13015
|
+
Form$2.Field,
|
|
13016
|
+
{
|
|
13017
|
+
control: form.control,
|
|
13018
|
+
name: "province",
|
|
13019
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13020
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13021
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13022
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13023
|
+
] })
|
|
13024
|
+
}
|
|
13025
|
+
),
|
|
13026
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13027
|
+
Form$2.Field,
|
|
13028
|
+
{
|
|
13029
|
+
control: form.control,
|
|
13030
|
+
name: "phone",
|
|
13031
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13032
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13033
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13034
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13035
|
+
] })
|
|
13036
|
+
}
|
|
13037
|
+
)
|
|
13038
|
+
] }) }),
|
|
12997
13039
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12998
13040
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12999
13041
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -13002,49 +13044,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
13002
13044
|
}
|
|
13003
13045
|
) });
|
|
13004
13046
|
};
|
|
13005
|
-
const
|
|
13006
|
-
const salesChannels = useComboboxData({
|
|
13007
|
-
queryFn: async (params) => {
|
|
13008
|
-
return await sdk.admin.salesChannel.list(params);
|
|
13009
|
-
},
|
|
13010
|
-
queryKey: ["sales-channels"],
|
|
13011
|
-
getOptions: (data) => {
|
|
13012
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
13013
|
-
label: salesChannel.name,
|
|
13014
|
-
value: salesChannel.id
|
|
13015
|
-
}));
|
|
13016
|
-
},
|
|
13017
|
-
defaultValue: order.sales_channel_id || void 0
|
|
13018
|
-
});
|
|
13019
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13020
|
-
Form$2.Field,
|
|
13021
|
-
{
|
|
13022
|
-
control,
|
|
13023
|
-
name: "sales_channel_id",
|
|
13024
|
-
render: ({ field }) => {
|
|
13025
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13026
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
13027
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13028
|
-
Combobox,
|
|
13029
|
-
{
|
|
13030
|
-
options: salesChannels.options,
|
|
13031
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
13032
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
13033
|
-
searchValue: salesChannels.searchValue,
|
|
13034
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
13035
|
-
placeholder: "Select sales channel",
|
|
13036
|
-
...field
|
|
13037
|
-
}
|
|
13038
|
-
) }),
|
|
13039
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13040
|
-
] });
|
|
13041
|
-
}
|
|
13042
|
-
}
|
|
13043
|
-
);
|
|
13044
|
-
};
|
|
13045
|
-
const schema = objectType({
|
|
13046
|
-
sales_channel_id: stringType().min(1)
|
|
13047
|
-
});
|
|
13047
|
+
const schema = addressSchema;
|
|
13048
13048
|
const widgetModule = { widgets: [] };
|
|
13049
13049
|
const routeModule = {
|
|
13050
13050
|
routes: [
|
|
@@ -13065,14 +13065,14 @@ const routeModule = {
|
|
|
13065
13065
|
handle,
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
|
-
{
|
|
13069
|
-
Component: BillingAddress,
|
|
13070
|
-
path: "/draft-orders/:id/billing-address"
|
|
13071
|
-
},
|
|
13072
13068
|
{
|
|
13073
13069
|
Component: CustomItems,
|
|
13074
13070
|
path: "/draft-orders/:id/custom-items"
|
|
13075
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: Email,
|
|
13074
|
+
path: "/draft-orders/:id/email"
|
|
13075
|
+
},
|
|
13076
13076
|
{
|
|
13077
13077
|
Component: Items,
|
|
13078
13078
|
path: "/draft-orders/:id/items"
|
|
@@ -13085,6 +13085,10 @@ const routeModule = {
|
|
|
13085
13085
|
Component: Promotions,
|
|
13086
13086
|
path: "/draft-orders/:id/promotions"
|
|
13087
13087
|
},
|
|
13088
|
+
{
|
|
13089
|
+
Component: SalesChannel,
|
|
13090
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13091
|
+
},
|
|
13088
13092
|
{
|
|
13089
13093
|
Component: Shipping,
|
|
13090
13094
|
path: "/draft-orders/:id/shipping"
|
|
@@ -13098,12 +13102,8 @@ const routeModule = {
|
|
|
13098
13102
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13099
13103
|
},
|
|
13100
13104
|
{
|
|
13101
|
-
Component:
|
|
13102
|
-
path: "/draft-orders/:id/
|
|
13103
|
-
},
|
|
13104
|
-
{
|
|
13105
|
-
Component: SalesChannel,
|
|
13106
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13105
|
+
Component: BillingAddress,
|
|
13106
|
+
path: "/draft-orders/:id/billing-address"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|