@medusajs/draft-order 2.10.2-preview-20250905090156 → 2.10.2-preview-20250905150153
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 +347 -347
- package/.medusa/server/src/admin/index.mjs +347 -347
- package/package.json +16 -16
|
@@ -9567,10 +9567,10 @@ const ID = () => {
|
|
|
9567
9567
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9568
9568
|
] });
|
|
9569
9569
|
};
|
|
9570
|
-
const
|
|
9570
|
+
const Email = () => {
|
|
9571
9571
|
const { id } = useParams();
|
|
9572
9572
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9573
|
-
fields: "+
|
|
9573
|
+
fields: "+email"
|
|
9574
9574
|
});
|
|
9575
9575
|
if (isError) {
|
|
9576
9576
|
throw error;
|
|
@@ -9578,26 +9578,16 @@ const BillingAddress = () => {
|
|
|
9578
9578
|
const isReady = !isPending && !!order;
|
|
9579
9579
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9580
9580
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9581
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
9582
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
9581
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9582
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9583
9583
|
] }),
|
|
9584
|
-
isReady && /* @__PURE__ */ jsx(
|
|
9584
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9585
9585
|
] });
|
|
9586
9586
|
};
|
|
9587
|
-
const
|
|
9588
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9587
|
+
const EmailForm = ({ order }) => {
|
|
9589
9588
|
const form = useForm({
|
|
9590
9589
|
defaultValues: {
|
|
9591
|
-
|
|
9592
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9593
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9594
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9595
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9596
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9597
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9598
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9599
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9600
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9590
|
+
email: order.email ?? ""
|
|
9601
9591
|
},
|
|
9602
9592
|
resolver: zodResolver(schema$5)
|
|
9603
9593
|
});
|
|
@@ -9605,7 +9595,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9605
9595
|
const { handleSuccess } = useRouteModal();
|
|
9606
9596
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
9607
9597
|
await mutateAsync(
|
|
9608
|
-
{
|
|
9598
|
+
{ email: data.email },
|
|
9609
9599
|
{
|
|
9610
9600
|
onSuccess: () => {
|
|
9611
9601
|
handleSuccess();
|
|
@@ -9622,132 +9612,18 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9622
9612
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9623
9613
|
onSubmit,
|
|
9624
9614
|
children: [
|
|
9625
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
),
|
|
9638
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9639
|
-
/* @__PURE__ */ jsx(
|
|
9640
|
-
Form$2.Field,
|
|
9641
|
-
{
|
|
9642
|
-
control: form.control,
|
|
9643
|
-
name: "first_name",
|
|
9644
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9645
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9646
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9647
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9648
|
-
] })
|
|
9649
|
-
}
|
|
9650
|
-
),
|
|
9651
|
-
/* @__PURE__ */ jsx(
|
|
9652
|
-
Form$2.Field,
|
|
9653
|
-
{
|
|
9654
|
-
control: form.control,
|
|
9655
|
-
name: "last_name",
|
|
9656
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9657
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9658
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9659
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9660
|
-
] })
|
|
9661
|
-
}
|
|
9662
|
-
)
|
|
9663
|
-
] }),
|
|
9664
|
-
/* @__PURE__ */ jsx(
|
|
9665
|
-
Form$2.Field,
|
|
9666
|
-
{
|
|
9667
|
-
control: form.control,
|
|
9668
|
-
name: "company",
|
|
9669
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9670
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9671
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9672
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9673
|
-
] })
|
|
9674
|
-
}
|
|
9675
|
-
),
|
|
9676
|
-
/* @__PURE__ */ jsx(
|
|
9677
|
-
Form$2.Field,
|
|
9678
|
-
{
|
|
9679
|
-
control: form.control,
|
|
9680
|
-
name: "address_1",
|
|
9681
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9682
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9683
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9684
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9685
|
-
] })
|
|
9686
|
-
}
|
|
9687
|
-
),
|
|
9688
|
-
/* @__PURE__ */ jsx(
|
|
9689
|
-
Form$2.Field,
|
|
9690
|
-
{
|
|
9691
|
-
control: form.control,
|
|
9692
|
-
name: "address_2",
|
|
9693
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9694
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9695
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9696
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9697
|
-
] })
|
|
9698
|
-
}
|
|
9699
|
-
),
|
|
9700
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9701
|
-
/* @__PURE__ */ jsx(
|
|
9702
|
-
Form$2.Field,
|
|
9703
|
-
{
|
|
9704
|
-
control: form.control,
|
|
9705
|
-
name: "postal_code",
|
|
9706
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9707
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9708
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9709
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9710
|
-
] })
|
|
9711
|
-
}
|
|
9712
|
-
),
|
|
9713
|
-
/* @__PURE__ */ jsx(
|
|
9714
|
-
Form$2.Field,
|
|
9715
|
-
{
|
|
9716
|
-
control: form.control,
|
|
9717
|
-
name: "city",
|
|
9718
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9719
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9720
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9721
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9722
|
-
] })
|
|
9723
|
-
}
|
|
9724
|
-
)
|
|
9725
|
-
] }),
|
|
9726
|
-
/* @__PURE__ */ jsx(
|
|
9727
|
-
Form$2.Field,
|
|
9728
|
-
{
|
|
9729
|
-
control: form.control,
|
|
9730
|
-
name: "province",
|
|
9731
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9732
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9733
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9734
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9735
|
-
] })
|
|
9736
|
-
}
|
|
9737
|
-
),
|
|
9738
|
-
/* @__PURE__ */ jsx(
|
|
9739
|
-
Form$2.Field,
|
|
9740
|
-
{
|
|
9741
|
-
control: form.control,
|
|
9742
|
-
name: "phone",
|
|
9743
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9744
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9745
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9746
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9747
|
-
] })
|
|
9748
|
-
}
|
|
9749
|
-
)
|
|
9750
|
-
] }) }),
|
|
9615
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9616
|
+
Form$2.Field,
|
|
9617
|
+
{
|
|
9618
|
+
control: form.control,
|
|
9619
|
+
name: "email",
|
|
9620
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9621
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9622
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9623
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9624
|
+
] })
|
|
9625
|
+
}
|
|
9626
|
+
) }),
|
|
9751
9627
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9752
9628
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9753
9629
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -9756,26 +9632,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9756
9632
|
}
|
|
9757
9633
|
) });
|
|
9758
9634
|
};
|
|
9759
|
-
const schema$5 =
|
|
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({
|
|
9635
|
+
const schema$5 = objectType({
|
|
9779
9636
|
email: stringType().email()
|
|
9780
9637
|
});
|
|
9781
9638
|
const NumberInput = forwardRef(
|
|
@@ -11379,157 +11236,51 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11379
11236
|
}
|
|
11380
11237
|
return Array.from(promotionIds);
|
|
11381
11238
|
}
|
|
11382
|
-
const
|
|
11239
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11240
|
+
const Shipping = () => {
|
|
11241
|
+
var _a;
|
|
11383
11242
|
const { id } = useParams();
|
|
11384
|
-
const {
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
);
|
|
11243
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11244
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11245
|
+
});
|
|
11246
|
+
const {
|
|
11247
|
+
order: preview,
|
|
11248
|
+
isPending: isPreviewPending,
|
|
11249
|
+
isError: isPreviewError,
|
|
11250
|
+
error: previewError
|
|
11251
|
+
} = useOrderPreview(id);
|
|
11252
|
+
useInitiateOrderEdit({ preview });
|
|
11253
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11393
11254
|
if (isError) {
|
|
11394
11255
|
throw error;
|
|
11395
11256
|
}
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11257
|
+
if (isPreviewError) {
|
|
11258
|
+
throw previewError;
|
|
11259
|
+
}
|
|
11260
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11261
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11262
|
+
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11263
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
11264
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
11265
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11266
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11267
|
+
] }) }) }),
|
|
11268
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11269
|
+
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
11270
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11271
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11272
|
+
] }) });
|
|
11404
11273
|
};
|
|
11405
|
-
const
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
}
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
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
|
-
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11489
|
-
const Shipping = () => {
|
|
11490
|
-
var _a;
|
|
11491
|
-
const { id } = useParams();
|
|
11492
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11493
|
-
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11494
|
-
});
|
|
11495
|
-
const {
|
|
11496
|
-
order: preview,
|
|
11497
|
-
isPending: isPreviewPending,
|
|
11498
|
-
isError: isPreviewError,
|
|
11499
|
-
error: previewError
|
|
11500
|
-
} = useOrderPreview(id);
|
|
11501
|
-
useInitiateOrderEdit({ preview });
|
|
11502
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11503
|
-
if (isError) {
|
|
11504
|
-
throw error;
|
|
11505
|
-
}
|
|
11506
|
-
if (isPreviewError) {
|
|
11507
|
-
throw previewError;
|
|
11508
|
-
}
|
|
11509
|
-
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11510
|
-
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11511
|
-
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11512
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
11513
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
11514
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11515
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11516
|
-
] }) }) }),
|
|
11517
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11518
|
-
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
11519
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11520
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11521
|
-
] }) });
|
|
11522
|
-
};
|
|
11523
|
-
const ShippingForm = ({ preview, order }) => {
|
|
11524
|
-
var _a;
|
|
11525
|
-
const { setIsOpen } = useStackedModal();
|
|
11526
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11527
|
-
const [data, setData] = useState(null);
|
|
11528
|
-
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11529
|
-
const { shipping_options } = useShippingOptions(
|
|
11530
|
-
{
|
|
11531
|
-
id: appliedShippingOptionIds,
|
|
11532
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11274
|
+
const ShippingForm = ({ preview, order }) => {
|
|
11275
|
+
var _a;
|
|
11276
|
+
const { setIsOpen } = useStackedModal();
|
|
11277
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11278
|
+
const [data, setData] = useState(null);
|
|
11279
|
+
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11280
|
+
const { shipping_options } = useShippingOptions(
|
|
11281
|
+
{
|
|
11282
|
+
id: appliedShippingOptionIds,
|
|
11283
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11533
11284
|
},
|
|
11534
11285
|
{
|
|
11535
11286
|
enabled: appliedShippingOptionIds.length > 0
|
|
@@ -12292,6 +12043,112 @@ const CustomAmountField = ({
|
|
|
12292
12043
|
}
|
|
12293
12044
|
);
|
|
12294
12045
|
};
|
|
12046
|
+
const SalesChannel = () => {
|
|
12047
|
+
const { id } = useParams();
|
|
12048
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12049
|
+
id,
|
|
12050
|
+
{
|
|
12051
|
+
fields: "+sales_channel_id"
|
|
12052
|
+
},
|
|
12053
|
+
{
|
|
12054
|
+
enabled: !!id
|
|
12055
|
+
}
|
|
12056
|
+
);
|
|
12057
|
+
if (isError) {
|
|
12058
|
+
throw error;
|
|
12059
|
+
}
|
|
12060
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12061
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12062
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12063
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12064
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12065
|
+
] }),
|
|
12066
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12067
|
+
] });
|
|
12068
|
+
};
|
|
12069
|
+
const SalesChannelForm = ({ order }) => {
|
|
12070
|
+
const form = useForm({
|
|
12071
|
+
defaultValues: {
|
|
12072
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12073
|
+
},
|
|
12074
|
+
resolver: zodResolver(schema$4)
|
|
12075
|
+
});
|
|
12076
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12077
|
+
const { handleSuccess } = useRouteModal();
|
|
12078
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12079
|
+
await mutateAsync(
|
|
12080
|
+
{
|
|
12081
|
+
sales_channel_id: data.sales_channel_id
|
|
12082
|
+
},
|
|
12083
|
+
{
|
|
12084
|
+
onSuccess: () => {
|
|
12085
|
+
toast.success("Sales channel updated");
|
|
12086
|
+
handleSuccess();
|
|
12087
|
+
},
|
|
12088
|
+
onError: (error) => {
|
|
12089
|
+
toast.error(error.message);
|
|
12090
|
+
}
|
|
12091
|
+
}
|
|
12092
|
+
);
|
|
12093
|
+
});
|
|
12094
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12095
|
+
KeyboundForm,
|
|
12096
|
+
{
|
|
12097
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12098
|
+
onSubmit,
|
|
12099
|
+
children: [
|
|
12100
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12101
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12102
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12103
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12104
|
+
] }) })
|
|
12105
|
+
]
|
|
12106
|
+
}
|
|
12107
|
+
) });
|
|
12108
|
+
};
|
|
12109
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12110
|
+
const salesChannels = useComboboxData({
|
|
12111
|
+
queryFn: async (params) => {
|
|
12112
|
+
return await sdk.admin.salesChannel.list(params);
|
|
12113
|
+
},
|
|
12114
|
+
queryKey: ["sales-channels"],
|
|
12115
|
+
getOptions: (data) => {
|
|
12116
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
12117
|
+
label: salesChannel.name,
|
|
12118
|
+
value: salesChannel.id
|
|
12119
|
+
}));
|
|
12120
|
+
},
|
|
12121
|
+
defaultValue: order.sales_channel_id || void 0
|
|
12122
|
+
});
|
|
12123
|
+
return /* @__PURE__ */ jsx(
|
|
12124
|
+
Form$2.Field,
|
|
12125
|
+
{
|
|
12126
|
+
control,
|
|
12127
|
+
name: "sales_channel_id",
|
|
12128
|
+
render: ({ field }) => {
|
|
12129
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12130
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12131
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
12132
|
+
Combobox,
|
|
12133
|
+
{
|
|
12134
|
+
options: salesChannels.options,
|
|
12135
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
12136
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12137
|
+
searchValue: salesChannels.searchValue,
|
|
12138
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12139
|
+
placeholder: "Select sales channel",
|
|
12140
|
+
...field
|
|
12141
|
+
}
|
|
12142
|
+
) }),
|
|
12143
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12144
|
+
] });
|
|
12145
|
+
}
|
|
12146
|
+
}
|
|
12147
|
+
);
|
|
12148
|
+
};
|
|
12149
|
+
const schema$4 = objectType({
|
|
12150
|
+
sales_channel_id: stringType().min(1)
|
|
12151
|
+
});
|
|
12295
12152
|
const ShippingAddress = () => {
|
|
12296
12153
|
const { id } = useParams();
|
|
12297
12154
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12324,7 +12181,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12324
12181
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12325
12182
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12326
12183
|
},
|
|
12327
|
-
resolver: zodResolver(schema$
|
|
12184
|
+
resolver: zodResolver(schema$3)
|
|
12328
12185
|
});
|
|
12329
12186
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12330
12187
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12494,7 +12351,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12494
12351
|
}
|
|
12495
12352
|
) });
|
|
12496
12353
|
};
|
|
12497
|
-
const schema$
|
|
12354
|
+
const schema$3 = addressSchema;
|
|
12498
12355
|
const TransferOwnership = () => {
|
|
12499
12356
|
const { id } = useParams();
|
|
12500
12357
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12518,7 +12375,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12518
12375
|
defaultValues: {
|
|
12519
12376
|
customer_id: order.customer_id || ""
|
|
12520
12377
|
},
|
|
12521
|
-
resolver: zodResolver(schema$
|
|
12378
|
+
resolver: zodResolver(schema$2)
|
|
12522
12379
|
});
|
|
12523
12380
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12524
12381
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12968,13 +12825,13 @@ const Illustration = () => {
|
|
|
12968
12825
|
}
|
|
12969
12826
|
);
|
|
12970
12827
|
};
|
|
12971
|
-
const schema$
|
|
12828
|
+
const schema$2 = objectType({
|
|
12972
12829
|
customer_id: stringType().min(1)
|
|
12973
12830
|
});
|
|
12974
|
-
const
|
|
12831
|
+
const BillingAddress = () => {
|
|
12975
12832
|
const { id } = useParams();
|
|
12976
12833
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12977
|
-
fields: "+
|
|
12834
|
+
fields: "+billing_address"
|
|
12978
12835
|
});
|
|
12979
12836
|
if (isError) {
|
|
12980
12837
|
throw error;
|
|
@@ -12982,24 +12839,34 @@ const Email = () => {
|
|
|
12982
12839
|
const isReady = !isPending && !!order;
|
|
12983
12840
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12984
12841
|
/* @__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
|
|
12842
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
12843
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12987
12844
|
] }),
|
|
12988
|
-
isReady && /* @__PURE__ */ jsx(
|
|
12845
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
12989
12846
|
] });
|
|
12990
12847
|
};
|
|
12991
|
-
const
|
|
12848
|
+
const BillingAddressForm = ({ order }) => {
|
|
12849
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12992
12850
|
const form = useForm({
|
|
12993
12851
|
defaultValues: {
|
|
12994
|
-
|
|
12852
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12853
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12854
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12855
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12856
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12857
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12858
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12859
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12860
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12861
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12995
12862
|
},
|
|
12996
|
-
resolver: zodResolver(schema)
|
|
12863
|
+
resolver: zodResolver(schema$1)
|
|
12997
12864
|
});
|
|
12998
12865
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12999
12866
|
const { handleSuccess } = useRouteModal();
|
|
13000
12867
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
13001
12868
|
await mutateAsync(
|
|
13002
|
-
{
|
|
12869
|
+
{ billing_address: data },
|
|
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
|
});
|
|
@@ -13060,12 +13060,8 @@ const routeModule = {
|
|
|
13060
13060
|
loader,
|
|
13061
13061
|
children: [
|
|
13062
13062
|
{
|
|
13063
|
-
Component:
|
|
13064
|
-
path: "/draft-orders/:id/
|
|
13065
|
-
},
|
|
13066
|
-
{
|
|
13067
|
-
Component: CustomItems,
|
|
13068
|
-
path: "/draft-orders/:id/custom-items"
|
|
13063
|
+
Component: Email,
|
|
13064
|
+
path: "/draft-orders/:id/email"
|
|
13069
13065
|
},
|
|
13070
13066
|
{
|
|
13071
13067
|
Component: Items,
|
|
@@ -13079,14 +13075,14 @@ const routeModule = {
|
|
|
13079
13075
|
Component: Promotions,
|
|
13080
13076
|
path: "/draft-orders/:id/promotions"
|
|
13081
13077
|
},
|
|
13082
|
-
{
|
|
13083
|
-
Component: SalesChannel,
|
|
13084
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13085
|
-
},
|
|
13086
13078
|
{
|
|
13087
13079
|
Component: Shipping,
|
|
13088
13080
|
path: "/draft-orders/:id/shipping"
|
|
13089
13081
|
},
|
|
13082
|
+
{
|
|
13083
|
+
Component: SalesChannel,
|
|
13084
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13085
|
+
},
|
|
13090
13086
|
{
|
|
13091
13087
|
Component: ShippingAddress,
|
|
13092
13088
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -13096,8 +13092,12 @@ const routeModule = {
|
|
|
13096
13092
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
13093
|
},
|
|
13098
13094
|
{
|
|
13099
|
-
Component:
|
|
13100
|
-
path: "/draft-orders/:id/
|
|
13095
|
+
Component: BillingAddress,
|
|
13096
|
+
path: "/draft-orders/:id/billing-address"
|
|
13097
|
+
},
|
|
13098
|
+
{
|
|
13099
|
+
Component: CustomItems,
|
|
13100
|
+
path: "/draft-orders/:id/custom-items"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|