@medusajs/draft-order 2.10.4-preview-20251013150216 → 2.10.4-preview-20251013180156
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 +351 -351
- package/.medusa/server/src/admin/index.mjs +351 -351
- package/package.json +16 -16
|
@@ -9573,31 +9573,10 @@ const ID = () => {
|
|
|
9573
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9574
9574
|
] });
|
|
9575
9575
|
};
|
|
9576
|
-
const
|
|
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 = () => {
|
|
9576
|
+
const BillingAddress = () => {
|
|
9598
9577
|
const { id } = reactRouterDom.useParams();
|
|
9599
9578
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9600
|
-
fields: "+
|
|
9579
|
+
fields: "+billing_address"
|
|
9601
9580
|
});
|
|
9602
9581
|
if (isError) {
|
|
9603
9582
|
throw error;
|
|
@@ -9605,24 +9584,34 @@ const Email = () => {
|
|
|
9605
9584
|
const isReady = !isPending && !!order;
|
|
9606
9585
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9607
9586
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9608
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
9609
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the
|
|
9587
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9588
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9610
9589
|
] }),
|
|
9611
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9590
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9612
9591
|
] });
|
|
9613
9592
|
};
|
|
9614
|
-
const
|
|
9593
|
+
const BillingAddressForm = ({ order }) => {
|
|
9594
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9615
9595
|
const form = reactHookForm.useForm({
|
|
9616
9596
|
defaultValues: {
|
|
9617
|
-
|
|
9597
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
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) ?? ""
|
|
9618
9607
|
},
|
|
9619
|
-
resolver: zod.zodResolver(schema$
|
|
9608
|
+
resolver: zod.zodResolver(schema$5)
|
|
9620
9609
|
});
|
|
9621
9610
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9622
9611
|
const { handleSuccess } = useRouteModal();
|
|
9623
9612
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
9624
9613
|
await mutateAsync(
|
|
9625
|
-
{
|
|
9614
|
+
{ billing_address: data },
|
|
9626
9615
|
{
|
|
9627
9616
|
onSuccess: () => {
|
|
9628
9617
|
handleSuccess();
|
|
@@ -9639,18 +9628,132 @@ const EmailForm = ({ order }) => {
|
|
|
9639
9628
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9640
9629
|
onSubmit,
|
|
9641
9630
|
children: [
|
|
9642
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9631
|
+
/* @__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: [
|
|
9632
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9633
|
+
Form$2.Field,
|
|
9634
|
+
{
|
|
9635
|
+
control: form.control,
|
|
9636
|
+
name: "country_code",
|
|
9637
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9638
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9639
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9640
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
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
|
+
] }) }),
|
|
9654
9757
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9655
9758
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9656
9759
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -9659,6 +9762,25 @@ const EmailForm = ({ order }) => {
|
|
|
9659
9762
|
}
|
|
9660
9763
|
) });
|
|
9661
9764
|
};
|
|
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
|
+
};
|
|
9662
9784
|
const schema$4 = objectType({
|
|
9663
9785
|
email: stringType().email()
|
|
9664
9786
|
});
|
|
@@ -11263,160 +11385,54 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11263
11385
|
}
|
|
11264
11386
|
return Array.from(promotionIds);
|
|
11265
11387
|
}
|
|
11266
|
-
const
|
|
11388
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11389
|
+
const Shipping = () => {
|
|
11390
|
+
var _a;
|
|
11267
11391
|
const { id } = reactRouterDom.useParams();
|
|
11268
|
-
const {
|
|
11269
|
-
|
|
11392
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11393
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
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(
|
|
11270
11430
|
{
|
|
11271
|
-
|
|
11431
|
+
id: appliedShippingOptionIds,
|
|
11432
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11272
11433
|
},
|
|
11273
11434
|
{
|
|
11274
|
-
enabled:
|
|
11275
|
-
}
|
|
11276
|
-
);
|
|
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
|
|
11435
|
+
enabled: appliedShippingOptionIds.length > 0
|
|
11420
11436
|
}
|
|
11421
11437
|
);
|
|
11422
11438
|
const uniqueShippingProfiles = React.useMemo(() => {
|
|
@@ -12208,7 +12224,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12208
12224
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12209
12225
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12210
12226
|
},
|
|
12211
|
-
resolver: zod.zodResolver(schema$
|
|
12227
|
+
resolver: zod.zodResolver(schema$3)
|
|
12212
12228
|
});
|
|
12213
12229
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12214
12230
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12378,7 +12394,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12378
12394
|
}
|
|
12379
12395
|
) });
|
|
12380
12396
|
};
|
|
12381
|
-
const schema$
|
|
12397
|
+
const schema$3 = addressSchema;
|
|
12382
12398
|
const TransferOwnership = () => {
|
|
12383
12399
|
const { id } = reactRouterDom.useParams();
|
|
12384
12400
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12402,7 +12418,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12402
12418
|
defaultValues: {
|
|
12403
12419
|
customer_id: order.customer_id || ""
|
|
12404
12420
|
},
|
|
12405
|
-
resolver: zod.zodResolver(schema$
|
|
12421
|
+
resolver: zod.zodResolver(schema$2)
|
|
12406
12422
|
});
|
|
12407
12423
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12408
12424
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12852,13 +12868,119 @@ const Illustration = () => {
|
|
|
12852
12868
|
}
|
|
12853
12869
|
);
|
|
12854
12870
|
};
|
|
12855
|
-
const schema$
|
|
12871
|
+
const schema$2 = objectType({
|
|
12856
12872
|
customer_id: stringType().min(1)
|
|
12857
12873
|
});
|
|
12858
|
-
const
|
|
12874
|
+
const SalesChannel = () => {
|
|
12875
|
+
const { id } = reactRouterDom.useParams();
|
|
12876
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12877
|
+
id,
|
|
12878
|
+
{
|
|
12879
|
+
fields: "+sales_channel_id"
|
|
12880
|
+
},
|
|
12881
|
+
{
|
|
12882
|
+
enabled: !!id
|
|
12883
|
+
}
|
|
12884
|
+
);
|
|
12885
|
+
if (isError) {
|
|
12886
|
+
throw error;
|
|
12887
|
+
}
|
|
12888
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12889
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12890
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12891
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12892
|
+
/* @__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" }) })
|
|
12893
|
+
] }),
|
|
12894
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12895
|
+
] });
|
|
12896
|
+
};
|
|
12897
|
+
const SalesChannelForm = ({ order }) => {
|
|
12898
|
+
const form = reactHookForm.useForm({
|
|
12899
|
+
defaultValues: {
|
|
12900
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12901
|
+
},
|
|
12902
|
+
resolver: zod.zodResolver(schema$1)
|
|
12903
|
+
});
|
|
12904
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12905
|
+
const { handleSuccess } = useRouteModal();
|
|
12906
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12907
|
+
await mutateAsync(
|
|
12908
|
+
{
|
|
12909
|
+
sales_channel_id: data.sales_channel_id
|
|
12910
|
+
},
|
|
12911
|
+
{
|
|
12912
|
+
onSuccess: () => {
|
|
12913
|
+
ui.toast.success("Sales channel updated");
|
|
12914
|
+
handleSuccess();
|
|
12915
|
+
},
|
|
12916
|
+
onError: (error) => {
|
|
12917
|
+
ui.toast.error(error.message);
|
|
12918
|
+
}
|
|
12919
|
+
}
|
|
12920
|
+
);
|
|
12921
|
+
});
|
|
12922
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12923
|
+
KeyboundForm,
|
|
12924
|
+
{
|
|
12925
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12926
|
+
onSubmit,
|
|
12927
|
+
children: [
|
|
12928
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12929
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12930
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12931
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12932
|
+
] }) })
|
|
12933
|
+
]
|
|
12934
|
+
}
|
|
12935
|
+
) });
|
|
12936
|
+
};
|
|
12937
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12938
|
+
const salesChannels = useComboboxData({
|
|
12939
|
+
queryFn: async (params) => {
|
|
12940
|
+
return await sdk.admin.salesChannel.list(params);
|
|
12941
|
+
},
|
|
12942
|
+
queryKey: ["sales-channels"],
|
|
12943
|
+
getOptions: (data) => {
|
|
12944
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
12945
|
+
label: salesChannel.name,
|
|
12946
|
+
value: salesChannel.id
|
|
12947
|
+
}));
|
|
12948
|
+
},
|
|
12949
|
+
defaultValue: order.sales_channel_id || void 0
|
|
12950
|
+
});
|
|
12951
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12952
|
+
Form$2.Field,
|
|
12953
|
+
{
|
|
12954
|
+
control,
|
|
12955
|
+
name: "sales_channel_id",
|
|
12956
|
+
render: ({ field }) => {
|
|
12957
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12958
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12959
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12960
|
+
Combobox,
|
|
12961
|
+
{
|
|
12962
|
+
options: salesChannels.options,
|
|
12963
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
12964
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12965
|
+
searchValue: salesChannels.searchValue,
|
|
12966
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12967
|
+
placeholder: "Select sales channel",
|
|
12968
|
+
...field
|
|
12969
|
+
}
|
|
12970
|
+
) }),
|
|
12971
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12972
|
+
] });
|
|
12973
|
+
}
|
|
12974
|
+
}
|
|
12975
|
+
);
|
|
12976
|
+
};
|
|
12977
|
+
const schema$1 = objectType({
|
|
12978
|
+
sales_channel_id: stringType().min(1)
|
|
12979
|
+
});
|
|
12980
|
+
const Email = () => {
|
|
12859
12981
|
const { id } = reactRouterDom.useParams();
|
|
12860
12982
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12861
|
-
fields: "+
|
|
12983
|
+
fields: "+email"
|
|
12862
12984
|
});
|
|
12863
12985
|
if (isError) {
|
|
12864
12986
|
throw error;
|
|
@@ -12866,26 +12988,16 @@ const BillingAddress = () => {
|
|
|
12866
12988
|
const isReady = !isPending && !!order;
|
|
12867
12989
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12868
12990
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12869
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
12870
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the
|
|
12991
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12992
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12871
12993
|
] }),
|
|
12872
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12994
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12873
12995
|
] });
|
|
12874
12996
|
};
|
|
12875
|
-
const
|
|
12876
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12997
|
+
const EmailForm = ({ order }) => {
|
|
12877
12998
|
const form = reactHookForm.useForm({
|
|
12878
12999
|
defaultValues: {
|
|
12879
|
-
|
|
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) ?? ""
|
|
13000
|
+
email: order.email ?? ""
|
|
12889
13001
|
},
|
|
12890
13002
|
resolver: zod.zodResolver(schema)
|
|
12891
13003
|
});
|
|
@@ -12893,7 +13005,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
12893
13005
|
const { handleSuccess } = useRouteModal();
|
|
12894
13006
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12895
13007
|
await mutateAsync(
|
|
12896
|
-
{
|
|
13008
|
+
{ email: data.email },
|
|
12897
13009
|
{
|
|
12898
13010
|
onSuccess: () => {
|
|
12899
13011
|
handleSuccess();
|
|
@@ -12910,132 +13022,18 @@ const BillingAddressForm = ({ order }) => {
|
|
|
12910
13022
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
12911
13023
|
onSubmit,
|
|
12912
13024
|
children: [
|
|
12913
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
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
|
-
] }) }),
|
|
13025
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13026
|
+
Form$2.Field,
|
|
13027
|
+
{
|
|
13028
|
+
control: form.control,
|
|
13029
|
+
name: "email",
|
|
13030
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13031
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
13032
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13033
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13034
|
+
] })
|
|
13035
|
+
}
|
|
13036
|
+
) }),
|
|
13039
13037
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13040
13038
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13041
13039
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -13044,7 +13042,9 @@ const BillingAddressForm = ({ order }) => {
|
|
|
13044
13042
|
}
|
|
13045
13043
|
) });
|
|
13046
13044
|
};
|
|
13047
|
-
const schema =
|
|
13045
|
+
const schema = objectType({
|
|
13046
|
+
email: stringType().email()
|
|
13047
|
+
});
|
|
13048
13048
|
const widgetModule = { widgets: [] };
|
|
13049
13049
|
const routeModule = {
|
|
13050
13050
|
routes: [
|
|
@@ -13066,12 +13066,12 @@ const routeModule = {
|
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
13068
|
{
|
|
13069
|
-
Component:
|
|
13070
|
-
path: "/draft-orders/:id/
|
|
13069
|
+
Component: BillingAddress,
|
|
13070
|
+
path: "/draft-orders/:id/billing-address"
|
|
13071
13071
|
},
|
|
13072
13072
|
{
|
|
13073
|
-
Component:
|
|
13074
|
-
path: "/draft-orders/:id/
|
|
13073
|
+
Component: CustomItems,
|
|
13074
|
+
path: "/draft-orders/:id/custom-items"
|
|
13075
13075
|
},
|
|
13076
13076
|
{
|
|
13077
13077
|
Component: Items,
|
|
@@ -13085,10 +13085,6 @@ 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
|
-
},
|
|
13092
13088
|
{
|
|
13093
13089
|
Component: Shipping,
|
|
13094
13090
|
path: "/draft-orders/:id/shipping"
|
|
@@ -13102,8 +13098,12 @@ const routeModule = {
|
|
|
13102
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13103
13099
|
},
|
|
13104
13100
|
{
|
|
13105
|
-
Component:
|
|
13106
|
-
path: "/draft-orders/:id/
|
|
13101
|
+
Component: SalesChannel,
|
|
13102
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13103
|
+
},
|
|
13104
|
+
{
|
|
13105
|
+
Component: Email,
|
|
13106
|
+
path: "/draft-orders/:id/email"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|