@medusajs/draft-order 2.12.2-preview-20251203210133 → 2.12.2-preview-20251204000309
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 +281 -281
- package/.medusa/server/src/admin/index.mjs +281 -281
- package/package.json +16 -16
|
@@ -9565,196 +9565,27 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
-
const
|
|
9569
|
-
const { id } = useParams();
|
|
9570
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9571
|
-
fields: "+billing_address"
|
|
9572
|
-
});
|
|
9573
|
-
if (isError) {
|
|
9574
|
-
throw error;
|
|
9575
|
-
}
|
|
9576
|
-
const isReady = !isPending && !!order;
|
|
9568
|
+
const CustomItems = () => {
|
|
9577
9569
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9578
|
-
/* @__PURE__ */
|
|
9579
|
-
|
|
9580
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9581
|
-
] }),
|
|
9582
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9570
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9571
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9583
9572
|
] });
|
|
9584
9573
|
};
|
|
9585
|
-
const
|
|
9586
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9574
|
+
const CustomItemsForm = () => {
|
|
9587
9575
|
const form = useForm({
|
|
9588
|
-
defaultValues: {
|
|
9589
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9590
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9591
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9592
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9593
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9594
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9595
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9596
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9597
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9599
|
-
},
|
|
9600
9576
|
resolver: zodResolver(schema$5)
|
|
9601
9577
|
});
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
{
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
handleSuccess();
|
|
9610
|
-
},
|
|
9611
|
-
onError: (error) => {
|
|
9612
|
-
toast.error(error.message);
|
|
9613
|
-
}
|
|
9614
|
-
}
|
|
9615
|
-
);
|
|
9616
|
-
});
|
|
9617
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9618
|
-
KeyboundForm,
|
|
9619
|
-
{
|
|
9620
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9621
|
-
onSubmit,
|
|
9622
|
-
children: [
|
|
9623
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
9624
|
-
/* @__PURE__ */ jsx(
|
|
9625
|
-
Form$2.Field,
|
|
9626
|
-
{
|
|
9627
|
-
control: form.control,
|
|
9628
|
-
name: "country_code",
|
|
9629
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9630
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9631
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9632
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9633
|
-
] })
|
|
9634
|
-
}
|
|
9635
|
-
),
|
|
9636
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9637
|
-
/* @__PURE__ */ jsx(
|
|
9638
|
-
Form$2.Field,
|
|
9639
|
-
{
|
|
9640
|
-
control: form.control,
|
|
9641
|
-
name: "first_name",
|
|
9642
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9643
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9644
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9645
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9646
|
-
] })
|
|
9647
|
-
}
|
|
9648
|
-
),
|
|
9649
|
-
/* @__PURE__ */ jsx(
|
|
9650
|
-
Form$2.Field,
|
|
9651
|
-
{
|
|
9652
|
-
control: form.control,
|
|
9653
|
-
name: "last_name",
|
|
9654
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9655
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9656
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9657
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9658
|
-
] })
|
|
9659
|
-
}
|
|
9660
|
-
)
|
|
9661
|
-
] }),
|
|
9662
|
-
/* @__PURE__ */ jsx(
|
|
9663
|
-
Form$2.Field,
|
|
9664
|
-
{
|
|
9665
|
-
control: form.control,
|
|
9666
|
-
name: "company",
|
|
9667
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9668
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9669
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9670
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9671
|
-
] })
|
|
9672
|
-
}
|
|
9673
|
-
),
|
|
9674
|
-
/* @__PURE__ */ jsx(
|
|
9675
|
-
Form$2.Field,
|
|
9676
|
-
{
|
|
9677
|
-
control: form.control,
|
|
9678
|
-
name: "address_1",
|
|
9679
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9680
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9681
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9682
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9683
|
-
] })
|
|
9684
|
-
}
|
|
9685
|
-
),
|
|
9686
|
-
/* @__PURE__ */ jsx(
|
|
9687
|
-
Form$2.Field,
|
|
9688
|
-
{
|
|
9689
|
-
control: form.control,
|
|
9690
|
-
name: "address_2",
|
|
9691
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9692
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9693
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9694
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9695
|
-
] })
|
|
9696
|
-
}
|
|
9697
|
-
),
|
|
9698
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9699
|
-
/* @__PURE__ */ jsx(
|
|
9700
|
-
Form$2.Field,
|
|
9701
|
-
{
|
|
9702
|
-
control: form.control,
|
|
9703
|
-
name: "postal_code",
|
|
9704
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9705
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9706
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9707
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9708
|
-
] })
|
|
9709
|
-
}
|
|
9710
|
-
),
|
|
9711
|
-
/* @__PURE__ */ jsx(
|
|
9712
|
-
Form$2.Field,
|
|
9713
|
-
{
|
|
9714
|
-
control: form.control,
|
|
9715
|
-
name: "city",
|
|
9716
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9717
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9718
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9719
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9720
|
-
] })
|
|
9721
|
-
}
|
|
9722
|
-
)
|
|
9723
|
-
] }),
|
|
9724
|
-
/* @__PURE__ */ jsx(
|
|
9725
|
-
Form$2.Field,
|
|
9726
|
-
{
|
|
9727
|
-
control: form.control,
|
|
9728
|
-
name: "province",
|
|
9729
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9730
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9731
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9732
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9733
|
-
] })
|
|
9734
|
-
}
|
|
9735
|
-
),
|
|
9736
|
-
/* @__PURE__ */ jsx(
|
|
9737
|
-
Form$2.Field,
|
|
9738
|
-
{
|
|
9739
|
-
control: form.control,
|
|
9740
|
-
name: "phone",
|
|
9741
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9742
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9743
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9744
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9745
|
-
] })
|
|
9746
|
-
}
|
|
9747
|
-
)
|
|
9748
|
-
] }) }),
|
|
9749
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9750
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9751
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9752
|
-
] }) })
|
|
9753
|
-
]
|
|
9754
|
-
}
|
|
9755
|
-
) });
|
|
9578
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9579
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9580
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9581
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9582
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9583
|
+
] }) })
|
|
9584
|
+
] }) });
|
|
9756
9585
|
};
|
|
9757
|
-
const schema$5 =
|
|
9586
|
+
const schema$5 = objectType({
|
|
9587
|
+
email: stringType().email()
|
|
9588
|
+
});
|
|
9758
9589
|
const Email = () => {
|
|
9759
9590
|
const { id } = useParams();
|
|
9760
9591
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9823,27 +9654,6 @@ const EmailForm = ({ order }) => {
|
|
|
9823
9654
|
const schema$4 = objectType({
|
|
9824
9655
|
email: stringType().email()
|
|
9825
9656
|
});
|
|
9826
|
-
const CustomItems = () => {
|
|
9827
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9828
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9829
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9830
|
-
] });
|
|
9831
|
-
};
|
|
9832
|
-
const CustomItemsForm = () => {
|
|
9833
|
-
const form = useForm({
|
|
9834
|
-
resolver: zodResolver(schema$3)
|
|
9835
|
-
});
|
|
9836
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9837
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9838
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9839
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9840
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9841
|
-
] }) })
|
|
9842
|
-
] }) });
|
|
9843
|
-
};
|
|
9844
|
-
const schema$3 = objectType({
|
|
9845
|
-
email: stringType().email()
|
|
9846
|
-
});
|
|
9847
9657
|
const NumberInput = forwardRef(
|
|
9848
9658
|
({
|
|
9849
9659
|
value,
|
|
@@ -11445,46 +11255,47 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11445
11255
|
}
|
|
11446
11256
|
return Array.from(promotionIds);
|
|
11447
11257
|
}
|
|
11448
|
-
const
|
|
11258
|
+
const BillingAddress = () => {
|
|
11449
11259
|
const { id } = useParams();
|
|
11450
|
-
const {
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
fields: "+sales_channel_id"
|
|
11454
|
-
},
|
|
11455
|
-
{
|
|
11456
|
-
enabled: !!id
|
|
11457
|
-
}
|
|
11458
|
-
);
|
|
11260
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11261
|
+
fields: "+billing_address"
|
|
11262
|
+
});
|
|
11459
11263
|
if (isError) {
|
|
11460
11264
|
throw error;
|
|
11461
11265
|
}
|
|
11462
|
-
const
|
|
11266
|
+
const isReady = !isPending && !!order;
|
|
11463
11267
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11464
11268
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11465
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
11466
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
11269
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
11270
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11467
11271
|
] }),
|
|
11468
|
-
|
|
11272
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
11469
11273
|
] });
|
|
11470
11274
|
};
|
|
11471
|
-
const
|
|
11275
|
+
const BillingAddressForm = ({ order }) => {
|
|
11276
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11472
11277
|
const form = useForm({
|
|
11473
11278
|
defaultValues: {
|
|
11474
|
-
|
|
11279
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11280
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11281
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11282
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11283
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11284
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11285
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11286
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11287
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11288
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11475
11289
|
},
|
|
11476
|
-
resolver: zodResolver(schema$
|
|
11290
|
+
resolver: zodResolver(schema$3)
|
|
11477
11291
|
});
|
|
11478
11292
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11479
11293
|
const { handleSuccess } = useRouteModal();
|
|
11480
11294
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
11481
11295
|
await mutateAsync(
|
|
11482
|
-
{
|
|
11483
|
-
sales_channel_id: data.sales_channel_id
|
|
11484
|
-
},
|
|
11296
|
+
{ billing_address: data },
|
|
11485
11297
|
{
|
|
11486
11298
|
onSuccess: () => {
|
|
11487
|
-
toast.success("Sales channel updated");
|
|
11488
11299
|
handleSuccess();
|
|
11489
11300
|
},
|
|
11490
11301
|
onError: (error) => {
|
|
@@ -11499,7 +11310,132 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11499
11310
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
11500
11311
|
onSubmit,
|
|
11501
11312
|
children: [
|
|
11502
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
11313
|
+
/* @__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: [
|
|
11314
|
+
/* @__PURE__ */ jsx(
|
|
11315
|
+
Form$2.Field,
|
|
11316
|
+
{
|
|
11317
|
+
control: form.control,
|
|
11318
|
+
name: "country_code",
|
|
11319
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11320
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11321
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11322
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11323
|
+
] })
|
|
11324
|
+
}
|
|
11325
|
+
),
|
|
11326
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11327
|
+
/* @__PURE__ */ jsx(
|
|
11328
|
+
Form$2.Field,
|
|
11329
|
+
{
|
|
11330
|
+
control: form.control,
|
|
11331
|
+
name: "first_name",
|
|
11332
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11333
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11334
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11335
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11336
|
+
] })
|
|
11337
|
+
}
|
|
11338
|
+
),
|
|
11339
|
+
/* @__PURE__ */ jsx(
|
|
11340
|
+
Form$2.Field,
|
|
11341
|
+
{
|
|
11342
|
+
control: form.control,
|
|
11343
|
+
name: "last_name",
|
|
11344
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11345
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11346
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11347
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11348
|
+
] })
|
|
11349
|
+
}
|
|
11350
|
+
)
|
|
11351
|
+
] }),
|
|
11352
|
+
/* @__PURE__ */ jsx(
|
|
11353
|
+
Form$2.Field,
|
|
11354
|
+
{
|
|
11355
|
+
control: form.control,
|
|
11356
|
+
name: "company",
|
|
11357
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11358
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11359
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11360
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11361
|
+
] })
|
|
11362
|
+
}
|
|
11363
|
+
),
|
|
11364
|
+
/* @__PURE__ */ jsx(
|
|
11365
|
+
Form$2.Field,
|
|
11366
|
+
{
|
|
11367
|
+
control: form.control,
|
|
11368
|
+
name: "address_1",
|
|
11369
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11370
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11371
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11372
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11373
|
+
] })
|
|
11374
|
+
}
|
|
11375
|
+
),
|
|
11376
|
+
/* @__PURE__ */ jsx(
|
|
11377
|
+
Form$2.Field,
|
|
11378
|
+
{
|
|
11379
|
+
control: form.control,
|
|
11380
|
+
name: "address_2",
|
|
11381
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11382
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11383
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11384
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11385
|
+
] })
|
|
11386
|
+
}
|
|
11387
|
+
),
|
|
11388
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11389
|
+
/* @__PURE__ */ jsx(
|
|
11390
|
+
Form$2.Field,
|
|
11391
|
+
{
|
|
11392
|
+
control: form.control,
|
|
11393
|
+
name: "postal_code",
|
|
11394
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11395
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11396
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11397
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11398
|
+
] })
|
|
11399
|
+
}
|
|
11400
|
+
),
|
|
11401
|
+
/* @__PURE__ */ jsx(
|
|
11402
|
+
Form$2.Field,
|
|
11403
|
+
{
|
|
11404
|
+
control: form.control,
|
|
11405
|
+
name: "city",
|
|
11406
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11407
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11408
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11409
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11410
|
+
] })
|
|
11411
|
+
}
|
|
11412
|
+
)
|
|
11413
|
+
] }),
|
|
11414
|
+
/* @__PURE__ */ jsx(
|
|
11415
|
+
Form$2.Field,
|
|
11416
|
+
{
|
|
11417
|
+
control: form.control,
|
|
11418
|
+
name: "province",
|
|
11419
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11420
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11421
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11422
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11423
|
+
] })
|
|
11424
|
+
}
|
|
11425
|
+
),
|
|
11426
|
+
/* @__PURE__ */ jsx(
|
|
11427
|
+
Form$2.Field,
|
|
11428
|
+
{
|
|
11429
|
+
control: form.control,
|
|
11430
|
+
name: "phone",
|
|
11431
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11432
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11433
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11434
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11435
|
+
] })
|
|
11436
|
+
}
|
|
11437
|
+
)
|
|
11438
|
+
] }) }),
|
|
11503
11439
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11504
11440
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11505
11441
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -11508,49 +11444,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11508
11444
|
}
|
|
11509
11445
|
) });
|
|
11510
11446
|
};
|
|
11511
|
-
const
|
|
11512
|
-
const salesChannels = useComboboxData({
|
|
11513
|
-
queryFn: async (params) => {
|
|
11514
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11515
|
-
},
|
|
11516
|
-
queryKey: ["sales-channels"],
|
|
11517
|
-
getOptions: (data) => {
|
|
11518
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11519
|
-
label: salesChannel.name,
|
|
11520
|
-
value: salesChannel.id
|
|
11521
|
-
}));
|
|
11522
|
-
},
|
|
11523
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11524
|
-
});
|
|
11525
|
-
return /* @__PURE__ */ jsx(
|
|
11526
|
-
Form$2.Field,
|
|
11527
|
-
{
|
|
11528
|
-
control,
|
|
11529
|
-
name: "sales_channel_id",
|
|
11530
|
-
render: ({ field }) => {
|
|
11531
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11532
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11533
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11534
|
-
Combobox,
|
|
11535
|
-
{
|
|
11536
|
-
options: salesChannels.options,
|
|
11537
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11538
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11539
|
-
searchValue: salesChannels.searchValue,
|
|
11540
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11541
|
-
placeholder: "Select sales channel",
|
|
11542
|
-
...field
|
|
11543
|
-
}
|
|
11544
|
-
) }),
|
|
11545
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11546
|
-
] });
|
|
11547
|
-
}
|
|
11548
|
-
}
|
|
11549
|
-
);
|
|
11550
|
-
};
|
|
11551
|
-
const schema$2 = objectType({
|
|
11552
|
-
sales_channel_id: stringType().min(1)
|
|
11553
|
-
});
|
|
11447
|
+
const schema$3 = addressSchema;
|
|
11554
11448
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11555
11449
|
const Shipping = () => {
|
|
11556
11450
|
var _a;
|
|
@@ -12390,7 +12284,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12390
12284
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12391
12285
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12392
12286
|
},
|
|
12393
|
-
resolver: zodResolver(schema$
|
|
12287
|
+
resolver: zodResolver(schema$2)
|
|
12394
12288
|
});
|
|
12395
12289
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12396
12290
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12560,7 +12454,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12560
12454
|
}
|
|
12561
12455
|
) });
|
|
12562
12456
|
};
|
|
12563
|
-
const schema$
|
|
12457
|
+
const schema$2 = addressSchema;
|
|
12564
12458
|
const TransferOwnership = () => {
|
|
12565
12459
|
const { id } = useParams();
|
|
12566
12460
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12584,7 +12478,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12584
12478
|
defaultValues: {
|
|
12585
12479
|
customer_id: order.customer_id || ""
|
|
12586
12480
|
},
|
|
12587
|
-
resolver: zodResolver(schema)
|
|
12481
|
+
resolver: zodResolver(schema$1)
|
|
12588
12482
|
});
|
|
12589
12483
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12590
12484
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13034,9 +12928,115 @@ const Illustration = () => {
|
|
|
13034
12928
|
}
|
|
13035
12929
|
);
|
|
13036
12930
|
};
|
|
13037
|
-
const schema = objectType({
|
|
12931
|
+
const schema$1 = objectType({
|
|
13038
12932
|
customer_id: stringType().min(1)
|
|
13039
12933
|
});
|
|
12934
|
+
const SalesChannel = () => {
|
|
12935
|
+
const { id } = useParams();
|
|
12936
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12937
|
+
id,
|
|
12938
|
+
{
|
|
12939
|
+
fields: "+sales_channel_id"
|
|
12940
|
+
},
|
|
12941
|
+
{
|
|
12942
|
+
enabled: !!id
|
|
12943
|
+
}
|
|
12944
|
+
);
|
|
12945
|
+
if (isError) {
|
|
12946
|
+
throw error;
|
|
12947
|
+
}
|
|
12948
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12949
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12950
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12951
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12952
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12953
|
+
] }),
|
|
12954
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12955
|
+
] });
|
|
12956
|
+
};
|
|
12957
|
+
const SalesChannelForm = ({ order }) => {
|
|
12958
|
+
const form = useForm({
|
|
12959
|
+
defaultValues: {
|
|
12960
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12961
|
+
},
|
|
12962
|
+
resolver: zodResolver(schema)
|
|
12963
|
+
});
|
|
12964
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12965
|
+
const { handleSuccess } = useRouteModal();
|
|
12966
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12967
|
+
await mutateAsync(
|
|
12968
|
+
{
|
|
12969
|
+
sales_channel_id: data.sales_channel_id
|
|
12970
|
+
},
|
|
12971
|
+
{
|
|
12972
|
+
onSuccess: () => {
|
|
12973
|
+
toast.success("Sales channel updated");
|
|
12974
|
+
handleSuccess();
|
|
12975
|
+
},
|
|
12976
|
+
onError: (error) => {
|
|
12977
|
+
toast.error(error.message);
|
|
12978
|
+
}
|
|
12979
|
+
}
|
|
12980
|
+
);
|
|
12981
|
+
});
|
|
12982
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12983
|
+
KeyboundForm,
|
|
12984
|
+
{
|
|
12985
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12986
|
+
onSubmit,
|
|
12987
|
+
children: [
|
|
12988
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12989
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12990
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12991
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12992
|
+
] }) })
|
|
12993
|
+
]
|
|
12994
|
+
}
|
|
12995
|
+
) });
|
|
12996
|
+
};
|
|
12997
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12998
|
+
const salesChannels = useComboboxData({
|
|
12999
|
+
queryFn: async (params) => {
|
|
13000
|
+
return await sdk.admin.salesChannel.list(params);
|
|
13001
|
+
},
|
|
13002
|
+
queryKey: ["sales-channels"],
|
|
13003
|
+
getOptions: (data) => {
|
|
13004
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
13005
|
+
label: salesChannel.name,
|
|
13006
|
+
value: salesChannel.id
|
|
13007
|
+
}));
|
|
13008
|
+
},
|
|
13009
|
+
defaultValue: order.sales_channel_id || void 0
|
|
13010
|
+
});
|
|
13011
|
+
return /* @__PURE__ */ jsx(
|
|
13012
|
+
Form$2.Field,
|
|
13013
|
+
{
|
|
13014
|
+
control,
|
|
13015
|
+
name: "sales_channel_id",
|
|
13016
|
+
render: ({ field }) => {
|
|
13017
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13018
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
13019
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
13020
|
+
Combobox,
|
|
13021
|
+
{
|
|
13022
|
+
options: salesChannels.options,
|
|
13023
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
13024
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
13025
|
+
searchValue: salesChannels.searchValue,
|
|
13026
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
13027
|
+
placeholder: "Select sales channel",
|
|
13028
|
+
...field
|
|
13029
|
+
}
|
|
13030
|
+
) }),
|
|
13031
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13032
|
+
] });
|
|
13033
|
+
}
|
|
13034
|
+
}
|
|
13035
|
+
);
|
|
13036
|
+
};
|
|
13037
|
+
const schema = objectType({
|
|
13038
|
+
sales_channel_id: stringType().min(1)
|
|
13039
|
+
});
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
13042
13042
|
routes: [
|
|
@@ -13058,17 +13058,13 @@ const routeModule = {
|
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
13060
|
{
|
|
13061
|
-
Component:
|
|
13062
|
-
path: "/draft-orders/:id/
|
|
13061
|
+
Component: CustomItems,
|
|
13062
|
+
path: "/draft-orders/:id/custom-items"
|
|
13063
13063
|
},
|
|
13064
13064
|
{
|
|
13065
13065
|
Component: Email,
|
|
13066
13066
|
path: "/draft-orders/:id/email"
|
|
13067
13067
|
},
|
|
13068
|
-
{
|
|
13069
|
-
Component: CustomItems,
|
|
13070
|
-
path: "/draft-orders/:id/custom-items"
|
|
13071
|
-
},
|
|
13072
13068
|
{
|
|
13073
13069
|
Component: Items,
|
|
13074
13070
|
path: "/draft-orders/:id/items"
|
|
@@ -13082,8 +13078,8 @@ const routeModule = {
|
|
|
13082
13078
|
path: "/draft-orders/:id/promotions"
|
|
13083
13079
|
},
|
|
13084
13080
|
{
|
|
13085
|
-
Component:
|
|
13086
|
-
path: "/draft-orders/:id/
|
|
13081
|
+
Component: BillingAddress,
|
|
13082
|
+
path: "/draft-orders/:id/billing-address"
|
|
13087
13083
|
},
|
|
13088
13084
|
{
|
|
13089
13085
|
Component: Shipping,
|
|
@@ -13096,6 +13092,10 @@ const routeModule = {
|
|
|
13096
13092
|
{
|
|
13097
13093
|
Component: TransferOwnership,
|
|
13098
13094
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
|
+
},
|
|
13096
|
+
{
|
|
13097
|
+
Component: SalesChannel,
|
|
13098
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|