@medusajs/draft-order 2.12.2-snapshot-20251204204625 → 2.12.2-snapshot-20251205131013
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 +136 -136
- package/.medusa/server/src/admin/index.mjs +136 -136
- package/package.json +16 -16
|
@@ -9762,6 +9762,27 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9762
|
) });
|
|
9763
9763
|
};
|
|
9764
9764
|
const schema$5 = addressSchema;
|
|
9765
|
+
const CustomItems = () => {
|
|
9766
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9767
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9768
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9769
|
+
] });
|
|
9770
|
+
};
|
|
9771
|
+
const CustomItemsForm = () => {
|
|
9772
|
+
const form = reactHookForm.useForm({
|
|
9773
|
+
resolver: zod.zodResolver(schema$4)
|
|
9774
|
+
});
|
|
9775
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9776
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9777
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9778
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9779
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9780
|
+
] }) })
|
|
9781
|
+
] }) });
|
|
9782
|
+
};
|
|
9783
|
+
const schema$4 = objectType({
|
|
9784
|
+
email: stringType().email()
|
|
9785
|
+
});
|
|
9765
9786
|
const Email = () => {
|
|
9766
9787
|
const { id } = reactRouterDom.useParams();
|
|
9767
9788
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9784,7 +9805,7 @@ const EmailForm = ({ order }) => {
|
|
|
9784
9805
|
defaultValues: {
|
|
9785
9806
|
email: order.email ?? ""
|
|
9786
9807
|
},
|
|
9787
|
-
resolver: zod.zodResolver(schema$
|
|
9808
|
+
resolver: zod.zodResolver(schema$3)
|
|
9788
9809
|
});
|
|
9789
9810
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9790
9811
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9827,27 +9848,6 @@ const EmailForm = ({ order }) => {
|
|
|
9827
9848
|
}
|
|
9828
9849
|
) });
|
|
9829
9850
|
};
|
|
9830
|
-
const schema$4 = objectType({
|
|
9831
|
-
email: stringType().email()
|
|
9832
|
-
});
|
|
9833
|
-
const CustomItems = () => {
|
|
9834
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9835
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9836
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9837
|
-
] });
|
|
9838
|
-
};
|
|
9839
|
-
const CustomItemsForm = () => {
|
|
9840
|
-
const form = reactHookForm.useForm({
|
|
9841
|
-
resolver: zod.zodResolver(schema$3)
|
|
9842
|
-
});
|
|
9843
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9844
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9845
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9846
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9847
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9848
|
-
] }) })
|
|
9849
|
-
] }) });
|
|
9850
|
-
};
|
|
9851
9851
|
const schema$3 = objectType({
|
|
9852
9852
|
email: stringType().email()
|
|
9853
9853
|
});
|
|
@@ -11452,112 +11452,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11452
11452
|
}
|
|
11453
11453
|
return Array.from(promotionIds);
|
|
11454
11454
|
}
|
|
11455
|
-
const SalesChannel = () => {
|
|
11456
|
-
const { id } = reactRouterDom.useParams();
|
|
11457
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11458
|
-
id,
|
|
11459
|
-
{
|
|
11460
|
-
fields: "+sales_channel_id"
|
|
11461
|
-
},
|
|
11462
|
-
{
|
|
11463
|
-
enabled: !!id
|
|
11464
|
-
}
|
|
11465
|
-
);
|
|
11466
|
-
if (isError) {
|
|
11467
|
-
throw error;
|
|
11468
|
-
}
|
|
11469
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
11470
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11471
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11472
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11473
|
-
/* @__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" }) })
|
|
11474
|
-
] }),
|
|
11475
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11476
|
-
] });
|
|
11477
|
-
};
|
|
11478
|
-
const SalesChannelForm = ({ order }) => {
|
|
11479
|
-
const form = reactHookForm.useForm({
|
|
11480
|
-
defaultValues: {
|
|
11481
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
11482
|
-
},
|
|
11483
|
-
resolver: zod.zodResolver(schema$2)
|
|
11484
|
-
});
|
|
11485
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11486
|
-
const { handleSuccess } = useRouteModal();
|
|
11487
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11488
|
-
await mutateAsync(
|
|
11489
|
-
{
|
|
11490
|
-
sales_channel_id: data.sales_channel_id
|
|
11491
|
-
},
|
|
11492
|
-
{
|
|
11493
|
-
onSuccess: () => {
|
|
11494
|
-
ui.toast.success("Sales channel updated");
|
|
11495
|
-
handleSuccess();
|
|
11496
|
-
},
|
|
11497
|
-
onError: (error) => {
|
|
11498
|
-
ui.toast.error(error.message);
|
|
11499
|
-
}
|
|
11500
|
-
}
|
|
11501
|
-
);
|
|
11502
|
-
});
|
|
11503
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11504
|
-
KeyboundForm,
|
|
11505
|
-
{
|
|
11506
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11507
|
-
onSubmit,
|
|
11508
|
-
children: [
|
|
11509
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11510
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11511
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11512
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11513
|
-
] }) })
|
|
11514
|
-
]
|
|
11515
|
-
}
|
|
11516
|
-
) });
|
|
11517
|
-
};
|
|
11518
|
-
const SalesChannelField = ({ control, order }) => {
|
|
11519
|
-
const salesChannels = useComboboxData({
|
|
11520
|
-
queryFn: async (params) => {
|
|
11521
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11522
|
-
},
|
|
11523
|
-
queryKey: ["sales-channels"],
|
|
11524
|
-
getOptions: (data) => {
|
|
11525
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11526
|
-
label: salesChannel.name,
|
|
11527
|
-
value: salesChannel.id
|
|
11528
|
-
}));
|
|
11529
|
-
},
|
|
11530
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11531
|
-
});
|
|
11532
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11533
|
-
Form$2.Field,
|
|
11534
|
-
{
|
|
11535
|
-
control,
|
|
11536
|
-
name: "sales_channel_id",
|
|
11537
|
-
render: ({ field }) => {
|
|
11538
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11539
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11540
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11541
|
-
Combobox,
|
|
11542
|
-
{
|
|
11543
|
-
options: salesChannels.options,
|
|
11544
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11545
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11546
|
-
searchValue: salesChannels.searchValue,
|
|
11547
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11548
|
-
placeholder: "Select sales channel",
|
|
11549
|
-
...field
|
|
11550
|
-
}
|
|
11551
|
-
) }),
|
|
11552
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11553
|
-
] });
|
|
11554
|
-
}
|
|
11555
|
-
}
|
|
11556
|
-
);
|
|
11557
|
-
};
|
|
11558
|
-
const schema$2 = objectType({
|
|
11559
|
-
sales_channel_id: stringType().min(1)
|
|
11560
|
-
});
|
|
11561
11455
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11562
11456
|
const Shipping = () => {
|
|
11563
11457
|
var _a;
|
|
@@ -12365,6 +12259,112 @@ const CustomAmountField = ({
|
|
|
12365
12259
|
}
|
|
12366
12260
|
);
|
|
12367
12261
|
};
|
|
12262
|
+
const SalesChannel = () => {
|
|
12263
|
+
const { id } = reactRouterDom.useParams();
|
|
12264
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12265
|
+
id,
|
|
12266
|
+
{
|
|
12267
|
+
fields: "+sales_channel_id"
|
|
12268
|
+
},
|
|
12269
|
+
{
|
|
12270
|
+
enabled: !!id
|
|
12271
|
+
}
|
|
12272
|
+
);
|
|
12273
|
+
if (isError) {
|
|
12274
|
+
throw error;
|
|
12275
|
+
}
|
|
12276
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12277
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12278
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12279
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12280
|
+
/* @__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" }) })
|
|
12281
|
+
] }),
|
|
12282
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12283
|
+
] });
|
|
12284
|
+
};
|
|
12285
|
+
const SalesChannelForm = ({ order }) => {
|
|
12286
|
+
const form = reactHookForm.useForm({
|
|
12287
|
+
defaultValues: {
|
|
12288
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12289
|
+
},
|
|
12290
|
+
resolver: zod.zodResolver(schema$2)
|
|
12291
|
+
});
|
|
12292
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12293
|
+
const { handleSuccess } = useRouteModal();
|
|
12294
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12295
|
+
await mutateAsync(
|
|
12296
|
+
{
|
|
12297
|
+
sales_channel_id: data.sales_channel_id
|
|
12298
|
+
},
|
|
12299
|
+
{
|
|
12300
|
+
onSuccess: () => {
|
|
12301
|
+
ui.toast.success("Sales channel updated");
|
|
12302
|
+
handleSuccess();
|
|
12303
|
+
},
|
|
12304
|
+
onError: (error) => {
|
|
12305
|
+
ui.toast.error(error.message);
|
|
12306
|
+
}
|
|
12307
|
+
}
|
|
12308
|
+
);
|
|
12309
|
+
});
|
|
12310
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12311
|
+
KeyboundForm,
|
|
12312
|
+
{
|
|
12313
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12314
|
+
onSubmit,
|
|
12315
|
+
children: [
|
|
12316
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12317
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12318
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12319
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12320
|
+
] }) })
|
|
12321
|
+
]
|
|
12322
|
+
}
|
|
12323
|
+
) });
|
|
12324
|
+
};
|
|
12325
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12326
|
+
const salesChannels = useComboboxData({
|
|
12327
|
+
queryFn: async (params) => {
|
|
12328
|
+
return await sdk.admin.salesChannel.list(params);
|
|
12329
|
+
},
|
|
12330
|
+
queryKey: ["sales-channels"],
|
|
12331
|
+
getOptions: (data) => {
|
|
12332
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
12333
|
+
label: salesChannel.name,
|
|
12334
|
+
value: salesChannel.id
|
|
12335
|
+
}));
|
|
12336
|
+
},
|
|
12337
|
+
defaultValue: order.sales_channel_id || void 0
|
|
12338
|
+
});
|
|
12339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12340
|
+
Form$2.Field,
|
|
12341
|
+
{
|
|
12342
|
+
control,
|
|
12343
|
+
name: "sales_channel_id",
|
|
12344
|
+
render: ({ field }) => {
|
|
12345
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12346
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12347
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12348
|
+
Combobox,
|
|
12349
|
+
{
|
|
12350
|
+
options: salesChannels.options,
|
|
12351
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
12352
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12353
|
+
searchValue: salesChannels.searchValue,
|
|
12354
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12355
|
+
placeholder: "Select sales channel",
|
|
12356
|
+
...field
|
|
12357
|
+
}
|
|
12358
|
+
) }),
|
|
12359
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12360
|
+
] });
|
|
12361
|
+
}
|
|
12362
|
+
}
|
|
12363
|
+
);
|
|
12364
|
+
};
|
|
12365
|
+
const schema$2 = objectType({
|
|
12366
|
+
sales_channel_id: stringType().min(1)
|
|
12367
|
+
});
|
|
12368
12368
|
const ShippingAddress = () => {
|
|
12369
12369
|
const { id } = reactRouterDom.useParams();
|
|
12370
12370
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -13068,14 +13068,14 @@ const routeModule = {
|
|
|
13068
13068
|
Component: BillingAddress,
|
|
13069
13069
|
path: "/draft-orders/:id/billing-address"
|
|
13070
13070
|
},
|
|
13071
|
-
{
|
|
13072
|
-
Component: Email,
|
|
13073
|
-
path: "/draft-orders/:id/email"
|
|
13074
|
-
},
|
|
13075
13071
|
{
|
|
13076
13072
|
Component: CustomItems,
|
|
13077
13073
|
path: "/draft-orders/:id/custom-items"
|
|
13078
13074
|
},
|
|
13075
|
+
{
|
|
13076
|
+
Component: Email,
|
|
13077
|
+
path: "/draft-orders/:id/email"
|
|
13078
|
+
},
|
|
13079
13079
|
{
|
|
13080
13080
|
Component: Items,
|
|
13081
13081
|
path: "/draft-orders/:id/items"
|
|
@@ -13088,14 +13088,14 @@ const routeModule = {
|
|
|
13088
13088
|
Component: Promotions,
|
|
13089
13089
|
path: "/draft-orders/:id/promotions"
|
|
13090
13090
|
},
|
|
13091
|
-
{
|
|
13092
|
-
Component: SalesChannel,
|
|
13093
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13094
|
-
},
|
|
13095
13091
|
{
|
|
13096
13092
|
Component: Shipping,
|
|
13097
13093
|
path: "/draft-orders/:id/shipping"
|
|
13098
13094
|
},
|
|
13095
|
+
{
|
|
13096
|
+
Component: SalesChannel,
|
|
13097
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13098
|
+
},
|
|
13099
13099
|
{
|
|
13100
13100
|
Component: ShippingAddress,
|
|
13101
13101
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -9755,6 +9755,27 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9755
9755
|
) });
|
|
9756
9756
|
};
|
|
9757
9757
|
const schema$5 = addressSchema;
|
|
9758
|
+
const CustomItems = () => {
|
|
9759
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9760
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9761
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9762
|
+
] });
|
|
9763
|
+
};
|
|
9764
|
+
const CustomItemsForm = () => {
|
|
9765
|
+
const form = useForm({
|
|
9766
|
+
resolver: zodResolver(schema$4)
|
|
9767
|
+
});
|
|
9768
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9769
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9770
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9771
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9772
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9773
|
+
] }) })
|
|
9774
|
+
] }) });
|
|
9775
|
+
};
|
|
9776
|
+
const schema$4 = objectType({
|
|
9777
|
+
email: stringType().email()
|
|
9778
|
+
});
|
|
9758
9779
|
const Email = () => {
|
|
9759
9780
|
const { id } = useParams();
|
|
9760
9781
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9777,7 +9798,7 @@ const EmailForm = ({ order }) => {
|
|
|
9777
9798
|
defaultValues: {
|
|
9778
9799
|
email: order.email ?? ""
|
|
9779
9800
|
},
|
|
9780
|
-
resolver: zodResolver(schema$
|
|
9801
|
+
resolver: zodResolver(schema$3)
|
|
9781
9802
|
});
|
|
9782
9803
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9783
9804
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9820,27 +9841,6 @@ const EmailForm = ({ order }) => {
|
|
|
9820
9841
|
}
|
|
9821
9842
|
) });
|
|
9822
9843
|
};
|
|
9823
|
-
const schema$4 = objectType({
|
|
9824
|
-
email: stringType().email()
|
|
9825
|
-
});
|
|
9826
|
-
const CustomItems = () => {
|
|
9827
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9828
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9829
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9830
|
-
] });
|
|
9831
|
-
};
|
|
9832
|
-
const CustomItemsForm = () => {
|
|
9833
|
-
const form = useForm({
|
|
9834
|
-
resolver: zodResolver(schema$3)
|
|
9835
|
-
});
|
|
9836
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9837
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9838
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9839
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9840
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9841
|
-
] }) })
|
|
9842
|
-
] }) });
|
|
9843
|
-
};
|
|
9844
9844
|
const schema$3 = objectType({
|
|
9845
9845
|
email: stringType().email()
|
|
9846
9846
|
});
|
|
@@ -11445,112 +11445,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11445
11445
|
}
|
|
11446
11446
|
return Array.from(promotionIds);
|
|
11447
11447
|
}
|
|
11448
|
-
const SalesChannel = () => {
|
|
11449
|
-
const { id } = useParams();
|
|
11450
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11451
|
-
id,
|
|
11452
|
-
{
|
|
11453
|
-
fields: "+sales_channel_id"
|
|
11454
|
-
},
|
|
11455
|
-
{
|
|
11456
|
-
enabled: !!id
|
|
11457
|
-
}
|
|
11458
|
-
);
|
|
11459
|
-
if (isError) {
|
|
11460
|
-
throw error;
|
|
11461
|
-
}
|
|
11462
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
11463
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11464
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11465
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11466
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11467
|
-
] }),
|
|
11468
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11469
|
-
] });
|
|
11470
|
-
};
|
|
11471
|
-
const SalesChannelForm = ({ order }) => {
|
|
11472
|
-
const form = useForm({
|
|
11473
|
-
defaultValues: {
|
|
11474
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
11475
|
-
},
|
|
11476
|
-
resolver: zodResolver(schema$2)
|
|
11477
|
-
});
|
|
11478
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11479
|
-
const { handleSuccess } = useRouteModal();
|
|
11480
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11481
|
-
await mutateAsync(
|
|
11482
|
-
{
|
|
11483
|
-
sales_channel_id: data.sales_channel_id
|
|
11484
|
-
},
|
|
11485
|
-
{
|
|
11486
|
-
onSuccess: () => {
|
|
11487
|
-
toast.success("Sales channel updated");
|
|
11488
|
-
handleSuccess();
|
|
11489
|
-
},
|
|
11490
|
-
onError: (error) => {
|
|
11491
|
-
toast.error(error.message);
|
|
11492
|
-
}
|
|
11493
|
-
}
|
|
11494
|
-
);
|
|
11495
|
-
});
|
|
11496
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11497
|
-
KeyboundForm,
|
|
11498
|
-
{
|
|
11499
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11500
|
-
onSubmit,
|
|
11501
|
-
children: [
|
|
11502
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11503
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11504
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11505
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11506
|
-
] }) })
|
|
11507
|
-
]
|
|
11508
|
-
}
|
|
11509
|
-
) });
|
|
11510
|
-
};
|
|
11511
|
-
const SalesChannelField = ({ control, order }) => {
|
|
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
|
-
});
|
|
11554
11448
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11555
11449
|
const Shipping = () => {
|
|
11556
11450
|
var _a;
|
|
@@ -12358,6 +12252,112 @@ const CustomAmountField = ({
|
|
|
12358
12252
|
}
|
|
12359
12253
|
);
|
|
12360
12254
|
};
|
|
12255
|
+
const SalesChannel = () => {
|
|
12256
|
+
const { id } = useParams();
|
|
12257
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12258
|
+
id,
|
|
12259
|
+
{
|
|
12260
|
+
fields: "+sales_channel_id"
|
|
12261
|
+
},
|
|
12262
|
+
{
|
|
12263
|
+
enabled: !!id
|
|
12264
|
+
}
|
|
12265
|
+
);
|
|
12266
|
+
if (isError) {
|
|
12267
|
+
throw error;
|
|
12268
|
+
}
|
|
12269
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12270
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12271
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12272
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12273
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12274
|
+
] }),
|
|
12275
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12276
|
+
] });
|
|
12277
|
+
};
|
|
12278
|
+
const SalesChannelForm = ({ order }) => {
|
|
12279
|
+
const form = useForm({
|
|
12280
|
+
defaultValues: {
|
|
12281
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12282
|
+
},
|
|
12283
|
+
resolver: zodResolver(schema$2)
|
|
12284
|
+
});
|
|
12285
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12286
|
+
const { handleSuccess } = useRouteModal();
|
|
12287
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12288
|
+
await mutateAsync(
|
|
12289
|
+
{
|
|
12290
|
+
sales_channel_id: data.sales_channel_id
|
|
12291
|
+
},
|
|
12292
|
+
{
|
|
12293
|
+
onSuccess: () => {
|
|
12294
|
+
toast.success("Sales channel updated");
|
|
12295
|
+
handleSuccess();
|
|
12296
|
+
},
|
|
12297
|
+
onError: (error) => {
|
|
12298
|
+
toast.error(error.message);
|
|
12299
|
+
}
|
|
12300
|
+
}
|
|
12301
|
+
);
|
|
12302
|
+
});
|
|
12303
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12304
|
+
KeyboundForm,
|
|
12305
|
+
{
|
|
12306
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12307
|
+
onSubmit,
|
|
12308
|
+
children: [
|
|
12309
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12310
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12311
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12312
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12313
|
+
] }) })
|
|
12314
|
+
]
|
|
12315
|
+
}
|
|
12316
|
+
) });
|
|
12317
|
+
};
|
|
12318
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12319
|
+
const salesChannels = useComboboxData({
|
|
12320
|
+
queryFn: async (params) => {
|
|
12321
|
+
return await sdk.admin.salesChannel.list(params);
|
|
12322
|
+
},
|
|
12323
|
+
queryKey: ["sales-channels"],
|
|
12324
|
+
getOptions: (data) => {
|
|
12325
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
12326
|
+
label: salesChannel.name,
|
|
12327
|
+
value: salesChannel.id
|
|
12328
|
+
}));
|
|
12329
|
+
},
|
|
12330
|
+
defaultValue: order.sales_channel_id || void 0
|
|
12331
|
+
});
|
|
12332
|
+
return /* @__PURE__ */ jsx(
|
|
12333
|
+
Form$2.Field,
|
|
12334
|
+
{
|
|
12335
|
+
control,
|
|
12336
|
+
name: "sales_channel_id",
|
|
12337
|
+
render: ({ field }) => {
|
|
12338
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12339
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12340
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
12341
|
+
Combobox,
|
|
12342
|
+
{
|
|
12343
|
+
options: salesChannels.options,
|
|
12344
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
12345
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12346
|
+
searchValue: salesChannels.searchValue,
|
|
12347
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12348
|
+
placeholder: "Select sales channel",
|
|
12349
|
+
...field
|
|
12350
|
+
}
|
|
12351
|
+
) }),
|
|
12352
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12353
|
+
] });
|
|
12354
|
+
}
|
|
12355
|
+
}
|
|
12356
|
+
);
|
|
12357
|
+
};
|
|
12358
|
+
const schema$2 = objectType({
|
|
12359
|
+
sales_channel_id: stringType().min(1)
|
|
12360
|
+
});
|
|
12361
12361
|
const ShippingAddress = () => {
|
|
12362
12362
|
const { id } = useParams();
|
|
12363
12363
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -13061,14 +13061,14 @@ const routeModule = {
|
|
|
13061
13061
|
Component: BillingAddress,
|
|
13062
13062
|
path: "/draft-orders/:id/billing-address"
|
|
13063
13063
|
},
|
|
13064
|
-
{
|
|
13065
|
-
Component: Email,
|
|
13066
|
-
path: "/draft-orders/:id/email"
|
|
13067
|
-
},
|
|
13068
13064
|
{
|
|
13069
13065
|
Component: CustomItems,
|
|
13070
13066
|
path: "/draft-orders/:id/custom-items"
|
|
13071
13067
|
},
|
|
13068
|
+
{
|
|
13069
|
+
Component: Email,
|
|
13070
|
+
path: "/draft-orders/:id/email"
|
|
13071
|
+
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Items,
|
|
13074
13074
|
path: "/draft-orders/:id/items"
|
|
@@ -13081,14 +13081,14 @@ const routeModule = {
|
|
|
13081
13081
|
Component: Promotions,
|
|
13082
13082
|
path: "/draft-orders/:id/promotions"
|
|
13083
13083
|
},
|
|
13084
|
-
{
|
|
13085
|
-
Component: SalesChannel,
|
|
13086
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13087
|
-
},
|
|
13088
13084
|
{
|
|
13089
13085
|
Component: Shipping,
|
|
13090
13086
|
path: "/draft-orders/:id/shipping"
|
|
13091
13087
|
},
|
|
13088
|
+
{
|
|
13089
|
+
Component: SalesChannel,
|
|
13090
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13091
|
+
},
|
|
13092
13092
|
{
|
|
13093
13093
|
Component: ShippingAddress,
|
|
13094
13094
|
path: "/draft-orders/:id/shipping-address"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.12.2-snapshot-
|
|
3
|
+
"version": "2.12.2-snapshot-20251205131013",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@babel/runtime": "^7.26.10",
|
|
39
39
|
"@hookform/resolvers": "3.4.2",
|
|
40
|
-
"@medusajs/js-sdk": "2.12.2-snapshot-
|
|
40
|
+
"@medusajs/js-sdk": "2.12.2-snapshot-20251205131013",
|
|
41
41
|
"@tanstack/react-query": "5.64.2",
|
|
42
42
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
43
43
|
"date-fns": "^3.6.0",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "2.12.2-snapshot-
|
|
52
|
-
"@medusajs/cli": "2.12.2-snapshot-
|
|
53
|
-
"@medusajs/framework": "2.12.2-snapshot-
|
|
54
|
-
"@medusajs/icons": "2.12.2-snapshot-
|
|
55
|
-
"@medusajs/test-utils": "2.12.2-snapshot-
|
|
56
|
-
"@medusajs/types": "2.12.2-snapshot-
|
|
57
|
-
"@medusajs/ui": "4.0.30-snapshot-
|
|
58
|
-
"@medusajs/ui-preset": "2.12.2-snapshot-
|
|
51
|
+
"@medusajs/admin-sdk": "2.12.2-snapshot-20251205131013",
|
|
52
|
+
"@medusajs/cli": "2.12.2-snapshot-20251205131013",
|
|
53
|
+
"@medusajs/framework": "2.12.2-snapshot-20251205131013",
|
|
54
|
+
"@medusajs/icons": "2.12.2-snapshot-20251205131013",
|
|
55
|
+
"@medusajs/test-utils": "2.12.2-snapshot-20251205131013",
|
|
56
|
+
"@medusajs/types": "2.12.2-snapshot-20251205131013",
|
|
57
|
+
"@medusajs/ui": "4.0.30-snapshot-20251205131013",
|
|
58
|
+
"@medusajs/ui-preset": "2.12.2-snapshot-20251205131013"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@medusajs/admin-sdk": "2.12.2-snapshot-
|
|
62
|
-
"@medusajs/cli": "2.12.2-snapshot-
|
|
63
|
-
"@medusajs/framework": "2.12.2-snapshot-
|
|
64
|
-
"@medusajs/icons": "2.12.2-snapshot-
|
|
65
|
-
"@medusajs/test-utils": "2.12.2-snapshot-
|
|
66
|
-
"@medusajs/ui": "4.0.30-snapshot-
|
|
61
|
+
"@medusajs/admin-sdk": "2.12.2-snapshot-20251205131013",
|
|
62
|
+
"@medusajs/cli": "2.12.2-snapshot-20251205131013",
|
|
63
|
+
"@medusajs/framework": "2.12.2-snapshot-20251205131013",
|
|
64
|
+
"@medusajs/icons": "2.12.2-snapshot-20251205131013",
|
|
65
|
+
"@medusajs/test-utils": "2.12.2-snapshot-20251205131013",
|
|
66
|
+
"@medusajs/ui": "4.0.30-snapshot-20251205131013",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|