@medusajs/draft-order 2.10.2-preview-20250905090156 → 2.10.2-preview-20250905120200
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 +186 -186
- package/.medusa/server/src/admin/index.mjs +186 -186
- package/package.json +16 -16
|
@@ -9784,6 +9784,74 @@ const CustomItemsForm = () => {
|
|
|
9784
9784
|
const schema$4 = objectType({
|
|
9785
9785
|
email: stringType().email()
|
|
9786
9786
|
});
|
|
9787
|
+
const Email = () => {
|
|
9788
|
+
const { id } = reactRouterDom.useParams();
|
|
9789
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9790
|
+
fields: "+email"
|
|
9791
|
+
});
|
|
9792
|
+
if (isError) {
|
|
9793
|
+
throw error;
|
|
9794
|
+
}
|
|
9795
|
+
const isReady = !isPending && !!order;
|
|
9796
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9797
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9798
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9799
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9800
|
+
] }),
|
|
9801
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9802
|
+
] });
|
|
9803
|
+
};
|
|
9804
|
+
const EmailForm = ({ order }) => {
|
|
9805
|
+
const form = reactHookForm.useForm({
|
|
9806
|
+
defaultValues: {
|
|
9807
|
+
email: order.email ?? ""
|
|
9808
|
+
},
|
|
9809
|
+
resolver: zod.zodResolver(schema$3)
|
|
9810
|
+
});
|
|
9811
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9812
|
+
const { handleSuccess } = useRouteModal();
|
|
9813
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9814
|
+
await mutateAsync(
|
|
9815
|
+
{ email: data.email },
|
|
9816
|
+
{
|
|
9817
|
+
onSuccess: () => {
|
|
9818
|
+
handleSuccess();
|
|
9819
|
+
},
|
|
9820
|
+
onError: (error) => {
|
|
9821
|
+
ui.toast.error(error.message);
|
|
9822
|
+
}
|
|
9823
|
+
}
|
|
9824
|
+
);
|
|
9825
|
+
});
|
|
9826
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9827
|
+
KeyboundForm,
|
|
9828
|
+
{
|
|
9829
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9830
|
+
onSubmit,
|
|
9831
|
+
children: [
|
|
9832
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9833
|
+
Form$2.Field,
|
|
9834
|
+
{
|
|
9835
|
+
control: form.control,
|
|
9836
|
+
name: "email",
|
|
9837
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9838
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9839
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9840
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9841
|
+
] })
|
|
9842
|
+
}
|
|
9843
|
+
) }),
|
|
9844
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9845
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9846
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9847
|
+
] }) })
|
|
9848
|
+
]
|
|
9849
|
+
}
|
|
9850
|
+
) });
|
|
9851
|
+
};
|
|
9852
|
+
const schema$3 = objectType({
|
|
9853
|
+
email: stringType().email()
|
|
9854
|
+
});
|
|
9787
9855
|
const NumberInput = React.forwardRef(
|
|
9788
9856
|
({
|
|
9789
9857
|
value,
|
|
@@ -11385,112 +11453,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11385
11453
|
}
|
|
11386
11454
|
return Array.from(promotionIds);
|
|
11387
11455
|
}
|
|
11388
|
-
const SalesChannel = () => {
|
|
11389
|
-
const { id } = reactRouterDom.useParams();
|
|
11390
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11391
|
-
id,
|
|
11392
|
-
{
|
|
11393
|
-
fields: "+sales_channel_id"
|
|
11394
|
-
},
|
|
11395
|
-
{
|
|
11396
|
-
enabled: !!id
|
|
11397
|
-
}
|
|
11398
|
-
);
|
|
11399
|
-
if (isError) {
|
|
11400
|
-
throw error;
|
|
11401
|
-
}
|
|
11402
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
11403
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11404
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11405
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11406
|
-
/* @__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" }) })
|
|
11407
|
-
] }),
|
|
11408
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11409
|
-
] });
|
|
11410
|
-
};
|
|
11411
|
-
const SalesChannelForm = ({ order }) => {
|
|
11412
|
-
const form = reactHookForm.useForm({
|
|
11413
|
-
defaultValues: {
|
|
11414
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
11415
|
-
},
|
|
11416
|
-
resolver: zod.zodResolver(schema$3)
|
|
11417
|
-
});
|
|
11418
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11419
|
-
const { handleSuccess } = useRouteModal();
|
|
11420
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11421
|
-
await mutateAsync(
|
|
11422
|
-
{
|
|
11423
|
-
sales_channel_id: data.sales_channel_id
|
|
11424
|
-
},
|
|
11425
|
-
{
|
|
11426
|
-
onSuccess: () => {
|
|
11427
|
-
ui.toast.success("Sales channel updated");
|
|
11428
|
-
handleSuccess();
|
|
11429
|
-
},
|
|
11430
|
-
onError: (error) => {
|
|
11431
|
-
ui.toast.error(error.message);
|
|
11432
|
-
}
|
|
11433
|
-
}
|
|
11434
|
-
);
|
|
11435
|
-
});
|
|
11436
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11437
|
-
KeyboundForm,
|
|
11438
|
-
{
|
|
11439
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11440
|
-
onSubmit,
|
|
11441
|
-
children: [
|
|
11442
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11443
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11444
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11445
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11446
|
-
] }) })
|
|
11447
|
-
]
|
|
11448
|
-
}
|
|
11449
|
-
) });
|
|
11450
|
-
};
|
|
11451
|
-
const SalesChannelField = ({ control, order }) => {
|
|
11452
|
-
const salesChannels = useComboboxData({
|
|
11453
|
-
queryFn: async (params) => {
|
|
11454
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11455
|
-
},
|
|
11456
|
-
queryKey: ["sales-channels"],
|
|
11457
|
-
getOptions: (data) => {
|
|
11458
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11459
|
-
label: salesChannel.name,
|
|
11460
|
-
value: salesChannel.id
|
|
11461
|
-
}));
|
|
11462
|
-
},
|
|
11463
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11464
|
-
});
|
|
11465
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11466
|
-
Form$2.Field,
|
|
11467
|
-
{
|
|
11468
|
-
control,
|
|
11469
|
-
name: "sales_channel_id",
|
|
11470
|
-
render: ({ field }) => {
|
|
11471
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11472
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11473
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11474
|
-
Combobox,
|
|
11475
|
-
{
|
|
11476
|
-
options: salesChannels.options,
|
|
11477
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11478
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11479
|
-
searchValue: salesChannels.searchValue,
|
|
11480
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11481
|
-
placeholder: "Select sales channel",
|
|
11482
|
-
...field
|
|
11483
|
-
}
|
|
11484
|
-
) }),
|
|
11485
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11486
|
-
] });
|
|
11487
|
-
}
|
|
11488
|
-
}
|
|
11489
|
-
);
|
|
11490
|
-
};
|
|
11491
|
-
const schema$3 = objectType({
|
|
11492
|
-
sales_channel_id: stringType().min(1)
|
|
11493
|
-
});
|
|
11494
11456
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11495
11457
|
const Shipping = () => {
|
|
11496
11458
|
var _a;
|
|
@@ -12298,6 +12260,112 @@ const CustomAmountField = ({
|
|
|
12298
12260
|
}
|
|
12299
12261
|
);
|
|
12300
12262
|
};
|
|
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
|
+
});
|
|
12301
12369
|
const ShippingAddress = () => {
|
|
12302
12370
|
const { id } = reactRouterDom.useParams();
|
|
12303
12371
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12330,7 +12398,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12330
12398
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12331
12399
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12332
12400
|
},
|
|
12333
|
-
resolver: zod.zodResolver(schema$
|
|
12401
|
+
resolver: zod.zodResolver(schema$1)
|
|
12334
12402
|
});
|
|
12335
12403
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12336
12404
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12500,7 +12568,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12500
12568
|
}
|
|
12501
12569
|
) });
|
|
12502
12570
|
};
|
|
12503
|
-
const schema$
|
|
12571
|
+
const schema$1 = addressSchema;
|
|
12504
12572
|
const TransferOwnership = () => {
|
|
12505
12573
|
const { id } = reactRouterDom.useParams();
|
|
12506
12574
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12524,7 +12592,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12524
12592
|
defaultValues: {
|
|
12525
12593
|
customer_id: order.customer_id || ""
|
|
12526
12594
|
},
|
|
12527
|
-
resolver: zod.zodResolver(schema
|
|
12595
|
+
resolver: zod.zodResolver(schema)
|
|
12528
12596
|
});
|
|
12529
12597
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12530
12598
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12974,76 +13042,8 @@ const Illustration = () => {
|
|
|
12974
13042
|
}
|
|
12975
13043
|
);
|
|
12976
13044
|
};
|
|
12977
|
-
const schema$1 = objectType({
|
|
12978
|
-
customer_id: stringType().min(1)
|
|
12979
|
-
});
|
|
12980
|
-
const Email = () => {
|
|
12981
|
-
const { id } = reactRouterDom.useParams();
|
|
12982
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12983
|
-
fields: "+email"
|
|
12984
|
-
});
|
|
12985
|
-
if (isError) {
|
|
12986
|
-
throw error;
|
|
12987
|
-
}
|
|
12988
|
-
const isReady = !isPending && !!order;
|
|
12989
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12990
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12991
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12992
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12993
|
-
] }),
|
|
12994
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12995
|
-
] });
|
|
12996
|
-
};
|
|
12997
|
-
const EmailForm = ({ order }) => {
|
|
12998
|
-
const form = reactHookForm.useForm({
|
|
12999
|
-
defaultValues: {
|
|
13000
|
-
email: order.email ?? ""
|
|
13001
|
-
},
|
|
13002
|
-
resolver: zod.zodResolver(schema)
|
|
13003
|
-
});
|
|
13004
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
13005
|
-
const { handleSuccess } = useRouteModal();
|
|
13006
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
13007
|
-
await mutateAsync(
|
|
13008
|
-
{ email: data.email },
|
|
13009
|
-
{
|
|
13010
|
-
onSuccess: () => {
|
|
13011
|
-
handleSuccess();
|
|
13012
|
-
},
|
|
13013
|
-
onError: (error) => {
|
|
13014
|
-
ui.toast.error(error.message);
|
|
13015
|
-
}
|
|
13016
|
-
}
|
|
13017
|
-
);
|
|
13018
|
-
});
|
|
13019
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13020
|
-
KeyboundForm,
|
|
13021
|
-
{
|
|
13022
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
13023
|
-
onSubmit,
|
|
13024
|
-
children: [
|
|
13025
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13026
|
-
Form$2.Field,
|
|
13027
|
-
{
|
|
13028
|
-
control: form.control,
|
|
13029
|
-
name: "email",
|
|
13030
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13031
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
13032
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13033
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13034
|
-
] })
|
|
13035
|
-
}
|
|
13036
|
-
) }),
|
|
13037
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13038
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13039
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13040
|
-
] }) })
|
|
13041
|
-
]
|
|
13042
|
-
}
|
|
13043
|
-
) });
|
|
13044
|
-
};
|
|
13045
13045
|
const schema = objectType({
|
|
13046
|
-
|
|
13046
|
+
customer_id: stringType().min(1)
|
|
13047
13047
|
});
|
|
13048
13048
|
const widgetModule = { widgets: [] };
|
|
13049
13049
|
const routeModule = {
|
|
@@ -13073,6 +13073,10 @@ const routeModule = {
|
|
|
13073
13073
|
Component: CustomItems,
|
|
13074
13074
|
path: "/draft-orders/:id/custom-items"
|
|
13075
13075
|
},
|
|
13076
|
+
{
|
|
13077
|
+
Component: Email,
|
|
13078
|
+
path: "/draft-orders/:id/email"
|
|
13079
|
+
},
|
|
13076
13080
|
{
|
|
13077
13081
|
Component: Items,
|
|
13078
13082
|
path: "/draft-orders/:id/items"
|
|
@@ -13085,14 +13089,14 @@ const routeModule = {
|
|
|
13085
13089
|
Component: Promotions,
|
|
13086
13090
|
path: "/draft-orders/:id/promotions"
|
|
13087
13091
|
},
|
|
13088
|
-
{
|
|
13089
|
-
Component: SalesChannel,
|
|
13090
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13091
|
-
},
|
|
13092
13092
|
{
|
|
13093
13093
|
Component: Shipping,
|
|
13094
13094
|
path: "/draft-orders/:id/shipping"
|
|
13095
13095
|
},
|
|
13096
|
+
{
|
|
13097
|
+
Component: SalesChannel,
|
|
13098
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13099
|
+
},
|
|
13096
13100
|
{
|
|
13097
13101
|
Component: ShippingAddress,
|
|
13098
13102
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -13100,10 +13104,6 @@ const routeModule = {
|
|
|
13100
13104
|
{
|
|
13101
13105
|
Component: TransferOwnership,
|
|
13102
13106
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13103
|
-
},
|
|
13104
|
-
{
|
|
13105
|
-
Component: Email,
|
|
13106
|
-
path: "/draft-orders/:id/email"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|
|
@@ -9778,6 +9778,74 @@ const CustomItemsForm = () => {
|
|
|
9778
9778
|
const schema$4 = objectType({
|
|
9779
9779
|
email: stringType().email()
|
|
9780
9780
|
});
|
|
9781
|
+
const Email = () => {
|
|
9782
|
+
const { id } = useParams();
|
|
9783
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9784
|
+
fields: "+email"
|
|
9785
|
+
});
|
|
9786
|
+
if (isError) {
|
|
9787
|
+
throw error;
|
|
9788
|
+
}
|
|
9789
|
+
const isReady = !isPending && !!order;
|
|
9790
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9791
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9792
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9793
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9794
|
+
] }),
|
|
9795
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9796
|
+
] });
|
|
9797
|
+
};
|
|
9798
|
+
const EmailForm = ({ order }) => {
|
|
9799
|
+
const form = useForm({
|
|
9800
|
+
defaultValues: {
|
|
9801
|
+
email: order.email ?? ""
|
|
9802
|
+
},
|
|
9803
|
+
resolver: zodResolver(schema$3)
|
|
9804
|
+
});
|
|
9805
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9806
|
+
const { handleSuccess } = useRouteModal();
|
|
9807
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9808
|
+
await mutateAsync(
|
|
9809
|
+
{ email: data.email },
|
|
9810
|
+
{
|
|
9811
|
+
onSuccess: () => {
|
|
9812
|
+
handleSuccess();
|
|
9813
|
+
},
|
|
9814
|
+
onError: (error) => {
|
|
9815
|
+
toast.error(error.message);
|
|
9816
|
+
}
|
|
9817
|
+
}
|
|
9818
|
+
);
|
|
9819
|
+
});
|
|
9820
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9821
|
+
KeyboundForm,
|
|
9822
|
+
{
|
|
9823
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9824
|
+
onSubmit,
|
|
9825
|
+
children: [
|
|
9826
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9827
|
+
Form$2.Field,
|
|
9828
|
+
{
|
|
9829
|
+
control: form.control,
|
|
9830
|
+
name: "email",
|
|
9831
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9832
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9833
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9834
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9835
|
+
] })
|
|
9836
|
+
}
|
|
9837
|
+
) }),
|
|
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", isLoading: isPending, children: "Save" })
|
|
9841
|
+
] }) })
|
|
9842
|
+
]
|
|
9843
|
+
}
|
|
9844
|
+
) });
|
|
9845
|
+
};
|
|
9846
|
+
const schema$3 = objectType({
|
|
9847
|
+
email: stringType().email()
|
|
9848
|
+
});
|
|
9781
9849
|
const NumberInput = forwardRef(
|
|
9782
9850
|
({
|
|
9783
9851
|
value,
|
|
@@ -11379,112 +11447,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11379
11447
|
}
|
|
11380
11448
|
return Array.from(promotionIds);
|
|
11381
11449
|
}
|
|
11382
|
-
const SalesChannel = () => {
|
|
11383
|
-
const { id } = useParams();
|
|
11384
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11385
|
-
id,
|
|
11386
|
-
{
|
|
11387
|
-
fields: "+sales_channel_id"
|
|
11388
|
-
},
|
|
11389
|
-
{
|
|
11390
|
-
enabled: !!id
|
|
11391
|
-
}
|
|
11392
|
-
);
|
|
11393
|
-
if (isError) {
|
|
11394
|
-
throw error;
|
|
11395
|
-
}
|
|
11396
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
11397
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11398
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11399
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11400
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11401
|
-
] }),
|
|
11402
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11403
|
-
] });
|
|
11404
|
-
};
|
|
11405
|
-
const SalesChannelForm = ({ order }) => {
|
|
11406
|
-
const form = useForm({
|
|
11407
|
-
defaultValues: {
|
|
11408
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
11409
|
-
},
|
|
11410
|
-
resolver: zodResolver(schema$3)
|
|
11411
|
-
});
|
|
11412
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11413
|
-
const { handleSuccess } = useRouteModal();
|
|
11414
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11415
|
-
await mutateAsync(
|
|
11416
|
-
{
|
|
11417
|
-
sales_channel_id: data.sales_channel_id
|
|
11418
|
-
},
|
|
11419
|
-
{
|
|
11420
|
-
onSuccess: () => {
|
|
11421
|
-
toast.success("Sales channel updated");
|
|
11422
|
-
handleSuccess();
|
|
11423
|
-
},
|
|
11424
|
-
onError: (error) => {
|
|
11425
|
-
toast.error(error.message);
|
|
11426
|
-
}
|
|
11427
|
-
}
|
|
11428
|
-
);
|
|
11429
|
-
});
|
|
11430
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11431
|
-
KeyboundForm,
|
|
11432
|
-
{
|
|
11433
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11434
|
-
onSubmit,
|
|
11435
|
-
children: [
|
|
11436
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11437
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11438
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11439
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11440
|
-
] }) })
|
|
11441
|
-
]
|
|
11442
|
-
}
|
|
11443
|
-
) });
|
|
11444
|
-
};
|
|
11445
|
-
const SalesChannelField = ({ control, order }) => {
|
|
11446
|
-
const salesChannels = useComboboxData({
|
|
11447
|
-
queryFn: async (params) => {
|
|
11448
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11449
|
-
},
|
|
11450
|
-
queryKey: ["sales-channels"],
|
|
11451
|
-
getOptions: (data) => {
|
|
11452
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11453
|
-
label: salesChannel.name,
|
|
11454
|
-
value: salesChannel.id
|
|
11455
|
-
}));
|
|
11456
|
-
},
|
|
11457
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11458
|
-
});
|
|
11459
|
-
return /* @__PURE__ */ jsx(
|
|
11460
|
-
Form$2.Field,
|
|
11461
|
-
{
|
|
11462
|
-
control,
|
|
11463
|
-
name: "sales_channel_id",
|
|
11464
|
-
render: ({ field }) => {
|
|
11465
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11466
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11467
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11468
|
-
Combobox,
|
|
11469
|
-
{
|
|
11470
|
-
options: salesChannels.options,
|
|
11471
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11472
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11473
|
-
searchValue: salesChannels.searchValue,
|
|
11474
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11475
|
-
placeholder: "Select sales channel",
|
|
11476
|
-
...field
|
|
11477
|
-
}
|
|
11478
|
-
) }),
|
|
11479
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11480
|
-
] });
|
|
11481
|
-
}
|
|
11482
|
-
}
|
|
11483
|
-
);
|
|
11484
|
-
};
|
|
11485
|
-
const schema$3 = objectType({
|
|
11486
|
-
sales_channel_id: stringType().min(1)
|
|
11487
|
-
});
|
|
11488
11450
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11489
11451
|
const Shipping = () => {
|
|
11490
11452
|
var _a;
|
|
@@ -12292,6 +12254,112 @@ const CustomAmountField = ({
|
|
|
12292
12254
|
}
|
|
12293
12255
|
);
|
|
12294
12256
|
};
|
|
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
|
+
});
|
|
12295
12363
|
const ShippingAddress = () => {
|
|
12296
12364
|
const { id } = useParams();
|
|
12297
12365
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12324,7 +12392,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12324
12392
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12325
12393
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12326
12394
|
},
|
|
12327
|
-
resolver: zodResolver(schema$
|
|
12395
|
+
resolver: zodResolver(schema$1)
|
|
12328
12396
|
});
|
|
12329
12397
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12330
12398
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12494,7 +12562,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12494
12562
|
}
|
|
12495
12563
|
) });
|
|
12496
12564
|
};
|
|
12497
|
-
const schema$
|
|
12565
|
+
const schema$1 = addressSchema;
|
|
12498
12566
|
const TransferOwnership = () => {
|
|
12499
12567
|
const { id } = useParams();
|
|
12500
12568
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12518,7 +12586,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12518
12586
|
defaultValues: {
|
|
12519
12587
|
customer_id: order.customer_id || ""
|
|
12520
12588
|
},
|
|
12521
|
-
resolver: zodResolver(schema
|
|
12589
|
+
resolver: zodResolver(schema)
|
|
12522
12590
|
});
|
|
12523
12591
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12524
12592
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12968,76 +13036,8 @@ const Illustration = () => {
|
|
|
12968
13036
|
}
|
|
12969
13037
|
);
|
|
12970
13038
|
};
|
|
12971
|
-
const schema$1 = objectType({
|
|
12972
|
-
customer_id: stringType().min(1)
|
|
12973
|
-
});
|
|
12974
|
-
const Email = () => {
|
|
12975
|
-
const { id } = useParams();
|
|
12976
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12977
|
-
fields: "+email"
|
|
12978
|
-
});
|
|
12979
|
-
if (isError) {
|
|
12980
|
-
throw error;
|
|
12981
|
-
}
|
|
12982
|
-
const isReady = !isPending && !!order;
|
|
12983
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12984
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12985
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12986
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12987
|
-
] }),
|
|
12988
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12989
|
-
] });
|
|
12990
|
-
};
|
|
12991
|
-
const EmailForm = ({ order }) => {
|
|
12992
|
-
const form = useForm({
|
|
12993
|
-
defaultValues: {
|
|
12994
|
-
email: order.email ?? ""
|
|
12995
|
-
},
|
|
12996
|
-
resolver: zodResolver(schema)
|
|
12997
|
-
});
|
|
12998
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12999
|
-
const { handleSuccess } = useRouteModal();
|
|
13000
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
13001
|
-
await mutateAsync(
|
|
13002
|
-
{ email: data.email },
|
|
13003
|
-
{
|
|
13004
|
-
onSuccess: () => {
|
|
13005
|
-
handleSuccess();
|
|
13006
|
-
},
|
|
13007
|
-
onError: (error) => {
|
|
13008
|
-
toast.error(error.message);
|
|
13009
|
-
}
|
|
13010
|
-
}
|
|
13011
|
-
);
|
|
13012
|
-
});
|
|
13013
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13014
|
-
KeyboundForm,
|
|
13015
|
-
{
|
|
13016
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
13017
|
-
onSubmit,
|
|
13018
|
-
children: [
|
|
13019
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13020
|
-
Form$2.Field,
|
|
13021
|
-
{
|
|
13022
|
-
control: form.control,
|
|
13023
|
-
name: "email",
|
|
13024
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13025
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13026
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13027
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13028
|
-
] })
|
|
13029
|
-
}
|
|
13030
|
-
) }),
|
|
13031
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13032
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13033
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13034
|
-
] }) })
|
|
13035
|
-
]
|
|
13036
|
-
}
|
|
13037
|
-
) });
|
|
13038
|
-
};
|
|
13039
13039
|
const schema = objectType({
|
|
13040
|
-
|
|
13040
|
+
customer_id: stringType().min(1)
|
|
13041
13041
|
});
|
|
13042
13042
|
const widgetModule = { widgets: [] };
|
|
13043
13043
|
const routeModule = {
|
|
@@ -13067,6 +13067,10 @@ const routeModule = {
|
|
|
13067
13067
|
Component: CustomItems,
|
|
13068
13068
|
path: "/draft-orders/:id/custom-items"
|
|
13069
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: Email,
|
|
13072
|
+
path: "/draft-orders/:id/email"
|
|
13073
|
+
},
|
|
13070
13074
|
{
|
|
13071
13075
|
Component: Items,
|
|
13072
13076
|
path: "/draft-orders/:id/items"
|
|
@@ -13079,14 +13083,14 @@ const routeModule = {
|
|
|
13079
13083
|
Component: Promotions,
|
|
13080
13084
|
path: "/draft-orders/:id/promotions"
|
|
13081
13085
|
},
|
|
13082
|
-
{
|
|
13083
|
-
Component: SalesChannel,
|
|
13084
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13085
|
-
},
|
|
13086
13086
|
{
|
|
13087
13087
|
Component: Shipping,
|
|
13088
13088
|
path: "/draft-orders/:id/shipping"
|
|
13089
13089
|
},
|
|
13090
|
+
{
|
|
13091
|
+
Component: SalesChannel,
|
|
13092
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13093
|
+
},
|
|
13090
13094
|
{
|
|
13091
13095
|
Component: ShippingAddress,
|
|
13092
13096
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -13094,10 +13098,6 @@ const routeModule = {
|
|
|
13094
13098
|
{
|
|
13095
13099
|
Component: TransferOwnership,
|
|
13096
13100
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
|
-
},
|
|
13098
|
-
{
|
|
13099
|
-
Component: Email,
|
|
13100
|
-
path: "/draft-orders/:id/email"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.2-preview-
|
|
3
|
+
"version": "2.10.2-preview-20250905120200",
|
|
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.2-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.2-preview-20250905120200",
|
|
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.2-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
53
|
-
"@medusajs/types": "2.10.2-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.2-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250905120200",
|
|
49
|
+
"@medusajs/cli": "2.10.2-preview-20250905120200",
|
|
50
|
+
"@medusajs/framework": "2.10.2-preview-20250905120200",
|
|
51
|
+
"@medusajs/icons": "2.10.2-preview-20250905120200",
|
|
52
|
+
"@medusajs/test-utils": "2.10.2-preview-20250905120200",
|
|
53
|
+
"@medusajs/types": "2.10.2-preview-20250905120200",
|
|
54
|
+
"@medusajs/ui": "4.0.22-preview-20250905120200",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.2-preview-20250905120200",
|
|
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.2-preview-
|
|
80
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
81
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
82
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
83
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
84
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
79
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250905120200",
|
|
80
|
+
"@medusajs/cli": "2.10.2-preview-20250905120200",
|
|
81
|
+
"@medusajs/framework": "2.10.2-preview-20250905120200",
|
|
82
|
+
"@medusajs/icons": "2.10.2-preview-20250905120200",
|
|
83
|
+
"@medusajs/test-utils": "2.10.2-preview-20250905120200",
|
|
84
|
+
"@medusajs/ui": "4.0.22-preview-20250905120200",
|
|
85
85
|
"@mikro-orm/cli": "6.4.3",
|
|
86
86
|
"@mikro-orm/core": "6.4.3",
|
|
87
87
|
"@mikro-orm/knex": "6.4.3",
|