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