@medusajs/draft-order 2.10.4-preview-20251011210159 → 2.10.4-preview-20251012000322
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 +400 -400
- package/.medusa/server/src/admin/index.mjs +400 -400
- 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,59 +11385,165 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11263
11385
|
}
|
|
11264
11386
|
return Array.from(promotionIds);
|
|
11265
11387
|
}
|
|
11266
|
-
const
|
|
11267
|
-
const Shipping = () => {
|
|
11268
|
-
var _a;
|
|
11388
|
+
const SalesChannel = () => {
|
|
11269
11389
|
const { id } = reactRouterDom.useParams();
|
|
11270
|
-
const {
|
|
11271
|
-
|
|
11272
|
-
});
|
|
11273
|
-
const {
|
|
11274
|
-
order: preview,
|
|
11275
|
-
isPending: isPreviewPending,
|
|
11276
|
-
isError: isPreviewError,
|
|
11277
|
-
error: previewError
|
|
11278
|
-
} = useOrderPreview(id);
|
|
11279
|
-
useInitiateOrderEdit({ preview });
|
|
11280
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11281
|
-
if (isError) {
|
|
11282
|
-
throw error;
|
|
11283
|
-
}
|
|
11284
|
-
if (isPreviewError) {
|
|
11285
|
-
throw previewError;
|
|
11286
|
-
}
|
|
11287
|
-
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11288
|
-
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11289
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11290
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11291
|
-
/* @__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: [
|
|
11292
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11293
|
-
/* @__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." }) })
|
|
11294
|
-
] }) }) }),
|
|
11295
|
-
/* @__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" }) }) })
|
|
11296
|
-
] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11297
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11298
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11299
|
-
] }) });
|
|
11300
|
-
};
|
|
11301
|
-
const ShippingForm = ({ preview, order }) => {
|
|
11302
|
-
var _a;
|
|
11303
|
-
const { setIsOpen } = useStackedModal();
|
|
11304
|
-
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11305
|
-
const [data, setData] = React.useState(null);
|
|
11306
|
-
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11307
|
-
const { shipping_options } = useShippingOptions(
|
|
11390
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11391
|
+
id,
|
|
11308
11392
|
{
|
|
11309
|
-
|
|
11310
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11393
|
+
fields: "+sales_channel_id"
|
|
11311
11394
|
},
|
|
11312
11395
|
{
|
|
11313
|
-
enabled:
|
|
11396
|
+
enabled: !!id
|
|
11314
11397
|
}
|
|
11315
11398
|
);
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11399
|
+
if (isError) {
|
|
11400
|
+
throw error;
|
|
11401
|
+
}
|
|
11402
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11403
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11404
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11405
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11406
|
+
/* @__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" }) })
|
|
11407
|
+
] }),
|
|
11408
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11409
|
+
] });
|
|
11410
|
+
};
|
|
11411
|
+
const SalesChannelForm = ({ order }) => {
|
|
11412
|
+
const form = reactHookForm.useForm({
|
|
11413
|
+
defaultValues: {
|
|
11414
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11415
|
+
},
|
|
11416
|
+
resolver: zod.zodResolver(schema$3)
|
|
11417
|
+
});
|
|
11418
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11419
|
+
const { handleSuccess } = useRouteModal();
|
|
11420
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11421
|
+
await mutateAsync(
|
|
11422
|
+
{
|
|
11423
|
+
sales_channel_id: data.sales_channel_id
|
|
11424
|
+
},
|
|
11425
|
+
{
|
|
11426
|
+
onSuccess: () => {
|
|
11427
|
+
ui.toast.success("Sales channel updated");
|
|
11428
|
+
handleSuccess();
|
|
11429
|
+
},
|
|
11430
|
+
onError: (error) => {
|
|
11431
|
+
ui.toast.error(error.message);
|
|
11432
|
+
}
|
|
11433
|
+
}
|
|
11434
|
+
);
|
|
11435
|
+
});
|
|
11436
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11437
|
+
KeyboundForm,
|
|
11438
|
+
{
|
|
11439
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11440
|
+
onSubmit,
|
|
11441
|
+
children: [
|
|
11442
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11443
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11444
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11445
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11446
|
+
] }) })
|
|
11447
|
+
]
|
|
11448
|
+
}
|
|
11449
|
+
) });
|
|
11450
|
+
};
|
|
11451
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11452
|
+
const salesChannels = useComboboxData({
|
|
11453
|
+
queryFn: async (params) => {
|
|
11454
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11455
|
+
},
|
|
11456
|
+
queryKey: ["sales-channels"],
|
|
11457
|
+
getOptions: (data) => {
|
|
11458
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11459
|
+
label: salesChannel.name,
|
|
11460
|
+
value: salesChannel.id
|
|
11461
|
+
}));
|
|
11462
|
+
},
|
|
11463
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11464
|
+
});
|
|
11465
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11466
|
+
Form$2.Field,
|
|
11467
|
+
{
|
|
11468
|
+
control,
|
|
11469
|
+
name: "sales_channel_id",
|
|
11470
|
+
render: ({ field }) => {
|
|
11471
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11472
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11473
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11474
|
+
Combobox,
|
|
11475
|
+
{
|
|
11476
|
+
options: salesChannels.options,
|
|
11477
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11478
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11479
|
+
searchValue: salesChannels.searchValue,
|
|
11480
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11481
|
+
placeholder: "Select sales channel",
|
|
11482
|
+
...field
|
|
11483
|
+
}
|
|
11484
|
+
) }),
|
|
11485
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11486
|
+
] });
|
|
11487
|
+
}
|
|
11488
|
+
}
|
|
11489
|
+
);
|
|
11490
|
+
};
|
|
11491
|
+
const schema$3 = objectType({
|
|
11492
|
+
sales_channel_id: stringType().min(1)
|
|
11493
|
+
});
|
|
11494
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11495
|
+
const Shipping = () => {
|
|
11496
|
+
var _a;
|
|
11497
|
+
const { id } = reactRouterDom.useParams();
|
|
11498
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11499
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11500
|
+
});
|
|
11501
|
+
const {
|
|
11502
|
+
order: preview,
|
|
11503
|
+
isPending: isPreviewPending,
|
|
11504
|
+
isError: isPreviewError,
|
|
11505
|
+
error: previewError
|
|
11506
|
+
} = useOrderPreview(id);
|
|
11507
|
+
useInitiateOrderEdit({ preview });
|
|
11508
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11509
|
+
if (isError) {
|
|
11510
|
+
throw error;
|
|
11511
|
+
}
|
|
11512
|
+
if (isPreviewError) {
|
|
11513
|
+
throw previewError;
|
|
11514
|
+
}
|
|
11515
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11516
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11517
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11518
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11519
|
+
/* @__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: [
|
|
11520
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11521
|
+
/* @__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." }) })
|
|
11522
|
+
] }) }) }),
|
|
11523
|
+
/* @__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" }) }) })
|
|
11524
|
+
] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11525
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11526
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11527
|
+
] }) });
|
|
11528
|
+
};
|
|
11529
|
+
const ShippingForm = ({ preview, order }) => {
|
|
11530
|
+
var _a;
|
|
11531
|
+
const { setIsOpen } = useStackedModal();
|
|
11532
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11533
|
+
const [data, setData] = React.useState(null);
|
|
11534
|
+
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11535
|
+
const { shipping_options } = useShippingOptions(
|
|
11536
|
+
{
|
|
11537
|
+
id: appliedShippingOptionIds,
|
|
11538
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11539
|
+
},
|
|
11540
|
+
{
|
|
11541
|
+
enabled: appliedShippingOptionIds.length > 0
|
|
11542
|
+
}
|
|
11543
|
+
);
|
|
11544
|
+
const uniqueShippingProfiles = React.useMemo(() => {
|
|
11545
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
11546
|
+
getUniqueShippingProfiles(order.items).forEach((profile) => {
|
|
11319
11547
|
profiles.set(profile.id, profile);
|
|
11320
11548
|
});
|
|
11321
11549
|
shipping_options == null ? void 0 : shipping_options.forEach((option) => {
|
|
@@ -12070,112 +12298,6 @@ const CustomAmountField = ({
|
|
|
12070
12298
|
}
|
|
12071
12299
|
);
|
|
12072
12300
|
};
|
|
12073
|
-
const SalesChannel = () => {
|
|
12074
|
-
const { id } = reactRouterDom.useParams();
|
|
12075
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12076
|
-
id,
|
|
12077
|
-
{
|
|
12078
|
-
fields: "+sales_channel_id"
|
|
12079
|
-
},
|
|
12080
|
-
{
|
|
12081
|
-
enabled: !!id
|
|
12082
|
-
}
|
|
12083
|
-
);
|
|
12084
|
-
if (isError) {
|
|
12085
|
-
throw error;
|
|
12086
|
-
}
|
|
12087
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12088
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12089
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12090
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12091
|
-
/* @__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" }) })
|
|
12092
|
-
] }),
|
|
12093
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12094
|
-
] });
|
|
12095
|
-
};
|
|
12096
|
-
const SalesChannelForm = ({ order }) => {
|
|
12097
|
-
const form = reactHookForm.useForm({
|
|
12098
|
-
defaultValues: {
|
|
12099
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12100
|
-
},
|
|
12101
|
-
resolver: zod.zodResolver(schema$3)
|
|
12102
|
-
});
|
|
12103
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12104
|
-
const { handleSuccess } = useRouteModal();
|
|
12105
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12106
|
-
await mutateAsync(
|
|
12107
|
-
{
|
|
12108
|
-
sales_channel_id: data.sales_channel_id
|
|
12109
|
-
},
|
|
12110
|
-
{
|
|
12111
|
-
onSuccess: () => {
|
|
12112
|
-
ui.toast.success("Sales channel updated");
|
|
12113
|
-
handleSuccess();
|
|
12114
|
-
},
|
|
12115
|
-
onError: (error) => {
|
|
12116
|
-
ui.toast.error(error.message);
|
|
12117
|
-
}
|
|
12118
|
-
}
|
|
12119
|
-
);
|
|
12120
|
-
});
|
|
12121
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12122
|
-
KeyboundForm,
|
|
12123
|
-
{
|
|
12124
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12125
|
-
onSubmit,
|
|
12126
|
-
children: [
|
|
12127
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12128
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12129
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12130
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12131
|
-
] }) })
|
|
12132
|
-
]
|
|
12133
|
-
}
|
|
12134
|
-
) });
|
|
12135
|
-
};
|
|
12136
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12137
|
-
const salesChannels = useComboboxData({
|
|
12138
|
-
queryFn: async (params) => {
|
|
12139
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12140
|
-
},
|
|
12141
|
-
queryKey: ["sales-channels"],
|
|
12142
|
-
getOptions: (data) => {
|
|
12143
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12144
|
-
label: salesChannel.name,
|
|
12145
|
-
value: salesChannel.id
|
|
12146
|
-
}));
|
|
12147
|
-
},
|
|
12148
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12149
|
-
});
|
|
12150
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12151
|
-
Form$2.Field,
|
|
12152
|
-
{
|
|
12153
|
-
control,
|
|
12154
|
-
name: "sales_channel_id",
|
|
12155
|
-
render: ({ field }) => {
|
|
12156
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12157
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12158
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12159
|
-
Combobox,
|
|
12160
|
-
{
|
|
12161
|
-
options: salesChannels.options,
|
|
12162
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
12163
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12164
|
-
searchValue: salesChannels.searchValue,
|
|
12165
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12166
|
-
placeholder: "Select sales channel",
|
|
12167
|
-
...field
|
|
12168
|
-
}
|
|
12169
|
-
) }),
|
|
12170
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12171
|
-
] });
|
|
12172
|
-
}
|
|
12173
|
-
}
|
|
12174
|
-
);
|
|
12175
|
-
};
|
|
12176
|
-
const schema$3 = objectType({
|
|
12177
|
-
sales_channel_id: stringType().min(1)
|
|
12178
|
-
});
|
|
12179
12301
|
const ShippingAddress = () => {
|
|
12180
12302
|
const { id } = reactRouterDom.useParams();
|
|
12181
12303
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12379,7 +12501,75 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12379
12501
|
) });
|
|
12380
12502
|
};
|
|
12381
12503
|
const schema$2 = addressSchema;
|
|
12382
|
-
const
|
|
12504
|
+
const Email = () => {
|
|
12505
|
+
const { id } = reactRouterDom.useParams();
|
|
12506
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12507
|
+
fields: "+email"
|
|
12508
|
+
});
|
|
12509
|
+
if (isError) {
|
|
12510
|
+
throw error;
|
|
12511
|
+
}
|
|
12512
|
+
const isReady = !isPending && !!order;
|
|
12513
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12514
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12515
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12516
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12517
|
+
] }),
|
|
12518
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12519
|
+
] });
|
|
12520
|
+
};
|
|
12521
|
+
const EmailForm = ({ order }) => {
|
|
12522
|
+
const form = reactHookForm.useForm({
|
|
12523
|
+
defaultValues: {
|
|
12524
|
+
email: order.email ?? ""
|
|
12525
|
+
},
|
|
12526
|
+
resolver: zod.zodResolver(schema$1)
|
|
12527
|
+
});
|
|
12528
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12529
|
+
const { handleSuccess } = useRouteModal();
|
|
12530
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12531
|
+
await mutateAsync(
|
|
12532
|
+
{ email: data.email },
|
|
12533
|
+
{
|
|
12534
|
+
onSuccess: () => {
|
|
12535
|
+
handleSuccess();
|
|
12536
|
+
},
|
|
12537
|
+
onError: (error) => {
|
|
12538
|
+
ui.toast.error(error.message);
|
|
12539
|
+
}
|
|
12540
|
+
}
|
|
12541
|
+
);
|
|
12542
|
+
});
|
|
12543
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12544
|
+
KeyboundForm,
|
|
12545
|
+
{
|
|
12546
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12547
|
+
onSubmit,
|
|
12548
|
+
children: [
|
|
12549
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12550
|
+
Form$2.Field,
|
|
12551
|
+
{
|
|
12552
|
+
control: form.control,
|
|
12553
|
+
name: "email",
|
|
12554
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12555
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
12556
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12557
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12558
|
+
] })
|
|
12559
|
+
}
|
|
12560
|
+
) }),
|
|
12561
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12562
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12563
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12564
|
+
] }) })
|
|
12565
|
+
]
|
|
12566
|
+
}
|
|
12567
|
+
) });
|
|
12568
|
+
};
|
|
12569
|
+
const schema$1 = objectType({
|
|
12570
|
+
email: stringType().email()
|
|
12571
|
+
});
|
|
12572
|
+
const TransferOwnership = () => {
|
|
12383
12573
|
const { id } = reactRouterDom.useParams();
|
|
12384
12574
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
12385
12575
|
fields: "id,customer_id,customer.*"
|
|
@@ -12402,7 +12592,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12402
12592
|
defaultValues: {
|
|
12403
12593
|
customer_id: order.customer_id || ""
|
|
12404
12594
|
},
|
|
12405
|
-
resolver: zod.zodResolver(schema
|
|
12595
|
+
resolver: zod.zodResolver(schema)
|
|
12406
12596
|
});
|
|
12407
12597
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12408
12598
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12852,199 +13042,9 @@ const Illustration = () => {
|
|
|
12852
13042
|
}
|
|
12853
13043
|
);
|
|
12854
13044
|
};
|
|
12855
|
-
const schema
|
|
13045
|
+
const schema = objectType({
|
|
12856
13046
|
customer_id: stringType().min(1)
|
|
12857
13047
|
});
|
|
12858
|
-
const BillingAddress = () => {
|
|
12859
|
-
const { id } = reactRouterDom.useParams();
|
|
12860
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12861
|
-
fields: "+billing_address"
|
|
12862
|
-
});
|
|
12863
|
-
if (isError) {
|
|
12864
|
-
throw error;
|
|
12865
|
-
}
|
|
12866
|
-
const isReady = !isPending && !!order;
|
|
12867
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12868
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
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" }) })
|
|
12871
|
-
] }),
|
|
12872
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
12873
|
-
] });
|
|
12874
|
-
};
|
|
12875
|
-
const BillingAddressForm = ({ order }) => {
|
|
12876
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12877
|
-
const form = reactHookForm.useForm({
|
|
12878
|
-
defaultValues: {
|
|
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) ?? ""
|
|
12889
|
-
},
|
|
12890
|
-
resolver: zod.zodResolver(schema)
|
|
12891
|
-
});
|
|
12892
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12893
|
-
const { handleSuccess } = useRouteModal();
|
|
12894
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12895
|
-
await mutateAsync(
|
|
12896
|
-
{ billing_address: data },
|
|
12897
|
-
{
|
|
12898
|
-
onSuccess: () => {
|
|
12899
|
-
handleSuccess();
|
|
12900
|
-
},
|
|
12901
|
-
onError: (error) => {
|
|
12902
|
-
ui.toast.error(error.message);
|
|
12903
|
-
}
|
|
12904
|
-
}
|
|
12905
|
-
);
|
|
12906
|
-
});
|
|
12907
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12908
|
-
KeyboundForm,
|
|
12909
|
-
{
|
|
12910
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12911
|
-
onSubmit,
|
|
12912
|
-
children: [
|
|
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
|
-
] }) }),
|
|
13039
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13040
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13041
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13042
|
-
] }) })
|
|
13043
|
-
]
|
|
13044
|
-
}
|
|
13045
|
-
) });
|
|
13046
|
-
};
|
|
13047
|
-
const schema = addressSchema;
|
|
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,25 +13085,25 @@ const routeModule = {
|
|
|
13085
13085
|
Component: Promotions,
|
|
13086
13086
|
path: "/draft-orders/:id/promotions"
|
|
13087
13087
|
},
|
|
13088
|
-
{
|
|
13089
|
-
Component: Shipping,
|
|
13090
|
-
path: "/draft-orders/:id/shipping"
|
|
13091
|
-
},
|
|
13092
13088
|
{
|
|
13093
13089
|
Component: SalesChannel,
|
|
13094
13090
|
path: "/draft-orders/:id/sales-channel"
|
|
13095
13091
|
},
|
|
13092
|
+
{
|
|
13093
|
+
Component: Shipping,
|
|
13094
|
+
path: "/draft-orders/:id/shipping"
|
|
13095
|
+
},
|
|
13096
13096
|
{
|
|
13097
13097
|
Component: ShippingAddress,
|
|
13098
13098
|
path: "/draft-orders/:id/shipping-address"
|
|
13099
13099
|
},
|
|
13100
13100
|
{
|
|
13101
|
-
Component:
|
|
13102
|
-
path: "/draft-orders/:id/
|
|
13101
|
+
Component: Email,
|
|
13102
|
+
path: "/draft-orders/:id/email"
|
|
13103
13103
|
},
|
|
13104
13104
|
{
|
|
13105
|
-
Component:
|
|
13106
|
-
path: "/draft-orders/:id/
|
|
13105
|
+
Component: TransferOwnership,
|
|
13106
|
+
path: "/draft-orders/:id/transfer-ownership"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|