@medusajs/draft-order 2.10.4-preview-20250922031739 → 2.10.4-preview-20250922060202
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 +582 -582
- package/.medusa/server/src/admin/index.mjs +582 -582
- package/package.json +16 -16
|
@@ -9567,196 +9567,6 @@ const ID = () => {
|
|
|
9567
9567
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9568
9568
|
] });
|
|
9569
9569
|
};
|
|
9570
|
-
const BillingAddress = () => {
|
|
9571
|
-
const { id } = useParams();
|
|
9572
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9573
|
-
fields: "+billing_address"
|
|
9574
|
-
});
|
|
9575
|
-
if (isError) {
|
|
9576
|
-
throw error;
|
|
9577
|
-
}
|
|
9578
|
-
const isReady = !isPending && !!order;
|
|
9579
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9580
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9581
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9582
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9583
|
-
] }),
|
|
9584
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9585
|
-
] });
|
|
9586
|
-
};
|
|
9587
|
-
const BillingAddressForm = ({ order }) => {
|
|
9588
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9589
|
-
const form = useForm({
|
|
9590
|
-
defaultValues: {
|
|
9591
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9592
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9593
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9594
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9595
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9596
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9597
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9598
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9599
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9600
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9601
|
-
},
|
|
9602
|
-
resolver: zodResolver(schema$5)
|
|
9603
|
-
});
|
|
9604
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9605
|
-
const { handleSuccess } = useRouteModal();
|
|
9606
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9607
|
-
await mutateAsync(
|
|
9608
|
-
{ billing_address: data },
|
|
9609
|
-
{
|
|
9610
|
-
onSuccess: () => {
|
|
9611
|
-
handleSuccess();
|
|
9612
|
-
},
|
|
9613
|
-
onError: (error) => {
|
|
9614
|
-
toast.error(error.message);
|
|
9615
|
-
}
|
|
9616
|
-
}
|
|
9617
|
-
);
|
|
9618
|
-
});
|
|
9619
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9620
|
-
KeyboundForm,
|
|
9621
|
-
{
|
|
9622
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9623
|
-
onSubmit,
|
|
9624
|
-
children: [
|
|
9625
|
-
/* @__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: [
|
|
9626
|
-
/* @__PURE__ */ jsx(
|
|
9627
|
-
Form$2.Field,
|
|
9628
|
-
{
|
|
9629
|
-
control: form.control,
|
|
9630
|
-
name: "country_code",
|
|
9631
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9632
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9633
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9634
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9635
|
-
] })
|
|
9636
|
-
}
|
|
9637
|
-
),
|
|
9638
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9639
|
-
/* @__PURE__ */ jsx(
|
|
9640
|
-
Form$2.Field,
|
|
9641
|
-
{
|
|
9642
|
-
control: form.control,
|
|
9643
|
-
name: "first_name",
|
|
9644
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9645
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9646
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9647
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9648
|
-
] })
|
|
9649
|
-
}
|
|
9650
|
-
),
|
|
9651
|
-
/* @__PURE__ */ jsx(
|
|
9652
|
-
Form$2.Field,
|
|
9653
|
-
{
|
|
9654
|
-
control: form.control,
|
|
9655
|
-
name: "last_name",
|
|
9656
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9657
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9658
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9659
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9660
|
-
] })
|
|
9661
|
-
}
|
|
9662
|
-
)
|
|
9663
|
-
] }),
|
|
9664
|
-
/* @__PURE__ */ jsx(
|
|
9665
|
-
Form$2.Field,
|
|
9666
|
-
{
|
|
9667
|
-
control: form.control,
|
|
9668
|
-
name: "company",
|
|
9669
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9670
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9671
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9672
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9673
|
-
] })
|
|
9674
|
-
}
|
|
9675
|
-
),
|
|
9676
|
-
/* @__PURE__ */ jsx(
|
|
9677
|
-
Form$2.Field,
|
|
9678
|
-
{
|
|
9679
|
-
control: form.control,
|
|
9680
|
-
name: "address_1",
|
|
9681
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9682
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9683
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9684
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9685
|
-
] })
|
|
9686
|
-
}
|
|
9687
|
-
),
|
|
9688
|
-
/* @__PURE__ */ jsx(
|
|
9689
|
-
Form$2.Field,
|
|
9690
|
-
{
|
|
9691
|
-
control: form.control,
|
|
9692
|
-
name: "address_2",
|
|
9693
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9694
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9695
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9696
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9697
|
-
] })
|
|
9698
|
-
}
|
|
9699
|
-
),
|
|
9700
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9701
|
-
/* @__PURE__ */ jsx(
|
|
9702
|
-
Form$2.Field,
|
|
9703
|
-
{
|
|
9704
|
-
control: form.control,
|
|
9705
|
-
name: "postal_code",
|
|
9706
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9707
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9708
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9709
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9710
|
-
] })
|
|
9711
|
-
}
|
|
9712
|
-
),
|
|
9713
|
-
/* @__PURE__ */ jsx(
|
|
9714
|
-
Form$2.Field,
|
|
9715
|
-
{
|
|
9716
|
-
control: form.control,
|
|
9717
|
-
name: "city",
|
|
9718
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9719
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9720
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9721
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9722
|
-
] })
|
|
9723
|
-
}
|
|
9724
|
-
)
|
|
9725
|
-
] }),
|
|
9726
|
-
/* @__PURE__ */ jsx(
|
|
9727
|
-
Form$2.Field,
|
|
9728
|
-
{
|
|
9729
|
-
control: form.control,
|
|
9730
|
-
name: "province",
|
|
9731
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9732
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9733
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9734
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9735
|
-
] })
|
|
9736
|
-
}
|
|
9737
|
-
),
|
|
9738
|
-
/* @__PURE__ */ jsx(
|
|
9739
|
-
Form$2.Field,
|
|
9740
|
-
{
|
|
9741
|
-
control: form.control,
|
|
9742
|
-
name: "phone",
|
|
9743
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9744
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9745
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9746
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9747
|
-
] })
|
|
9748
|
-
}
|
|
9749
|
-
)
|
|
9750
|
-
] }) }),
|
|
9751
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9752
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9753
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9754
|
-
] }) })
|
|
9755
|
-
]
|
|
9756
|
-
}
|
|
9757
|
-
) });
|
|
9758
|
-
};
|
|
9759
|
-
const schema$5 = addressSchema;
|
|
9760
9570
|
const Email = () => {
|
|
9761
9571
|
const { id } = useParams();
|
|
9762
9572
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9779,7 +9589,7 @@ const EmailForm = ({ order }) => {
|
|
|
9779
9589
|
defaultValues: {
|
|
9780
9590
|
email: order.email ?? ""
|
|
9781
9591
|
},
|
|
9782
|
-
resolver: zodResolver(schema$
|
|
9592
|
+
resolver: zodResolver(schema$5)
|
|
9783
9593
|
});
|
|
9784
9594
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9785
9595
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9822,28 +9632,7 @@ const EmailForm = ({ order }) => {
|
|
|
9822
9632
|
}
|
|
9823
9633
|
) });
|
|
9824
9634
|
};
|
|
9825
|
-
const schema$
|
|
9826
|
-
email: stringType().email()
|
|
9827
|
-
});
|
|
9828
|
-
const CustomItems = () => {
|
|
9829
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9830
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9831
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9832
|
-
] });
|
|
9833
|
-
};
|
|
9834
|
-
const CustomItemsForm = () => {
|
|
9835
|
-
const form = useForm({
|
|
9836
|
-
resolver: zodResolver(schema$3)
|
|
9837
|
-
});
|
|
9838
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9839
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9840
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9841
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9842
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9843
|
-
] }) })
|
|
9844
|
-
] }) });
|
|
9845
|
-
};
|
|
9846
|
-
const schema$3 = objectType({
|
|
9635
|
+
const schema$5 = objectType({
|
|
9847
9636
|
email: stringType().email()
|
|
9848
9637
|
});
|
|
9849
9638
|
const NumberInput = forwardRef(
|
|
@@ -10820,50 +10609,400 @@ const customItemSchema = objectType({
|
|
|
10820
10609
|
quantity: numberType(),
|
|
10821
10610
|
unit_price: unionType([numberType(), stringType()])
|
|
10822
10611
|
});
|
|
10823
|
-
const
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
}
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10612
|
+
const InlineTip = forwardRef(
|
|
10613
|
+
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10614
|
+
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
10615
|
+
return /* @__PURE__ */ jsxs(
|
|
10616
|
+
"div",
|
|
10617
|
+
{
|
|
10618
|
+
ref,
|
|
10619
|
+
className: clx(
|
|
10620
|
+
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
10621
|
+
className
|
|
10622
|
+
),
|
|
10623
|
+
...props,
|
|
10624
|
+
children: [
|
|
10625
|
+
/* @__PURE__ */ jsx(
|
|
10626
|
+
"div",
|
|
10627
|
+
{
|
|
10628
|
+
role: "presentation",
|
|
10629
|
+
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
10630
|
+
"bg-ui-tag-orange-icon": variant === "warning"
|
|
10631
|
+
})
|
|
10632
|
+
}
|
|
10633
|
+
),
|
|
10634
|
+
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
10635
|
+
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
10636
|
+
labelValue,
|
|
10637
|
+
":"
|
|
10638
|
+
] }),
|
|
10639
|
+
" ",
|
|
10640
|
+
children
|
|
10641
|
+
] })
|
|
10642
|
+
]
|
|
10643
|
+
}
|
|
10644
|
+
);
|
|
10645
|
+
}
|
|
10646
|
+
);
|
|
10647
|
+
InlineTip.displayName = "InlineTip";
|
|
10648
|
+
const MetadataFieldSchema = objectType({
|
|
10649
|
+
key: stringType(),
|
|
10650
|
+
disabled: booleanType().optional(),
|
|
10651
|
+
value: anyType()
|
|
10652
|
+
});
|
|
10653
|
+
const MetadataSchema = objectType({
|
|
10654
|
+
metadata: arrayType(MetadataFieldSchema)
|
|
10655
|
+
});
|
|
10656
|
+
const Metadata = () => {
|
|
10657
|
+
const { id } = useParams();
|
|
10658
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10659
|
+
fields: "metadata"
|
|
10660
|
+
});
|
|
10661
|
+
if (isError) {
|
|
10662
|
+
throw error;
|
|
10663
|
+
}
|
|
10664
|
+
const isReady = !isPending && !!order;
|
|
10665
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10666
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10667
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
|
|
10668
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
10669
|
+
] }),
|
|
10670
|
+
!isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
10671
|
+
] });
|
|
10672
|
+
};
|
|
10673
|
+
const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
|
|
10674
|
+
const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
|
|
10675
|
+
const MetadataForm = ({ orderId, metadata }) => {
|
|
10676
|
+
const { handleSuccess } = useRouteModal();
|
|
10677
|
+
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
10678
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
10679
|
+
const form = useForm({
|
|
10680
|
+
defaultValues: {
|
|
10681
|
+
metadata: getDefaultValues(metadata)
|
|
10682
|
+
},
|
|
10683
|
+
resolver: zodResolver(MetadataSchema)
|
|
10684
|
+
});
|
|
10685
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
10686
|
+
const parsedData = parseValues(data);
|
|
10687
|
+
await mutateAsync(
|
|
10688
|
+
{
|
|
10689
|
+
metadata: parsedData
|
|
10690
|
+
},
|
|
10691
|
+
{
|
|
10692
|
+
onSuccess: () => {
|
|
10693
|
+
toast.success("Metadata updated");
|
|
10694
|
+
handleSuccess();
|
|
10695
|
+
},
|
|
10696
|
+
onError: (error) => {
|
|
10697
|
+
toast.error(error.message);
|
|
10698
|
+
}
|
|
10699
|
+
}
|
|
10700
|
+
);
|
|
10701
|
+
});
|
|
10702
|
+
const { fields, insert, remove } = useFieldArray({
|
|
10703
|
+
control: form.control,
|
|
10704
|
+
name: "metadata"
|
|
10705
|
+
});
|
|
10706
|
+
function deleteRow(index) {
|
|
10707
|
+
remove(index);
|
|
10708
|
+
if (fields.length === 1) {
|
|
10709
|
+
insert(0, {
|
|
10710
|
+
key: "",
|
|
10711
|
+
value: "",
|
|
10712
|
+
disabled: false
|
|
10713
|
+
});
|
|
10714
|
+
}
|
|
10715
|
+
}
|
|
10716
|
+
function insertRow(index, position) {
|
|
10717
|
+
insert(index + (position === "above" ? 0 : 1), {
|
|
10718
|
+
key: "",
|
|
10719
|
+
value: "",
|
|
10720
|
+
disabled: false
|
|
10721
|
+
});
|
|
10722
|
+
}
|
|
10723
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10724
|
+
KeyboundForm,
|
|
10725
|
+
{
|
|
10726
|
+
onSubmit: handleSubmit,
|
|
10727
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10728
|
+
children: [
|
|
10729
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
|
|
10730
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
|
|
10731
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
|
|
10732
|
+
/* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
|
|
10733
|
+
/* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
|
|
10734
|
+
] }),
|
|
10735
|
+
fields.map((field, index) => {
|
|
10736
|
+
const isDisabled = field.disabled || false;
|
|
10737
|
+
let placeholder = "-";
|
|
10738
|
+
if (typeof field.value === "object") {
|
|
10739
|
+
placeholder = "{ ... }";
|
|
10740
|
+
}
|
|
10741
|
+
if (Array.isArray(field.value)) {
|
|
10742
|
+
placeholder = "[ ... ]";
|
|
10743
|
+
}
|
|
10744
|
+
return /* @__PURE__ */ jsx(
|
|
10745
|
+
ConditionalTooltip,
|
|
10746
|
+
{
|
|
10747
|
+
showTooltip: isDisabled,
|
|
10748
|
+
content: "This row is disabled because it contains non-primitive data.",
|
|
10749
|
+
children: /* @__PURE__ */ jsxs("div", { className: "group/table relative", children: [
|
|
10750
|
+
/* @__PURE__ */ jsxs(
|
|
10751
|
+
"div",
|
|
10752
|
+
{
|
|
10753
|
+
className: clx("grid grid-cols-2 divide-x", {
|
|
10754
|
+
"overflow-hidden rounded-b-lg": index === fields.length - 1
|
|
10755
|
+
}),
|
|
10756
|
+
children: [
|
|
10757
|
+
/* @__PURE__ */ jsx(
|
|
10758
|
+
Form$2.Field,
|
|
10759
|
+
{
|
|
10760
|
+
control: form.control,
|
|
10761
|
+
name: `metadata.${index}.key`,
|
|
10762
|
+
render: ({ field: field2 }) => {
|
|
10763
|
+
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10764
|
+
GridInput,
|
|
10765
|
+
{
|
|
10766
|
+
"aria-labelledby": METADATA_KEY_LABEL_ID,
|
|
10767
|
+
...field2,
|
|
10768
|
+
disabled: isDisabled,
|
|
10769
|
+
placeholder: "Key"
|
|
10770
|
+
}
|
|
10771
|
+
) }) });
|
|
10772
|
+
}
|
|
10773
|
+
}
|
|
10774
|
+
),
|
|
10775
|
+
/* @__PURE__ */ jsx(
|
|
10776
|
+
Form$2.Field,
|
|
10777
|
+
{
|
|
10778
|
+
control: form.control,
|
|
10779
|
+
name: `metadata.${index}.value`,
|
|
10780
|
+
render: ({ field: { value, ...field2 } }) => {
|
|
10781
|
+
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10782
|
+
GridInput,
|
|
10783
|
+
{
|
|
10784
|
+
"aria-labelledby": METADATA_VALUE_LABEL_ID,
|
|
10785
|
+
...field2,
|
|
10786
|
+
value: isDisabled ? placeholder : value,
|
|
10787
|
+
disabled: isDisabled,
|
|
10788
|
+
placeholder: "Value"
|
|
10789
|
+
}
|
|
10790
|
+
) }) });
|
|
10791
|
+
}
|
|
10792
|
+
}
|
|
10793
|
+
)
|
|
10794
|
+
]
|
|
10795
|
+
}
|
|
10796
|
+
),
|
|
10797
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
10798
|
+
/* @__PURE__ */ jsx(
|
|
10799
|
+
DropdownMenu.Trigger,
|
|
10800
|
+
{
|
|
10801
|
+
className: clx(
|
|
10802
|
+
"invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
|
|
10803
|
+
{
|
|
10804
|
+
hidden: isDisabled
|
|
10805
|
+
}
|
|
10806
|
+
),
|
|
10807
|
+
disabled: isDisabled,
|
|
10808
|
+
asChild: true,
|
|
10809
|
+
children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
|
|
10810
|
+
}
|
|
10811
|
+
),
|
|
10812
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
|
|
10813
|
+
/* @__PURE__ */ jsxs(
|
|
10814
|
+
DropdownMenu.Item,
|
|
10815
|
+
{
|
|
10816
|
+
className: "gap-x-2",
|
|
10817
|
+
onClick: () => insertRow(index, "above"),
|
|
10818
|
+
children: [
|
|
10819
|
+
/* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
|
|
10820
|
+
"Insert row above"
|
|
10821
|
+
]
|
|
10822
|
+
}
|
|
10823
|
+
),
|
|
10824
|
+
/* @__PURE__ */ jsxs(
|
|
10825
|
+
DropdownMenu.Item,
|
|
10826
|
+
{
|
|
10827
|
+
className: "gap-x-2",
|
|
10828
|
+
onClick: () => insertRow(index, "below"),
|
|
10829
|
+
children: [
|
|
10830
|
+
/* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
|
|
10831
|
+
"Insert row below"
|
|
10832
|
+
]
|
|
10833
|
+
}
|
|
10834
|
+
),
|
|
10835
|
+
/* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
|
|
10836
|
+
/* @__PURE__ */ jsxs(
|
|
10837
|
+
DropdownMenu.Item,
|
|
10838
|
+
{
|
|
10839
|
+
className: "gap-x-2",
|
|
10840
|
+
onClick: () => deleteRow(index),
|
|
10841
|
+
children: [
|
|
10842
|
+
/* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
|
|
10843
|
+
"Delete row"
|
|
10844
|
+
]
|
|
10845
|
+
}
|
|
10846
|
+
)
|
|
10847
|
+
] })
|
|
10848
|
+
] })
|
|
10849
|
+
] })
|
|
10850
|
+
},
|
|
10851
|
+
field.id
|
|
10852
|
+
);
|
|
10853
|
+
})
|
|
10854
|
+
] }),
|
|
10855
|
+
hasUneditableRows && /* @__PURE__ */ jsx(InlineTip, { variant: "warning", label: "Some rows are disabled", children: "This object contains non-primitive metadata, such as arrays or objects, that can't be edited here. To edit the disabled rows, use the API directly." })
|
|
10856
|
+
] }),
|
|
10857
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
10858
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10859
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10860
|
+
] }) })
|
|
10861
|
+
]
|
|
10862
|
+
}
|
|
10863
|
+
) });
|
|
10864
|
+
};
|
|
10865
|
+
const GridInput = forwardRef(({ className, ...props }, ref) => {
|
|
10866
|
+
return /* @__PURE__ */ jsx(
|
|
10867
|
+
"input",
|
|
10868
|
+
{
|
|
10869
|
+
ref,
|
|
10870
|
+
...props,
|
|
10871
|
+
autoComplete: "off",
|
|
10872
|
+
className: clx(
|
|
10873
|
+
"txt-compact-small text-ui-fg-base placeholder:text-ui-fg-muted disabled:text-ui-fg-disabled disabled:bg-ui-bg-base bg-transparent px-2 py-1.5 outline-none",
|
|
10874
|
+
className
|
|
10875
|
+
)
|
|
10876
|
+
}
|
|
10877
|
+
);
|
|
10878
|
+
});
|
|
10879
|
+
GridInput.displayName = "MetadataForm.GridInput";
|
|
10880
|
+
const PlaceholderInner = () => {
|
|
10881
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
10882
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
|
|
10883
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
10884
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
|
|
10885
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
|
|
10886
|
+
] }) })
|
|
10887
|
+
] });
|
|
10888
|
+
};
|
|
10889
|
+
const EDITABLE_TYPES = ["string", "number", "boolean"];
|
|
10890
|
+
function getDefaultValues(metadata) {
|
|
10891
|
+
if (!metadata || !Object.keys(metadata).length) {
|
|
10892
|
+
return [
|
|
10893
|
+
{
|
|
10894
|
+
key: "",
|
|
10895
|
+
value: "",
|
|
10896
|
+
disabled: false
|
|
10897
|
+
}
|
|
10898
|
+
];
|
|
10899
|
+
}
|
|
10900
|
+
return Object.entries(metadata).map(([key, value]) => {
|
|
10901
|
+
if (!EDITABLE_TYPES.includes(typeof value)) {
|
|
10902
|
+
return {
|
|
10903
|
+
key,
|
|
10904
|
+
value,
|
|
10905
|
+
disabled: true
|
|
10906
|
+
};
|
|
10907
|
+
}
|
|
10908
|
+
let stringValue = value;
|
|
10909
|
+
if (typeof value !== "string") {
|
|
10910
|
+
stringValue = JSON.stringify(value);
|
|
10911
|
+
}
|
|
10912
|
+
return {
|
|
10913
|
+
key,
|
|
10914
|
+
value: stringValue,
|
|
10915
|
+
original_key: key
|
|
10916
|
+
};
|
|
10917
|
+
});
|
|
10918
|
+
}
|
|
10919
|
+
function parseValues(values) {
|
|
10920
|
+
const metadata = values.metadata;
|
|
10921
|
+
const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
|
|
10922
|
+
if (isEmpty) {
|
|
10923
|
+
return null;
|
|
10924
|
+
}
|
|
10925
|
+
const update = {};
|
|
10926
|
+
metadata.forEach((field) => {
|
|
10927
|
+
let key = field.key;
|
|
10928
|
+
let value = field.value;
|
|
10929
|
+
const disabled = field.disabled;
|
|
10930
|
+
if (!key || !value) {
|
|
10931
|
+
return;
|
|
10932
|
+
}
|
|
10933
|
+
if (disabled) {
|
|
10934
|
+
update[key] = value;
|
|
10935
|
+
return;
|
|
10936
|
+
}
|
|
10937
|
+
key = key.trim();
|
|
10938
|
+
value = value.trim();
|
|
10939
|
+
if (value === "true") {
|
|
10940
|
+
update[key] = true;
|
|
10941
|
+
} else if (value === "false") {
|
|
10942
|
+
update[key] = false;
|
|
10943
|
+
} else {
|
|
10944
|
+
const parsedNumber = parseFloat(value);
|
|
10945
|
+
if (!isNaN(parsedNumber)) {
|
|
10946
|
+
update[key] = parsedNumber;
|
|
10947
|
+
} else {
|
|
10948
|
+
update[key] = value;
|
|
10949
|
+
}
|
|
10950
|
+
}
|
|
10951
|
+
});
|
|
10952
|
+
return update;
|
|
10953
|
+
}
|
|
10954
|
+
function getHasUneditableRows(metadata) {
|
|
10955
|
+
if (!metadata) {
|
|
10956
|
+
return false;
|
|
10957
|
+
}
|
|
10958
|
+
return Object.values(metadata).some(
|
|
10959
|
+
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
10960
|
+
);
|
|
10961
|
+
}
|
|
10962
|
+
const PROMOTION_QUERY_KEY = "promotions";
|
|
10963
|
+
const promotionsQueryKeys = {
|
|
10964
|
+
list: (query2) => [
|
|
10965
|
+
PROMOTION_QUERY_KEY,
|
|
10966
|
+
query2 ? query2 : void 0
|
|
10967
|
+
],
|
|
10968
|
+
detail: (id, query2) => [
|
|
10969
|
+
PROMOTION_QUERY_KEY,
|
|
10970
|
+
id,
|
|
10971
|
+
query2 ? query2 : void 0
|
|
10972
|
+
]
|
|
10973
|
+
};
|
|
10974
|
+
const usePromotions = (query2, options) => {
|
|
10975
|
+
const { data, ...rest } = useQuery({
|
|
10976
|
+
queryKey: promotionsQueryKeys.list(query2),
|
|
10977
|
+
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
10978
|
+
...options
|
|
10979
|
+
});
|
|
10980
|
+
return { ...data, ...rest };
|
|
10981
|
+
};
|
|
10982
|
+
const Promotions = () => {
|
|
10983
|
+
const { id } = useParams();
|
|
10984
|
+
const {
|
|
10985
|
+
order: preview,
|
|
10986
|
+
isError: isPreviewError,
|
|
10987
|
+
error: previewError
|
|
10988
|
+
} = useOrderPreview(id, void 0);
|
|
10989
|
+
useInitiateOrderEdit({ preview });
|
|
10990
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
10991
|
+
if (isPreviewError) {
|
|
10992
|
+
throw previewError;
|
|
10993
|
+
}
|
|
10994
|
+
const isReady = !!preview;
|
|
10995
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
10996
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
|
|
10997
|
+
isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
|
|
10998
|
+
] });
|
|
10999
|
+
};
|
|
11000
|
+
const PromotionForm = ({ preview }) => {
|
|
11001
|
+
const { items, shipping_methods } = preview;
|
|
11002
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11003
|
+
const [comboboxValue, setComboboxValue] = useState("");
|
|
11004
|
+
const { handleSuccess } = useRouteModal();
|
|
11005
|
+
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
10867
11006
|
const promoIds = getPromotionIds(items, shipping_methods);
|
|
10868
11007
|
const { promotions, isPending, isError, error } = usePromotions(
|
|
10869
11008
|
{
|
|
@@ -11097,54 +11236,10 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11097
11236
|
}
|
|
11098
11237
|
return Array.from(promotionIds);
|
|
11099
11238
|
}
|
|
11100
|
-
const
|
|
11101
|
-
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
11102
|
-
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
11103
|
-
return /* @__PURE__ */ jsxs(
|
|
11104
|
-
"div",
|
|
11105
|
-
{
|
|
11106
|
-
ref,
|
|
11107
|
-
className: clx(
|
|
11108
|
-
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
11109
|
-
className
|
|
11110
|
-
),
|
|
11111
|
-
...props,
|
|
11112
|
-
children: [
|
|
11113
|
-
/* @__PURE__ */ jsx(
|
|
11114
|
-
"div",
|
|
11115
|
-
{
|
|
11116
|
-
role: "presentation",
|
|
11117
|
-
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
11118
|
-
"bg-ui-tag-orange-icon": variant === "warning"
|
|
11119
|
-
})
|
|
11120
|
-
}
|
|
11121
|
-
),
|
|
11122
|
-
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
11123
|
-
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
11124
|
-
labelValue,
|
|
11125
|
-
":"
|
|
11126
|
-
] }),
|
|
11127
|
-
" ",
|
|
11128
|
-
children
|
|
11129
|
-
] })
|
|
11130
|
-
]
|
|
11131
|
-
}
|
|
11132
|
-
);
|
|
11133
|
-
}
|
|
11134
|
-
);
|
|
11135
|
-
InlineTip.displayName = "InlineTip";
|
|
11136
|
-
const MetadataFieldSchema = objectType({
|
|
11137
|
-
key: stringType(),
|
|
11138
|
-
disabled: booleanType().optional(),
|
|
11139
|
-
value: anyType()
|
|
11140
|
-
});
|
|
11141
|
-
const MetadataSchema = objectType({
|
|
11142
|
-
metadata: arrayType(MetadataFieldSchema)
|
|
11143
|
-
});
|
|
11144
|
-
const Metadata = () => {
|
|
11239
|
+
const BillingAddress = () => {
|
|
11145
11240
|
const { id } = useParams();
|
|
11146
11241
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
11147
|
-
fields: "
|
|
11242
|
+
fields: "+billing_address"
|
|
11148
11243
|
});
|
|
11149
11244
|
if (isError) {
|
|
11150
11245
|
throw error;
|
|
@@ -11152,33 +11247,36 @@ const Metadata = () => {
|
|
|
11152
11247
|
const isReady = !isPending && !!order;
|
|
11153
11248
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11154
11249
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11155
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
11156
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
11250
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
11251
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11157
11252
|
] }),
|
|
11158
|
-
|
|
11253
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
11159
11254
|
] });
|
|
11160
11255
|
};
|
|
11161
|
-
const
|
|
11162
|
-
|
|
11163
|
-
const MetadataForm = ({ orderId, metadata }) => {
|
|
11164
|
-
const { handleSuccess } = useRouteModal();
|
|
11165
|
-
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
11166
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
11256
|
+
const BillingAddressForm = ({ order }) => {
|
|
11257
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11167
11258
|
const form = useForm({
|
|
11168
11259
|
defaultValues: {
|
|
11169
|
-
|
|
11260
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11261
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11262
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11263
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11264
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11265
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11266
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11267
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11268
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11269
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11170
11270
|
},
|
|
11171
|
-
resolver: zodResolver(
|
|
11271
|
+
resolver: zodResolver(schema$4)
|
|
11172
11272
|
});
|
|
11173
|
-
const
|
|
11174
|
-
|
|
11273
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11274
|
+
const { handleSuccess } = useRouteModal();
|
|
11275
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11175
11276
|
await mutateAsync(
|
|
11176
|
-
{
|
|
11177
|
-
metadata: parsedData
|
|
11178
|
-
},
|
|
11277
|
+
{ billing_address: data },
|
|
11179
11278
|
{
|
|
11180
11279
|
onSuccess: () => {
|
|
11181
|
-
toast.success("Metadata updated");
|
|
11182
11280
|
handleSuccess();
|
|
11183
11281
|
},
|
|
11184
11282
|
onError: (error) => {
|
|
@@ -11187,266 +11285,147 @@ const MetadataForm = ({ orderId, metadata }) => {
|
|
|
11187
11285
|
}
|
|
11188
11286
|
);
|
|
11189
11287
|
});
|
|
11190
|
-
const { fields, insert, remove } = useFieldArray({
|
|
11191
|
-
control: form.control,
|
|
11192
|
-
name: "metadata"
|
|
11193
|
-
});
|
|
11194
|
-
function deleteRow(index) {
|
|
11195
|
-
remove(index);
|
|
11196
|
-
if (fields.length === 1) {
|
|
11197
|
-
insert(0, {
|
|
11198
|
-
key: "",
|
|
11199
|
-
value: "",
|
|
11200
|
-
disabled: false
|
|
11201
|
-
});
|
|
11202
|
-
}
|
|
11203
|
-
}
|
|
11204
|
-
function insertRow(index, position) {
|
|
11205
|
-
insert(index + (position === "above" ? 0 : 1), {
|
|
11206
|
-
key: "",
|
|
11207
|
-
value: "",
|
|
11208
|
-
disabled: false
|
|
11209
|
-
});
|
|
11210
|
-
}
|
|
11211
11288
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11212
11289
|
KeyboundForm,
|
|
11213
11290
|
{
|
|
11214
|
-
onSubmit: handleSubmit,
|
|
11215
11291
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
11292
|
+
onSubmit,
|
|
11216
11293
|
children: [
|
|
11217
|
-
/* @__PURE__ */
|
|
11218
|
-
/* @__PURE__ */
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
...field2,
|
|
11256
|
-
disabled: isDisabled,
|
|
11257
|
-
placeholder: "Key"
|
|
11258
|
-
}
|
|
11259
|
-
) }) });
|
|
11260
|
-
}
|
|
11261
|
-
}
|
|
11262
|
-
),
|
|
11263
|
-
/* @__PURE__ */ jsx(
|
|
11264
|
-
Form$2.Field,
|
|
11265
|
-
{
|
|
11266
|
-
control: form.control,
|
|
11267
|
-
name: `metadata.${index}.value`,
|
|
11268
|
-
render: ({ field: { value, ...field2 } }) => {
|
|
11269
|
-
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11270
|
-
GridInput,
|
|
11271
|
-
{
|
|
11272
|
-
"aria-labelledby": METADATA_VALUE_LABEL_ID,
|
|
11273
|
-
...field2,
|
|
11274
|
-
value: isDisabled ? placeholder : value,
|
|
11275
|
-
disabled: isDisabled,
|
|
11276
|
-
placeholder: "Value"
|
|
11277
|
-
}
|
|
11278
|
-
) }) });
|
|
11279
|
-
}
|
|
11280
|
-
}
|
|
11281
|
-
)
|
|
11282
|
-
]
|
|
11283
|
-
}
|
|
11284
|
-
),
|
|
11285
|
-
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
11286
|
-
/* @__PURE__ */ jsx(
|
|
11287
|
-
DropdownMenu.Trigger,
|
|
11288
|
-
{
|
|
11289
|
-
className: clx(
|
|
11290
|
-
"invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
|
|
11291
|
-
{
|
|
11292
|
-
hidden: isDisabled
|
|
11293
|
-
}
|
|
11294
|
-
),
|
|
11295
|
-
disabled: isDisabled,
|
|
11296
|
-
asChild: true,
|
|
11297
|
-
children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
|
|
11298
|
-
}
|
|
11299
|
-
),
|
|
11300
|
-
/* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
|
|
11301
|
-
/* @__PURE__ */ jsxs(
|
|
11302
|
-
DropdownMenu.Item,
|
|
11303
|
-
{
|
|
11304
|
-
className: "gap-x-2",
|
|
11305
|
-
onClick: () => insertRow(index, "above"),
|
|
11306
|
-
children: [
|
|
11307
|
-
/* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
|
|
11308
|
-
"Insert row above"
|
|
11309
|
-
]
|
|
11310
|
-
}
|
|
11311
|
-
),
|
|
11312
|
-
/* @__PURE__ */ jsxs(
|
|
11313
|
-
DropdownMenu.Item,
|
|
11314
|
-
{
|
|
11315
|
-
className: "gap-x-2",
|
|
11316
|
-
onClick: () => insertRow(index, "below"),
|
|
11317
|
-
children: [
|
|
11318
|
-
/* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
|
|
11319
|
-
"Insert row below"
|
|
11320
|
-
]
|
|
11321
|
-
}
|
|
11322
|
-
),
|
|
11323
|
-
/* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
|
|
11324
|
-
/* @__PURE__ */ jsxs(
|
|
11325
|
-
DropdownMenu.Item,
|
|
11326
|
-
{
|
|
11327
|
-
className: "gap-x-2",
|
|
11328
|
-
onClick: () => deleteRow(index),
|
|
11329
|
-
children: [
|
|
11330
|
-
/* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
|
|
11331
|
-
"Delete row"
|
|
11332
|
-
]
|
|
11333
|
-
}
|
|
11334
|
-
)
|
|
11335
|
-
] })
|
|
11336
|
-
] })
|
|
11337
|
-
] })
|
|
11338
|
-
},
|
|
11339
|
-
field.id
|
|
11340
|
-
);
|
|
11341
|
-
})
|
|
11294
|
+
/* @__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: [
|
|
11295
|
+
/* @__PURE__ */ jsx(
|
|
11296
|
+
Form$2.Field,
|
|
11297
|
+
{
|
|
11298
|
+
control: form.control,
|
|
11299
|
+
name: "country_code",
|
|
11300
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11301
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11302
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11303
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11304
|
+
] })
|
|
11305
|
+
}
|
|
11306
|
+
),
|
|
11307
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11308
|
+
/* @__PURE__ */ jsx(
|
|
11309
|
+
Form$2.Field,
|
|
11310
|
+
{
|
|
11311
|
+
control: form.control,
|
|
11312
|
+
name: "first_name",
|
|
11313
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11314
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11315
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11316
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11317
|
+
] })
|
|
11318
|
+
}
|
|
11319
|
+
),
|
|
11320
|
+
/* @__PURE__ */ jsx(
|
|
11321
|
+
Form$2.Field,
|
|
11322
|
+
{
|
|
11323
|
+
control: form.control,
|
|
11324
|
+
name: "last_name",
|
|
11325
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11326
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11327
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11328
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11329
|
+
] })
|
|
11330
|
+
}
|
|
11331
|
+
)
|
|
11342
11332
|
] }),
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11333
|
+
/* @__PURE__ */ jsx(
|
|
11334
|
+
Form$2.Field,
|
|
11335
|
+
{
|
|
11336
|
+
control: form.control,
|
|
11337
|
+
name: "company",
|
|
11338
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11339
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11340
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11341
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11342
|
+
] })
|
|
11343
|
+
}
|
|
11344
|
+
),
|
|
11345
|
+
/* @__PURE__ */ jsx(
|
|
11346
|
+
Form$2.Field,
|
|
11347
|
+
{
|
|
11348
|
+
control: form.control,
|
|
11349
|
+
name: "address_1",
|
|
11350
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11351
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11352
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11353
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11354
|
+
] })
|
|
11355
|
+
}
|
|
11356
|
+
),
|
|
11357
|
+
/* @__PURE__ */ jsx(
|
|
11358
|
+
Form$2.Field,
|
|
11359
|
+
{
|
|
11360
|
+
control: form.control,
|
|
11361
|
+
name: "address_2",
|
|
11362
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11363
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11364
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11365
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11366
|
+
] })
|
|
11367
|
+
}
|
|
11368
|
+
),
|
|
11369
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11370
|
+
/* @__PURE__ */ jsx(
|
|
11371
|
+
Form$2.Field,
|
|
11372
|
+
{
|
|
11373
|
+
control: form.control,
|
|
11374
|
+
name: "postal_code",
|
|
11375
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11376
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11377
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11378
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11379
|
+
] })
|
|
11380
|
+
}
|
|
11381
|
+
),
|
|
11382
|
+
/* @__PURE__ */ jsx(
|
|
11383
|
+
Form$2.Field,
|
|
11384
|
+
{
|
|
11385
|
+
control: form.control,
|
|
11386
|
+
name: "city",
|
|
11387
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11388
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11389
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11390
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11391
|
+
] })
|
|
11392
|
+
}
|
|
11393
|
+
)
|
|
11394
|
+
] }),
|
|
11395
|
+
/* @__PURE__ */ jsx(
|
|
11396
|
+
Form$2.Field,
|
|
11397
|
+
{
|
|
11398
|
+
control: form.control,
|
|
11399
|
+
name: "province",
|
|
11400
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11401
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11402
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11403
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11404
|
+
] })
|
|
11405
|
+
}
|
|
11406
|
+
),
|
|
11407
|
+
/* @__PURE__ */ jsx(
|
|
11408
|
+
Form$2.Field,
|
|
11409
|
+
{
|
|
11410
|
+
control: form.control,
|
|
11411
|
+
name: "phone",
|
|
11412
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11413
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11414
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11415
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11416
|
+
] })
|
|
11417
|
+
}
|
|
11418
|
+
)
|
|
11419
|
+
] }) }),
|
|
11420
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11421
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11347
11422
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11348
11423
|
] }) })
|
|
11349
11424
|
]
|
|
11350
11425
|
}
|
|
11351
11426
|
) });
|
|
11352
11427
|
};
|
|
11353
|
-
const
|
|
11354
|
-
return /* @__PURE__ */ jsx(
|
|
11355
|
-
"input",
|
|
11356
|
-
{
|
|
11357
|
-
ref,
|
|
11358
|
-
...props,
|
|
11359
|
-
autoComplete: "off",
|
|
11360
|
-
className: clx(
|
|
11361
|
-
"txt-compact-small text-ui-fg-base placeholder:text-ui-fg-muted disabled:text-ui-fg-disabled disabled:bg-ui-bg-base bg-transparent px-2 py-1.5 outline-none",
|
|
11362
|
-
className
|
|
11363
|
-
)
|
|
11364
|
-
}
|
|
11365
|
-
);
|
|
11366
|
-
});
|
|
11367
|
-
GridInput.displayName = "MetadataForm.GridInput";
|
|
11368
|
-
const PlaceholderInner = () => {
|
|
11369
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
11370
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
|
|
11371
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
11372
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
|
|
11373
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
|
|
11374
|
-
] }) })
|
|
11375
|
-
] });
|
|
11376
|
-
};
|
|
11377
|
-
const EDITABLE_TYPES = ["string", "number", "boolean"];
|
|
11378
|
-
function getDefaultValues(metadata) {
|
|
11379
|
-
if (!metadata || !Object.keys(metadata).length) {
|
|
11380
|
-
return [
|
|
11381
|
-
{
|
|
11382
|
-
key: "",
|
|
11383
|
-
value: "",
|
|
11384
|
-
disabled: false
|
|
11385
|
-
}
|
|
11386
|
-
];
|
|
11387
|
-
}
|
|
11388
|
-
return Object.entries(metadata).map(([key, value]) => {
|
|
11389
|
-
if (!EDITABLE_TYPES.includes(typeof value)) {
|
|
11390
|
-
return {
|
|
11391
|
-
key,
|
|
11392
|
-
value,
|
|
11393
|
-
disabled: true
|
|
11394
|
-
};
|
|
11395
|
-
}
|
|
11396
|
-
let stringValue = value;
|
|
11397
|
-
if (typeof value !== "string") {
|
|
11398
|
-
stringValue = JSON.stringify(value);
|
|
11399
|
-
}
|
|
11400
|
-
return {
|
|
11401
|
-
key,
|
|
11402
|
-
value: stringValue,
|
|
11403
|
-
original_key: key
|
|
11404
|
-
};
|
|
11405
|
-
});
|
|
11406
|
-
}
|
|
11407
|
-
function parseValues(values) {
|
|
11408
|
-
const metadata = values.metadata;
|
|
11409
|
-
const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
|
|
11410
|
-
if (isEmpty) {
|
|
11411
|
-
return null;
|
|
11412
|
-
}
|
|
11413
|
-
const update = {};
|
|
11414
|
-
metadata.forEach((field) => {
|
|
11415
|
-
let key = field.key;
|
|
11416
|
-
let value = field.value;
|
|
11417
|
-
const disabled = field.disabled;
|
|
11418
|
-
if (!key || !value) {
|
|
11419
|
-
return;
|
|
11420
|
-
}
|
|
11421
|
-
if (disabled) {
|
|
11422
|
-
update[key] = value;
|
|
11423
|
-
return;
|
|
11424
|
-
}
|
|
11425
|
-
key = key.trim();
|
|
11426
|
-
value = value.trim();
|
|
11427
|
-
if (value === "true") {
|
|
11428
|
-
update[key] = true;
|
|
11429
|
-
} else if (value === "false") {
|
|
11430
|
-
update[key] = false;
|
|
11431
|
-
} else {
|
|
11432
|
-
const parsedNumber = parseFloat(value);
|
|
11433
|
-
if (!isNaN(parsedNumber)) {
|
|
11434
|
-
update[key] = parsedNumber;
|
|
11435
|
-
} else {
|
|
11436
|
-
update[key] = value;
|
|
11437
|
-
}
|
|
11438
|
-
}
|
|
11439
|
-
});
|
|
11440
|
-
return update;
|
|
11441
|
-
}
|
|
11442
|
-
function getHasUneditableRows(metadata) {
|
|
11443
|
-
if (!metadata) {
|
|
11444
|
-
return false;
|
|
11445
|
-
}
|
|
11446
|
-
return Object.values(metadata).some(
|
|
11447
|
-
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11448
|
-
);
|
|
11449
|
-
}
|
|
11428
|
+
const schema$4 = addressSchema;
|
|
11450
11429
|
const SalesChannel = () => {
|
|
11451
11430
|
const { id } = useParams();
|
|
11452
11431
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -11475,7 +11454,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11475
11454
|
defaultValues: {
|
|
11476
11455
|
sales_channel_id: order.sales_channel_id || ""
|
|
11477
11456
|
},
|
|
11478
|
-
resolver: zodResolver(schema$
|
|
11457
|
+
resolver: zodResolver(schema$3)
|
|
11479
11458
|
});
|
|
11480
11459
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11481
11460
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11550,7 +11529,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11550
11529
|
}
|
|
11551
11530
|
);
|
|
11552
11531
|
};
|
|
11553
|
-
const schema$
|
|
11532
|
+
const schema$3 = objectType({
|
|
11554
11533
|
sales_channel_id: stringType().min(1)
|
|
11555
11534
|
});
|
|
11556
11535
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12392,7 +12371,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12392
12371
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12393
12372
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12394
12373
|
},
|
|
12395
|
-
resolver: zodResolver(schema$
|
|
12374
|
+
resolver: zodResolver(schema$2)
|
|
12396
12375
|
});
|
|
12397
12376
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12398
12377
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12562,7 +12541,28 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12562
12541
|
}
|
|
12563
12542
|
) });
|
|
12564
12543
|
};
|
|
12565
|
-
const schema$
|
|
12544
|
+
const schema$2 = addressSchema;
|
|
12545
|
+
const CustomItems = () => {
|
|
12546
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12547
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
12548
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
12549
|
+
] });
|
|
12550
|
+
};
|
|
12551
|
+
const CustomItemsForm = () => {
|
|
12552
|
+
const form = useForm({
|
|
12553
|
+
resolver: zodResolver(schema$1)
|
|
12554
|
+
});
|
|
12555
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
12556
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
12557
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12558
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12559
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
12560
|
+
] }) })
|
|
12561
|
+
] }) });
|
|
12562
|
+
};
|
|
12563
|
+
const schema$1 = objectType({
|
|
12564
|
+
email: stringType().email()
|
|
12565
|
+
});
|
|
12566
12566
|
const TransferOwnership = () => {
|
|
12567
12567
|
const { id } = useParams();
|
|
12568
12568
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13059,29 +13059,25 @@ const routeModule = {
|
|
|
13059
13059
|
handle,
|
|
13060
13060
|
loader,
|
|
13061
13061
|
children: [
|
|
13062
|
-
{
|
|
13063
|
-
Component: BillingAddress,
|
|
13064
|
-
path: "/draft-orders/:id/billing-address"
|
|
13065
|
-
},
|
|
13066
13062
|
{
|
|
13067
13063
|
Component: Email,
|
|
13068
13064
|
path: "/draft-orders/:id/email"
|
|
13069
13065
|
},
|
|
13070
|
-
{
|
|
13071
|
-
Component: CustomItems,
|
|
13072
|
-
path: "/draft-orders/:id/custom-items"
|
|
13073
|
-
},
|
|
13074
13066
|
{
|
|
13075
13067
|
Component: Items,
|
|
13076
13068
|
path: "/draft-orders/:id/items"
|
|
13077
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: Metadata,
|
|
13072
|
+
path: "/draft-orders/:id/metadata"
|
|
13073
|
+
},
|
|
13078
13074
|
{
|
|
13079
13075
|
Component: Promotions,
|
|
13080
13076
|
path: "/draft-orders/:id/promotions"
|
|
13081
13077
|
},
|
|
13082
13078
|
{
|
|
13083
|
-
Component:
|
|
13084
|
-
path: "/draft-orders/:id/
|
|
13079
|
+
Component: BillingAddress,
|
|
13080
|
+
path: "/draft-orders/:id/billing-address"
|
|
13085
13081
|
},
|
|
13086
13082
|
{
|
|
13087
13083
|
Component: SalesChannel,
|
|
@@ -13095,6 +13091,10 @@ const routeModule = {
|
|
|
13095
13091
|
Component: ShippingAddress,
|
|
13096
13092
|
path: "/draft-orders/:id/shipping-address"
|
|
13097
13093
|
},
|
|
13094
|
+
{
|
|
13095
|
+
Component: CustomItems,
|
|
13096
|
+
path: "/draft-orders/:id/custom-items"
|
|
13097
|
+
},
|
|
13098
13098
|
{
|
|
13099
13099
|
Component: TransferOwnership,
|
|
13100
13100
|
path: "/draft-orders/:id/transfer-ownership"
|