@medusajs/draft-order 2.10.4-preview-20251011090154 → 2.10.4-preview-20251011120205
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 +369 -369
- package/.medusa/server/src/admin/index.mjs +369 -369
- package/package.json +16 -16
|
@@ -9573,217 +9573,6 @@ const ID = () => {
|
|
|
9573
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9574
9574
|
] });
|
|
9575
9575
|
};
|
|
9576
|
-
const BillingAddress = () => {
|
|
9577
|
-
const { id } = reactRouterDom.useParams();
|
|
9578
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9579
|
-
fields: "+billing_address"
|
|
9580
|
-
});
|
|
9581
|
-
if (isError) {
|
|
9582
|
-
throw error;
|
|
9583
|
-
}
|
|
9584
|
-
const isReady = !isPending && !!order;
|
|
9585
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9586
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9587
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9588
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9589
|
-
] }),
|
|
9590
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9591
|
-
] });
|
|
9592
|
-
};
|
|
9593
|
-
const BillingAddressForm = ({ order }) => {
|
|
9594
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9595
|
-
const form = reactHookForm.useForm({
|
|
9596
|
-
defaultValues: {
|
|
9597
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9598
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9599
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9600
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9601
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9602
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9603
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9604
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9605
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9606
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9607
|
-
},
|
|
9608
|
-
resolver: zod.zodResolver(schema$5)
|
|
9609
|
-
});
|
|
9610
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9611
|
-
const { handleSuccess } = useRouteModal();
|
|
9612
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9613
|
-
await mutateAsync(
|
|
9614
|
-
{ billing_address: data },
|
|
9615
|
-
{
|
|
9616
|
-
onSuccess: () => {
|
|
9617
|
-
handleSuccess();
|
|
9618
|
-
},
|
|
9619
|
-
onError: (error) => {
|
|
9620
|
-
ui.toast.error(error.message);
|
|
9621
|
-
}
|
|
9622
|
-
}
|
|
9623
|
-
);
|
|
9624
|
-
});
|
|
9625
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9626
|
-
KeyboundForm,
|
|
9627
|
-
{
|
|
9628
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9629
|
-
onSubmit,
|
|
9630
|
-
children: [
|
|
9631
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
9632
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9633
|
-
Form$2.Field,
|
|
9634
|
-
{
|
|
9635
|
-
control: form.control,
|
|
9636
|
-
name: "country_code",
|
|
9637
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9638
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9639
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9640
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9641
|
-
] })
|
|
9642
|
-
}
|
|
9643
|
-
),
|
|
9644
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9645
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9646
|
-
Form$2.Field,
|
|
9647
|
-
{
|
|
9648
|
-
control: form.control,
|
|
9649
|
-
name: "first_name",
|
|
9650
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9652
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9653
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9654
|
-
] })
|
|
9655
|
-
}
|
|
9656
|
-
),
|
|
9657
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9658
|
-
Form$2.Field,
|
|
9659
|
-
{
|
|
9660
|
-
control: form.control,
|
|
9661
|
-
name: "last_name",
|
|
9662
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9664
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9665
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9666
|
-
] })
|
|
9667
|
-
}
|
|
9668
|
-
)
|
|
9669
|
-
] }),
|
|
9670
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9671
|
-
Form$2.Field,
|
|
9672
|
-
{
|
|
9673
|
-
control: form.control,
|
|
9674
|
-
name: "company",
|
|
9675
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9677
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9678
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9679
|
-
] })
|
|
9680
|
-
}
|
|
9681
|
-
),
|
|
9682
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9683
|
-
Form$2.Field,
|
|
9684
|
-
{
|
|
9685
|
-
control: form.control,
|
|
9686
|
-
name: "address_1",
|
|
9687
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9689
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9690
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9691
|
-
] })
|
|
9692
|
-
}
|
|
9693
|
-
),
|
|
9694
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9695
|
-
Form$2.Field,
|
|
9696
|
-
{
|
|
9697
|
-
control: form.control,
|
|
9698
|
-
name: "address_2",
|
|
9699
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9701
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9702
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9703
|
-
] })
|
|
9704
|
-
}
|
|
9705
|
-
),
|
|
9706
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9707
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9708
|
-
Form$2.Field,
|
|
9709
|
-
{
|
|
9710
|
-
control: form.control,
|
|
9711
|
-
name: "postal_code",
|
|
9712
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
9714
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9715
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9716
|
-
] })
|
|
9717
|
-
}
|
|
9718
|
-
),
|
|
9719
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9720
|
-
Form$2.Field,
|
|
9721
|
-
{
|
|
9722
|
-
control: form.control,
|
|
9723
|
-
name: "city",
|
|
9724
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9726
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9727
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9728
|
-
] })
|
|
9729
|
-
}
|
|
9730
|
-
)
|
|
9731
|
-
] }),
|
|
9732
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9733
|
-
Form$2.Field,
|
|
9734
|
-
{
|
|
9735
|
-
control: form.control,
|
|
9736
|
-
name: "province",
|
|
9737
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9739
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9740
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9741
|
-
] })
|
|
9742
|
-
}
|
|
9743
|
-
),
|
|
9744
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9745
|
-
Form$2.Field,
|
|
9746
|
-
{
|
|
9747
|
-
control: form.control,
|
|
9748
|
-
name: "phone",
|
|
9749
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9750
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9751
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9752
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9753
|
-
] })
|
|
9754
|
-
}
|
|
9755
|
-
)
|
|
9756
|
-
] }) }),
|
|
9757
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9758
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9759
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9760
|
-
] }) })
|
|
9761
|
-
]
|
|
9762
|
-
}
|
|
9763
|
-
) });
|
|
9764
|
-
};
|
|
9765
|
-
const schema$5 = addressSchema;
|
|
9766
|
-
const CustomItems = () => {
|
|
9767
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9768
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9769
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9770
|
-
] });
|
|
9771
|
-
};
|
|
9772
|
-
const CustomItemsForm = () => {
|
|
9773
|
-
const form = reactHookForm.useForm({
|
|
9774
|
-
resolver: zod.zodResolver(schema$4)
|
|
9775
|
-
});
|
|
9776
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9779
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9780
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9781
|
-
] }) })
|
|
9782
|
-
] }) });
|
|
9783
|
-
};
|
|
9784
|
-
const schema$4 = objectType({
|
|
9785
|
-
email: stringType().email()
|
|
9786
|
-
});
|
|
9787
9576
|
const Email = () => {
|
|
9788
9577
|
const { id } = reactRouterDom.useParams();
|
|
9789
9578
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9806,7 +9595,7 @@ const EmailForm = ({ order }) => {
|
|
|
9806
9595
|
defaultValues: {
|
|
9807
9596
|
email: order.email ?? ""
|
|
9808
9597
|
},
|
|
9809
|
-
resolver: zod.zodResolver(schema$
|
|
9598
|
+
resolver: zod.zodResolver(schema$5)
|
|
9810
9599
|
});
|
|
9811
9600
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9812
9601
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9849,7 +9638,7 @@ const EmailForm = ({ order }) => {
|
|
|
9849
9638
|
}
|
|
9850
9639
|
) });
|
|
9851
9640
|
};
|
|
9852
|
-
const schema$
|
|
9641
|
+
const schema$5 = objectType({
|
|
9853
9642
|
email: stringType().email()
|
|
9854
9643
|
});
|
|
9855
9644
|
const NumberInput = React.forwardRef(
|
|
@@ -11453,44 +11242,150 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11453
11242
|
}
|
|
11454
11243
|
return Array.from(promotionIds);
|
|
11455
11244
|
}
|
|
11456
|
-
const
|
|
11457
|
-
const Shipping = () => {
|
|
11458
|
-
var _a;
|
|
11245
|
+
const SalesChannel = () => {
|
|
11459
11246
|
const { id } = reactRouterDom.useParams();
|
|
11460
|
-
const {
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
useInitiateOrderEdit({ preview });
|
|
11470
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11247
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11248
|
+
id,
|
|
11249
|
+
{
|
|
11250
|
+
fields: "+sales_channel_id"
|
|
11251
|
+
},
|
|
11252
|
+
{
|
|
11253
|
+
enabled: !!id
|
|
11254
|
+
}
|
|
11255
|
+
);
|
|
11471
11256
|
if (isError) {
|
|
11472
11257
|
throw error;
|
|
11473
11258
|
}
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
};
|
|
11491
|
-
const
|
|
11492
|
-
|
|
11493
|
-
|
|
11259
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11260
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11261
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11262
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11263
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11264
|
+
] }),
|
|
11265
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11266
|
+
] });
|
|
11267
|
+
};
|
|
11268
|
+
const SalesChannelForm = ({ order }) => {
|
|
11269
|
+
const form = reactHookForm.useForm({
|
|
11270
|
+
defaultValues: {
|
|
11271
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11272
|
+
},
|
|
11273
|
+
resolver: zod.zodResolver(schema$4)
|
|
11274
|
+
});
|
|
11275
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11276
|
+
const { handleSuccess } = useRouteModal();
|
|
11277
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11278
|
+
await mutateAsync(
|
|
11279
|
+
{
|
|
11280
|
+
sales_channel_id: data.sales_channel_id
|
|
11281
|
+
},
|
|
11282
|
+
{
|
|
11283
|
+
onSuccess: () => {
|
|
11284
|
+
ui.toast.success("Sales channel updated");
|
|
11285
|
+
handleSuccess();
|
|
11286
|
+
},
|
|
11287
|
+
onError: (error) => {
|
|
11288
|
+
ui.toast.error(error.message);
|
|
11289
|
+
}
|
|
11290
|
+
}
|
|
11291
|
+
);
|
|
11292
|
+
});
|
|
11293
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11294
|
+
KeyboundForm,
|
|
11295
|
+
{
|
|
11296
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11297
|
+
onSubmit,
|
|
11298
|
+
children: [
|
|
11299
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11300
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11301
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11302
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11303
|
+
] }) })
|
|
11304
|
+
]
|
|
11305
|
+
}
|
|
11306
|
+
) });
|
|
11307
|
+
};
|
|
11308
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11309
|
+
const salesChannels = useComboboxData({
|
|
11310
|
+
queryFn: async (params) => {
|
|
11311
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11312
|
+
},
|
|
11313
|
+
queryKey: ["sales-channels"],
|
|
11314
|
+
getOptions: (data) => {
|
|
11315
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11316
|
+
label: salesChannel.name,
|
|
11317
|
+
value: salesChannel.id
|
|
11318
|
+
}));
|
|
11319
|
+
},
|
|
11320
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11321
|
+
});
|
|
11322
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11323
|
+
Form$2.Field,
|
|
11324
|
+
{
|
|
11325
|
+
control,
|
|
11326
|
+
name: "sales_channel_id",
|
|
11327
|
+
render: ({ field }) => {
|
|
11328
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11329
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11330
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11331
|
+
Combobox,
|
|
11332
|
+
{
|
|
11333
|
+
options: salesChannels.options,
|
|
11334
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11335
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11336
|
+
searchValue: salesChannels.searchValue,
|
|
11337
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11338
|
+
placeholder: "Select sales channel",
|
|
11339
|
+
...field
|
|
11340
|
+
}
|
|
11341
|
+
) }),
|
|
11342
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11343
|
+
] });
|
|
11344
|
+
}
|
|
11345
|
+
}
|
|
11346
|
+
);
|
|
11347
|
+
};
|
|
11348
|
+
const schema$4 = objectType({
|
|
11349
|
+
sales_channel_id: stringType().min(1)
|
|
11350
|
+
});
|
|
11351
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11352
|
+
const Shipping = () => {
|
|
11353
|
+
var _a;
|
|
11354
|
+
const { id } = reactRouterDom.useParams();
|
|
11355
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11356
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11357
|
+
});
|
|
11358
|
+
const {
|
|
11359
|
+
order: preview,
|
|
11360
|
+
isPending: isPreviewPending,
|
|
11361
|
+
isError: isPreviewError,
|
|
11362
|
+
error: previewError
|
|
11363
|
+
} = useOrderPreview(id);
|
|
11364
|
+
useInitiateOrderEdit({ preview });
|
|
11365
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11366
|
+
if (isError) {
|
|
11367
|
+
throw error;
|
|
11368
|
+
}
|
|
11369
|
+
if (isPreviewError) {
|
|
11370
|
+
throw previewError;
|
|
11371
|
+
}
|
|
11372
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11373
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11374
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11375
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11376
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
11377
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11378
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11379
|
+
] }) }) }),
|
|
11380
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11381
|
+
] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11382
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11383
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11384
|
+
] }) });
|
|
11385
|
+
};
|
|
11386
|
+
const ShippingForm = ({ preview, order }) => {
|
|
11387
|
+
var _a;
|
|
11388
|
+
const { setIsOpen } = useStackedModal();
|
|
11494
11389
|
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11495
11390
|
const [data, setData] = React.useState(null);
|
|
11496
11391
|
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
@@ -12260,112 +12155,6 @@ const CustomAmountField = ({
|
|
|
12260
12155
|
}
|
|
12261
12156
|
);
|
|
12262
12157
|
};
|
|
12263
|
-
const SalesChannel = () => {
|
|
12264
|
-
const { id } = reactRouterDom.useParams();
|
|
12265
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12266
|
-
id,
|
|
12267
|
-
{
|
|
12268
|
-
fields: "+sales_channel_id"
|
|
12269
|
-
},
|
|
12270
|
-
{
|
|
12271
|
-
enabled: !!id
|
|
12272
|
-
}
|
|
12273
|
-
);
|
|
12274
|
-
if (isError) {
|
|
12275
|
-
throw error;
|
|
12276
|
-
}
|
|
12277
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12278
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12279
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12280
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12281
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12282
|
-
] }),
|
|
12283
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12284
|
-
] });
|
|
12285
|
-
};
|
|
12286
|
-
const SalesChannelForm = ({ order }) => {
|
|
12287
|
-
const form = reactHookForm.useForm({
|
|
12288
|
-
defaultValues: {
|
|
12289
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12290
|
-
},
|
|
12291
|
-
resolver: zod.zodResolver(schema$2)
|
|
12292
|
-
});
|
|
12293
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12294
|
-
const { handleSuccess } = useRouteModal();
|
|
12295
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12296
|
-
await mutateAsync(
|
|
12297
|
-
{
|
|
12298
|
-
sales_channel_id: data.sales_channel_id
|
|
12299
|
-
},
|
|
12300
|
-
{
|
|
12301
|
-
onSuccess: () => {
|
|
12302
|
-
ui.toast.success("Sales channel updated");
|
|
12303
|
-
handleSuccess();
|
|
12304
|
-
},
|
|
12305
|
-
onError: (error) => {
|
|
12306
|
-
ui.toast.error(error.message);
|
|
12307
|
-
}
|
|
12308
|
-
}
|
|
12309
|
-
);
|
|
12310
|
-
});
|
|
12311
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12312
|
-
KeyboundForm,
|
|
12313
|
-
{
|
|
12314
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12315
|
-
onSubmit,
|
|
12316
|
-
children: [
|
|
12317
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12318
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12319
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12320
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12321
|
-
] }) })
|
|
12322
|
-
]
|
|
12323
|
-
}
|
|
12324
|
-
) });
|
|
12325
|
-
};
|
|
12326
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12327
|
-
const salesChannels = useComboboxData({
|
|
12328
|
-
queryFn: async (params) => {
|
|
12329
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12330
|
-
},
|
|
12331
|
-
queryKey: ["sales-channels"],
|
|
12332
|
-
getOptions: (data) => {
|
|
12333
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12334
|
-
label: salesChannel.name,
|
|
12335
|
-
value: salesChannel.id
|
|
12336
|
-
}));
|
|
12337
|
-
},
|
|
12338
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12339
|
-
});
|
|
12340
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12341
|
-
Form$2.Field,
|
|
12342
|
-
{
|
|
12343
|
-
control,
|
|
12344
|
-
name: "sales_channel_id",
|
|
12345
|
-
render: ({ field }) => {
|
|
12346
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12347
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12348
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12349
|
-
Combobox,
|
|
12350
|
-
{
|
|
12351
|
-
options: salesChannels.options,
|
|
12352
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
12353
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12354
|
-
searchValue: salesChannels.searchValue,
|
|
12355
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12356
|
-
placeholder: "Select sales channel",
|
|
12357
|
-
...field
|
|
12358
|
-
}
|
|
12359
|
-
) }),
|
|
12360
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12361
|
-
] });
|
|
12362
|
-
}
|
|
12363
|
-
}
|
|
12364
|
-
);
|
|
12365
|
-
};
|
|
12366
|
-
const schema$2 = objectType({
|
|
12367
|
-
sales_channel_id: stringType().min(1)
|
|
12368
|
-
});
|
|
12369
12158
|
const ShippingAddress = () => {
|
|
12370
12159
|
const { id } = reactRouterDom.useParams();
|
|
12371
12160
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12398,7 +12187,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12398
12187
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12399
12188
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12400
12189
|
},
|
|
12401
|
-
resolver: zod.zodResolver(schema$
|
|
12190
|
+
resolver: zod.zodResolver(schema$3)
|
|
12402
12191
|
});
|
|
12403
12192
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12404
12193
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12568,7 +12357,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12568
12357
|
}
|
|
12569
12358
|
) });
|
|
12570
12359
|
};
|
|
12571
|
-
const schema$
|
|
12360
|
+
const schema$3 = addressSchema;
|
|
12572
12361
|
const TransferOwnership = () => {
|
|
12573
12362
|
const { id } = reactRouterDom.useParams();
|
|
12574
12363
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12592,7 +12381,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12592
12381
|
defaultValues: {
|
|
12593
12382
|
customer_id: order.customer_id || ""
|
|
12594
12383
|
},
|
|
12595
|
-
resolver: zod.zodResolver(schema)
|
|
12384
|
+
resolver: zod.zodResolver(schema$2)
|
|
12596
12385
|
});
|
|
12597
12386
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12598
12387
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13042,9 +12831,220 @@ const Illustration = () => {
|
|
|
13042
12831
|
}
|
|
13043
12832
|
);
|
|
13044
12833
|
};
|
|
13045
|
-
const schema = objectType({
|
|
12834
|
+
const schema$2 = objectType({
|
|
13046
12835
|
customer_id: stringType().min(1)
|
|
13047
12836
|
});
|
|
12837
|
+
const BillingAddress = () => {
|
|
12838
|
+
const { id } = reactRouterDom.useParams();
|
|
12839
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12840
|
+
fields: "+billing_address"
|
|
12841
|
+
});
|
|
12842
|
+
if (isError) {
|
|
12843
|
+
throw error;
|
|
12844
|
+
}
|
|
12845
|
+
const isReady = !isPending && !!order;
|
|
12846
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12847
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12848
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
12849
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12850
|
+
] }),
|
|
12851
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
12852
|
+
] });
|
|
12853
|
+
};
|
|
12854
|
+
const BillingAddressForm = ({ order }) => {
|
|
12855
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12856
|
+
const form = reactHookForm.useForm({
|
|
12857
|
+
defaultValues: {
|
|
12858
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12859
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12860
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12861
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12862
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12863
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12864
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12865
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12866
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12867
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12868
|
+
},
|
|
12869
|
+
resolver: zod.zodResolver(schema$1)
|
|
12870
|
+
});
|
|
12871
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12872
|
+
const { handleSuccess } = useRouteModal();
|
|
12873
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12874
|
+
await mutateAsync(
|
|
12875
|
+
{ billing_address: data },
|
|
12876
|
+
{
|
|
12877
|
+
onSuccess: () => {
|
|
12878
|
+
handleSuccess();
|
|
12879
|
+
},
|
|
12880
|
+
onError: (error) => {
|
|
12881
|
+
ui.toast.error(error.message);
|
|
12882
|
+
}
|
|
12883
|
+
}
|
|
12884
|
+
);
|
|
12885
|
+
});
|
|
12886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12887
|
+
KeyboundForm,
|
|
12888
|
+
{
|
|
12889
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12890
|
+
onSubmit,
|
|
12891
|
+
children: [
|
|
12892
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
12893
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12894
|
+
Form$2.Field,
|
|
12895
|
+
{
|
|
12896
|
+
control: form.control,
|
|
12897
|
+
name: "country_code",
|
|
12898
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12899
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12900
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12901
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12902
|
+
] })
|
|
12903
|
+
}
|
|
12904
|
+
),
|
|
12905
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12906
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12907
|
+
Form$2.Field,
|
|
12908
|
+
{
|
|
12909
|
+
control: form.control,
|
|
12910
|
+
name: "first_name",
|
|
12911
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12912
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12913
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12914
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12915
|
+
] })
|
|
12916
|
+
}
|
|
12917
|
+
),
|
|
12918
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12919
|
+
Form$2.Field,
|
|
12920
|
+
{
|
|
12921
|
+
control: form.control,
|
|
12922
|
+
name: "last_name",
|
|
12923
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12924
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12925
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12926
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12927
|
+
] })
|
|
12928
|
+
}
|
|
12929
|
+
)
|
|
12930
|
+
] }),
|
|
12931
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12932
|
+
Form$2.Field,
|
|
12933
|
+
{
|
|
12934
|
+
control: form.control,
|
|
12935
|
+
name: "company",
|
|
12936
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12937
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12938
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12939
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12940
|
+
] })
|
|
12941
|
+
}
|
|
12942
|
+
),
|
|
12943
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12944
|
+
Form$2.Field,
|
|
12945
|
+
{
|
|
12946
|
+
control: form.control,
|
|
12947
|
+
name: "address_1",
|
|
12948
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12949
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12950
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12951
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12952
|
+
] })
|
|
12953
|
+
}
|
|
12954
|
+
),
|
|
12955
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12956
|
+
Form$2.Field,
|
|
12957
|
+
{
|
|
12958
|
+
control: form.control,
|
|
12959
|
+
name: "address_2",
|
|
12960
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12961
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12962
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12963
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12964
|
+
] })
|
|
12965
|
+
}
|
|
12966
|
+
),
|
|
12967
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12968
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12969
|
+
Form$2.Field,
|
|
12970
|
+
{
|
|
12971
|
+
control: form.control,
|
|
12972
|
+
name: "postal_code",
|
|
12973
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12974
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12975
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12976
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12977
|
+
] })
|
|
12978
|
+
}
|
|
12979
|
+
),
|
|
12980
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12981
|
+
Form$2.Field,
|
|
12982
|
+
{
|
|
12983
|
+
control: form.control,
|
|
12984
|
+
name: "city",
|
|
12985
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12986
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
12987
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12988
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12989
|
+
] })
|
|
12990
|
+
}
|
|
12991
|
+
)
|
|
12992
|
+
] }),
|
|
12993
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12994
|
+
Form$2.Field,
|
|
12995
|
+
{
|
|
12996
|
+
control: form.control,
|
|
12997
|
+
name: "province",
|
|
12998
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12999
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13000
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13001
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13002
|
+
] })
|
|
13003
|
+
}
|
|
13004
|
+
),
|
|
13005
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13006
|
+
Form$2.Field,
|
|
13007
|
+
{
|
|
13008
|
+
control: form.control,
|
|
13009
|
+
name: "phone",
|
|
13010
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13011
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13012
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13013
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13014
|
+
] })
|
|
13015
|
+
}
|
|
13016
|
+
)
|
|
13017
|
+
] }) }),
|
|
13018
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13019
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13020
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13021
|
+
] }) })
|
|
13022
|
+
]
|
|
13023
|
+
}
|
|
13024
|
+
) });
|
|
13025
|
+
};
|
|
13026
|
+
const schema$1 = addressSchema;
|
|
13027
|
+
const CustomItems = () => {
|
|
13028
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
13029
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
13030
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
13031
|
+
] });
|
|
13032
|
+
};
|
|
13033
|
+
const CustomItemsForm = () => {
|
|
13034
|
+
const form = reactHookForm.useForm({
|
|
13035
|
+
resolver: zod.zodResolver(schema)
|
|
13036
|
+
});
|
|
13037
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
13038
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
13039
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13040
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13041
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
13042
|
+
] }) })
|
|
13043
|
+
] }) });
|
|
13044
|
+
};
|
|
13045
|
+
const schema = objectType({
|
|
13046
|
+
email: stringType().email()
|
|
13047
|
+
});
|
|
13048
13048
|
const widgetModule = { widgets: [] };
|
|
13049
13049
|
const routeModule = {
|
|
13050
13050
|
routes: [
|
|
@@ -13065,14 +13065,6 @@ const routeModule = {
|
|
|
13065
13065
|
handle,
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
|
-
{
|
|
13069
|
-
Component: BillingAddress,
|
|
13070
|
-
path: "/draft-orders/:id/billing-address"
|
|
13071
|
-
},
|
|
13072
|
-
{
|
|
13073
|
-
Component: CustomItems,
|
|
13074
|
-
path: "/draft-orders/:id/custom-items"
|
|
13075
|
-
},
|
|
13076
13068
|
{
|
|
13077
13069
|
Component: Email,
|
|
13078
13070
|
path: "/draft-orders/:id/email"
|
|
@@ -13089,14 +13081,14 @@ const routeModule = {
|
|
|
13089
13081
|
Component: Promotions,
|
|
13090
13082
|
path: "/draft-orders/:id/promotions"
|
|
13091
13083
|
},
|
|
13092
|
-
{
|
|
13093
|
-
Component: Shipping,
|
|
13094
|
-
path: "/draft-orders/:id/shipping"
|
|
13095
|
-
},
|
|
13096
13084
|
{
|
|
13097
13085
|
Component: SalesChannel,
|
|
13098
13086
|
path: "/draft-orders/:id/sales-channel"
|
|
13099
13087
|
},
|
|
13088
|
+
{
|
|
13089
|
+
Component: Shipping,
|
|
13090
|
+
path: "/draft-orders/:id/shipping"
|
|
13091
|
+
},
|
|
13100
13092
|
{
|
|
13101
13093
|
Component: ShippingAddress,
|
|
13102
13094
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -13104,6 +13096,14 @@ const routeModule = {
|
|
|
13104
13096
|
{
|
|
13105
13097
|
Component: TransferOwnership,
|
|
13106
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13099
|
+
},
|
|
13100
|
+
{
|
|
13101
|
+
Component: BillingAddress,
|
|
13102
|
+
path: "/draft-orders/:id/billing-address"
|
|
13103
|
+
},
|
|
13104
|
+
{
|
|
13105
|
+
Component: CustomItems,
|
|
13106
|
+
path: "/draft-orders/:id/custom-items"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|