@medusajs/draft-order 2.11.2-snapshot-20251030163249 → 2.11.2-snapshot-20251031083831
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 +489 -488
- package/.medusa/server/src/admin/index.mjs +487 -487
- package/package.json +26 -23
|
@@ -13,9 +13,9 @@ import { FormProvider, Controller, useFormContext, useFormState, useForm, useWat
|
|
|
13
13
|
import { Slot, Collapsible, Accordion } from "radix-ui";
|
|
14
14
|
import { ComboboxProvider, Combobox as Combobox$1, ComboboxDisclosure, ComboboxPopover, ComboboxItem, ComboboxItemCheck, ComboboxItemValue, Separator } from "@ariakit/react";
|
|
15
15
|
import { matchSorter } from "match-sorter";
|
|
16
|
-
import debounce from "lodash
|
|
16
|
+
import debounce from "lodash.debounce";
|
|
17
17
|
import Primitive from "@uiw/react-json-view";
|
|
18
|
-
import
|
|
18
|
+
import isEqual from "lodash.isequal";
|
|
19
19
|
function useQueryParams(keys, prefix) {
|
|
20
20
|
const [params] = useSearchParams();
|
|
21
21
|
const result = {};
|
|
@@ -9565,27 +9565,196 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
-
const
|
|
9568
|
+
const BillingAddress = () => {
|
|
9569
|
+
const { id } = useParams();
|
|
9570
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9571
|
+
fields: "+billing_address"
|
|
9572
|
+
});
|
|
9573
|
+
if (isError) {
|
|
9574
|
+
throw error;
|
|
9575
|
+
}
|
|
9576
|
+
const isReady = !isPending && !!order;
|
|
9569
9577
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9570
|
-
/* @__PURE__ */
|
|
9571
|
-
|
|
9578
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9579
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9580
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9581
|
+
] }),
|
|
9582
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9572
9583
|
] });
|
|
9573
9584
|
};
|
|
9574
|
-
const
|
|
9585
|
+
const BillingAddressForm = ({ order }) => {
|
|
9586
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9575
9587
|
const form = useForm({
|
|
9588
|
+
defaultValues: {
|
|
9589
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9590
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9591
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9592
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9593
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9594
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9595
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9596
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9597
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9599
|
+
},
|
|
9576
9600
|
resolver: zodResolver(schema$5)
|
|
9577
9601
|
});
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9602
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9603
|
+
const { handleSuccess } = useRouteModal();
|
|
9604
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9605
|
+
await mutateAsync(
|
|
9606
|
+
{ billing_address: data },
|
|
9607
|
+
{
|
|
9608
|
+
onSuccess: () => {
|
|
9609
|
+
handleSuccess();
|
|
9610
|
+
},
|
|
9611
|
+
onError: (error) => {
|
|
9612
|
+
toast.error(error.message);
|
|
9613
|
+
}
|
|
9614
|
+
}
|
|
9615
|
+
);
|
|
9616
|
+
});
|
|
9617
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9618
|
+
KeyboundForm,
|
|
9619
|
+
{
|
|
9620
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9621
|
+
onSubmit,
|
|
9622
|
+
children: [
|
|
9623
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
9624
|
+
/* @__PURE__ */ jsx(
|
|
9625
|
+
Form$2.Field,
|
|
9626
|
+
{
|
|
9627
|
+
control: form.control,
|
|
9628
|
+
name: "country_code",
|
|
9629
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9630
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9631
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9632
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9633
|
+
] })
|
|
9634
|
+
}
|
|
9635
|
+
),
|
|
9636
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9637
|
+
/* @__PURE__ */ jsx(
|
|
9638
|
+
Form$2.Field,
|
|
9639
|
+
{
|
|
9640
|
+
control: form.control,
|
|
9641
|
+
name: "first_name",
|
|
9642
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9643
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9644
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9645
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9646
|
+
] })
|
|
9647
|
+
}
|
|
9648
|
+
),
|
|
9649
|
+
/* @__PURE__ */ jsx(
|
|
9650
|
+
Form$2.Field,
|
|
9651
|
+
{
|
|
9652
|
+
control: form.control,
|
|
9653
|
+
name: "last_name",
|
|
9654
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9655
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9656
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9657
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9658
|
+
] })
|
|
9659
|
+
}
|
|
9660
|
+
)
|
|
9661
|
+
] }),
|
|
9662
|
+
/* @__PURE__ */ jsx(
|
|
9663
|
+
Form$2.Field,
|
|
9664
|
+
{
|
|
9665
|
+
control: form.control,
|
|
9666
|
+
name: "company",
|
|
9667
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9668
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9669
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9670
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9671
|
+
] })
|
|
9672
|
+
}
|
|
9673
|
+
),
|
|
9674
|
+
/* @__PURE__ */ jsx(
|
|
9675
|
+
Form$2.Field,
|
|
9676
|
+
{
|
|
9677
|
+
control: form.control,
|
|
9678
|
+
name: "address_1",
|
|
9679
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9680
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9681
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9682
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9683
|
+
] })
|
|
9684
|
+
}
|
|
9685
|
+
),
|
|
9686
|
+
/* @__PURE__ */ jsx(
|
|
9687
|
+
Form$2.Field,
|
|
9688
|
+
{
|
|
9689
|
+
control: form.control,
|
|
9690
|
+
name: "address_2",
|
|
9691
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9692
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9693
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9694
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9695
|
+
] })
|
|
9696
|
+
}
|
|
9697
|
+
),
|
|
9698
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9699
|
+
/* @__PURE__ */ jsx(
|
|
9700
|
+
Form$2.Field,
|
|
9701
|
+
{
|
|
9702
|
+
control: form.control,
|
|
9703
|
+
name: "postal_code",
|
|
9704
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9705
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9706
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9707
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9708
|
+
] })
|
|
9709
|
+
}
|
|
9710
|
+
),
|
|
9711
|
+
/* @__PURE__ */ jsx(
|
|
9712
|
+
Form$2.Field,
|
|
9713
|
+
{
|
|
9714
|
+
control: form.control,
|
|
9715
|
+
name: "city",
|
|
9716
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9717
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9718
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9719
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9720
|
+
] })
|
|
9721
|
+
}
|
|
9722
|
+
)
|
|
9723
|
+
] }),
|
|
9724
|
+
/* @__PURE__ */ jsx(
|
|
9725
|
+
Form$2.Field,
|
|
9726
|
+
{
|
|
9727
|
+
control: form.control,
|
|
9728
|
+
name: "province",
|
|
9729
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9730
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9731
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9732
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9733
|
+
] })
|
|
9734
|
+
}
|
|
9735
|
+
),
|
|
9736
|
+
/* @__PURE__ */ jsx(
|
|
9737
|
+
Form$2.Field,
|
|
9738
|
+
{
|
|
9739
|
+
control: form.control,
|
|
9740
|
+
name: "phone",
|
|
9741
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9742
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9743
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9744
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9745
|
+
] })
|
|
9746
|
+
}
|
|
9747
|
+
)
|
|
9748
|
+
] }) }),
|
|
9749
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9750
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9751
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9752
|
+
] }) })
|
|
9753
|
+
]
|
|
9754
|
+
}
|
|
9755
|
+
) });
|
|
9585
9756
|
};
|
|
9586
|
-
const schema$5 =
|
|
9587
|
-
email: stringType().email()
|
|
9588
|
-
});
|
|
9757
|
+
const schema$5 = addressSchema;
|
|
9589
9758
|
const Email = () => {
|
|
9590
9759
|
const { id } = useParams();
|
|
9591
9760
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9654,6 +9823,27 @@ const EmailForm = ({ order }) => {
|
|
|
9654
9823
|
const schema$4 = objectType({
|
|
9655
9824
|
email: stringType().email()
|
|
9656
9825
|
});
|
|
9826
|
+
const CustomItems = () => {
|
|
9827
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9828
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9829
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9830
|
+
] });
|
|
9831
|
+
};
|
|
9832
|
+
const CustomItemsForm = () => {
|
|
9833
|
+
const form = useForm({
|
|
9834
|
+
resolver: zodResolver(schema$3)
|
|
9835
|
+
});
|
|
9836
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9837
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9838
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9839
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9840
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9841
|
+
] }) })
|
|
9842
|
+
] }) });
|
|
9843
|
+
};
|
|
9844
|
+
const schema$3 = objectType({
|
|
9845
|
+
email: stringType().email()
|
|
9846
|
+
});
|
|
9657
9847
|
const NumberInput = forwardRef(
|
|
9658
9848
|
({
|
|
9659
9849
|
value,
|
|
@@ -11283,7 +11473,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11283
11473
|
defaultValues: {
|
|
11284
11474
|
sales_channel_id: order.sales_channel_id || ""
|
|
11285
11475
|
},
|
|
11286
|
-
resolver: zodResolver(schema$
|
|
11476
|
+
resolver: zodResolver(schema$2)
|
|
11287
11477
|
});
|
|
11288
11478
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11289
11479
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11358,43 +11548,246 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11358
11548
|
}
|
|
11359
11549
|
);
|
|
11360
11550
|
};
|
|
11361
|
-
const schema$
|
|
11551
|
+
const schema$2 = objectType({
|
|
11362
11552
|
sales_channel_id: stringType().min(1)
|
|
11363
11553
|
});
|
|
11364
|
-
const
|
|
11365
|
-
const Shipping = () => {
|
|
11366
|
-
var _a;
|
|
11554
|
+
const ShippingAddress = () => {
|
|
11367
11555
|
const { id } = useParams();
|
|
11368
11556
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
11369
|
-
fields: "+
|
|
11557
|
+
fields: "+shipping_address"
|
|
11370
11558
|
});
|
|
11371
|
-
const {
|
|
11372
|
-
order: preview,
|
|
11373
|
-
isPending: isPreviewPending,
|
|
11374
|
-
isError: isPreviewError,
|
|
11375
|
-
error: previewError
|
|
11376
|
-
} = useOrderPreview(id);
|
|
11377
|
-
useInitiateOrderEdit({ preview });
|
|
11378
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11379
11559
|
if (isError) {
|
|
11380
11560
|
throw error;
|
|
11381
11561
|
}
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
/* @__PURE__ */ jsx(
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11562
|
+
const isReady = !isPending && !!order;
|
|
11563
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11564
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11565
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
11566
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11567
|
+
] }),
|
|
11568
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
11569
|
+
] });
|
|
11570
|
+
};
|
|
11571
|
+
const ShippingAddressForm = ({ order }) => {
|
|
11572
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11573
|
+
const form = useForm({
|
|
11574
|
+
defaultValues: {
|
|
11575
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11576
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11577
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11578
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11579
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11580
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11581
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11582
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11583
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11584
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11585
|
+
},
|
|
11586
|
+
resolver: zodResolver(schema$1)
|
|
11587
|
+
});
|
|
11588
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11589
|
+
const { handleSuccess } = useRouteModal();
|
|
11590
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11591
|
+
await mutateAsync(
|
|
11592
|
+
{
|
|
11593
|
+
shipping_address: {
|
|
11594
|
+
first_name: data.first_name,
|
|
11595
|
+
last_name: data.last_name,
|
|
11596
|
+
company: data.company,
|
|
11597
|
+
address_1: data.address_1,
|
|
11598
|
+
address_2: data.address_2,
|
|
11599
|
+
city: data.city,
|
|
11600
|
+
province: data.province,
|
|
11601
|
+
country_code: data.country_code,
|
|
11602
|
+
postal_code: data.postal_code,
|
|
11603
|
+
phone: data.phone
|
|
11604
|
+
}
|
|
11605
|
+
},
|
|
11606
|
+
{
|
|
11607
|
+
onSuccess: () => {
|
|
11608
|
+
handleSuccess();
|
|
11609
|
+
},
|
|
11610
|
+
onError: (error) => {
|
|
11611
|
+
toast.error(error.message);
|
|
11612
|
+
}
|
|
11613
|
+
}
|
|
11614
|
+
);
|
|
11615
|
+
});
|
|
11616
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11617
|
+
KeyboundForm,
|
|
11618
|
+
{
|
|
11619
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11620
|
+
onSubmit,
|
|
11621
|
+
children: [
|
|
11622
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
11623
|
+
/* @__PURE__ */ jsx(
|
|
11624
|
+
Form$2.Field,
|
|
11625
|
+
{
|
|
11626
|
+
control: form.control,
|
|
11627
|
+
name: "country_code",
|
|
11628
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11629
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11630
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11631
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11632
|
+
] })
|
|
11633
|
+
}
|
|
11634
|
+
),
|
|
11635
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11636
|
+
/* @__PURE__ */ jsx(
|
|
11637
|
+
Form$2.Field,
|
|
11638
|
+
{
|
|
11639
|
+
control: form.control,
|
|
11640
|
+
name: "first_name",
|
|
11641
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11642
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11643
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11644
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11645
|
+
] })
|
|
11646
|
+
}
|
|
11647
|
+
),
|
|
11648
|
+
/* @__PURE__ */ jsx(
|
|
11649
|
+
Form$2.Field,
|
|
11650
|
+
{
|
|
11651
|
+
control: form.control,
|
|
11652
|
+
name: "last_name",
|
|
11653
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11654
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11655
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11656
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11657
|
+
] })
|
|
11658
|
+
}
|
|
11659
|
+
)
|
|
11660
|
+
] }),
|
|
11661
|
+
/* @__PURE__ */ jsx(
|
|
11662
|
+
Form$2.Field,
|
|
11663
|
+
{
|
|
11664
|
+
control: form.control,
|
|
11665
|
+
name: "company",
|
|
11666
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11667
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11668
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11669
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11670
|
+
] })
|
|
11671
|
+
}
|
|
11672
|
+
),
|
|
11673
|
+
/* @__PURE__ */ jsx(
|
|
11674
|
+
Form$2.Field,
|
|
11675
|
+
{
|
|
11676
|
+
control: form.control,
|
|
11677
|
+
name: "address_1",
|
|
11678
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11679
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11680
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11681
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11682
|
+
] })
|
|
11683
|
+
}
|
|
11684
|
+
),
|
|
11685
|
+
/* @__PURE__ */ jsx(
|
|
11686
|
+
Form$2.Field,
|
|
11687
|
+
{
|
|
11688
|
+
control: form.control,
|
|
11689
|
+
name: "address_2",
|
|
11690
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11691
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11692
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11693
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11694
|
+
] })
|
|
11695
|
+
}
|
|
11696
|
+
),
|
|
11697
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11698
|
+
/* @__PURE__ */ jsx(
|
|
11699
|
+
Form$2.Field,
|
|
11700
|
+
{
|
|
11701
|
+
control: form.control,
|
|
11702
|
+
name: "postal_code",
|
|
11703
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11704
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11705
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11706
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11707
|
+
] })
|
|
11708
|
+
}
|
|
11709
|
+
),
|
|
11710
|
+
/* @__PURE__ */ jsx(
|
|
11711
|
+
Form$2.Field,
|
|
11712
|
+
{
|
|
11713
|
+
control: form.control,
|
|
11714
|
+
name: "city",
|
|
11715
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11716
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11717
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11718
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11719
|
+
] })
|
|
11720
|
+
}
|
|
11721
|
+
)
|
|
11722
|
+
] }),
|
|
11723
|
+
/* @__PURE__ */ jsx(
|
|
11724
|
+
Form$2.Field,
|
|
11725
|
+
{
|
|
11726
|
+
control: form.control,
|
|
11727
|
+
name: "province",
|
|
11728
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11729
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11730
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11731
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11732
|
+
] })
|
|
11733
|
+
}
|
|
11734
|
+
),
|
|
11735
|
+
/* @__PURE__ */ jsx(
|
|
11736
|
+
Form$2.Field,
|
|
11737
|
+
{
|
|
11738
|
+
control: form.control,
|
|
11739
|
+
name: "phone",
|
|
11740
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11741
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11742
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11743
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11744
|
+
] })
|
|
11745
|
+
}
|
|
11746
|
+
)
|
|
11747
|
+
] }) }),
|
|
11748
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11749
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11750
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11751
|
+
] }) })
|
|
11752
|
+
]
|
|
11753
|
+
}
|
|
11754
|
+
) });
|
|
11755
|
+
};
|
|
11756
|
+
const schema$1 = addressSchema;
|
|
11757
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11758
|
+
const Shipping = () => {
|
|
11759
|
+
var _a;
|
|
11760
|
+
const { id } = useParams();
|
|
11761
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11762
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11763
|
+
});
|
|
11764
|
+
const {
|
|
11765
|
+
order: preview,
|
|
11766
|
+
isPending: isPreviewPending,
|
|
11767
|
+
isError: isPreviewError,
|
|
11768
|
+
error: previewError
|
|
11769
|
+
} = useOrderPreview(id);
|
|
11770
|
+
useInitiateOrderEdit({ preview });
|
|
11771
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11772
|
+
if (isError) {
|
|
11773
|
+
throw error;
|
|
11774
|
+
}
|
|
11775
|
+
if (isPreviewError) {
|
|
11776
|
+
throw previewError;
|
|
11777
|
+
}
|
|
11778
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11779
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11780
|
+
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11781
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
11782
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
|
|
11783
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11784
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11785
|
+
] }) }) }),
|
|
11786
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11787
|
+
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
11788
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11789
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11790
|
+
] }) });
|
|
11398
11791
|
};
|
|
11399
11792
|
const ShippingForm = ({ preview, order }) => {
|
|
11400
11793
|
var _a;
|
|
@@ -11473,14 +11866,14 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11473
11866
|
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
11474
11867
|
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
11475
11868
|
/* @__PURE__ */ jsxs(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
11476
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16
|
|
11869
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
|
|
11477
11870
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
11478
11871
|
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11479
11872
|
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Choose which shipping method(s) to use for the items in the order." }) })
|
|
11480
11873
|
] }),
|
|
11481
11874
|
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11482
|
-
/* @__PURE__ */ jsx(Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle
|
|
11483
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
11875
|
+
/* @__PURE__ */ jsx(Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
|
|
11876
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2", children: [
|
|
11484
11877
|
/* @__PURE__ */ jsx(
|
|
11485
11878
|
Text,
|
|
11486
11879
|
{
|
|
@@ -11522,8 +11915,8 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11522
11915
|
value: profile.id,
|
|
11523
11916
|
className: "bg-ui-bg-base shadow-elevation-card-rest rounded-lg",
|
|
11524
11917
|
children: [
|
|
11525
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
11526
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3
|
|
11918
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 px-3 py-2", children: [
|
|
11919
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-x-3 overflow-hidden", children: [
|
|
11527
11920
|
/* @__PURE__ */ jsx(Accordion.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
11528
11921
|
IconButton,
|
|
11529
11922
|
{
|
|
@@ -11531,12 +11924,12 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11531
11924
|
variant: "transparent",
|
|
11532
11925
|
className: "group/trigger",
|
|
11533
11926
|
disabled: !hasItems,
|
|
11534
|
-
children: /* @__PURE__ */ jsx(TriangleRightMini, { className: "group-data-[state=open]/trigger:rotate-90
|
|
11927
|
+
children: /* @__PURE__ */ jsx(TriangleRightMini, { className: "transition-transform group-data-[state=open]/trigger:rotate-90" })
|
|
11535
11928
|
}
|
|
11536
11929
|
) }),
|
|
11537
11930
|
!shippingOption ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
11538
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
11539
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-
|
|
11931
|
+
/* @__PURE__ */ jsx("div", { className: "shadow-borders-base flex size-7 items-center justify-center rounded-md", children: /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-component-hover flex size-6 items-center justify-center rounded", children: /* @__PURE__ */ jsx(Shopping, { className: "text-ui-fg-subtle" }) }) }),
|
|
11932
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col", children: [
|
|
11540
11933
|
/* @__PURE__ */ jsx(
|
|
11541
11934
|
Text,
|
|
11542
11935
|
{
|
|
@@ -11560,7 +11953,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11560
11953
|
}
|
|
11561
11954
|
)
|
|
11562
11955
|
] })
|
|
11563
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[5px] max-sm:flex-col max-sm:items-start
|
|
11956
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-1 items-center gap-[5px] overflow-hidden max-sm:flex-col max-sm:items-start", children: [
|
|
11564
11957
|
/* @__PURE__ */ jsx(
|
|
11565
11958
|
Tooltip,
|
|
11566
11959
|
{
|
|
@@ -11577,7 +11970,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11577
11970
|
children: /* @__PURE__ */ jsxs(
|
|
11578
11971
|
Badge,
|
|
11579
11972
|
{
|
|
11580
|
-
className: "flex items-center gap-x-[3px] overflow-hidden
|
|
11973
|
+
className: "flex cursor-default items-center gap-x-[3px] overflow-hidden",
|
|
11581
11974
|
size: "xsmall",
|
|
11582
11975
|
children: [
|
|
11583
11976
|
/* @__PURE__ */ jsx(Shopping, { className: "shrink-0" }),
|
|
@@ -11602,7 +11995,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11602
11995
|
children: /* @__PURE__ */ jsxs(
|
|
11603
11996
|
Badge,
|
|
11604
11997
|
{
|
|
11605
|
-
className: "flex items-center gap-x-[3px] overflow-hidden
|
|
11998
|
+
className: "flex cursor-default items-center gap-x-[3px] overflow-hidden",
|
|
11606
11999
|
size: "xsmall",
|
|
11607
12000
|
children: [
|
|
11608
12001
|
/* @__PURE__ */ jsx(Buildings, { className: "shrink-0" }),
|
|
@@ -11615,7 +12008,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11615
12008
|
/* @__PURE__ */ jsx(Tooltip, { content: shippingOption.name, children: /* @__PURE__ */ jsxs(
|
|
11616
12009
|
Badge,
|
|
11617
12010
|
{
|
|
11618
|
-
className: "flex items-center gap-x-[3px] overflow-hidden
|
|
12011
|
+
className: "flex cursor-default items-center gap-x-[3px] overflow-hidden",
|
|
11619
12012
|
size: "xsmall",
|
|
11620
12013
|
children: [
|
|
11621
12014
|
/* @__PURE__ */ jsx(TruckFast, { className: "shrink-0" }),
|
|
@@ -11686,17 +12079,17 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11686
12079
|
/* @__PURE__ */ jsxs(
|
|
11687
12080
|
"div",
|
|
11688
12081
|
{
|
|
11689
|
-
className: "
|
|
12082
|
+
className: "flex items-center gap-x-3 px-3",
|
|
11690
12083
|
children: [
|
|
11691
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
12084
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-[56px] w-5 flex-col items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
11692
12085
|
Divider,
|
|
11693
12086
|
{
|
|
11694
12087
|
variant: "dashed",
|
|
11695
12088
|
orientation: "vertical"
|
|
11696
12089
|
}
|
|
11697
12090
|
) }),
|
|
11698
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
11699
|
-
/* @__PURE__ */ jsx("div", { className: "size-7
|
|
12091
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3 py-2", children: [
|
|
12092
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-7 items-center justify-center tabular-nums", children: /* @__PURE__ */ jsxs(
|
|
11700
12093
|
Text,
|
|
11701
12094
|
{
|
|
11702
12095
|
size: "small",
|
|
@@ -11877,7 +12270,7 @@ const ShippingProfileForm = ({
|
|
|
11877
12270
|
onSubmit,
|
|
11878
12271
|
children: [
|
|
11879
12272
|
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
11880
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16
|
|
12273
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
|
|
11881
12274
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
11882
12275
|
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11883
12276
|
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a shipping method for the selected shipping profile. You can see the items that will be shipped using this method in the preview below." }) })
|
|
@@ -11950,14 +12343,14 @@ const ItemsPreview = ({ order, shippingProfileId }) => {
|
|
|
11950
12343
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Items with the selected shipping profile." })
|
|
11951
12344
|
] }) }),
|
|
11952
12345
|
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
|
|
11953
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 px-4 py-2
|
|
12346
|
+
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted grid grid-cols-2 gap-3 px-4 py-2", children: [
|
|
11954
12347
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: "Item" }) }),
|
|
11955
12348
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: "Quantity" }) })
|
|
11956
12349
|
] }),
|
|
11957
12350
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsxs(
|
|
11958
12351
|
"div",
|
|
11959
12352
|
{
|
|
11960
|
-
className: "
|
|
12353
|
+
className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-2 items-center gap-3 rounded-lg px-4 py-2",
|
|
11961
12354
|
children: [
|
|
11962
12355
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
11963
12356
|
/* @__PURE__ */ jsx(
|
|
@@ -12010,7 +12403,7 @@ const ItemsPreview = ({ order, shippingProfileId }) => {
|
|
|
12010
12403
|
]
|
|
12011
12404
|
},
|
|
12012
12405
|
item.id
|
|
12013
|
-
)) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-x-3
|
|
12406
|
+
)) : /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex flex-col items-center justify-center gap-1 gap-x-3 rounded-lg p-4", children: [
|
|
12014
12407
|
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
|
|
12015
12408
|
/* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
12016
12409
|
'No items found for "',
|
|
@@ -12168,244 +12561,41 @@ const CustomAmountField = ({
|
|
|
12168
12561
|
}
|
|
12169
12562
|
);
|
|
12170
12563
|
};
|
|
12171
|
-
const
|
|
12564
|
+
const TransferOwnership = () => {
|
|
12172
12565
|
const { id } = useParams();
|
|
12173
|
-
const {
|
|
12174
|
-
fields: "
|
|
12566
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
12567
|
+
fields: "id,customer_id,customer.*"
|
|
12175
12568
|
});
|
|
12176
12569
|
if (isError) {
|
|
12177
12570
|
throw error;
|
|
12178
12571
|
}
|
|
12179
|
-
const isReady = !isPending && !!
|
|
12572
|
+
const isReady = !isPending && !!draft_order;
|
|
12180
12573
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12181
12574
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12182
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
12183
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
12575
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
|
|
12576
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
|
|
12184
12577
|
] }),
|
|
12185
|
-
isReady && /* @__PURE__ */ jsx(
|
|
12578
|
+
isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
|
|
12186
12579
|
] });
|
|
12187
12580
|
};
|
|
12188
|
-
const
|
|
12189
|
-
var _a, _b
|
|
12581
|
+
const TransferOwnershipForm = ({ order }) => {
|
|
12582
|
+
var _a, _b;
|
|
12190
12583
|
const form = useForm({
|
|
12191
12584
|
defaultValues: {
|
|
12192
|
-
|
|
12193
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12194
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12195
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12196
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12197
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12198
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12199
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12200
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12201
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12585
|
+
customer_id: order.customer_id || ""
|
|
12202
12586
|
},
|
|
12203
|
-
resolver: zodResolver(schema
|
|
12587
|
+
resolver: zodResolver(schema)
|
|
12204
12588
|
});
|
|
12205
12589
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12206
12590
|
const { handleSuccess } = useRouteModal();
|
|
12591
|
+
const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
|
|
12592
|
+
const currentCustomer = order.customer ? {
|
|
12593
|
+
label: name ? `${name} (${order.customer.email})` : order.customer.email,
|
|
12594
|
+
value: order.customer.id
|
|
12595
|
+
} : null;
|
|
12207
12596
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12208
12597
|
await mutateAsync(
|
|
12209
|
-
{
|
|
12210
|
-
shipping_address: {
|
|
12211
|
-
first_name: data.first_name,
|
|
12212
|
-
last_name: data.last_name,
|
|
12213
|
-
company: data.company,
|
|
12214
|
-
address_1: data.address_1,
|
|
12215
|
-
address_2: data.address_2,
|
|
12216
|
-
city: data.city,
|
|
12217
|
-
province: data.province,
|
|
12218
|
-
country_code: data.country_code,
|
|
12219
|
-
postal_code: data.postal_code,
|
|
12220
|
-
phone: data.phone
|
|
12221
|
-
}
|
|
12222
|
-
},
|
|
12223
|
-
{
|
|
12224
|
-
onSuccess: () => {
|
|
12225
|
-
handleSuccess();
|
|
12226
|
-
},
|
|
12227
|
-
onError: (error) => {
|
|
12228
|
-
toast.error(error.message);
|
|
12229
|
-
}
|
|
12230
|
-
}
|
|
12231
|
-
);
|
|
12232
|
-
});
|
|
12233
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12234
|
-
KeyboundForm,
|
|
12235
|
-
{
|
|
12236
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12237
|
-
onSubmit,
|
|
12238
|
-
children: [
|
|
12239
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
12240
|
-
/* @__PURE__ */ jsx(
|
|
12241
|
-
Form$2.Field,
|
|
12242
|
-
{
|
|
12243
|
-
control: form.control,
|
|
12244
|
-
name: "country_code",
|
|
12245
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12246
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12247
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12248
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12249
|
-
] })
|
|
12250
|
-
}
|
|
12251
|
-
),
|
|
12252
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12253
|
-
/* @__PURE__ */ jsx(
|
|
12254
|
-
Form$2.Field,
|
|
12255
|
-
{
|
|
12256
|
-
control: form.control,
|
|
12257
|
-
name: "first_name",
|
|
12258
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12259
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12260
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12261
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12262
|
-
] })
|
|
12263
|
-
}
|
|
12264
|
-
),
|
|
12265
|
-
/* @__PURE__ */ jsx(
|
|
12266
|
-
Form$2.Field,
|
|
12267
|
-
{
|
|
12268
|
-
control: form.control,
|
|
12269
|
-
name: "last_name",
|
|
12270
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12271
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12272
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12273
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12274
|
-
] })
|
|
12275
|
-
}
|
|
12276
|
-
)
|
|
12277
|
-
] }),
|
|
12278
|
-
/* @__PURE__ */ jsx(
|
|
12279
|
-
Form$2.Field,
|
|
12280
|
-
{
|
|
12281
|
-
control: form.control,
|
|
12282
|
-
name: "company",
|
|
12283
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12284
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12285
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12286
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12287
|
-
] })
|
|
12288
|
-
}
|
|
12289
|
-
),
|
|
12290
|
-
/* @__PURE__ */ jsx(
|
|
12291
|
-
Form$2.Field,
|
|
12292
|
-
{
|
|
12293
|
-
control: form.control,
|
|
12294
|
-
name: "address_1",
|
|
12295
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12296
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12297
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12298
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12299
|
-
] })
|
|
12300
|
-
}
|
|
12301
|
-
),
|
|
12302
|
-
/* @__PURE__ */ jsx(
|
|
12303
|
-
Form$2.Field,
|
|
12304
|
-
{
|
|
12305
|
-
control: form.control,
|
|
12306
|
-
name: "address_2",
|
|
12307
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12308
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12309
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12310
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12311
|
-
] })
|
|
12312
|
-
}
|
|
12313
|
-
),
|
|
12314
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12315
|
-
/* @__PURE__ */ jsx(
|
|
12316
|
-
Form$2.Field,
|
|
12317
|
-
{
|
|
12318
|
-
control: form.control,
|
|
12319
|
-
name: "postal_code",
|
|
12320
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12321
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12322
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12323
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12324
|
-
] })
|
|
12325
|
-
}
|
|
12326
|
-
),
|
|
12327
|
-
/* @__PURE__ */ jsx(
|
|
12328
|
-
Form$2.Field,
|
|
12329
|
-
{
|
|
12330
|
-
control: form.control,
|
|
12331
|
-
name: "city",
|
|
12332
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12333
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12334
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12335
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12336
|
-
] })
|
|
12337
|
-
}
|
|
12338
|
-
)
|
|
12339
|
-
] }),
|
|
12340
|
-
/* @__PURE__ */ jsx(
|
|
12341
|
-
Form$2.Field,
|
|
12342
|
-
{
|
|
12343
|
-
control: form.control,
|
|
12344
|
-
name: "province",
|
|
12345
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12346
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12347
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12348
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12349
|
-
] })
|
|
12350
|
-
}
|
|
12351
|
-
),
|
|
12352
|
-
/* @__PURE__ */ jsx(
|
|
12353
|
-
Form$2.Field,
|
|
12354
|
-
{
|
|
12355
|
-
control: form.control,
|
|
12356
|
-
name: "phone",
|
|
12357
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12358
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12359
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12360
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12361
|
-
] })
|
|
12362
|
-
}
|
|
12363
|
-
)
|
|
12364
|
-
] }) }),
|
|
12365
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12366
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12367
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12368
|
-
] }) })
|
|
12369
|
-
]
|
|
12370
|
-
}
|
|
12371
|
-
) });
|
|
12372
|
-
};
|
|
12373
|
-
const schema$2 = addressSchema;
|
|
12374
|
-
const TransferOwnership = () => {
|
|
12375
|
-
const { id } = useParams();
|
|
12376
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
12377
|
-
fields: "id,customer_id,customer.*"
|
|
12378
|
-
});
|
|
12379
|
-
if (isError) {
|
|
12380
|
-
throw error;
|
|
12381
|
-
}
|
|
12382
|
-
const isReady = !isPending && !!draft_order;
|
|
12383
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12384
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12385
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
|
|
12386
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
|
|
12387
|
-
] }),
|
|
12388
|
-
isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
|
|
12389
|
-
] });
|
|
12390
|
-
};
|
|
12391
|
-
const TransferOwnershipForm = ({ order }) => {
|
|
12392
|
-
var _a, _b;
|
|
12393
|
-
const form = useForm({
|
|
12394
|
-
defaultValues: {
|
|
12395
|
-
customer_id: order.customer_id || ""
|
|
12396
|
-
},
|
|
12397
|
-
resolver: zodResolver(schema$1)
|
|
12398
|
-
});
|
|
12399
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12400
|
-
const { handleSuccess } = useRouteModal();
|
|
12401
|
-
const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
|
|
12402
|
-
const currentCustomer = order.customer ? {
|
|
12403
|
-
label: name ? `${name} (${order.customer.email})` : order.customer.email,
|
|
12404
|
-
value: order.customer.id
|
|
12405
|
-
} : null;
|
|
12406
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12407
|
-
await mutateAsync(
|
|
12408
|
-
{ customer_id: data.customer_id },
|
|
12598
|
+
{ customer_id: data.customer_id },
|
|
12409
12599
|
{
|
|
12410
12600
|
onSuccess: () => {
|
|
12411
12601
|
toast.success("Customer updated");
|
|
@@ -12844,199 +13034,9 @@ const Illustration = () => {
|
|
|
12844
13034
|
}
|
|
12845
13035
|
);
|
|
12846
13036
|
};
|
|
12847
|
-
const schema
|
|
13037
|
+
const schema = objectType({
|
|
12848
13038
|
customer_id: stringType().min(1)
|
|
12849
13039
|
});
|
|
12850
|
-
const BillingAddress = () => {
|
|
12851
|
-
const { id } = useParams();
|
|
12852
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12853
|
-
fields: "+billing_address"
|
|
12854
|
-
});
|
|
12855
|
-
if (isError) {
|
|
12856
|
-
throw error;
|
|
12857
|
-
}
|
|
12858
|
-
const isReady = !isPending && !!order;
|
|
12859
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12860
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12861
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
12862
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12863
|
-
] }),
|
|
12864
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
12865
|
-
] });
|
|
12866
|
-
};
|
|
12867
|
-
const BillingAddressForm = ({ order }) => {
|
|
12868
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12869
|
-
const form = useForm({
|
|
12870
|
-
defaultValues: {
|
|
12871
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12872
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12873
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12874
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12875
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12876
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12877
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12878
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12879
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12880
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12881
|
-
},
|
|
12882
|
-
resolver: zodResolver(schema)
|
|
12883
|
-
});
|
|
12884
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12885
|
-
const { handleSuccess } = useRouteModal();
|
|
12886
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12887
|
-
await mutateAsync(
|
|
12888
|
-
{ billing_address: data },
|
|
12889
|
-
{
|
|
12890
|
-
onSuccess: () => {
|
|
12891
|
-
handleSuccess();
|
|
12892
|
-
},
|
|
12893
|
-
onError: (error) => {
|
|
12894
|
-
toast.error(error.message);
|
|
12895
|
-
}
|
|
12896
|
-
}
|
|
12897
|
-
);
|
|
12898
|
-
});
|
|
12899
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12900
|
-
KeyboundForm,
|
|
12901
|
-
{
|
|
12902
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12903
|
-
onSubmit,
|
|
12904
|
-
children: [
|
|
12905
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
12906
|
-
/* @__PURE__ */ jsx(
|
|
12907
|
-
Form$2.Field,
|
|
12908
|
-
{
|
|
12909
|
-
control: form.control,
|
|
12910
|
-
name: "country_code",
|
|
12911
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12912
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12913
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12914
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12915
|
-
] })
|
|
12916
|
-
}
|
|
12917
|
-
),
|
|
12918
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12919
|
-
/* @__PURE__ */ jsx(
|
|
12920
|
-
Form$2.Field,
|
|
12921
|
-
{
|
|
12922
|
-
control: form.control,
|
|
12923
|
-
name: "first_name",
|
|
12924
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12925
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12926
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12927
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12928
|
-
] })
|
|
12929
|
-
}
|
|
12930
|
-
),
|
|
12931
|
-
/* @__PURE__ */ jsx(
|
|
12932
|
-
Form$2.Field,
|
|
12933
|
-
{
|
|
12934
|
-
control: form.control,
|
|
12935
|
-
name: "last_name",
|
|
12936
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12937
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12938
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12939
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12940
|
-
] })
|
|
12941
|
-
}
|
|
12942
|
-
)
|
|
12943
|
-
] }),
|
|
12944
|
-
/* @__PURE__ */ jsx(
|
|
12945
|
-
Form$2.Field,
|
|
12946
|
-
{
|
|
12947
|
-
control: form.control,
|
|
12948
|
-
name: "company",
|
|
12949
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12950
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12951
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12952
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12953
|
-
] })
|
|
12954
|
-
}
|
|
12955
|
-
),
|
|
12956
|
-
/* @__PURE__ */ jsx(
|
|
12957
|
-
Form$2.Field,
|
|
12958
|
-
{
|
|
12959
|
-
control: form.control,
|
|
12960
|
-
name: "address_1",
|
|
12961
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12962
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12963
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12964
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12965
|
-
] })
|
|
12966
|
-
}
|
|
12967
|
-
),
|
|
12968
|
-
/* @__PURE__ */ jsx(
|
|
12969
|
-
Form$2.Field,
|
|
12970
|
-
{
|
|
12971
|
-
control: form.control,
|
|
12972
|
-
name: "address_2",
|
|
12973
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12974
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12975
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12976
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12977
|
-
] })
|
|
12978
|
-
}
|
|
12979
|
-
),
|
|
12980
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12981
|
-
/* @__PURE__ */ jsx(
|
|
12982
|
-
Form$2.Field,
|
|
12983
|
-
{
|
|
12984
|
-
control: form.control,
|
|
12985
|
-
name: "postal_code",
|
|
12986
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12987
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12988
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12989
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12990
|
-
] })
|
|
12991
|
-
}
|
|
12992
|
-
),
|
|
12993
|
-
/* @__PURE__ */ jsx(
|
|
12994
|
-
Form$2.Field,
|
|
12995
|
-
{
|
|
12996
|
-
control: form.control,
|
|
12997
|
-
name: "city",
|
|
12998
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12999
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
13000
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13001
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13002
|
-
] })
|
|
13003
|
-
}
|
|
13004
|
-
)
|
|
13005
|
-
] }),
|
|
13006
|
-
/* @__PURE__ */ jsx(
|
|
13007
|
-
Form$2.Field,
|
|
13008
|
-
{
|
|
13009
|
-
control: form.control,
|
|
13010
|
-
name: "province",
|
|
13011
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13012
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13013
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13014
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13015
|
-
] })
|
|
13016
|
-
}
|
|
13017
|
-
),
|
|
13018
|
-
/* @__PURE__ */ jsx(
|
|
13019
|
-
Form$2.Field,
|
|
13020
|
-
{
|
|
13021
|
-
control: form.control,
|
|
13022
|
-
name: "phone",
|
|
13023
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13024
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13025
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13026
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13027
|
-
] })
|
|
13028
|
-
}
|
|
13029
|
-
)
|
|
13030
|
-
] }) }),
|
|
13031
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13032
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13033
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13034
|
-
] }) })
|
|
13035
|
-
]
|
|
13036
|
-
}
|
|
13037
|
-
) });
|
|
13038
|
-
};
|
|
13039
|
-
const schema = addressSchema;
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
13042
13042
|
routes: [
|
|
@@ -13058,13 +13058,17 @@ const routeModule = {
|
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
13060
|
{
|
|
13061
|
-
Component:
|
|
13062
|
-
path: "/draft-orders/:id/
|
|
13061
|
+
Component: BillingAddress,
|
|
13062
|
+
path: "/draft-orders/:id/billing-address"
|
|
13063
13063
|
},
|
|
13064
13064
|
{
|
|
13065
13065
|
Component: Email,
|
|
13066
13066
|
path: "/draft-orders/:id/email"
|
|
13067
13067
|
},
|
|
13068
|
+
{
|
|
13069
|
+
Component: CustomItems,
|
|
13070
|
+
path: "/draft-orders/:id/custom-items"
|
|
13071
|
+
},
|
|
13068
13072
|
{
|
|
13069
13073
|
Component: Items,
|
|
13070
13074
|
path: "/draft-orders/:id/items"
|
|
@@ -13081,21 +13085,17 @@ const routeModule = {
|
|
|
13081
13085
|
Component: SalesChannel,
|
|
13082
13086
|
path: "/draft-orders/:id/sales-channel"
|
|
13083
13087
|
},
|
|
13084
|
-
{
|
|
13085
|
-
Component: Shipping,
|
|
13086
|
-
path: "/draft-orders/:id/shipping"
|
|
13087
|
-
},
|
|
13088
13088
|
{
|
|
13089
13089
|
Component: ShippingAddress,
|
|
13090
13090
|
path: "/draft-orders/:id/shipping-address"
|
|
13091
13091
|
},
|
|
13092
13092
|
{
|
|
13093
|
-
Component:
|
|
13094
|
-
path: "/draft-orders/:id/
|
|
13093
|
+
Component: Shipping,
|
|
13094
|
+
path: "/draft-orders/:id/shipping"
|
|
13095
13095
|
},
|
|
13096
13096
|
{
|
|
13097
|
-
Component:
|
|
13098
|
-
path: "/draft-orders/:id/
|
|
13097
|
+
Component: TransferOwnership,
|
|
13098
|
+
path: "/draft-orders/:id/transfer-ownership"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|