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