@medusajs/draft-order 2.10.2-preview-20250901180147 → 2.10.2-preview-20250901210142
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 +246 -246
- package/.medusa/server/src/admin/index.mjs +246 -246
- package/package.json +16 -16
|
@@ -9560,196 +9560,27 @@ const ID = () => {
|
|
|
9560
9560
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9561
9561
|
] });
|
|
9562
9562
|
};
|
|
9563
|
-
const
|
|
9564
|
-
const { id } = reactRouterDom.useParams();
|
|
9565
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9566
|
-
fields: "+billing_address"
|
|
9567
|
-
});
|
|
9568
|
-
if (isError) {
|
|
9569
|
-
throw error;
|
|
9570
|
-
}
|
|
9571
|
-
const isReady = !isPending && !!order;
|
|
9563
|
+
const CustomItems = () => {
|
|
9572
9564
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9573
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9574
|
-
|
|
9575
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9576
|
-
] }),
|
|
9577
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9565
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9566
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9578
9567
|
] });
|
|
9579
9568
|
};
|
|
9580
|
-
const
|
|
9581
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9569
|
+
const CustomItemsForm = () => {
|
|
9582
9570
|
const form = reactHookForm.useForm({
|
|
9583
|
-
defaultValues: {
|
|
9584
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9585
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9586
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9587
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9588
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9589
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9590
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9591
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9592
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9593
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9594
|
-
},
|
|
9595
9571
|
resolver: zod.zodResolver(schema$5)
|
|
9596
9572
|
});
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
{
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
handleSuccess();
|
|
9605
|
-
},
|
|
9606
|
-
onError: (error) => {
|
|
9607
|
-
ui.toast.error(error.message);
|
|
9608
|
-
}
|
|
9609
|
-
}
|
|
9610
|
-
);
|
|
9611
|
-
});
|
|
9612
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9613
|
-
KeyboundForm,
|
|
9614
|
-
{
|
|
9615
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9616
|
-
onSubmit,
|
|
9617
|
-
children: [
|
|
9618
|
-
/* @__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: [
|
|
9619
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9620
|
-
Form$2.Field,
|
|
9621
|
-
{
|
|
9622
|
-
control: form.control,
|
|
9623
|
-
name: "country_code",
|
|
9624
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9625
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9626
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9627
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9628
|
-
] })
|
|
9629
|
-
}
|
|
9630
|
-
),
|
|
9631
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9632
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9633
|
-
Form$2.Field,
|
|
9634
|
-
{
|
|
9635
|
-
control: form.control,
|
|
9636
|
-
name: "first_name",
|
|
9637
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9638
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9639
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9640
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9641
|
-
] })
|
|
9642
|
-
}
|
|
9643
|
-
),
|
|
9644
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9645
|
-
Form$2.Field,
|
|
9646
|
-
{
|
|
9647
|
-
control: form.control,
|
|
9648
|
-
name: "last_name",
|
|
9649
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9650
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9652
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9653
|
-
] })
|
|
9654
|
-
}
|
|
9655
|
-
)
|
|
9656
|
-
] }),
|
|
9657
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9658
|
-
Form$2.Field,
|
|
9659
|
-
{
|
|
9660
|
-
control: form.control,
|
|
9661
|
-
name: "company",
|
|
9662
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
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
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9670
|
-
Form$2.Field,
|
|
9671
|
-
{
|
|
9672
|
-
control: form.control,
|
|
9673
|
-
name: "address_1",
|
|
9674
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9675
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9677
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9678
|
-
] })
|
|
9679
|
-
}
|
|
9680
|
-
),
|
|
9681
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9682
|
-
Form$2.Field,
|
|
9683
|
-
{
|
|
9684
|
-
control: form.control,
|
|
9685
|
-
name: "address_2",
|
|
9686
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9687
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9689
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9690
|
-
] })
|
|
9691
|
-
}
|
|
9692
|
-
),
|
|
9693
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9694
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9695
|
-
Form$2.Field,
|
|
9696
|
-
{
|
|
9697
|
-
control: form.control,
|
|
9698
|
-
name: "postal_code",
|
|
9699
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
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.jsx(
|
|
9707
|
-
Form$2.Field,
|
|
9708
|
-
{
|
|
9709
|
-
control: form.control,
|
|
9710
|
-
name: "city",
|
|
9711
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9712
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9714
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9715
|
-
] })
|
|
9716
|
-
}
|
|
9717
|
-
)
|
|
9718
|
-
] }),
|
|
9719
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9720
|
-
Form$2.Field,
|
|
9721
|
-
{
|
|
9722
|
-
control: form.control,
|
|
9723
|
-
name: "province",
|
|
9724
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
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
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9732
|
-
Form$2.Field,
|
|
9733
|
-
{
|
|
9734
|
-
control: form.control,
|
|
9735
|
-
name: "phone",
|
|
9736
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9737
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9739
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9740
|
-
] })
|
|
9741
|
-
}
|
|
9742
|
-
)
|
|
9743
|
-
] }) }),
|
|
9744
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9745
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9746
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9747
|
-
] }) })
|
|
9748
|
-
]
|
|
9749
|
-
}
|
|
9750
|
-
) });
|
|
9573
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9574
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9575
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9576
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9577
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9578
|
+
] }) })
|
|
9579
|
+
] }) });
|
|
9751
9580
|
};
|
|
9752
|
-
const schema$5 =
|
|
9581
|
+
const schema$5 = objectType({
|
|
9582
|
+
email: stringType().email()
|
|
9583
|
+
});
|
|
9753
9584
|
const Email = () => {
|
|
9754
9585
|
const { id } = reactRouterDom.useParams();
|
|
9755
9586
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12332,6 +12163,209 @@ const CustomAmountField = ({
|
|
|
12332
12163
|
}
|
|
12333
12164
|
);
|
|
12334
12165
|
};
|
|
12166
|
+
const ShippingAddress = () => {
|
|
12167
|
+
const { id } = reactRouterDom.useParams();
|
|
12168
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12169
|
+
fields: "+shipping_address"
|
|
12170
|
+
});
|
|
12171
|
+
if (isError) {
|
|
12172
|
+
throw error;
|
|
12173
|
+
}
|
|
12174
|
+
const isReady = !isPending && !!order;
|
|
12175
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12176
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12177
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
12178
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12179
|
+
] }),
|
|
12180
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
12181
|
+
] });
|
|
12182
|
+
};
|
|
12183
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12185
|
+
const form = reactHookForm.useForm({
|
|
12186
|
+
defaultValues: {
|
|
12187
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12188
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12189
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12190
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12191
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12192
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12193
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12194
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12195
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12196
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12197
|
+
},
|
|
12198
|
+
resolver: zod.zodResolver(schema$2)
|
|
12199
|
+
});
|
|
12200
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12201
|
+
const { handleSuccess } = useRouteModal();
|
|
12202
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12203
|
+
await mutateAsync(
|
|
12204
|
+
{
|
|
12205
|
+
shipping_address: {
|
|
12206
|
+
first_name: data.first_name,
|
|
12207
|
+
last_name: data.last_name,
|
|
12208
|
+
company: data.company,
|
|
12209
|
+
address_1: data.address_1,
|
|
12210
|
+
address_2: data.address_2,
|
|
12211
|
+
city: data.city,
|
|
12212
|
+
province: data.province,
|
|
12213
|
+
country_code: data.country_code,
|
|
12214
|
+
postal_code: data.postal_code,
|
|
12215
|
+
phone: data.phone
|
|
12216
|
+
}
|
|
12217
|
+
},
|
|
12218
|
+
{
|
|
12219
|
+
onSuccess: () => {
|
|
12220
|
+
handleSuccess();
|
|
12221
|
+
},
|
|
12222
|
+
onError: (error) => {
|
|
12223
|
+
ui.toast.error(error.message);
|
|
12224
|
+
}
|
|
12225
|
+
}
|
|
12226
|
+
);
|
|
12227
|
+
});
|
|
12228
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12229
|
+
KeyboundForm,
|
|
12230
|
+
{
|
|
12231
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12232
|
+
onSubmit,
|
|
12233
|
+
children: [
|
|
12234
|
+
/* @__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: [
|
|
12235
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12236
|
+
Form$2.Field,
|
|
12237
|
+
{
|
|
12238
|
+
control: form.control,
|
|
12239
|
+
name: "country_code",
|
|
12240
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12241
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12242
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12243
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12244
|
+
] })
|
|
12245
|
+
}
|
|
12246
|
+
),
|
|
12247
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12248
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12249
|
+
Form$2.Field,
|
|
12250
|
+
{
|
|
12251
|
+
control: form.control,
|
|
12252
|
+
name: "first_name",
|
|
12253
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12254
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12255
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12256
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12257
|
+
] })
|
|
12258
|
+
}
|
|
12259
|
+
),
|
|
12260
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12261
|
+
Form$2.Field,
|
|
12262
|
+
{
|
|
12263
|
+
control: form.control,
|
|
12264
|
+
name: "last_name",
|
|
12265
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12266
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12267
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12268
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12269
|
+
] })
|
|
12270
|
+
}
|
|
12271
|
+
)
|
|
12272
|
+
] }),
|
|
12273
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12274
|
+
Form$2.Field,
|
|
12275
|
+
{
|
|
12276
|
+
control: form.control,
|
|
12277
|
+
name: "company",
|
|
12278
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12279
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12280
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12281
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12282
|
+
] })
|
|
12283
|
+
}
|
|
12284
|
+
),
|
|
12285
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12286
|
+
Form$2.Field,
|
|
12287
|
+
{
|
|
12288
|
+
control: form.control,
|
|
12289
|
+
name: "address_1",
|
|
12290
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12291
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12292
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12293
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12294
|
+
] })
|
|
12295
|
+
}
|
|
12296
|
+
),
|
|
12297
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12298
|
+
Form$2.Field,
|
|
12299
|
+
{
|
|
12300
|
+
control: form.control,
|
|
12301
|
+
name: "address_2",
|
|
12302
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12303
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12304
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12305
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12306
|
+
] })
|
|
12307
|
+
}
|
|
12308
|
+
),
|
|
12309
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12310
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12311
|
+
Form$2.Field,
|
|
12312
|
+
{
|
|
12313
|
+
control: form.control,
|
|
12314
|
+
name: "postal_code",
|
|
12315
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12316
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12317
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12318
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12319
|
+
] })
|
|
12320
|
+
}
|
|
12321
|
+
),
|
|
12322
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12323
|
+
Form$2.Field,
|
|
12324
|
+
{
|
|
12325
|
+
control: form.control,
|
|
12326
|
+
name: "city",
|
|
12327
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12328
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
12329
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12330
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12331
|
+
] })
|
|
12332
|
+
}
|
|
12333
|
+
)
|
|
12334
|
+
] }),
|
|
12335
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12336
|
+
Form$2.Field,
|
|
12337
|
+
{
|
|
12338
|
+
control: form.control,
|
|
12339
|
+
name: "province",
|
|
12340
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12341
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12342
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12343
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12344
|
+
] })
|
|
12345
|
+
}
|
|
12346
|
+
),
|
|
12347
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12348
|
+
Form$2.Field,
|
|
12349
|
+
{
|
|
12350
|
+
control: form.control,
|
|
12351
|
+
name: "phone",
|
|
12352
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12353
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12354
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12355
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12356
|
+
] })
|
|
12357
|
+
}
|
|
12358
|
+
)
|
|
12359
|
+
] }) }),
|
|
12360
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12361
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12362
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12363
|
+
] }) })
|
|
12364
|
+
]
|
|
12365
|
+
}
|
|
12366
|
+
) });
|
|
12367
|
+
};
|
|
12368
|
+
const schema$2 = addressSchema;
|
|
12335
12369
|
const TransferOwnership = () => {
|
|
12336
12370
|
const { id } = reactRouterDom.useParams();
|
|
12337
12371
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12355,7 +12389,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12355
12389
|
defaultValues: {
|
|
12356
12390
|
customer_id: order.customer_id || ""
|
|
12357
12391
|
},
|
|
12358
|
-
resolver: zod.zodResolver(schema$
|
|
12392
|
+
resolver: zod.zodResolver(schema$1)
|
|
12359
12393
|
});
|
|
12360
12394
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12361
12395
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12805,13 +12839,13 @@ const Illustration = () => {
|
|
|
12805
12839
|
}
|
|
12806
12840
|
);
|
|
12807
12841
|
};
|
|
12808
|
-
const schema$
|
|
12842
|
+
const schema$1 = objectType({
|
|
12809
12843
|
customer_id: stringType().min(1)
|
|
12810
12844
|
});
|
|
12811
|
-
const
|
|
12845
|
+
const BillingAddress = () => {
|
|
12812
12846
|
const { id } = reactRouterDom.useParams();
|
|
12813
12847
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12814
|
-
fields: "+
|
|
12848
|
+
fields: "+billing_address"
|
|
12815
12849
|
});
|
|
12816
12850
|
if (isError) {
|
|
12817
12851
|
throw error;
|
|
@@ -12819,47 +12853,34 @@ const ShippingAddress = () => {
|
|
|
12819
12853
|
const isReady = !isPending && !!order;
|
|
12820
12854
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12821
12855
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12822
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
12823
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the
|
|
12856
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
12857
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12824
12858
|
] }),
|
|
12825
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12859
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
12826
12860
|
] });
|
|
12827
12861
|
};
|
|
12828
|
-
const
|
|
12862
|
+
const BillingAddressForm = ({ order }) => {
|
|
12829
12863
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12830
12864
|
const form = reactHookForm.useForm({
|
|
12831
12865
|
defaultValues: {
|
|
12832
|
-
first_name: ((_a = order.
|
|
12833
|
-
last_name: ((_b = order.
|
|
12834
|
-
company: ((_c = order.
|
|
12835
|
-
address_1: ((_d = order.
|
|
12836
|
-
address_2: ((_e = order.
|
|
12837
|
-
city: ((_f = order.
|
|
12838
|
-
province: ((_g = order.
|
|
12839
|
-
country_code: ((_h = order.
|
|
12840
|
-
postal_code: ((_i = order.
|
|
12841
|
-
phone: ((_j = order.
|
|
12866
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12867
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12868
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12869
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12870
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12871
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12872
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12873
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12874
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12875
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12842
12876
|
},
|
|
12843
|
-
resolver: zod.zodResolver(schema
|
|
12877
|
+
resolver: zod.zodResolver(schema)
|
|
12844
12878
|
});
|
|
12845
12879
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12846
12880
|
const { handleSuccess } = useRouteModal();
|
|
12847
12881
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12848
12882
|
await mutateAsync(
|
|
12849
|
-
{
|
|
12850
|
-
shipping_address: {
|
|
12851
|
-
first_name: data.first_name,
|
|
12852
|
-
last_name: data.last_name,
|
|
12853
|
-
company: data.company,
|
|
12854
|
-
address_1: data.address_1,
|
|
12855
|
-
address_2: data.address_2,
|
|
12856
|
-
city: data.city,
|
|
12857
|
-
province: data.province,
|
|
12858
|
-
country_code: data.country_code,
|
|
12859
|
-
postal_code: data.postal_code,
|
|
12860
|
-
phone: data.phone
|
|
12861
|
-
}
|
|
12862
|
-
},
|
|
12883
|
+
{ billing_address: data },
|
|
12863
12884
|
{
|
|
12864
12885
|
onSuccess: () => {
|
|
12865
12886
|
handleSuccess();
|
|
@@ -13010,28 +13031,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
13010
13031
|
}
|
|
13011
13032
|
) });
|
|
13012
13033
|
};
|
|
13013
|
-
const schema
|
|
13014
|
-
const CustomItems = () => {
|
|
13015
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
13016
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
13017
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
13018
|
-
] });
|
|
13019
|
-
};
|
|
13020
|
-
const CustomItemsForm = () => {
|
|
13021
|
-
const form = reactHookForm.useForm({
|
|
13022
|
-
resolver: zod.zodResolver(schema)
|
|
13023
|
-
});
|
|
13024
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
13025
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
13026
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13027
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13028
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
13029
|
-
] }) })
|
|
13030
|
-
] }) });
|
|
13031
|
-
};
|
|
13032
|
-
const schema = objectType({
|
|
13033
|
-
email: stringType().email()
|
|
13034
|
-
});
|
|
13034
|
+
const schema = addressSchema;
|
|
13035
13035
|
const widgetModule = { widgets: [] };
|
|
13036
13036
|
const routeModule = {
|
|
13037
13037
|
routes: [
|
|
@@ -13053,8 +13053,8 @@ const routeModule = {
|
|
|
13053
13053
|
loader,
|
|
13054
13054
|
children: [
|
|
13055
13055
|
{
|
|
13056
|
-
Component:
|
|
13057
|
-
path: "/draft-orders/:id/
|
|
13056
|
+
Component: CustomItems,
|
|
13057
|
+
path: "/draft-orders/:id/custom-items"
|
|
13058
13058
|
},
|
|
13059
13059
|
{
|
|
13060
13060
|
Component: Email,
|
|
@@ -13080,17 +13080,17 @@ const routeModule = {
|
|
|
13080
13080
|
Component: Shipping,
|
|
13081
13081
|
path: "/draft-orders/:id/shipping"
|
|
13082
13082
|
},
|
|
13083
|
-
{
|
|
13084
|
-
Component: TransferOwnership,
|
|
13085
|
-
path: "/draft-orders/:id/transfer-ownership"
|
|
13086
|
-
},
|
|
13087
13083
|
{
|
|
13088
13084
|
Component: ShippingAddress,
|
|
13089
13085
|
path: "/draft-orders/:id/shipping-address"
|
|
13090
13086
|
},
|
|
13091
13087
|
{
|
|
13092
|
-
Component:
|
|
13093
|
-
path: "/draft-orders/:id/
|
|
13088
|
+
Component: TransferOwnership,
|
|
13089
|
+
path: "/draft-orders/:id/transfer-ownership"
|
|
13090
|
+
},
|
|
13091
|
+
{
|
|
13092
|
+
Component: BillingAddress,
|
|
13093
|
+
path: "/draft-orders/:id/billing-address"
|
|
13094
13094
|
}
|
|
13095
13095
|
]
|
|
13096
13096
|
}
|
|
@@ -9554,196 +9554,27 @@ const ID = () => {
|
|
|
9554
9554
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9555
9555
|
] });
|
|
9556
9556
|
};
|
|
9557
|
-
const
|
|
9558
|
-
const { id } = useParams();
|
|
9559
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9560
|
-
fields: "+billing_address"
|
|
9561
|
-
});
|
|
9562
|
-
if (isError) {
|
|
9563
|
-
throw error;
|
|
9564
|
-
}
|
|
9565
|
-
const isReady = !isPending && !!order;
|
|
9557
|
+
const CustomItems = () => {
|
|
9566
9558
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9567
|
-
/* @__PURE__ */
|
|
9568
|
-
|
|
9569
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9570
|
-
] }),
|
|
9571
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9559
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9560
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9572
9561
|
] });
|
|
9573
9562
|
};
|
|
9574
|
-
const
|
|
9575
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9563
|
+
const CustomItemsForm = () => {
|
|
9576
9564
|
const form = useForm({
|
|
9577
|
-
defaultValues: {
|
|
9578
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9579
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9580
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9581
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9582
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9583
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9584
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9585
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9586
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9587
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9588
|
-
},
|
|
9589
9565
|
resolver: zodResolver(schema$5)
|
|
9590
9566
|
});
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
{
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
handleSuccess();
|
|
9599
|
-
},
|
|
9600
|
-
onError: (error) => {
|
|
9601
|
-
toast.error(error.message);
|
|
9602
|
-
}
|
|
9603
|
-
}
|
|
9604
|
-
);
|
|
9605
|
-
});
|
|
9606
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9607
|
-
KeyboundForm,
|
|
9608
|
-
{
|
|
9609
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9610
|
-
onSubmit,
|
|
9611
|
-
children: [
|
|
9612
|
-
/* @__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: [
|
|
9613
|
-
/* @__PURE__ */ jsx(
|
|
9614
|
-
Form$2.Field,
|
|
9615
|
-
{
|
|
9616
|
-
control: form.control,
|
|
9617
|
-
name: "country_code",
|
|
9618
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9619
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9620
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9621
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9622
|
-
] })
|
|
9623
|
-
}
|
|
9624
|
-
),
|
|
9625
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9626
|
-
/* @__PURE__ */ jsx(
|
|
9627
|
-
Form$2.Field,
|
|
9628
|
-
{
|
|
9629
|
-
control: form.control,
|
|
9630
|
-
name: "first_name",
|
|
9631
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9632
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9633
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9634
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9635
|
-
] })
|
|
9636
|
-
}
|
|
9637
|
-
),
|
|
9638
|
-
/* @__PURE__ */ jsx(
|
|
9639
|
-
Form$2.Field,
|
|
9640
|
-
{
|
|
9641
|
-
control: form.control,
|
|
9642
|
-
name: "last_name",
|
|
9643
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9644
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9645
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9646
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9647
|
-
] })
|
|
9648
|
-
}
|
|
9649
|
-
)
|
|
9650
|
-
] }),
|
|
9651
|
-
/* @__PURE__ */ jsx(
|
|
9652
|
-
Form$2.Field,
|
|
9653
|
-
{
|
|
9654
|
-
control: form.control,
|
|
9655
|
-
name: "company",
|
|
9656
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9657
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9658
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9659
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9660
|
-
] })
|
|
9661
|
-
}
|
|
9662
|
-
),
|
|
9663
|
-
/* @__PURE__ */ jsx(
|
|
9664
|
-
Form$2.Field,
|
|
9665
|
-
{
|
|
9666
|
-
control: form.control,
|
|
9667
|
-
name: "address_1",
|
|
9668
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9669
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9670
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9671
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9672
|
-
] })
|
|
9673
|
-
}
|
|
9674
|
-
),
|
|
9675
|
-
/* @__PURE__ */ jsx(
|
|
9676
|
-
Form$2.Field,
|
|
9677
|
-
{
|
|
9678
|
-
control: form.control,
|
|
9679
|
-
name: "address_2",
|
|
9680
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9681
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9682
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9683
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9684
|
-
] })
|
|
9685
|
-
}
|
|
9686
|
-
),
|
|
9687
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9688
|
-
/* @__PURE__ */ jsx(
|
|
9689
|
-
Form$2.Field,
|
|
9690
|
-
{
|
|
9691
|
-
control: form.control,
|
|
9692
|
-
name: "postal_code",
|
|
9693
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9694
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9695
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9696
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9697
|
-
] })
|
|
9698
|
-
}
|
|
9699
|
-
),
|
|
9700
|
-
/* @__PURE__ */ jsx(
|
|
9701
|
-
Form$2.Field,
|
|
9702
|
-
{
|
|
9703
|
-
control: form.control,
|
|
9704
|
-
name: "city",
|
|
9705
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9706
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9707
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9708
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9709
|
-
] })
|
|
9710
|
-
}
|
|
9711
|
-
)
|
|
9712
|
-
] }),
|
|
9713
|
-
/* @__PURE__ */ jsx(
|
|
9714
|
-
Form$2.Field,
|
|
9715
|
-
{
|
|
9716
|
-
control: form.control,
|
|
9717
|
-
name: "province",
|
|
9718
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9719
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9720
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9721
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9722
|
-
] })
|
|
9723
|
-
}
|
|
9724
|
-
),
|
|
9725
|
-
/* @__PURE__ */ jsx(
|
|
9726
|
-
Form$2.Field,
|
|
9727
|
-
{
|
|
9728
|
-
control: form.control,
|
|
9729
|
-
name: "phone",
|
|
9730
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9731
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9732
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9733
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9734
|
-
] })
|
|
9735
|
-
}
|
|
9736
|
-
)
|
|
9737
|
-
] }) }),
|
|
9738
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9739
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9740
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9741
|
-
] }) })
|
|
9742
|
-
]
|
|
9743
|
-
}
|
|
9744
|
-
) });
|
|
9567
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9568
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9569
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9570
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9571
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9572
|
+
] }) })
|
|
9573
|
+
] }) });
|
|
9745
9574
|
};
|
|
9746
|
-
const schema$5 =
|
|
9575
|
+
const schema$5 = objectType({
|
|
9576
|
+
email: stringType().email()
|
|
9577
|
+
});
|
|
9747
9578
|
const Email = () => {
|
|
9748
9579
|
const { id } = useParams();
|
|
9749
9580
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12326,6 +12157,209 @@ const CustomAmountField = ({
|
|
|
12326
12157
|
}
|
|
12327
12158
|
);
|
|
12328
12159
|
};
|
|
12160
|
+
const ShippingAddress = () => {
|
|
12161
|
+
const { id } = useParams();
|
|
12162
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12163
|
+
fields: "+shipping_address"
|
|
12164
|
+
});
|
|
12165
|
+
if (isError) {
|
|
12166
|
+
throw error;
|
|
12167
|
+
}
|
|
12168
|
+
const isReady = !isPending && !!order;
|
|
12169
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12170
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12171
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12172
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12173
|
+
] }),
|
|
12174
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12175
|
+
] });
|
|
12176
|
+
};
|
|
12177
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12178
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12179
|
+
const form = useForm({
|
|
12180
|
+
defaultValues: {
|
|
12181
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12182
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12183
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12184
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12185
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12186
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12187
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12188
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12189
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12190
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12191
|
+
},
|
|
12192
|
+
resolver: zodResolver(schema$2)
|
|
12193
|
+
});
|
|
12194
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12195
|
+
const { handleSuccess } = useRouteModal();
|
|
12196
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12197
|
+
await mutateAsync(
|
|
12198
|
+
{
|
|
12199
|
+
shipping_address: {
|
|
12200
|
+
first_name: data.first_name,
|
|
12201
|
+
last_name: data.last_name,
|
|
12202
|
+
company: data.company,
|
|
12203
|
+
address_1: data.address_1,
|
|
12204
|
+
address_2: data.address_2,
|
|
12205
|
+
city: data.city,
|
|
12206
|
+
province: data.province,
|
|
12207
|
+
country_code: data.country_code,
|
|
12208
|
+
postal_code: data.postal_code,
|
|
12209
|
+
phone: data.phone
|
|
12210
|
+
}
|
|
12211
|
+
},
|
|
12212
|
+
{
|
|
12213
|
+
onSuccess: () => {
|
|
12214
|
+
handleSuccess();
|
|
12215
|
+
},
|
|
12216
|
+
onError: (error) => {
|
|
12217
|
+
toast.error(error.message);
|
|
12218
|
+
}
|
|
12219
|
+
}
|
|
12220
|
+
);
|
|
12221
|
+
});
|
|
12222
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12223
|
+
KeyboundForm,
|
|
12224
|
+
{
|
|
12225
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12226
|
+
onSubmit,
|
|
12227
|
+
children: [
|
|
12228
|
+
/* @__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: [
|
|
12229
|
+
/* @__PURE__ */ jsx(
|
|
12230
|
+
Form$2.Field,
|
|
12231
|
+
{
|
|
12232
|
+
control: form.control,
|
|
12233
|
+
name: "country_code",
|
|
12234
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12235
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12236
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12237
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12238
|
+
] })
|
|
12239
|
+
}
|
|
12240
|
+
),
|
|
12241
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12242
|
+
/* @__PURE__ */ jsx(
|
|
12243
|
+
Form$2.Field,
|
|
12244
|
+
{
|
|
12245
|
+
control: form.control,
|
|
12246
|
+
name: "first_name",
|
|
12247
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12248
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12249
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12250
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12251
|
+
] })
|
|
12252
|
+
}
|
|
12253
|
+
),
|
|
12254
|
+
/* @__PURE__ */ jsx(
|
|
12255
|
+
Form$2.Field,
|
|
12256
|
+
{
|
|
12257
|
+
control: form.control,
|
|
12258
|
+
name: "last_name",
|
|
12259
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12260
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12261
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12262
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12263
|
+
] })
|
|
12264
|
+
}
|
|
12265
|
+
)
|
|
12266
|
+
] }),
|
|
12267
|
+
/* @__PURE__ */ jsx(
|
|
12268
|
+
Form$2.Field,
|
|
12269
|
+
{
|
|
12270
|
+
control: form.control,
|
|
12271
|
+
name: "company",
|
|
12272
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12273
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12274
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12275
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12276
|
+
] })
|
|
12277
|
+
}
|
|
12278
|
+
),
|
|
12279
|
+
/* @__PURE__ */ jsx(
|
|
12280
|
+
Form$2.Field,
|
|
12281
|
+
{
|
|
12282
|
+
control: form.control,
|
|
12283
|
+
name: "address_1",
|
|
12284
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12285
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12286
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12287
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12288
|
+
] })
|
|
12289
|
+
}
|
|
12290
|
+
),
|
|
12291
|
+
/* @__PURE__ */ jsx(
|
|
12292
|
+
Form$2.Field,
|
|
12293
|
+
{
|
|
12294
|
+
control: form.control,
|
|
12295
|
+
name: "address_2",
|
|
12296
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12297
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12298
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12299
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12300
|
+
] })
|
|
12301
|
+
}
|
|
12302
|
+
),
|
|
12303
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12304
|
+
/* @__PURE__ */ jsx(
|
|
12305
|
+
Form$2.Field,
|
|
12306
|
+
{
|
|
12307
|
+
control: form.control,
|
|
12308
|
+
name: "postal_code",
|
|
12309
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12310
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12311
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12312
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12313
|
+
] })
|
|
12314
|
+
}
|
|
12315
|
+
),
|
|
12316
|
+
/* @__PURE__ */ jsx(
|
|
12317
|
+
Form$2.Field,
|
|
12318
|
+
{
|
|
12319
|
+
control: form.control,
|
|
12320
|
+
name: "city",
|
|
12321
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12322
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12323
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12324
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12325
|
+
] })
|
|
12326
|
+
}
|
|
12327
|
+
)
|
|
12328
|
+
] }),
|
|
12329
|
+
/* @__PURE__ */ jsx(
|
|
12330
|
+
Form$2.Field,
|
|
12331
|
+
{
|
|
12332
|
+
control: form.control,
|
|
12333
|
+
name: "province",
|
|
12334
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12335
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12336
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12337
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12338
|
+
] })
|
|
12339
|
+
}
|
|
12340
|
+
),
|
|
12341
|
+
/* @__PURE__ */ jsx(
|
|
12342
|
+
Form$2.Field,
|
|
12343
|
+
{
|
|
12344
|
+
control: form.control,
|
|
12345
|
+
name: "phone",
|
|
12346
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12347
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12348
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12349
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12350
|
+
] })
|
|
12351
|
+
}
|
|
12352
|
+
)
|
|
12353
|
+
] }) }),
|
|
12354
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12355
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12356
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12357
|
+
] }) })
|
|
12358
|
+
]
|
|
12359
|
+
}
|
|
12360
|
+
) });
|
|
12361
|
+
};
|
|
12362
|
+
const schema$2 = addressSchema;
|
|
12329
12363
|
const TransferOwnership = () => {
|
|
12330
12364
|
const { id } = useParams();
|
|
12331
12365
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12349,7 +12383,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12349
12383
|
defaultValues: {
|
|
12350
12384
|
customer_id: order.customer_id || ""
|
|
12351
12385
|
},
|
|
12352
|
-
resolver: zodResolver(schema$
|
|
12386
|
+
resolver: zodResolver(schema$1)
|
|
12353
12387
|
});
|
|
12354
12388
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12355
12389
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12799,13 +12833,13 @@ const Illustration = () => {
|
|
|
12799
12833
|
}
|
|
12800
12834
|
);
|
|
12801
12835
|
};
|
|
12802
|
-
const schema$
|
|
12836
|
+
const schema$1 = objectType({
|
|
12803
12837
|
customer_id: stringType().min(1)
|
|
12804
12838
|
});
|
|
12805
|
-
const
|
|
12839
|
+
const BillingAddress = () => {
|
|
12806
12840
|
const { id } = useParams();
|
|
12807
12841
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
12808
|
-
fields: "+
|
|
12842
|
+
fields: "+billing_address"
|
|
12809
12843
|
});
|
|
12810
12844
|
if (isError) {
|
|
12811
12845
|
throw error;
|
|
@@ -12813,47 +12847,34 @@ const ShippingAddress = () => {
|
|
|
12813
12847
|
const isReady = !isPending && !!order;
|
|
12814
12848
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12815
12849
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12816
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
12817
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
12850
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
12851
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12818
12852
|
] }),
|
|
12819
|
-
isReady && /* @__PURE__ */ jsx(
|
|
12853
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
12820
12854
|
] });
|
|
12821
12855
|
};
|
|
12822
|
-
const
|
|
12856
|
+
const BillingAddressForm = ({ order }) => {
|
|
12823
12857
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12824
12858
|
const form = useForm({
|
|
12825
12859
|
defaultValues: {
|
|
12826
|
-
first_name: ((_a = order.
|
|
12827
|
-
last_name: ((_b = order.
|
|
12828
|
-
company: ((_c = order.
|
|
12829
|
-
address_1: ((_d = order.
|
|
12830
|
-
address_2: ((_e = order.
|
|
12831
|
-
city: ((_f = order.
|
|
12832
|
-
province: ((_g = order.
|
|
12833
|
-
country_code: ((_h = order.
|
|
12834
|
-
postal_code: ((_i = order.
|
|
12835
|
-
phone: ((_j = order.
|
|
12860
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12861
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12862
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12863
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12864
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12865
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12866
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12867
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12868
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12869
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12836
12870
|
},
|
|
12837
|
-
resolver: zodResolver(schema
|
|
12871
|
+
resolver: zodResolver(schema)
|
|
12838
12872
|
});
|
|
12839
12873
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12840
12874
|
const { handleSuccess } = useRouteModal();
|
|
12841
12875
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
12842
12876
|
await mutateAsync(
|
|
12843
|
-
{
|
|
12844
|
-
shipping_address: {
|
|
12845
|
-
first_name: data.first_name,
|
|
12846
|
-
last_name: data.last_name,
|
|
12847
|
-
company: data.company,
|
|
12848
|
-
address_1: data.address_1,
|
|
12849
|
-
address_2: data.address_2,
|
|
12850
|
-
city: data.city,
|
|
12851
|
-
province: data.province,
|
|
12852
|
-
country_code: data.country_code,
|
|
12853
|
-
postal_code: data.postal_code,
|
|
12854
|
-
phone: data.phone
|
|
12855
|
-
}
|
|
12856
|
-
},
|
|
12877
|
+
{ billing_address: data },
|
|
12857
12878
|
{
|
|
12858
12879
|
onSuccess: () => {
|
|
12859
12880
|
handleSuccess();
|
|
@@ -13004,28 +13025,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
13004
13025
|
}
|
|
13005
13026
|
) });
|
|
13006
13027
|
};
|
|
13007
|
-
const schema
|
|
13008
|
-
const CustomItems = () => {
|
|
13009
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
13010
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
13011
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
13012
|
-
] });
|
|
13013
|
-
};
|
|
13014
|
-
const CustomItemsForm = () => {
|
|
13015
|
-
const form = useForm({
|
|
13016
|
-
resolver: zodResolver(schema)
|
|
13017
|
-
});
|
|
13018
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
13019
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
13020
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13021
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13022
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
13023
|
-
] }) })
|
|
13024
|
-
] }) });
|
|
13025
|
-
};
|
|
13026
|
-
const schema = objectType({
|
|
13027
|
-
email: stringType().email()
|
|
13028
|
-
});
|
|
13028
|
+
const schema = addressSchema;
|
|
13029
13029
|
const widgetModule = { widgets: [] };
|
|
13030
13030
|
const routeModule = {
|
|
13031
13031
|
routes: [
|
|
@@ -13047,8 +13047,8 @@ const routeModule = {
|
|
|
13047
13047
|
loader,
|
|
13048
13048
|
children: [
|
|
13049
13049
|
{
|
|
13050
|
-
Component:
|
|
13051
|
-
path: "/draft-orders/:id/
|
|
13050
|
+
Component: CustomItems,
|
|
13051
|
+
path: "/draft-orders/:id/custom-items"
|
|
13052
13052
|
},
|
|
13053
13053
|
{
|
|
13054
13054
|
Component: Email,
|
|
@@ -13074,17 +13074,17 @@ const routeModule = {
|
|
|
13074
13074
|
Component: Shipping,
|
|
13075
13075
|
path: "/draft-orders/:id/shipping"
|
|
13076
13076
|
},
|
|
13077
|
-
{
|
|
13078
|
-
Component: TransferOwnership,
|
|
13079
|
-
path: "/draft-orders/:id/transfer-ownership"
|
|
13080
|
-
},
|
|
13081
13077
|
{
|
|
13082
13078
|
Component: ShippingAddress,
|
|
13083
13079
|
path: "/draft-orders/:id/shipping-address"
|
|
13084
13080
|
},
|
|
13085
13081
|
{
|
|
13086
|
-
Component:
|
|
13087
|
-
path: "/draft-orders/:id/
|
|
13082
|
+
Component: TransferOwnership,
|
|
13083
|
+
path: "/draft-orders/:id/transfer-ownership"
|
|
13084
|
+
},
|
|
13085
|
+
{
|
|
13086
|
+
Component: BillingAddress,
|
|
13087
|
+
path: "/draft-orders/:id/billing-address"
|
|
13088
13088
|
}
|
|
13089
13089
|
]
|
|
13090
13090
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.2-preview-
|
|
3
|
+
"version": "2.10.2-preview-20250901210142",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@hookform/resolvers": "3.4.2",
|
|
39
|
-
"@medusajs/js-sdk": "2.10.2-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.2-preview-20250901210142",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
41
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
42
42
|
"date-fns": "^3.6.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.10.2-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
53
|
-
"@medusajs/types": "2.10.2-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.2-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250901210142",
|
|
49
|
+
"@medusajs/cli": "2.10.2-preview-20250901210142",
|
|
50
|
+
"@medusajs/framework": "2.10.2-preview-20250901210142",
|
|
51
|
+
"@medusajs/icons": "2.10.2-preview-20250901210142",
|
|
52
|
+
"@medusajs/test-utils": "2.10.2-preview-20250901210142",
|
|
53
|
+
"@medusajs/types": "2.10.2-preview-20250901210142",
|
|
54
|
+
"@medusajs/ui": "4.0.22-preview-20250901210142",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.2-preview-20250901210142",
|
|
56
56
|
"@mikro-orm/cli": "6.4.3",
|
|
57
57
|
"@mikro-orm/core": "6.4.3",
|
|
58
58
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"yalc": "^1.0.0-pre.53"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@medusajs/admin-sdk": "2.10.2-preview-
|
|
80
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
81
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
82
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
83
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
84
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
79
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250901210142",
|
|
80
|
+
"@medusajs/cli": "2.10.2-preview-20250901210142",
|
|
81
|
+
"@medusajs/framework": "2.10.2-preview-20250901210142",
|
|
82
|
+
"@medusajs/icons": "2.10.2-preview-20250901210142",
|
|
83
|
+
"@medusajs/test-utils": "2.10.2-preview-20250901210142",
|
|
84
|
+
"@medusajs/ui": "4.0.22-preview-20250901210142",
|
|
85
85
|
"@mikro-orm/cli": "6.4.3",
|
|
86
86
|
"@mikro-orm/core": "6.4.3",
|
|
87
87
|
"@mikro-orm/knex": "6.4.3",
|