@medusajs/draft-order 2.10.4-snapshot-20250926124023 → 2.10.4-snapshot-20250926180407
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +354 -354
- package/.medusa/server/src/admin/index.mjs +354 -354
- package/package.json +16 -16
|
@@ -9567,10 +9567,31 @@ const ID = () => {
|
|
|
9567
9567
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9568
9568
|
] });
|
|
9569
9569
|
};
|
|
9570
|
-
const
|
|
9570
|
+
const CustomItems = () => {
|
|
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 = () => {
|
|
9571
9592
|
const { id } = useParams();
|
|
9572
9593
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9573
|
-
fields: "+
|
|
9594
|
+
fields: "+email"
|
|
9574
9595
|
});
|
|
9575
9596
|
if (isError) {
|
|
9576
9597
|
throw error;
|
|
@@ -9578,34 +9599,24 @@ const BillingAddress = () => {
|
|
|
9578
9599
|
const isReady = !isPending && !!order;
|
|
9579
9600
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9580
9601
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9581
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
9582
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
9602
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9603
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9583
9604
|
] }),
|
|
9584
|
-
isReady && /* @__PURE__ */ jsx(
|
|
9605
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9585
9606
|
] });
|
|
9586
9607
|
};
|
|
9587
|
-
const
|
|
9588
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9608
|
+
const EmailForm = ({ order }) => {
|
|
9589
9609
|
const form = useForm({
|
|
9590
9610
|
defaultValues: {
|
|
9591
|
-
|
|
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) ?? ""
|
|
9611
|
+
email: order.email ?? ""
|
|
9601
9612
|
},
|
|
9602
|
-
resolver: zodResolver(schema$
|
|
9613
|
+
resolver: zodResolver(schema$4)
|
|
9603
9614
|
});
|
|
9604
9615
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9605
9616
|
const { handleSuccess } = useRouteModal();
|
|
9606
9617
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
9607
9618
|
await mutateAsync(
|
|
9608
|
-
{
|
|
9619
|
+
{ email: data.email },
|
|
9609
9620
|
{
|
|
9610
9621
|
onSuccess: () => {
|
|
9611
9622
|
handleSuccess();
|
|
@@ -9622,132 +9633,18 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9622
9633
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9623
9634
|
onSubmit,
|
|
9624
9635
|
children: [
|
|
9625
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
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
|
-
] }) }),
|
|
9636
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9637
|
+
Form$2.Field,
|
|
9638
|
+
{
|
|
9639
|
+
control: form.control,
|
|
9640
|
+
name: "email",
|
|
9641
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9642
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9643
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9644
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9645
|
+
] })
|
|
9646
|
+
}
|
|
9647
|
+
) }),
|
|
9751
9648
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9752
9649
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9753
9650
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -9756,25 +9653,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9756
9653
|
}
|
|
9757
9654
|
) });
|
|
9758
9655
|
};
|
|
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
|
-
};
|
|
9778
9656
|
const schema$4 = objectType({
|
|
9779
9657
|
email: stringType().email()
|
|
9780
9658
|
});
|
|
@@ -11379,59 +11257,165 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11379
11257
|
}
|
|
11380
11258
|
return Array.from(promotionIds);
|
|
11381
11259
|
}
|
|
11382
|
-
const
|
|
11383
|
-
const Shipping = () => {
|
|
11384
|
-
var _a;
|
|
11260
|
+
const SalesChannel = () => {
|
|
11385
11261
|
const { id } = useParams();
|
|
11386
|
-
const {
|
|
11387
|
-
|
|
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(
|
|
11262
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11263
|
+
id,
|
|
11424
11264
|
{
|
|
11425
|
-
|
|
11426
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11265
|
+
fields: "+sales_channel_id"
|
|
11427
11266
|
},
|
|
11428
11267
|
{
|
|
11429
|
-
enabled:
|
|
11268
|
+
enabled: !!id
|
|
11430
11269
|
}
|
|
11431
11270
|
);
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
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
|
|
11414
|
+
}
|
|
11415
|
+
);
|
|
11416
|
+
const uniqueShippingProfiles = useMemo(() => {
|
|
11417
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
11418
|
+
getUniqueShippingProfiles(order.items).forEach((profile) => {
|
|
11435
11419
|
profiles.set(profile.id, profile);
|
|
11436
11420
|
});
|
|
11437
11421
|
shipping_options == null ? void 0 : shipping_options.forEach((option) => {
|
|
@@ -12218,7 +12202,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12218
12202
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12219
12203
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12220
12204
|
},
|
|
12221
|
-
resolver: zodResolver(schema$
|
|
12205
|
+
resolver: zodResolver(schema$2)
|
|
12222
12206
|
});
|
|
12223
12207
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12224
12208
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12388,7 +12372,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12388
12372
|
}
|
|
12389
12373
|
) });
|
|
12390
12374
|
};
|
|
12391
|
-
const schema$
|
|
12375
|
+
const schema$2 = addressSchema;
|
|
12392
12376
|
const TransferOwnership = () => {
|
|
12393
12377
|
const { id } = useParams();
|
|
12394
12378
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12412,7 +12396,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12412
12396
|
defaultValues: {
|
|
12413
12397
|
customer_id: order.customer_id || ""
|
|
12414
12398
|
},
|
|
12415
|
-
resolver: zodResolver(schema$
|
|
12399
|
+
resolver: zodResolver(schema$1)
|
|
12416
12400
|
});
|
|
12417
12401
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12418
12402
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12862,13 +12846,13 @@ const Illustration = () => {
|
|
|
12862
12846
|
}
|
|
12863
12847
|
);
|
|
12864
12848
|
};
|
|
12865
|
-
const schema$
|
|
12849
|
+
const schema$1 = objectType({
|
|
12866
12850
|
customer_id: stringType().min(1)
|
|
12867
12851
|
});
|
|
12868
|
-
const
|
|
12852
|
+
const BillingAddress = () => {
|
|
12869
12853
|
const { id } = useParams();
|
|
12870
12854
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12871
|
-
fields: "+
|
|
12855
|
+
fields: "+billing_address"
|
|
12872
12856
|
});
|
|
12873
12857
|
if (isError) {
|
|
12874
12858
|
throw error;
|
|
@@ -12876,90 +12860,26 @@ const Email = () => {
|
|
|
12876
12860
|
const isReady = !isPending && !!order;
|
|
12877
12861
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12878
12862
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12879
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
12880
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
12881
|
-
] }),
|
|
12882
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12883
|
-
] });
|
|
12884
|
-
};
|
|
12885
|
-
const EmailForm = ({ order }) => {
|
|
12886
|
-
const form = useForm({
|
|
12887
|
-
defaultValues: {
|
|
12888
|
-
email: order.email ?? ""
|
|
12889
|
-
},
|
|
12890
|
-
resolver: zodResolver(schema$1)
|
|
12891
|
-
});
|
|
12892
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12893
|
-
const { handleSuccess } = useRouteModal();
|
|
12894
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12895
|
-
await mutateAsync(
|
|
12896
|
-
{ email: data.email },
|
|
12897
|
-
{
|
|
12898
|
-
onSuccess: () => {
|
|
12899
|
-
handleSuccess();
|
|
12900
|
-
},
|
|
12901
|
-
onError: (error) => {
|
|
12902
|
-
toast.error(error.message);
|
|
12903
|
-
}
|
|
12904
|
-
}
|
|
12905
|
-
);
|
|
12906
|
-
});
|
|
12907
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12908
|
-
KeyboundForm,
|
|
12909
|
-
{
|
|
12910
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12911
|
-
onSubmit,
|
|
12912
|
-
children: [
|
|
12913
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
12914
|
-
Form$2.Field,
|
|
12915
|
-
{
|
|
12916
|
-
control: form.control,
|
|
12917
|
-
name: "email",
|
|
12918
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12919
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
12920
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12921
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12922
|
-
] })
|
|
12923
|
-
}
|
|
12924
|
-
) }),
|
|
12925
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12926
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12927
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12928
|
-
] }) })
|
|
12929
|
-
]
|
|
12930
|
-
}
|
|
12931
|
-
) });
|
|
12932
|
-
};
|
|
12933
|
-
const schema$1 = objectType({
|
|
12934
|
-
email: stringType().email()
|
|
12935
|
-
});
|
|
12936
|
-
const SalesChannel = () => {
|
|
12937
|
-
const { id } = useParams();
|
|
12938
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12939
|
-
id,
|
|
12940
|
-
{
|
|
12941
|
-
fields: "+sales_channel_id"
|
|
12942
|
-
},
|
|
12943
|
-
{
|
|
12944
|
-
enabled: !!id
|
|
12945
|
-
}
|
|
12946
|
-
);
|
|
12947
|
-
if (isError) {
|
|
12948
|
-
throw error;
|
|
12949
|
-
}
|
|
12950
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12951
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12952
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12953
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12954
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12863
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
12864
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12955
12865
|
] }),
|
|
12956
|
-
|
|
12866
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
12957
12867
|
] });
|
|
12958
12868
|
};
|
|
12959
|
-
const
|
|
12869
|
+
const BillingAddressForm = ({ order }) => {
|
|
12870
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12960
12871
|
const form = useForm({
|
|
12961
12872
|
defaultValues: {
|
|
12962
|
-
|
|
12873
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
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) ?? ""
|
|
12963
12883
|
},
|
|
12964
12884
|
resolver: zodResolver(schema)
|
|
12965
12885
|
});
|
|
@@ -12967,12 +12887,9 @@ const SalesChannelForm = ({ order }) => {
|
|
|
12967
12887
|
const { handleSuccess } = useRouteModal();
|
|
12968
12888
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12969
12889
|
await mutateAsync(
|
|
12970
|
-
{
|
|
12971
|
-
sales_channel_id: data.sales_channel_id
|
|
12972
|
-
},
|
|
12890
|
+
{ billing_address: data },
|
|
12973
12891
|
{
|
|
12974
12892
|
onSuccess: () => {
|
|
12975
|
-
toast.success("Sales channel updated");
|
|
12976
12893
|
handleSuccess();
|
|
12977
12894
|
},
|
|
12978
12895
|
onError: (error) => {
|
|
@@ -12987,7 +12904,132 @@ const SalesChannelForm = ({ order }) => {
|
|
|
12987
12904
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
12988
12905
|
onSubmit,
|
|
12989
12906
|
children: [
|
|
12990
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
12907
|
+
/* @__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: [
|
|
12908
|
+
/* @__PURE__ */ jsx(
|
|
12909
|
+
Form$2.Field,
|
|
12910
|
+
{
|
|
12911
|
+
control: form.control,
|
|
12912
|
+
name: "country_code",
|
|
12913
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12914
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12915
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12916
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
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
|
+
] }) }),
|
|
12991
13033
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12992
13034
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12993
13035
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -12996,49 +13038,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
12996
13038
|
}
|
|
12997
13039
|
) });
|
|
12998
13040
|
};
|
|
12999
|
-
const
|
|
13000
|
-
const salesChannels = useComboboxData({
|
|
13001
|
-
queryFn: async (params) => {
|
|
13002
|
-
return await sdk.admin.salesChannel.list(params);
|
|
13003
|
-
},
|
|
13004
|
-
queryKey: ["sales-channels"],
|
|
13005
|
-
getOptions: (data) => {
|
|
13006
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
13007
|
-
label: salesChannel.name,
|
|
13008
|
-
value: salesChannel.id
|
|
13009
|
-
}));
|
|
13010
|
-
},
|
|
13011
|
-
defaultValue: order.sales_channel_id || void 0
|
|
13012
|
-
});
|
|
13013
|
-
return /* @__PURE__ */ jsx(
|
|
13014
|
-
Form$2.Field,
|
|
13015
|
-
{
|
|
13016
|
-
control,
|
|
13017
|
-
name: "sales_channel_id",
|
|
13018
|
-
render: ({ field }) => {
|
|
13019
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13020
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
13021
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
13022
|
-
Combobox,
|
|
13023
|
-
{
|
|
13024
|
-
options: salesChannels.options,
|
|
13025
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
13026
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
13027
|
-
searchValue: salesChannels.searchValue,
|
|
13028
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
13029
|
-
placeholder: "Select sales channel",
|
|
13030
|
-
...field
|
|
13031
|
-
}
|
|
13032
|
-
) }),
|
|
13033
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13034
|
-
] });
|
|
13035
|
-
}
|
|
13036
|
-
}
|
|
13037
|
-
);
|
|
13038
|
-
};
|
|
13039
|
-
const schema = objectType({
|
|
13040
|
-
sales_channel_id: stringType().min(1)
|
|
13041
|
-
});
|
|
13041
|
+
const schema = addressSchema;
|
|
13042
13042
|
const widgetModule = { widgets: [] };
|
|
13043
13043
|
const routeModule = {
|
|
13044
13044
|
routes: [
|
|
@@ -13059,14 +13059,14 @@ const routeModule = {
|
|
|
13059
13059
|
handle,
|
|
13060
13060
|
loader,
|
|
13061
13061
|
children: [
|
|
13062
|
-
{
|
|
13063
|
-
Component: BillingAddress,
|
|
13064
|
-
path: "/draft-orders/:id/billing-address"
|
|
13065
|
-
},
|
|
13066
13062
|
{
|
|
13067
13063
|
Component: CustomItems,
|
|
13068
13064
|
path: "/draft-orders/:id/custom-items"
|
|
13069
13065
|
},
|
|
13066
|
+
{
|
|
13067
|
+
Component: Email,
|
|
13068
|
+
path: "/draft-orders/:id/email"
|
|
13069
|
+
},
|
|
13070
13070
|
{
|
|
13071
13071
|
Component: Items,
|
|
13072
13072
|
path: "/draft-orders/:id/items"
|
|
@@ -13079,6 +13079,10 @@ 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
|
+
},
|
|
13082
13086
|
{
|
|
13083
13087
|
Component: Shipping,
|
|
13084
13088
|
path: "/draft-orders/:id/shipping"
|
|
@@ -13092,12 +13096,8 @@ const routeModule = {
|
|
|
13092
13096
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13093
13097
|
},
|
|
13094
13098
|
{
|
|
13095
|
-
Component:
|
|
13096
|
-
path: "/draft-orders/:id/
|
|
13097
|
-
},
|
|
13098
|
-
{
|
|
13099
|
-
Component: SalesChannel,
|
|
13100
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13099
|
+
Component: BillingAddress,
|
|
13100
|
+
path: "/draft-orders/:id/billing-address"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|