@medusajs/draft-order 2.10.4-preview-20250919210158 → 2.10.4-preview-20250920000323
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 +324 -324
- package/.medusa/server/src/admin/index.mjs +324 -324
- package/package.json +16 -16
|
@@ -9573,95 +9573,6 @@ const ID = () => {
|
|
|
9573
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9574
9574
|
] });
|
|
9575
9575
|
};
|
|
9576
|
-
const CustomItems = () => {
|
|
9577
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9578
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9579
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9580
|
-
] });
|
|
9581
|
-
};
|
|
9582
|
-
const CustomItemsForm = () => {
|
|
9583
|
-
const form = reactHookForm.useForm({
|
|
9584
|
-
resolver: zod.zodResolver(schema$5)
|
|
9585
|
-
});
|
|
9586
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9587
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9588
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9589
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9590
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9591
|
-
] }) })
|
|
9592
|
-
] }) });
|
|
9593
|
-
};
|
|
9594
|
-
const schema$5 = objectType({
|
|
9595
|
-
email: stringType().email()
|
|
9596
|
-
});
|
|
9597
|
-
const Email = () => {
|
|
9598
|
-
const { id } = reactRouterDom.useParams();
|
|
9599
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9600
|
-
fields: "+email"
|
|
9601
|
-
});
|
|
9602
|
-
if (isError) {
|
|
9603
|
-
throw error;
|
|
9604
|
-
}
|
|
9605
|
-
const isReady = !isPending && !!order;
|
|
9606
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9607
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9608
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9609
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9610
|
-
] }),
|
|
9611
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9612
|
-
] });
|
|
9613
|
-
};
|
|
9614
|
-
const EmailForm = ({ order }) => {
|
|
9615
|
-
const form = reactHookForm.useForm({
|
|
9616
|
-
defaultValues: {
|
|
9617
|
-
email: order.email ?? ""
|
|
9618
|
-
},
|
|
9619
|
-
resolver: zod.zodResolver(schema$4)
|
|
9620
|
-
});
|
|
9621
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9622
|
-
const { handleSuccess } = useRouteModal();
|
|
9623
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9624
|
-
await mutateAsync(
|
|
9625
|
-
{ email: data.email },
|
|
9626
|
-
{
|
|
9627
|
-
onSuccess: () => {
|
|
9628
|
-
handleSuccess();
|
|
9629
|
-
},
|
|
9630
|
-
onError: (error) => {
|
|
9631
|
-
ui.toast.error(error.message);
|
|
9632
|
-
}
|
|
9633
|
-
}
|
|
9634
|
-
);
|
|
9635
|
-
});
|
|
9636
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9637
|
-
KeyboundForm,
|
|
9638
|
-
{
|
|
9639
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9640
|
-
onSubmit,
|
|
9641
|
-
children: [
|
|
9642
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9643
|
-
Form$2.Field,
|
|
9644
|
-
{
|
|
9645
|
-
control: form.control,
|
|
9646
|
-
name: "email",
|
|
9647
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9648
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9649
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9650
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9651
|
-
] })
|
|
9652
|
-
}
|
|
9653
|
-
) }),
|
|
9654
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9655
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9656
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9657
|
-
] }) })
|
|
9658
|
-
]
|
|
9659
|
-
}
|
|
9660
|
-
) });
|
|
9661
|
-
};
|
|
9662
|
-
const schema$4 = objectType({
|
|
9663
|
-
email: stringType().email()
|
|
9664
|
-
});
|
|
9665
9576
|
const BillingAddress = () => {
|
|
9666
9577
|
const { id } = reactRouterDom.useParams();
|
|
9667
9578
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9694,7 +9605,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9694
9605
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9695
9606
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9696
9607
|
},
|
|
9697
|
-
resolver: zod.zodResolver(schema$
|
|
9608
|
+
resolver: zod.zodResolver(schema$5)
|
|
9698
9609
|
});
|
|
9699
9610
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9700
9611
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9851,7 +9762,96 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9851
9762
|
}
|
|
9852
9763
|
) });
|
|
9853
9764
|
};
|
|
9854
|
-
const schema$
|
|
9765
|
+
const schema$5 = addressSchema;
|
|
9766
|
+
const CustomItems = () => {
|
|
9767
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9768
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9769
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9770
|
+
] });
|
|
9771
|
+
};
|
|
9772
|
+
const CustomItemsForm = () => {
|
|
9773
|
+
const form = reactHookForm.useForm({
|
|
9774
|
+
resolver: zod.zodResolver(schema$4)
|
|
9775
|
+
});
|
|
9776
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9777
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9778
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9779
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9780
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9781
|
+
] }) })
|
|
9782
|
+
] }) });
|
|
9783
|
+
};
|
|
9784
|
+
const schema$4 = objectType({
|
|
9785
|
+
email: stringType().email()
|
|
9786
|
+
});
|
|
9787
|
+
const Email = () => {
|
|
9788
|
+
const { id } = reactRouterDom.useParams();
|
|
9789
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9790
|
+
fields: "+email"
|
|
9791
|
+
});
|
|
9792
|
+
if (isError) {
|
|
9793
|
+
throw error;
|
|
9794
|
+
}
|
|
9795
|
+
const isReady = !isPending && !!order;
|
|
9796
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9797
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9798
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9799
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9800
|
+
] }),
|
|
9801
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9802
|
+
] });
|
|
9803
|
+
};
|
|
9804
|
+
const EmailForm = ({ order }) => {
|
|
9805
|
+
const form = reactHookForm.useForm({
|
|
9806
|
+
defaultValues: {
|
|
9807
|
+
email: order.email ?? ""
|
|
9808
|
+
},
|
|
9809
|
+
resolver: zod.zodResolver(schema$3)
|
|
9810
|
+
});
|
|
9811
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9812
|
+
const { handleSuccess } = useRouteModal();
|
|
9813
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9814
|
+
await mutateAsync(
|
|
9815
|
+
{ email: data.email },
|
|
9816
|
+
{
|
|
9817
|
+
onSuccess: () => {
|
|
9818
|
+
handleSuccess();
|
|
9819
|
+
},
|
|
9820
|
+
onError: (error) => {
|
|
9821
|
+
ui.toast.error(error.message);
|
|
9822
|
+
}
|
|
9823
|
+
}
|
|
9824
|
+
);
|
|
9825
|
+
});
|
|
9826
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9827
|
+
KeyboundForm,
|
|
9828
|
+
{
|
|
9829
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9830
|
+
onSubmit,
|
|
9831
|
+
children: [
|
|
9832
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9833
|
+
Form$2.Field,
|
|
9834
|
+
{
|
|
9835
|
+
control: form.control,
|
|
9836
|
+
name: "email",
|
|
9837
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9838
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9839
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9840
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9841
|
+
] })
|
|
9842
|
+
}
|
|
9843
|
+
) }),
|
|
9844
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9845
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9846
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9847
|
+
] }) })
|
|
9848
|
+
]
|
|
9849
|
+
}
|
|
9850
|
+
) });
|
|
9851
|
+
};
|
|
9852
|
+
const schema$3 = objectType({
|
|
9853
|
+
email: stringType().email()
|
|
9854
|
+
});
|
|
9855
9855
|
const NumberInput = React.forwardRef(
|
|
9856
9856
|
({
|
|
9857
9857
|
value,
|
|
@@ -11453,33 +11453,37 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11453
11453
|
}
|
|
11454
11454
|
return Array.from(promotionIds);
|
|
11455
11455
|
}
|
|
11456
|
-
const
|
|
11456
|
+
const ShippingAddress = () => {
|
|
11457
11457
|
const { id } = reactRouterDom.useParams();
|
|
11458
|
-
const {
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
fields: "+sales_channel_id"
|
|
11462
|
-
},
|
|
11463
|
-
{
|
|
11464
|
-
enabled: !!id
|
|
11465
|
-
}
|
|
11466
|
-
);
|
|
11458
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11459
|
+
fields: "+shipping_address"
|
|
11460
|
+
});
|
|
11467
11461
|
if (isError) {
|
|
11468
11462
|
throw error;
|
|
11469
11463
|
}
|
|
11470
|
-
const
|
|
11464
|
+
const isReady = !isPending && !!order;
|
|
11471
11465
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11472
11466
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11473
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
11474
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "
|
|
11467
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
11468
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11475
11469
|
] }),
|
|
11476
|
-
|
|
11470
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
11477
11471
|
] });
|
|
11478
11472
|
};
|
|
11479
|
-
const
|
|
11473
|
+
const ShippingAddressForm = ({ order }) => {
|
|
11474
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11480
11475
|
const form = reactHookForm.useForm({
|
|
11481
11476
|
defaultValues: {
|
|
11482
|
-
|
|
11477
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11478
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11479
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11480
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11481
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11482
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11483
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11484
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11485
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11486
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11483
11487
|
},
|
|
11484
11488
|
resolver: zod.zodResolver(schema$2)
|
|
11485
11489
|
});
|
|
@@ -11488,11 +11492,21 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11488
11492
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
11489
11493
|
await mutateAsync(
|
|
11490
11494
|
{
|
|
11491
|
-
|
|
11495
|
+
shipping_address: {
|
|
11496
|
+
first_name: data.first_name,
|
|
11497
|
+
last_name: data.last_name,
|
|
11498
|
+
company: data.company,
|
|
11499
|
+
address_1: data.address_1,
|
|
11500
|
+
address_2: data.address_2,
|
|
11501
|
+
city: data.city,
|
|
11502
|
+
province: data.province,
|
|
11503
|
+
country_code: data.country_code,
|
|
11504
|
+
postal_code: data.postal_code,
|
|
11505
|
+
phone: data.phone
|
|
11506
|
+
}
|
|
11492
11507
|
},
|
|
11493
11508
|
{
|
|
11494
11509
|
onSuccess: () => {
|
|
11495
|
-
ui.toast.success("Sales channel updated");
|
|
11496
11510
|
handleSuccess();
|
|
11497
11511
|
},
|
|
11498
11512
|
onError: (error) => {
|
|
@@ -11507,58 +11521,141 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11507
11521
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
11508
11522
|
onSubmit,
|
|
11509
11523
|
children: [
|
|
11510
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11514
|
-
] }) })
|
|
11515
|
-
]
|
|
11516
|
-
}
|
|
11517
|
-
) });
|
|
11518
|
-
};
|
|
11519
|
-
const SalesChannelField = ({ control, order }) => {
|
|
11520
|
-
const salesChannels = useComboboxData({
|
|
11521
|
-
queryFn: async (params) => {
|
|
11522
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11523
|
-
},
|
|
11524
|
-
queryKey: ["sales-channels"],
|
|
11525
|
-
getOptions: (data) => {
|
|
11526
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11527
|
-
label: salesChannel.name,
|
|
11528
|
-
value: salesChannel.id
|
|
11529
|
-
}));
|
|
11530
|
-
},
|
|
11531
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11532
|
-
});
|
|
11533
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11534
|
-
Form$2.Field,
|
|
11535
|
-
{
|
|
11536
|
-
control,
|
|
11537
|
-
name: "sales_channel_id",
|
|
11538
|
-
render: ({ field }) => {
|
|
11539
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11540
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11541
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11542
|
-
Combobox,
|
|
11524
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
11525
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11526
|
+
Form$2.Field,
|
|
11543
11527
|
{
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11528
|
+
control: form.control,
|
|
11529
|
+
name: "country_code",
|
|
11530
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11531
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11532
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11533
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11534
|
+
] })
|
|
11551
11535
|
}
|
|
11552
|
-
)
|
|
11553
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11554
|
-
|
|
11555
|
-
|
|
11536
|
+
),
|
|
11537
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11539
|
+
Form$2.Field,
|
|
11540
|
+
{
|
|
11541
|
+
control: form.control,
|
|
11542
|
+
name: "first_name",
|
|
11543
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11544
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11545
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11546
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11547
|
+
] })
|
|
11548
|
+
}
|
|
11549
|
+
),
|
|
11550
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11551
|
+
Form$2.Field,
|
|
11552
|
+
{
|
|
11553
|
+
control: form.control,
|
|
11554
|
+
name: "last_name",
|
|
11555
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11556
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11557
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11558
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11559
|
+
] })
|
|
11560
|
+
}
|
|
11561
|
+
)
|
|
11562
|
+
] }),
|
|
11563
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11564
|
+
Form$2.Field,
|
|
11565
|
+
{
|
|
11566
|
+
control: form.control,
|
|
11567
|
+
name: "company",
|
|
11568
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11569
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11570
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11571
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11572
|
+
] })
|
|
11573
|
+
}
|
|
11574
|
+
),
|
|
11575
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11576
|
+
Form$2.Field,
|
|
11577
|
+
{
|
|
11578
|
+
control: form.control,
|
|
11579
|
+
name: "address_1",
|
|
11580
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11581
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11582
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11583
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11584
|
+
] })
|
|
11585
|
+
}
|
|
11586
|
+
),
|
|
11587
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11588
|
+
Form$2.Field,
|
|
11589
|
+
{
|
|
11590
|
+
control: form.control,
|
|
11591
|
+
name: "address_2",
|
|
11592
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11593
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11594
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11595
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11596
|
+
] })
|
|
11597
|
+
}
|
|
11598
|
+
),
|
|
11599
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11600
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11601
|
+
Form$2.Field,
|
|
11602
|
+
{
|
|
11603
|
+
control: form.control,
|
|
11604
|
+
name: "postal_code",
|
|
11605
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11606
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11607
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11608
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11609
|
+
] })
|
|
11610
|
+
}
|
|
11611
|
+
),
|
|
11612
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11613
|
+
Form$2.Field,
|
|
11614
|
+
{
|
|
11615
|
+
control: form.control,
|
|
11616
|
+
name: "city",
|
|
11617
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11618
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11619
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11620
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11621
|
+
] })
|
|
11622
|
+
}
|
|
11623
|
+
)
|
|
11624
|
+
] }),
|
|
11625
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11626
|
+
Form$2.Field,
|
|
11627
|
+
{
|
|
11628
|
+
control: form.control,
|
|
11629
|
+
name: "province",
|
|
11630
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11631
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11632
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11633
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11634
|
+
] })
|
|
11635
|
+
}
|
|
11636
|
+
),
|
|
11637
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11638
|
+
Form$2.Field,
|
|
11639
|
+
{
|
|
11640
|
+
control: form.control,
|
|
11641
|
+
name: "phone",
|
|
11642
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11643
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11644
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11645
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11646
|
+
] })
|
|
11647
|
+
}
|
|
11648
|
+
)
|
|
11649
|
+
] }) }),
|
|
11650
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11651
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11652
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11653
|
+
] }) })
|
|
11654
|
+
]
|
|
11556
11655
|
}
|
|
11557
|
-
);
|
|
11656
|
+
) });
|
|
11558
11657
|
};
|
|
11559
|
-
const schema$2 =
|
|
11560
|
-
sales_channel_id: stringType().min(1)
|
|
11561
|
-
});
|
|
11658
|
+
const schema$2 = addressSchema;
|
|
11562
11659
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11563
11660
|
const Shipping = () => {
|
|
11564
11661
|
var _a;
|
|
@@ -12842,37 +12939,33 @@ const Illustration = () => {
|
|
|
12842
12939
|
const schema$1 = objectType({
|
|
12843
12940
|
customer_id: stringType().min(1)
|
|
12844
12941
|
});
|
|
12845
|
-
const
|
|
12942
|
+
const SalesChannel = () => {
|
|
12846
12943
|
const { id } = reactRouterDom.useParams();
|
|
12847
|
-
const {
|
|
12848
|
-
|
|
12849
|
-
|
|
12944
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12945
|
+
id,
|
|
12946
|
+
{
|
|
12947
|
+
fields: "+sales_channel_id"
|
|
12948
|
+
},
|
|
12949
|
+
{
|
|
12950
|
+
enabled: !!id
|
|
12951
|
+
}
|
|
12952
|
+
);
|
|
12850
12953
|
if (isError) {
|
|
12851
12954
|
throw error;
|
|
12852
12955
|
}
|
|
12853
|
-
const
|
|
12956
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12854
12957
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12855
12958
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12856
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
12857
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "
|
|
12959
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12960
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12858
12961
|
] }),
|
|
12859
|
-
|
|
12962
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12860
12963
|
] });
|
|
12861
12964
|
};
|
|
12862
|
-
const
|
|
12863
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12965
|
+
const SalesChannelForm = ({ order }) => {
|
|
12864
12966
|
const form = reactHookForm.useForm({
|
|
12865
12967
|
defaultValues: {
|
|
12866
|
-
|
|
12867
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12868
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12869
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12870
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12871
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12872
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12873
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12874
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12875
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12968
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12876
12969
|
},
|
|
12877
12970
|
resolver: zod.zodResolver(schema)
|
|
12878
12971
|
});
|
|
@@ -12881,21 +12974,11 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12881
12974
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12882
12975
|
await mutateAsync(
|
|
12883
12976
|
{
|
|
12884
|
-
|
|
12885
|
-
first_name: data.first_name,
|
|
12886
|
-
last_name: data.last_name,
|
|
12887
|
-
company: data.company,
|
|
12888
|
-
address_1: data.address_1,
|
|
12889
|
-
address_2: data.address_2,
|
|
12890
|
-
city: data.city,
|
|
12891
|
-
province: data.province,
|
|
12892
|
-
country_code: data.country_code,
|
|
12893
|
-
postal_code: data.postal_code,
|
|
12894
|
-
phone: data.phone
|
|
12895
|
-
}
|
|
12977
|
+
sales_channel_id: data.sales_channel_id
|
|
12896
12978
|
},
|
|
12897
12979
|
{
|
|
12898
12980
|
onSuccess: () => {
|
|
12981
|
+
ui.toast.success("Sales channel updated");
|
|
12899
12982
|
handleSuccess();
|
|
12900
12983
|
},
|
|
12901
12984
|
onError: (error) => {
|
|
@@ -12910,132 +12993,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12910
12993
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
12911
12994
|
onSubmit,
|
|
12912
12995
|
children: [
|
|
12913
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.
|
|
12914
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12915
|
-
Form$2.Field,
|
|
12916
|
-
{
|
|
12917
|
-
control: form.control,
|
|
12918
|
-
name: "country_code",
|
|
12919
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12920
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12921
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12922
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12923
|
-
] })
|
|
12924
|
-
}
|
|
12925
|
-
),
|
|
12926
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12927
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12928
|
-
Form$2.Field,
|
|
12929
|
-
{
|
|
12930
|
-
control: form.control,
|
|
12931
|
-
name: "first_name",
|
|
12932
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12933
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12934
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12935
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12936
|
-
] })
|
|
12937
|
-
}
|
|
12938
|
-
),
|
|
12939
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12940
|
-
Form$2.Field,
|
|
12941
|
-
{
|
|
12942
|
-
control: form.control,
|
|
12943
|
-
name: "last_name",
|
|
12944
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12945
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12946
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12947
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12948
|
-
] })
|
|
12949
|
-
}
|
|
12950
|
-
)
|
|
12951
|
-
] }),
|
|
12952
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12953
|
-
Form$2.Field,
|
|
12954
|
-
{
|
|
12955
|
-
control: form.control,
|
|
12956
|
-
name: "company",
|
|
12957
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12958
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12959
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12960
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12961
|
-
] })
|
|
12962
|
-
}
|
|
12963
|
-
),
|
|
12964
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12965
|
-
Form$2.Field,
|
|
12966
|
-
{
|
|
12967
|
-
control: form.control,
|
|
12968
|
-
name: "address_1",
|
|
12969
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12970
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12971
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12972
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12973
|
-
] })
|
|
12974
|
-
}
|
|
12975
|
-
),
|
|
12976
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12977
|
-
Form$2.Field,
|
|
12978
|
-
{
|
|
12979
|
-
control: form.control,
|
|
12980
|
-
name: "address_2",
|
|
12981
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12982
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12983
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12984
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12985
|
-
] })
|
|
12986
|
-
}
|
|
12987
|
-
),
|
|
12988
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12989
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12990
|
-
Form$2.Field,
|
|
12991
|
-
{
|
|
12992
|
-
control: form.control,
|
|
12993
|
-
name: "postal_code",
|
|
12994
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12995
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12996
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12997
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12998
|
-
] })
|
|
12999
|
-
}
|
|
13000
|
-
),
|
|
13001
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13002
|
-
Form$2.Field,
|
|
13003
|
-
{
|
|
13004
|
-
control: form.control,
|
|
13005
|
-
name: "city",
|
|
13006
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13007
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
13008
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13009
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13010
|
-
] })
|
|
13011
|
-
}
|
|
13012
|
-
)
|
|
13013
|
-
] }),
|
|
13014
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13015
|
-
Form$2.Field,
|
|
13016
|
-
{
|
|
13017
|
-
control: form.control,
|
|
13018
|
-
name: "province",
|
|
13019
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13020
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13021
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13022
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13023
|
-
] })
|
|
13024
|
-
}
|
|
13025
|
-
),
|
|
13026
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13027
|
-
Form$2.Field,
|
|
13028
|
-
{
|
|
13029
|
-
control: form.control,
|
|
13030
|
-
name: "phone",
|
|
13031
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13032
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13033
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13034
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13035
|
-
] })
|
|
13036
|
-
}
|
|
13037
|
-
)
|
|
13038
|
-
] }) }),
|
|
12996
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
13039
12997
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13040
12998
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13041
12999
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -13044,7 +13002,49 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
13044
13002
|
}
|
|
13045
13003
|
) });
|
|
13046
13004
|
};
|
|
13047
|
-
const
|
|
13005
|
+
const SalesChannelField = ({ control, order }) => {
|
|
13006
|
+
const salesChannels = useComboboxData({
|
|
13007
|
+
queryFn: async (params) => {
|
|
13008
|
+
return await sdk.admin.salesChannel.list(params);
|
|
13009
|
+
},
|
|
13010
|
+
queryKey: ["sales-channels"],
|
|
13011
|
+
getOptions: (data) => {
|
|
13012
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
13013
|
+
label: salesChannel.name,
|
|
13014
|
+
value: salesChannel.id
|
|
13015
|
+
}));
|
|
13016
|
+
},
|
|
13017
|
+
defaultValue: order.sales_channel_id || void 0
|
|
13018
|
+
});
|
|
13019
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13020
|
+
Form$2.Field,
|
|
13021
|
+
{
|
|
13022
|
+
control,
|
|
13023
|
+
name: "sales_channel_id",
|
|
13024
|
+
render: ({ field }) => {
|
|
13025
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13026
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
13027
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13028
|
+
Combobox,
|
|
13029
|
+
{
|
|
13030
|
+
options: salesChannels.options,
|
|
13031
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
13032
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
13033
|
+
searchValue: salesChannels.searchValue,
|
|
13034
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
13035
|
+
placeholder: "Select sales channel",
|
|
13036
|
+
...field
|
|
13037
|
+
}
|
|
13038
|
+
) }),
|
|
13039
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13040
|
+
] });
|
|
13041
|
+
}
|
|
13042
|
+
}
|
|
13043
|
+
);
|
|
13044
|
+
};
|
|
13045
|
+
const schema = objectType({
|
|
13046
|
+
sales_channel_id: stringType().min(1)
|
|
13047
|
+
});
|
|
13048
13048
|
const widgetModule = { widgets: [] };
|
|
13049
13049
|
const routeModule = {
|
|
13050
13050
|
routes: [
|
|
@@ -13065,6 +13065,10 @@ const routeModule = {
|
|
|
13065
13065
|
handle,
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
|
+
{
|
|
13069
|
+
Component: BillingAddress,
|
|
13070
|
+
path: "/draft-orders/:id/billing-address"
|
|
13071
|
+
},
|
|
13068
13072
|
{
|
|
13069
13073
|
Component: CustomItems,
|
|
13070
13074
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13073,10 +13077,6 @@ const routeModule = {
|
|
|
13073
13077
|
Component: Email,
|
|
13074
13078
|
path: "/draft-orders/:id/email"
|
|
13075
13079
|
},
|
|
13076
|
-
{
|
|
13077
|
-
Component: BillingAddress,
|
|
13078
|
-
path: "/draft-orders/:id/billing-address"
|
|
13079
|
-
},
|
|
13080
13080
|
{
|
|
13081
13081
|
Component: Items,
|
|
13082
13082
|
path: "/draft-orders/:id/items"
|
|
@@ -13090,8 +13090,8 @@ const routeModule = {
|
|
|
13090
13090
|
path: "/draft-orders/:id/promotions"
|
|
13091
13091
|
},
|
|
13092
13092
|
{
|
|
13093
|
-
Component:
|
|
13094
|
-
path: "/draft-orders/:id/
|
|
13093
|
+
Component: ShippingAddress,
|
|
13094
|
+
path: "/draft-orders/:id/shipping-address"
|
|
13095
13095
|
},
|
|
13096
13096
|
{
|
|
13097
13097
|
Component: Shipping,
|
|
@@ -13102,8 +13102,8 @@ const routeModule = {
|
|
|
13102
13102
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13103
13103
|
},
|
|
13104
13104
|
{
|
|
13105
|
-
Component:
|
|
13106
|
-
path: "/draft-orders/:id/
|
|
13105
|
+
Component: SalesChannel,
|
|
13106
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|