@medusajs/draft-order 2.10.4-preview-20250924210149 → 2.10.4-preview-20250925031439
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 +386 -386
- package/.medusa/server/src/admin/index.mjs +386 -386
- package/package.json +16 -16
|
@@ -9757,23 +9757,70 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9757
9757
|
) });
|
|
9758
9758
|
};
|
|
9759
9759
|
const schema$5 = addressSchema;
|
|
9760
|
-
const
|
|
9760
|
+
const Email = () => {
|
|
9761
|
+
const { id } = useParams();
|
|
9762
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9763
|
+
fields: "+email"
|
|
9764
|
+
});
|
|
9765
|
+
if (isError) {
|
|
9766
|
+
throw error;
|
|
9767
|
+
}
|
|
9768
|
+
const isReady = !isPending && !!order;
|
|
9761
9769
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9762
|
-
/* @__PURE__ */
|
|
9763
|
-
|
|
9770
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9771
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9772
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9773
|
+
] }),
|
|
9774
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9764
9775
|
] });
|
|
9765
9776
|
};
|
|
9766
|
-
const
|
|
9777
|
+
const EmailForm = ({ order }) => {
|
|
9767
9778
|
const form = useForm({
|
|
9779
|
+
defaultValues: {
|
|
9780
|
+
email: order.email ?? ""
|
|
9781
|
+
},
|
|
9768
9782
|
resolver: zodResolver(schema$4)
|
|
9769
9783
|
});
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9784
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9785
|
+
const { handleSuccess } = useRouteModal();
|
|
9786
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9787
|
+
await mutateAsync(
|
|
9788
|
+
{ email: data.email },
|
|
9789
|
+
{
|
|
9790
|
+
onSuccess: () => {
|
|
9791
|
+
handleSuccess();
|
|
9792
|
+
},
|
|
9793
|
+
onError: (error) => {
|
|
9794
|
+
toast.error(error.message);
|
|
9795
|
+
}
|
|
9796
|
+
}
|
|
9797
|
+
);
|
|
9798
|
+
});
|
|
9799
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9800
|
+
KeyboundForm,
|
|
9801
|
+
{
|
|
9802
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9803
|
+
onSubmit,
|
|
9804
|
+
children: [
|
|
9805
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9806
|
+
Form$2.Field,
|
|
9807
|
+
{
|
|
9808
|
+
control: form.control,
|
|
9809
|
+
name: "email",
|
|
9810
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9811
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9812
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9813
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9814
|
+
] })
|
|
9815
|
+
}
|
|
9816
|
+
) }),
|
|
9817
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9818
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9819
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9820
|
+
] }) })
|
|
9821
|
+
]
|
|
9822
|
+
}
|
|
9823
|
+
) });
|
|
9777
9824
|
};
|
|
9778
9825
|
const schema$4 = objectType({
|
|
9779
9826
|
email: stringType().email()
|
|
@@ -11379,112 +11426,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11379
11426
|
}
|
|
11380
11427
|
return Array.from(promotionIds);
|
|
11381
11428
|
}
|
|
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
11429
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11489
11430
|
const Shipping = () => {
|
|
11490
11431
|
var _a;
|
|
@@ -12292,60 +12233,44 @@ const CustomAmountField = ({
|
|
|
12292
12233
|
}
|
|
12293
12234
|
);
|
|
12294
12235
|
};
|
|
12295
|
-
const
|
|
12236
|
+
const TransferOwnership = () => {
|
|
12296
12237
|
const { id } = useParams();
|
|
12297
|
-
const {
|
|
12298
|
-
fields: "
|
|
12238
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
12239
|
+
fields: "id,customer_id,customer.*"
|
|
12299
12240
|
});
|
|
12300
12241
|
if (isError) {
|
|
12301
12242
|
throw error;
|
|
12302
12243
|
}
|
|
12303
|
-
const isReady = !isPending && !!
|
|
12244
|
+
const isReady = !isPending && !!draft_order;
|
|
12304
12245
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12305
12246
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12306
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
12307
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
12247
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
|
|
12248
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
|
|
12308
12249
|
] }),
|
|
12309
|
-
isReady && /* @__PURE__ */ jsx(
|
|
12250
|
+
isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
|
|
12310
12251
|
] });
|
|
12311
12252
|
};
|
|
12312
|
-
const
|
|
12313
|
-
var _a, _b
|
|
12253
|
+
const TransferOwnershipForm = ({ order }) => {
|
|
12254
|
+
var _a, _b;
|
|
12314
12255
|
const form = useForm({
|
|
12315
12256
|
defaultValues: {
|
|
12316
|
-
|
|
12317
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12318
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12319
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12320
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12321
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12322
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12323
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12324
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12325
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12257
|
+
customer_id: order.customer_id || ""
|
|
12326
12258
|
},
|
|
12327
|
-
resolver: zodResolver(schema$
|
|
12259
|
+
resolver: zodResolver(schema$3)
|
|
12328
12260
|
});
|
|
12329
12261
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12330
12262
|
const { handleSuccess } = useRouteModal();
|
|
12263
|
+
const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
|
|
12264
|
+
const currentCustomer = order.customer ? {
|
|
12265
|
+
label: name ? `${name} (${order.customer.email})` : order.customer.email,
|
|
12266
|
+
value: order.customer.id
|
|
12267
|
+
} : null;
|
|
12331
12268
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12332
12269
|
await mutateAsync(
|
|
12333
|
-
{
|
|
12334
|
-
shipping_address: {
|
|
12335
|
-
first_name: data.first_name,
|
|
12336
|
-
last_name: data.last_name,
|
|
12337
|
-
company: data.company,
|
|
12338
|
-
address_1: data.address_1,
|
|
12339
|
-
address_2: data.address_2,
|
|
12340
|
-
city: data.city,
|
|
12341
|
-
province: data.province,
|
|
12342
|
-
country_code: data.country_code,
|
|
12343
|
-
postal_code: data.postal_code,
|
|
12344
|
-
phone: data.phone
|
|
12345
|
-
}
|
|
12346
|
-
},
|
|
12270
|
+
{ customer_id: data.customer_id },
|
|
12347
12271
|
{
|
|
12348
12272
|
onSuccess: () => {
|
|
12273
|
+
toast.success("Customer updated");
|
|
12349
12274
|
handleSuccess();
|
|
12350
12275
|
},
|
|
12351
12276
|
onError: (error) => {
|
|
@@ -12360,210 +12285,23 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12360
12285
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
12361
12286
|
onSubmit,
|
|
12362
12287
|
children: [
|
|
12363
|
-
/* @__PURE__ */
|
|
12288
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
12289
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsx(Illustration, {}) }),
|
|
12290
|
+
currentCustomer && /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-3", children: [
|
|
12291
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
12292
|
+
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
|
|
12293
|
+
/* @__PURE__ */ jsx(Hint$1, { children: "The customer that is currently associated with this draft order." })
|
|
12294
|
+
] }),
|
|
12295
|
+
/* @__PURE__ */ jsxs(Select, { disabled: true, value: currentCustomer.value, children: [
|
|
12296
|
+
/* @__PURE__ */ jsx(Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
12297
|
+
/* @__PURE__ */ jsx(Select.Content, { children: /* @__PURE__ */ jsx(Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
|
|
12298
|
+
] })
|
|
12299
|
+
] }),
|
|
12364
12300
|
/* @__PURE__ */ jsx(
|
|
12365
|
-
|
|
12301
|
+
CustomerField,
|
|
12366
12302
|
{
|
|
12367
12303
|
control: form.control,
|
|
12368
|
-
|
|
12369
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12370
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12371
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12372
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12373
|
-
] })
|
|
12374
|
-
}
|
|
12375
|
-
),
|
|
12376
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12377
|
-
/* @__PURE__ */ jsx(
|
|
12378
|
-
Form$2.Field,
|
|
12379
|
-
{
|
|
12380
|
-
control: form.control,
|
|
12381
|
-
name: "first_name",
|
|
12382
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12383
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12384
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12385
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12386
|
-
] })
|
|
12387
|
-
}
|
|
12388
|
-
),
|
|
12389
|
-
/* @__PURE__ */ jsx(
|
|
12390
|
-
Form$2.Field,
|
|
12391
|
-
{
|
|
12392
|
-
control: form.control,
|
|
12393
|
-
name: "last_name",
|
|
12394
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12395
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12396
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12397
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12398
|
-
] })
|
|
12399
|
-
}
|
|
12400
|
-
)
|
|
12401
|
-
] }),
|
|
12402
|
-
/* @__PURE__ */ jsx(
|
|
12403
|
-
Form$2.Field,
|
|
12404
|
-
{
|
|
12405
|
-
control: form.control,
|
|
12406
|
-
name: "company",
|
|
12407
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12408
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12409
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12410
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12411
|
-
] })
|
|
12412
|
-
}
|
|
12413
|
-
),
|
|
12414
|
-
/* @__PURE__ */ jsx(
|
|
12415
|
-
Form$2.Field,
|
|
12416
|
-
{
|
|
12417
|
-
control: form.control,
|
|
12418
|
-
name: "address_1",
|
|
12419
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12420
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12421
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12422
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12423
|
-
] })
|
|
12424
|
-
}
|
|
12425
|
-
),
|
|
12426
|
-
/* @__PURE__ */ jsx(
|
|
12427
|
-
Form$2.Field,
|
|
12428
|
-
{
|
|
12429
|
-
control: form.control,
|
|
12430
|
-
name: "address_2",
|
|
12431
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12432
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12433
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12434
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12435
|
-
] })
|
|
12436
|
-
}
|
|
12437
|
-
),
|
|
12438
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12439
|
-
/* @__PURE__ */ jsx(
|
|
12440
|
-
Form$2.Field,
|
|
12441
|
-
{
|
|
12442
|
-
control: form.control,
|
|
12443
|
-
name: "postal_code",
|
|
12444
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12445
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12446
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12447
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12448
|
-
] })
|
|
12449
|
-
}
|
|
12450
|
-
),
|
|
12451
|
-
/* @__PURE__ */ jsx(
|
|
12452
|
-
Form$2.Field,
|
|
12453
|
-
{
|
|
12454
|
-
control: form.control,
|
|
12455
|
-
name: "city",
|
|
12456
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12457
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12458
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12459
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12460
|
-
] })
|
|
12461
|
-
}
|
|
12462
|
-
)
|
|
12463
|
-
] }),
|
|
12464
|
-
/* @__PURE__ */ jsx(
|
|
12465
|
-
Form$2.Field,
|
|
12466
|
-
{
|
|
12467
|
-
control: form.control,
|
|
12468
|
-
name: "province",
|
|
12469
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12470
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12471
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12472
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12473
|
-
] })
|
|
12474
|
-
}
|
|
12475
|
-
),
|
|
12476
|
-
/* @__PURE__ */ jsx(
|
|
12477
|
-
Form$2.Field,
|
|
12478
|
-
{
|
|
12479
|
-
control: form.control,
|
|
12480
|
-
name: "phone",
|
|
12481
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12482
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12483
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12484
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12485
|
-
] })
|
|
12486
|
-
}
|
|
12487
|
-
)
|
|
12488
|
-
] }) }),
|
|
12489
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12490
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12491
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12492
|
-
] }) })
|
|
12493
|
-
]
|
|
12494
|
-
}
|
|
12495
|
-
) });
|
|
12496
|
-
};
|
|
12497
|
-
const schema$2 = addressSchema;
|
|
12498
|
-
const TransferOwnership = () => {
|
|
12499
|
-
const { id } = useParams();
|
|
12500
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
12501
|
-
fields: "id,customer_id,customer.*"
|
|
12502
|
-
});
|
|
12503
|
-
if (isError) {
|
|
12504
|
-
throw error;
|
|
12505
|
-
}
|
|
12506
|
-
const isReady = !isPending && !!draft_order;
|
|
12507
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12508
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12509
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
|
|
12510
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
|
|
12511
|
-
] }),
|
|
12512
|
-
isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
|
|
12513
|
-
] });
|
|
12514
|
-
};
|
|
12515
|
-
const TransferOwnershipForm = ({ order }) => {
|
|
12516
|
-
var _a, _b;
|
|
12517
|
-
const form = useForm({
|
|
12518
|
-
defaultValues: {
|
|
12519
|
-
customer_id: order.customer_id || ""
|
|
12520
|
-
},
|
|
12521
|
-
resolver: zodResolver(schema$1)
|
|
12522
|
-
});
|
|
12523
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12524
|
-
const { handleSuccess } = useRouteModal();
|
|
12525
|
-
const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
|
|
12526
|
-
const currentCustomer = order.customer ? {
|
|
12527
|
-
label: name ? `${name} (${order.customer.email})` : order.customer.email,
|
|
12528
|
-
value: order.customer.id
|
|
12529
|
-
} : null;
|
|
12530
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12531
|
-
await mutateAsync(
|
|
12532
|
-
{ customer_id: data.customer_id },
|
|
12533
|
-
{
|
|
12534
|
-
onSuccess: () => {
|
|
12535
|
-
toast.success("Customer updated");
|
|
12536
|
-
handleSuccess();
|
|
12537
|
-
},
|
|
12538
|
-
onError: (error) => {
|
|
12539
|
-
toast.error(error.message);
|
|
12540
|
-
}
|
|
12541
|
-
}
|
|
12542
|
-
);
|
|
12543
|
-
});
|
|
12544
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12545
|
-
KeyboundForm,
|
|
12546
|
-
{
|
|
12547
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12548
|
-
onSubmit,
|
|
12549
|
-
children: [
|
|
12550
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
12551
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsx(Illustration, {}) }),
|
|
12552
|
-
currentCustomer && /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-3", children: [
|
|
12553
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
12554
|
-
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
|
|
12555
|
-
/* @__PURE__ */ jsx(Hint$1, { children: "The customer that is currently associated with this draft order." })
|
|
12556
|
-
] }),
|
|
12557
|
-
/* @__PURE__ */ jsxs(Select, { disabled: true, value: currentCustomer.value, children: [
|
|
12558
|
-
/* @__PURE__ */ jsx(Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
12559
|
-
/* @__PURE__ */ jsx(Select.Content, { children: /* @__PURE__ */ jsx(Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
|
|
12560
|
-
] })
|
|
12561
|
-
] }),
|
|
12562
|
-
/* @__PURE__ */ jsx(
|
|
12563
|
-
CustomerField,
|
|
12564
|
-
{
|
|
12565
|
-
control: form.control,
|
|
12566
|
-
currentCustomerId: order.customer_id
|
|
12304
|
+
currentCustomerId: order.customer_id
|
|
12567
12305
|
}
|
|
12568
12306
|
)
|
|
12569
12307
|
] }),
|
|
@@ -12968,13 +12706,119 @@ const Illustration = () => {
|
|
|
12968
12706
|
}
|
|
12969
12707
|
);
|
|
12970
12708
|
};
|
|
12971
|
-
const schema$
|
|
12709
|
+
const schema$3 = objectType({
|
|
12972
12710
|
customer_id: stringType().min(1)
|
|
12973
12711
|
});
|
|
12974
|
-
const
|
|
12712
|
+
const SalesChannel = () => {
|
|
12713
|
+
const { id } = useParams();
|
|
12714
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12715
|
+
id,
|
|
12716
|
+
{
|
|
12717
|
+
fields: "+sales_channel_id"
|
|
12718
|
+
},
|
|
12719
|
+
{
|
|
12720
|
+
enabled: !!id
|
|
12721
|
+
}
|
|
12722
|
+
);
|
|
12723
|
+
if (isError) {
|
|
12724
|
+
throw error;
|
|
12725
|
+
}
|
|
12726
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12727
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12728
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12729
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12730
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12731
|
+
] }),
|
|
12732
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12733
|
+
] });
|
|
12734
|
+
};
|
|
12735
|
+
const SalesChannelForm = ({ order }) => {
|
|
12736
|
+
const form = useForm({
|
|
12737
|
+
defaultValues: {
|
|
12738
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12739
|
+
},
|
|
12740
|
+
resolver: zodResolver(schema$2)
|
|
12741
|
+
});
|
|
12742
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12743
|
+
const { handleSuccess } = useRouteModal();
|
|
12744
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12745
|
+
await mutateAsync(
|
|
12746
|
+
{
|
|
12747
|
+
sales_channel_id: data.sales_channel_id
|
|
12748
|
+
},
|
|
12749
|
+
{
|
|
12750
|
+
onSuccess: () => {
|
|
12751
|
+
toast.success("Sales channel updated");
|
|
12752
|
+
handleSuccess();
|
|
12753
|
+
},
|
|
12754
|
+
onError: (error) => {
|
|
12755
|
+
toast.error(error.message);
|
|
12756
|
+
}
|
|
12757
|
+
}
|
|
12758
|
+
);
|
|
12759
|
+
});
|
|
12760
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12761
|
+
KeyboundForm,
|
|
12762
|
+
{
|
|
12763
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12764
|
+
onSubmit,
|
|
12765
|
+
children: [
|
|
12766
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12767
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12768
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12769
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12770
|
+
] }) })
|
|
12771
|
+
]
|
|
12772
|
+
}
|
|
12773
|
+
) });
|
|
12774
|
+
};
|
|
12775
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12776
|
+
const salesChannels = useComboboxData({
|
|
12777
|
+
queryFn: async (params) => {
|
|
12778
|
+
return await sdk.admin.salesChannel.list(params);
|
|
12779
|
+
},
|
|
12780
|
+
queryKey: ["sales-channels"],
|
|
12781
|
+
getOptions: (data) => {
|
|
12782
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
12783
|
+
label: salesChannel.name,
|
|
12784
|
+
value: salesChannel.id
|
|
12785
|
+
}));
|
|
12786
|
+
},
|
|
12787
|
+
defaultValue: order.sales_channel_id || void 0
|
|
12788
|
+
});
|
|
12789
|
+
return /* @__PURE__ */ jsx(
|
|
12790
|
+
Form$2.Field,
|
|
12791
|
+
{
|
|
12792
|
+
control,
|
|
12793
|
+
name: "sales_channel_id",
|
|
12794
|
+
render: ({ field }) => {
|
|
12795
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12796
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12797
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
12798
|
+
Combobox,
|
|
12799
|
+
{
|
|
12800
|
+
options: salesChannels.options,
|
|
12801
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
12802
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12803
|
+
searchValue: salesChannels.searchValue,
|
|
12804
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12805
|
+
placeholder: "Select sales channel",
|
|
12806
|
+
...field
|
|
12807
|
+
}
|
|
12808
|
+
) }),
|
|
12809
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12810
|
+
] });
|
|
12811
|
+
}
|
|
12812
|
+
}
|
|
12813
|
+
);
|
|
12814
|
+
};
|
|
12815
|
+
const schema$2 = objectType({
|
|
12816
|
+
sales_channel_id: stringType().min(1)
|
|
12817
|
+
});
|
|
12818
|
+
const ShippingAddress = () => {
|
|
12975
12819
|
const { id } = useParams();
|
|
12976
12820
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12977
|
-
fields: "+
|
|
12821
|
+
fields: "+shipping_address"
|
|
12978
12822
|
});
|
|
12979
12823
|
if (isError) {
|
|
12980
12824
|
throw error;
|
|
@@ -12982,24 +12826,47 @@ const Email = () => {
|
|
|
12982
12826
|
const isReady = !isPending && !!order;
|
|
12983
12827
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12984
12828
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12985
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
12986
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
12829
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12830
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12987
12831
|
] }),
|
|
12988
|
-
isReady && /* @__PURE__ */ jsx(
|
|
12832
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12989
12833
|
] });
|
|
12990
12834
|
};
|
|
12991
|
-
const
|
|
12835
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12836
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12992
12837
|
const form = useForm({
|
|
12993
12838
|
defaultValues: {
|
|
12994
|
-
|
|
12839
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12840
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12841
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12842
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12843
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12844
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12845
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12846
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12847
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12848
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12995
12849
|
},
|
|
12996
|
-
resolver: zodResolver(schema)
|
|
12850
|
+
resolver: zodResolver(schema$1)
|
|
12997
12851
|
});
|
|
12998
12852
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12999
12853
|
const { handleSuccess } = useRouteModal();
|
|
13000
12854
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
13001
12855
|
await mutateAsync(
|
|
13002
|
-
{
|
|
12856
|
+
{
|
|
12857
|
+
shipping_address: {
|
|
12858
|
+
first_name: data.first_name,
|
|
12859
|
+
last_name: data.last_name,
|
|
12860
|
+
company: data.company,
|
|
12861
|
+
address_1: data.address_1,
|
|
12862
|
+
address_2: data.address_2,
|
|
12863
|
+
city: data.city,
|
|
12864
|
+
province: data.province,
|
|
12865
|
+
country_code: data.country_code,
|
|
12866
|
+
postal_code: data.postal_code,
|
|
12867
|
+
phone: data.phone
|
|
12868
|
+
}
|
|
12869
|
+
},
|
|
13003
12870
|
{
|
|
13004
12871
|
onSuccess: () => {
|
|
13005
12872
|
handleSuccess();
|
|
@@ -13016,18 +12883,132 @@ const EmailForm = ({ order }) => {
|
|
|
13016
12883
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
13017
12884
|
onSubmit,
|
|
13018
12885
|
children: [
|
|
13019
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
/* @__PURE__ */
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
|
|
12886
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
12887
|
+
/* @__PURE__ */ jsx(
|
|
12888
|
+
Form$2.Field,
|
|
12889
|
+
{
|
|
12890
|
+
control: form.control,
|
|
12891
|
+
name: "country_code",
|
|
12892
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12893
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12894
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12895
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12896
|
+
] })
|
|
12897
|
+
}
|
|
12898
|
+
),
|
|
12899
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12900
|
+
/* @__PURE__ */ jsx(
|
|
12901
|
+
Form$2.Field,
|
|
12902
|
+
{
|
|
12903
|
+
control: form.control,
|
|
12904
|
+
name: "first_name",
|
|
12905
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12906
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12907
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12908
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12909
|
+
] })
|
|
12910
|
+
}
|
|
12911
|
+
),
|
|
12912
|
+
/* @__PURE__ */ jsx(
|
|
12913
|
+
Form$2.Field,
|
|
12914
|
+
{
|
|
12915
|
+
control: form.control,
|
|
12916
|
+
name: "last_name",
|
|
12917
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12918
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12919
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12920
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12921
|
+
] })
|
|
12922
|
+
}
|
|
12923
|
+
)
|
|
12924
|
+
] }),
|
|
12925
|
+
/* @__PURE__ */ jsx(
|
|
12926
|
+
Form$2.Field,
|
|
12927
|
+
{
|
|
12928
|
+
control: form.control,
|
|
12929
|
+
name: "company",
|
|
12930
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12931
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12932
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12933
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12934
|
+
] })
|
|
12935
|
+
}
|
|
12936
|
+
),
|
|
12937
|
+
/* @__PURE__ */ jsx(
|
|
12938
|
+
Form$2.Field,
|
|
12939
|
+
{
|
|
12940
|
+
control: form.control,
|
|
12941
|
+
name: "address_1",
|
|
12942
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12943
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12944
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12945
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12946
|
+
] })
|
|
12947
|
+
}
|
|
12948
|
+
),
|
|
12949
|
+
/* @__PURE__ */ jsx(
|
|
12950
|
+
Form$2.Field,
|
|
12951
|
+
{
|
|
12952
|
+
control: form.control,
|
|
12953
|
+
name: "address_2",
|
|
12954
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12955
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12956
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12957
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12958
|
+
] })
|
|
12959
|
+
}
|
|
12960
|
+
),
|
|
12961
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12962
|
+
/* @__PURE__ */ jsx(
|
|
12963
|
+
Form$2.Field,
|
|
12964
|
+
{
|
|
12965
|
+
control: form.control,
|
|
12966
|
+
name: "postal_code",
|
|
12967
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12968
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12969
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12970
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12971
|
+
] })
|
|
12972
|
+
}
|
|
12973
|
+
),
|
|
12974
|
+
/* @__PURE__ */ jsx(
|
|
12975
|
+
Form$2.Field,
|
|
12976
|
+
{
|
|
12977
|
+
control: form.control,
|
|
12978
|
+
name: "city",
|
|
12979
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12980
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12981
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12982
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12983
|
+
] })
|
|
12984
|
+
}
|
|
12985
|
+
)
|
|
12986
|
+
] }),
|
|
12987
|
+
/* @__PURE__ */ jsx(
|
|
12988
|
+
Form$2.Field,
|
|
12989
|
+
{
|
|
12990
|
+
control: form.control,
|
|
12991
|
+
name: "province",
|
|
12992
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12993
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12994
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12995
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12996
|
+
] })
|
|
12997
|
+
}
|
|
12998
|
+
),
|
|
12999
|
+
/* @__PURE__ */ jsx(
|
|
13000
|
+
Form$2.Field,
|
|
13001
|
+
{
|
|
13002
|
+
control: form.control,
|
|
13003
|
+
name: "phone",
|
|
13004
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13005
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13006
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13007
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13008
|
+
] })
|
|
13009
|
+
}
|
|
13010
|
+
)
|
|
13011
|
+
] }) }),
|
|
13031
13012
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13032
13013
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13033
13014
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -13036,6 +13017,25 @@ const EmailForm = ({ order }) => {
|
|
|
13036
13017
|
}
|
|
13037
13018
|
) });
|
|
13038
13019
|
};
|
|
13020
|
+
const schema$1 = addressSchema;
|
|
13021
|
+
const CustomItems = () => {
|
|
13022
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
13023
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
13024
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
13025
|
+
] });
|
|
13026
|
+
};
|
|
13027
|
+
const CustomItemsForm = () => {
|
|
13028
|
+
const form = useForm({
|
|
13029
|
+
resolver: zodResolver(schema)
|
|
13030
|
+
});
|
|
13031
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
13032
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
13033
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13034
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13035
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
13036
|
+
] }) })
|
|
13037
|
+
] }) });
|
|
13038
|
+
};
|
|
13039
13039
|
const schema = objectType({
|
|
13040
13040
|
email: stringType().email()
|
|
13041
13041
|
});
|
|
@@ -13064,8 +13064,8 @@ const routeModule = {
|
|
|
13064
13064
|
path: "/draft-orders/:id/billing-address"
|
|
13065
13065
|
},
|
|
13066
13066
|
{
|
|
13067
|
-
Component:
|
|
13068
|
-
path: "/draft-orders/:id/
|
|
13067
|
+
Component: Email,
|
|
13068
|
+
path: "/draft-orders/:id/email"
|
|
13069
13069
|
},
|
|
13070
13070
|
{
|
|
13071
13071
|
Component: Items,
|
|
@@ -13079,25 +13079,25 @@ const routeModule = {
|
|
|
13079
13079
|
Component: Promotions,
|
|
13080
13080
|
path: "/draft-orders/:id/promotions"
|
|
13081
13081
|
},
|
|
13082
|
-
{
|
|
13083
|
-
Component: SalesChannel,
|
|
13084
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13085
|
-
},
|
|
13086
13082
|
{
|
|
13087
13083
|
Component: Shipping,
|
|
13088
13084
|
path: "/draft-orders/:id/shipping"
|
|
13089
13085
|
},
|
|
13090
|
-
{
|
|
13091
|
-
Component: ShippingAddress,
|
|
13092
|
-
path: "/draft-orders/:id/shipping-address"
|
|
13093
|
-
},
|
|
13094
13086
|
{
|
|
13095
13087
|
Component: TransferOwnership,
|
|
13096
13088
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
13089
|
},
|
|
13098
13090
|
{
|
|
13099
|
-
Component:
|
|
13100
|
-
path: "/draft-orders/:id/
|
|
13091
|
+
Component: SalesChannel,
|
|
13092
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13093
|
+
},
|
|
13094
|
+
{
|
|
13095
|
+
Component: ShippingAddress,
|
|
13096
|
+
path: "/draft-orders/:id/shipping-address"
|
|
13097
|
+
},
|
|
13098
|
+
{
|
|
13099
|
+
Component: CustomItems,
|
|
13100
|
+
path: "/draft-orders/:id/custom-items"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|