@medusajs/draft-order 2.11.2-preview-20251026210155 → 2.11.2-preview-20251027000324
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 +351 -351
- package/.medusa/server/src/admin/index.mjs +351 -351
- package/package.json +16 -16
|
@@ -9565,10 +9565,10 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
-
const
|
|
9568
|
+
const BillingAddress = () => {
|
|
9569
9569
|
const { id } = useParams();
|
|
9570
9570
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9571
|
-
fields: "+
|
|
9571
|
+
fields: "+billing_address"
|
|
9572
9572
|
});
|
|
9573
9573
|
if (isError) {
|
|
9574
9574
|
throw error;
|
|
@@ -9576,16 +9576,26 @@ const Email = () => {
|
|
|
9576
9576
|
const isReady = !isPending && !!order;
|
|
9577
9577
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9578
9578
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9579
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
9580
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
9579
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9580
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9581
9581
|
] }),
|
|
9582
|
-
isReady && /* @__PURE__ */ jsx(
|
|
9582
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9583
9583
|
] });
|
|
9584
9584
|
};
|
|
9585
|
-
const
|
|
9585
|
+
const BillingAddressForm = ({ order }) => {
|
|
9586
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9586
9587
|
const form = useForm({
|
|
9587
9588
|
defaultValues: {
|
|
9588
|
-
|
|
9589
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9590
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9591
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9592
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9593
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9594
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9595
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9596
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9597
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9589
9599
|
},
|
|
9590
9600
|
resolver: zodResolver(schema$5)
|
|
9591
9601
|
});
|
|
@@ -9593,7 +9603,7 @@ const EmailForm = ({ order }) => {
|
|
|
9593
9603
|
const { handleSuccess } = useRouteModal();
|
|
9594
9604
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
9595
9605
|
await mutateAsync(
|
|
9596
|
-
{
|
|
9606
|
+
{ billing_address: data },
|
|
9597
9607
|
{
|
|
9598
9608
|
onSuccess: () => {
|
|
9599
9609
|
handleSuccess();
|
|
@@ -9610,18 +9620,132 @@ const EmailForm = ({ order }) => {
|
|
|
9610
9620
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9611
9621
|
onSubmit,
|
|
9612
9622
|
children: [
|
|
9613
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
/* @__PURE__ */
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9623
|
+
/* @__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: [
|
|
9624
|
+
/* @__PURE__ */ jsx(
|
|
9625
|
+
Form$2.Field,
|
|
9626
|
+
{
|
|
9627
|
+
control: form.control,
|
|
9628
|
+
name: "country_code",
|
|
9629
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9630
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9631
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9632
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9633
|
+
] })
|
|
9634
|
+
}
|
|
9635
|
+
),
|
|
9636
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9637
|
+
/* @__PURE__ */ jsx(
|
|
9638
|
+
Form$2.Field,
|
|
9639
|
+
{
|
|
9640
|
+
control: form.control,
|
|
9641
|
+
name: "first_name",
|
|
9642
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9643
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9644
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9645
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9646
|
+
] })
|
|
9647
|
+
}
|
|
9648
|
+
),
|
|
9649
|
+
/* @__PURE__ */ jsx(
|
|
9650
|
+
Form$2.Field,
|
|
9651
|
+
{
|
|
9652
|
+
control: form.control,
|
|
9653
|
+
name: "last_name",
|
|
9654
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9655
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9656
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9657
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9658
|
+
] })
|
|
9659
|
+
}
|
|
9660
|
+
)
|
|
9661
|
+
] }),
|
|
9662
|
+
/* @__PURE__ */ jsx(
|
|
9663
|
+
Form$2.Field,
|
|
9664
|
+
{
|
|
9665
|
+
control: form.control,
|
|
9666
|
+
name: "company",
|
|
9667
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9668
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9669
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9670
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9671
|
+
] })
|
|
9672
|
+
}
|
|
9673
|
+
),
|
|
9674
|
+
/* @__PURE__ */ jsx(
|
|
9675
|
+
Form$2.Field,
|
|
9676
|
+
{
|
|
9677
|
+
control: form.control,
|
|
9678
|
+
name: "address_1",
|
|
9679
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9680
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9681
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9682
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9683
|
+
] })
|
|
9684
|
+
}
|
|
9685
|
+
),
|
|
9686
|
+
/* @__PURE__ */ jsx(
|
|
9687
|
+
Form$2.Field,
|
|
9688
|
+
{
|
|
9689
|
+
control: form.control,
|
|
9690
|
+
name: "address_2",
|
|
9691
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9692
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9693
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9694
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9695
|
+
] })
|
|
9696
|
+
}
|
|
9697
|
+
),
|
|
9698
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9699
|
+
/* @__PURE__ */ jsx(
|
|
9700
|
+
Form$2.Field,
|
|
9701
|
+
{
|
|
9702
|
+
control: form.control,
|
|
9703
|
+
name: "postal_code",
|
|
9704
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9705
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9706
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9707
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9708
|
+
] })
|
|
9709
|
+
}
|
|
9710
|
+
),
|
|
9711
|
+
/* @__PURE__ */ jsx(
|
|
9712
|
+
Form$2.Field,
|
|
9713
|
+
{
|
|
9714
|
+
control: form.control,
|
|
9715
|
+
name: "city",
|
|
9716
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9717
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9718
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9719
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9720
|
+
] })
|
|
9721
|
+
}
|
|
9722
|
+
)
|
|
9723
|
+
] }),
|
|
9724
|
+
/* @__PURE__ */ jsx(
|
|
9725
|
+
Form$2.Field,
|
|
9726
|
+
{
|
|
9727
|
+
control: form.control,
|
|
9728
|
+
name: "province",
|
|
9729
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9730
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9731
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9732
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9733
|
+
] })
|
|
9734
|
+
}
|
|
9735
|
+
),
|
|
9736
|
+
/* @__PURE__ */ jsx(
|
|
9737
|
+
Form$2.Field,
|
|
9738
|
+
{
|
|
9739
|
+
control: form.control,
|
|
9740
|
+
name: "phone",
|
|
9741
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9742
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9743
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9744
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9745
|
+
] })
|
|
9746
|
+
}
|
|
9747
|
+
)
|
|
9748
|
+
] }) }),
|
|
9625
9749
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9626
9750
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9627
9751
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -9630,30 +9754,7 @@ const EmailForm = ({ order }) => {
|
|
|
9630
9754
|
}
|
|
9631
9755
|
) });
|
|
9632
9756
|
};
|
|
9633
|
-
const schema$5 =
|
|
9634
|
-
email: stringType().email()
|
|
9635
|
-
});
|
|
9636
|
-
const CustomItems = () => {
|
|
9637
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9638
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9639
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9640
|
-
] });
|
|
9641
|
-
};
|
|
9642
|
-
const CustomItemsForm = () => {
|
|
9643
|
-
const form = useForm({
|
|
9644
|
-
resolver: zodResolver(schema$4)
|
|
9645
|
-
});
|
|
9646
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9647
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9648
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9649
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9650
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9651
|
-
] }) })
|
|
9652
|
-
] }) });
|
|
9653
|
-
};
|
|
9654
|
-
const schema$4 = objectType({
|
|
9655
|
-
email: stringType().email()
|
|
9656
|
-
});
|
|
9757
|
+
const schema$5 = addressSchema;
|
|
9657
9758
|
const NumberInput = forwardRef(
|
|
9658
9759
|
({
|
|
9659
9760
|
value,
|
|
@@ -11255,157 +11356,51 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11255
11356
|
}
|
|
11256
11357
|
return Array.from(promotionIds);
|
|
11257
11358
|
}
|
|
11258
|
-
const
|
|
11359
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11360
|
+
const Shipping = () => {
|
|
11361
|
+
var _a;
|
|
11259
11362
|
const { id } = useParams();
|
|
11260
|
-
const {
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
);
|
|
11363
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11364
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11365
|
+
});
|
|
11366
|
+
const {
|
|
11367
|
+
order: preview,
|
|
11368
|
+
isPending: isPreviewPending,
|
|
11369
|
+
isError: isPreviewError,
|
|
11370
|
+
error: previewError
|
|
11371
|
+
} = useOrderPreview(id);
|
|
11372
|
+
useInitiateOrderEdit({ preview });
|
|
11373
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11269
11374
|
if (isError) {
|
|
11270
11375
|
throw error;
|
|
11271
11376
|
}
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
|
|
11377
|
+
if (isPreviewError) {
|
|
11378
|
+
throw previewError;
|
|
11379
|
+
}
|
|
11380
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11381
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11382
|
+
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11383
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
11384
|
+
/* @__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: [
|
|
11385
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11386
|
+
/* @__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." }) })
|
|
11387
|
+
] }) }) }),
|
|
11388
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11389
|
+
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
11390
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11391
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11392
|
+
] }) });
|
|
11280
11393
|
};
|
|
11281
|
-
const
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
}
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
await mutateAsync(
|
|
11292
|
-
{
|
|
11293
|
-
sales_channel_id: data.sales_channel_id
|
|
11294
|
-
},
|
|
11295
|
-
{
|
|
11296
|
-
onSuccess: () => {
|
|
11297
|
-
toast.success("Sales channel updated");
|
|
11298
|
-
handleSuccess();
|
|
11299
|
-
},
|
|
11300
|
-
onError: (error) => {
|
|
11301
|
-
toast.error(error.message);
|
|
11302
|
-
}
|
|
11303
|
-
}
|
|
11304
|
-
);
|
|
11305
|
-
});
|
|
11306
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11307
|
-
KeyboundForm,
|
|
11308
|
-
{
|
|
11309
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11310
|
-
onSubmit,
|
|
11311
|
-
children: [
|
|
11312
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11313
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11314
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11315
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11316
|
-
] }) })
|
|
11317
|
-
]
|
|
11318
|
-
}
|
|
11319
|
-
) });
|
|
11320
|
-
};
|
|
11321
|
-
const SalesChannelField = ({ control, order }) => {
|
|
11322
|
-
const salesChannels = useComboboxData({
|
|
11323
|
-
queryFn: async (params) => {
|
|
11324
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11325
|
-
},
|
|
11326
|
-
queryKey: ["sales-channels"],
|
|
11327
|
-
getOptions: (data) => {
|
|
11328
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11329
|
-
label: salesChannel.name,
|
|
11330
|
-
value: salesChannel.id
|
|
11331
|
-
}));
|
|
11332
|
-
},
|
|
11333
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11334
|
-
});
|
|
11335
|
-
return /* @__PURE__ */ jsx(
|
|
11336
|
-
Form$2.Field,
|
|
11337
|
-
{
|
|
11338
|
-
control,
|
|
11339
|
-
name: "sales_channel_id",
|
|
11340
|
-
render: ({ field }) => {
|
|
11341
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11342
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11343
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11344
|
-
Combobox,
|
|
11345
|
-
{
|
|
11346
|
-
options: salesChannels.options,
|
|
11347
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11348
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11349
|
-
searchValue: salesChannels.searchValue,
|
|
11350
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11351
|
-
placeholder: "Select sales channel",
|
|
11352
|
-
...field
|
|
11353
|
-
}
|
|
11354
|
-
) }),
|
|
11355
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11356
|
-
] });
|
|
11357
|
-
}
|
|
11358
|
-
}
|
|
11359
|
-
);
|
|
11360
|
-
};
|
|
11361
|
-
const schema$3 = objectType({
|
|
11362
|
-
sales_channel_id: stringType().min(1)
|
|
11363
|
-
});
|
|
11364
|
-
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11365
|
-
const Shipping = () => {
|
|
11366
|
-
var _a;
|
|
11367
|
-
const { id } = useParams();
|
|
11368
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11369
|
-
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11370
|
-
});
|
|
11371
|
-
const {
|
|
11372
|
-
order: preview,
|
|
11373
|
-
isPending: isPreviewPending,
|
|
11374
|
-
isError: isPreviewError,
|
|
11375
|
-
error: previewError
|
|
11376
|
-
} = useOrderPreview(id);
|
|
11377
|
-
useInitiateOrderEdit({ preview });
|
|
11378
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11379
|
-
if (isError) {
|
|
11380
|
-
throw error;
|
|
11381
|
-
}
|
|
11382
|
-
if (isPreviewError) {
|
|
11383
|
-
throw previewError;
|
|
11384
|
-
}
|
|
11385
|
-
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11386
|
-
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11387
|
-
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11388
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
11389
|
-
/* @__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: [
|
|
11390
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11391
|
-
/* @__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." }) })
|
|
11392
|
-
] }) }) }),
|
|
11393
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11394
|
-
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
11395
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11396
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11397
|
-
] }) });
|
|
11398
|
-
};
|
|
11399
|
-
const ShippingForm = ({ preview, order }) => {
|
|
11400
|
-
var _a;
|
|
11401
|
-
const { setIsOpen } = useStackedModal();
|
|
11402
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11403
|
-
const [data, setData] = useState(null);
|
|
11404
|
-
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11405
|
-
const { shipping_options } = useShippingOptions(
|
|
11406
|
-
{
|
|
11407
|
-
id: appliedShippingOptionIds,
|
|
11408
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11394
|
+
const ShippingForm = ({ preview, order }) => {
|
|
11395
|
+
var _a;
|
|
11396
|
+
const { setIsOpen } = useStackedModal();
|
|
11397
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11398
|
+
const [data, setData] = useState(null);
|
|
11399
|
+
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11400
|
+
const { shipping_options } = useShippingOptions(
|
|
11401
|
+
{
|
|
11402
|
+
id: appliedShippingOptionIds,
|
|
11403
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11409
11404
|
},
|
|
11410
11405
|
{
|
|
11411
11406
|
enabled: appliedShippingOptionIds.length > 0
|
|
@@ -12168,6 +12163,112 @@ const CustomAmountField = ({
|
|
|
12168
12163
|
}
|
|
12169
12164
|
);
|
|
12170
12165
|
};
|
|
12166
|
+
const SalesChannel = () => {
|
|
12167
|
+
const { id } = useParams();
|
|
12168
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12169
|
+
id,
|
|
12170
|
+
{
|
|
12171
|
+
fields: "+sales_channel_id"
|
|
12172
|
+
},
|
|
12173
|
+
{
|
|
12174
|
+
enabled: !!id
|
|
12175
|
+
}
|
|
12176
|
+
);
|
|
12177
|
+
if (isError) {
|
|
12178
|
+
throw error;
|
|
12179
|
+
}
|
|
12180
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12181
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12182
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12183
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12184
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12185
|
+
] }),
|
|
12186
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12187
|
+
] });
|
|
12188
|
+
};
|
|
12189
|
+
const SalesChannelForm = ({ order }) => {
|
|
12190
|
+
const form = useForm({
|
|
12191
|
+
defaultValues: {
|
|
12192
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12193
|
+
},
|
|
12194
|
+
resolver: zodResolver(schema$4)
|
|
12195
|
+
});
|
|
12196
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12197
|
+
const { handleSuccess } = useRouteModal();
|
|
12198
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12199
|
+
await mutateAsync(
|
|
12200
|
+
{
|
|
12201
|
+
sales_channel_id: data.sales_channel_id
|
|
12202
|
+
},
|
|
12203
|
+
{
|
|
12204
|
+
onSuccess: () => {
|
|
12205
|
+
toast.success("Sales channel updated");
|
|
12206
|
+
handleSuccess();
|
|
12207
|
+
},
|
|
12208
|
+
onError: (error) => {
|
|
12209
|
+
toast.error(error.message);
|
|
12210
|
+
}
|
|
12211
|
+
}
|
|
12212
|
+
);
|
|
12213
|
+
});
|
|
12214
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12215
|
+
KeyboundForm,
|
|
12216
|
+
{
|
|
12217
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12218
|
+
onSubmit,
|
|
12219
|
+
children: [
|
|
12220
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12221
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12222
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12223
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12224
|
+
] }) })
|
|
12225
|
+
]
|
|
12226
|
+
}
|
|
12227
|
+
) });
|
|
12228
|
+
};
|
|
12229
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12230
|
+
const salesChannels = useComboboxData({
|
|
12231
|
+
queryFn: async (params) => {
|
|
12232
|
+
return await sdk.admin.salesChannel.list(params);
|
|
12233
|
+
},
|
|
12234
|
+
queryKey: ["sales-channels"],
|
|
12235
|
+
getOptions: (data) => {
|
|
12236
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
12237
|
+
label: salesChannel.name,
|
|
12238
|
+
value: salesChannel.id
|
|
12239
|
+
}));
|
|
12240
|
+
},
|
|
12241
|
+
defaultValue: order.sales_channel_id || void 0
|
|
12242
|
+
});
|
|
12243
|
+
return /* @__PURE__ */ jsx(
|
|
12244
|
+
Form$2.Field,
|
|
12245
|
+
{
|
|
12246
|
+
control,
|
|
12247
|
+
name: "sales_channel_id",
|
|
12248
|
+
render: ({ field }) => {
|
|
12249
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12250
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12251
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
12252
|
+
Combobox,
|
|
12253
|
+
{
|
|
12254
|
+
options: salesChannels.options,
|
|
12255
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
12256
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12257
|
+
searchValue: salesChannels.searchValue,
|
|
12258
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12259
|
+
placeholder: "Select sales channel",
|
|
12260
|
+
...field
|
|
12261
|
+
}
|
|
12262
|
+
) }),
|
|
12263
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12264
|
+
] });
|
|
12265
|
+
}
|
|
12266
|
+
}
|
|
12267
|
+
);
|
|
12268
|
+
};
|
|
12269
|
+
const schema$4 = objectType({
|
|
12270
|
+
sales_channel_id: stringType().min(1)
|
|
12271
|
+
});
|
|
12171
12272
|
const ShippingAddress = () => {
|
|
12172
12273
|
const { id } = useParams();
|
|
12173
12274
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12200,7 +12301,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12200
12301
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12201
12302
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12202
12303
|
},
|
|
12203
|
-
resolver: zodResolver(schema$
|
|
12304
|
+
resolver: zodResolver(schema$3)
|
|
12204
12305
|
});
|
|
12205
12306
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12206
12307
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12370,7 +12471,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12370
12471
|
}
|
|
12371
12472
|
) });
|
|
12372
12473
|
};
|
|
12373
|
-
const schema$
|
|
12474
|
+
const schema$3 = addressSchema;
|
|
12374
12475
|
const TransferOwnership = () => {
|
|
12375
12476
|
const { id } = useParams();
|
|
12376
12477
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12394,7 +12495,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12394
12495
|
defaultValues: {
|
|
12395
12496
|
customer_id: order.customer_id || ""
|
|
12396
12497
|
},
|
|
12397
|
-
resolver: zodResolver(schema$
|
|
12498
|
+
resolver: zodResolver(schema$2)
|
|
12398
12499
|
});
|
|
12399
12500
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12400
12501
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12844,13 +12945,34 @@ const Illustration = () => {
|
|
|
12844
12945
|
}
|
|
12845
12946
|
);
|
|
12846
12947
|
};
|
|
12847
|
-
const schema$
|
|
12948
|
+
const schema$2 = objectType({
|
|
12848
12949
|
customer_id: stringType().min(1)
|
|
12849
12950
|
});
|
|
12850
|
-
const
|
|
12951
|
+
const CustomItems = () => {
|
|
12952
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12953
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
12954
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
12955
|
+
] });
|
|
12956
|
+
};
|
|
12957
|
+
const CustomItemsForm = () => {
|
|
12958
|
+
const form = useForm({
|
|
12959
|
+
resolver: zodResolver(schema$1)
|
|
12960
|
+
});
|
|
12961
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
12962
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
12963
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12964
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12965
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
12966
|
+
] }) })
|
|
12967
|
+
] }) });
|
|
12968
|
+
};
|
|
12969
|
+
const schema$1 = objectType({
|
|
12970
|
+
email: stringType().email()
|
|
12971
|
+
});
|
|
12972
|
+
const Email = () => {
|
|
12851
12973
|
const { id } = useParams();
|
|
12852
12974
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12853
|
-
fields: "+
|
|
12975
|
+
fields: "+email"
|
|
12854
12976
|
});
|
|
12855
12977
|
if (isError) {
|
|
12856
12978
|
throw error;
|
|
@@ -12858,26 +12980,16 @@ const BillingAddress = () => {
|
|
|
12858
12980
|
const isReady = !isPending && !!order;
|
|
12859
12981
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12860
12982
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12861
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
12862
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
12983
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12984
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12863
12985
|
] }),
|
|
12864
|
-
isReady && /* @__PURE__ */ jsx(
|
|
12986
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12865
12987
|
] });
|
|
12866
12988
|
};
|
|
12867
|
-
const
|
|
12868
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12989
|
+
const EmailForm = ({ order }) => {
|
|
12869
12990
|
const form = useForm({
|
|
12870
12991
|
defaultValues: {
|
|
12871
|
-
|
|
12872
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12873
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12874
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12875
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12876
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12877
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12878
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12879
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12880
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12992
|
+
email: order.email ?? ""
|
|
12881
12993
|
},
|
|
12882
12994
|
resolver: zodResolver(schema)
|
|
12883
12995
|
});
|
|
@@ -12885,7 +12997,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
12885
12997
|
const { handleSuccess } = useRouteModal();
|
|
12886
12998
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12887
12999
|
await mutateAsync(
|
|
12888
|
-
{
|
|
13000
|
+
{ email: data.email },
|
|
12889
13001
|
{
|
|
12890
13002
|
onSuccess: () => {
|
|
12891
13003
|
handleSuccess();
|
|
@@ -12902,132 +13014,18 @@ const BillingAddressForm = ({ order }) => {
|
|
|
12902
13014
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
12903
13015
|
onSubmit,
|
|
12904
13016
|
children: [
|
|
12905
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
),
|
|
12918
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12919
|
-
/* @__PURE__ */ jsx(
|
|
12920
|
-
Form$2.Field,
|
|
12921
|
-
{
|
|
12922
|
-
control: form.control,
|
|
12923
|
-
name: "first_name",
|
|
12924
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12925
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12926
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12927
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12928
|
-
] })
|
|
12929
|
-
}
|
|
12930
|
-
),
|
|
12931
|
-
/* @__PURE__ */ jsx(
|
|
12932
|
-
Form$2.Field,
|
|
12933
|
-
{
|
|
12934
|
-
control: form.control,
|
|
12935
|
-
name: "last_name",
|
|
12936
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12937
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12938
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12939
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12940
|
-
] })
|
|
12941
|
-
}
|
|
12942
|
-
)
|
|
12943
|
-
] }),
|
|
12944
|
-
/* @__PURE__ */ jsx(
|
|
12945
|
-
Form$2.Field,
|
|
12946
|
-
{
|
|
12947
|
-
control: form.control,
|
|
12948
|
-
name: "company",
|
|
12949
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12950
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12951
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12952
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12953
|
-
] })
|
|
12954
|
-
}
|
|
12955
|
-
),
|
|
12956
|
-
/* @__PURE__ */ jsx(
|
|
12957
|
-
Form$2.Field,
|
|
12958
|
-
{
|
|
12959
|
-
control: form.control,
|
|
12960
|
-
name: "address_1",
|
|
12961
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12962
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12963
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12964
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12965
|
-
] })
|
|
12966
|
-
}
|
|
12967
|
-
),
|
|
12968
|
-
/* @__PURE__ */ jsx(
|
|
12969
|
-
Form$2.Field,
|
|
12970
|
-
{
|
|
12971
|
-
control: form.control,
|
|
12972
|
-
name: "address_2",
|
|
12973
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12974
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12975
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12976
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12977
|
-
] })
|
|
12978
|
-
}
|
|
12979
|
-
),
|
|
12980
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12981
|
-
/* @__PURE__ */ jsx(
|
|
12982
|
-
Form$2.Field,
|
|
12983
|
-
{
|
|
12984
|
-
control: form.control,
|
|
12985
|
-
name: "postal_code",
|
|
12986
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12987
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12988
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12989
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12990
|
-
] })
|
|
12991
|
-
}
|
|
12992
|
-
),
|
|
12993
|
-
/* @__PURE__ */ jsx(
|
|
12994
|
-
Form$2.Field,
|
|
12995
|
-
{
|
|
12996
|
-
control: form.control,
|
|
12997
|
-
name: "city",
|
|
12998
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12999
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
13000
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13001
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13002
|
-
] })
|
|
13003
|
-
}
|
|
13004
|
-
)
|
|
13005
|
-
] }),
|
|
13006
|
-
/* @__PURE__ */ jsx(
|
|
13007
|
-
Form$2.Field,
|
|
13008
|
-
{
|
|
13009
|
-
control: form.control,
|
|
13010
|
-
name: "province",
|
|
13011
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13012
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13013
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13014
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13015
|
-
] })
|
|
13016
|
-
}
|
|
13017
|
-
),
|
|
13018
|
-
/* @__PURE__ */ jsx(
|
|
13019
|
-
Form$2.Field,
|
|
13020
|
-
{
|
|
13021
|
-
control: form.control,
|
|
13022
|
-
name: "phone",
|
|
13023
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13024
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13025
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13026
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13027
|
-
] })
|
|
13028
|
-
}
|
|
13029
|
-
)
|
|
13030
|
-
] }) }),
|
|
13017
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13018
|
+
Form$2.Field,
|
|
13019
|
+
{
|
|
13020
|
+
control: form.control,
|
|
13021
|
+
name: "email",
|
|
13022
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13023
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13024
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13025
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13026
|
+
] })
|
|
13027
|
+
}
|
|
13028
|
+
) }),
|
|
13031
13029
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13032
13030
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13033
13031
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -13036,7 +13034,9 @@ const BillingAddressForm = ({ order }) => {
|
|
|
13036
13034
|
}
|
|
13037
13035
|
) });
|
|
13038
13036
|
};
|
|
13039
|
-
const schema =
|
|
13037
|
+
const schema = objectType({
|
|
13038
|
+
email: stringType().email()
|
|
13039
|
+
});
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
13042
13042
|
routes: [
|
|
@@ -13058,12 +13058,8 @@ const routeModule = {
|
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
13060
|
{
|
|
13061
|
-
Component:
|
|
13062
|
-
path: "/draft-orders/:id/
|
|
13063
|
-
},
|
|
13064
|
-
{
|
|
13065
|
-
Component: CustomItems,
|
|
13066
|
-
path: "/draft-orders/:id/custom-items"
|
|
13061
|
+
Component: BillingAddress,
|
|
13062
|
+
path: "/draft-orders/:id/billing-address"
|
|
13067
13063
|
},
|
|
13068
13064
|
{
|
|
13069
13065
|
Component: Items,
|
|
@@ -13077,14 +13073,14 @@ const routeModule = {
|
|
|
13077
13073
|
Component: Promotions,
|
|
13078
13074
|
path: "/draft-orders/:id/promotions"
|
|
13079
13075
|
},
|
|
13080
|
-
{
|
|
13081
|
-
Component: SalesChannel,
|
|
13082
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13083
|
-
},
|
|
13084
13076
|
{
|
|
13085
13077
|
Component: Shipping,
|
|
13086
13078
|
path: "/draft-orders/:id/shipping"
|
|
13087
13079
|
},
|
|
13080
|
+
{
|
|
13081
|
+
Component: SalesChannel,
|
|
13082
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13083
|
+
},
|
|
13088
13084
|
{
|
|
13089
13085
|
Component: ShippingAddress,
|
|
13090
13086
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -13094,8 +13090,12 @@ const routeModule = {
|
|
|
13094
13090
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
13091
|
},
|
|
13096
13092
|
{
|
|
13097
|
-
Component:
|
|
13098
|
-
path: "/draft-orders/:id/
|
|
13093
|
+
Component: CustomItems,
|
|
13094
|
+
path: "/draft-orders/:id/custom-items"
|
|
13095
|
+
},
|
|
13096
|
+
{
|
|
13097
|
+
Component: Email,
|
|
13098
|
+
path: "/draft-orders/:id/email"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|