@medusajs/draft-order 2.10.0-snapshot-20250828080217 → 2.10.0-snapshot-20250828112445
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 +755 -755
- package/.medusa/server/src/admin/index.mjs +756 -756
- package/package.json +23 -26
|
@@ -4,7 +4,7 @@ import { Tooltip, DropdownMenu, clx, IconButton, useDataTable, DataTable as Data
|
|
|
4
4
|
import { useQuery, useQueryClient, useMutation, keepPreviousData, useInfiniteQuery } from "@tanstack/react-query";
|
|
5
5
|
import React, { useState, useCallback, useMemo, Fragment, createContext, forwardRef, useId, useContext, useTransition, useRef, useImperativeHandle, useDeferredValue, useEffect, Suspense } from "react";
|
|
6
6
|
import { useSearchParams, Link, useNavigate, Outlet, useBlocker, useLocation, useParams } from "react-router-dom";
|
|
7
|
-
import { EllipsisHorizontal, XMark, InformationCircleSolid, XMarkMini, TrianglesMini, CheckMini, EllipseMiniSolid, PlusMini, ExclamationCircleSolid, ArrowPath, FlyingBox, CurrencyDollar, Envelope, Channels, Trash, ArrowUpRightOnBox, TriangleDownMini, Check, SquareTwoStack, Photo, TriangleRightMini, Shopping, Buildings, TruckFast, Plus, ReceiptPercent,
|
|
7
|
+
import { EllipsisHorizontal, XMark, InformationCircleSolid, XMarkMini, TrianglesMini, CheckMini, EllipseMiniSolid, PlusMini, ExclamationCircleSolid, ArrowPath, FlyingBox, CurrencyDollar, Envelope, Channels, Trash, ArrowUpRightOnBox, TriangleDownMini, Check, SquareTwoStack, Photo, TriangleRightMini, Shopping, Buildings, TruckFast, Plus, ReceiptPercent, EllipsisVertical, ArrowUpMini, ArrowDownMini, Minus, PencilSquare } from "@medusajs/icons";
|
|
8
8
|
import Medusa from "@medusajs/js-sdk";
|
|
9
9
|
import { format, formatDistance, sub, subDays, subMonths } from "date-fns";
|
|
10
10
|
import { enUS } from "date-fns/locale";
|
|
@@ -9554,27 +9554,6 @@ const ID = () => {
|
|
|
9554
9554
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9555
9555
|
] });
|
|
9556
9556
|
};
|
|
9557
|
-
const CustomItems = () => {
|
|
9558
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9559
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9560
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9561
|
-
] });
|
|
9562
|
-
};
|
|
9563
|
-
const CustomItemsForm = () => {
|
|
9564
|
-
const form = useForm({
|
|
9565
|
-
resolver: zodResolver(schema$5)
|
|
9566
|
-
});
|
|
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
|
-
] }) });
|
|
9574
|
-
};
|
|
9575
|
-
const schema$5 = objectType({
|
|
9576
|
-
email: stringType().email()
|
|
9577
|
-
});
|
|
9578
9557
|
const BillingAddress = () => {
|
|
9579
9558
|
const { id } = useParams();
|
|
9580
9559
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9607,7 +9586,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9607
9586
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9608
9587
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9609
9588
|
},
|
|
9610
|
-
resolver: zodResolver(schema$
|
|
9589
|
+
resolver: zodResolver(schema$5)
|
|
9611
9590
|
});
|
|
9612
9591
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9613
9592
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9764,11 +9743,76 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9764
9743
|
}
|
|
9765
9744
|
) });
|
|
9766
9745
|
};
|
|
9767
|
-
const schema$
|
|
9768
|
-
const
|
|
9746
|
+
const schema$5 = addressSchema;
|
|
9747
|
+
const CustomItems = () => {
|
|
9748
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9749
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9750
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9751
|
+
] });
|
|
9752
|
+
};
|
|
9753
|
+
const CustomItemsForm = () => {
|
|
9754
|
+
const form = useForm({
|
|
9755
|
+
resolver: zodResolver(schema$4)
|
|
9756
|
+
});
|
|
9757
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9758
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9759
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9760
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9761
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9762
|
+
] }) })
|
|
9763
|
+
] }) });
|
|
9764
|
+
};
|
|
9765
|
+
const schema$4 = objectType({
|
|
9766
|
+
email: stringType().email()
|
|
9767
|
+
});
|
|
9768
|
+
const InlineTip = forwardRef(
|
|
9769
|
+
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
9770
|
+
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
9771
|
+
return /* @__PURE__ */ jsxs(
|
|
9772
|
+
"div",
|
|
9773
|
+
{
|
|
9774
|
+
ref,
|
|
9775
|
+
className: clx(
|
|
9776
|
+
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
9777
|
+
className
|
|
9778
|
+
),
|
|
9779
|
+
...props,
|
|
9780
|
+
children: [
|
|
9781
|
+
/* @__PURE__ */ jsx(
|
|
9782
|
+
"div",
|
|
9783
|
+
{
|
|
9784
|
+
role: "presentation",
|
|
9785
|
+
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
9786
|
+
"bg-ui-tag-orange-icon": variant === "warning"
|
|
9787
|
+
})
|
|
9788
|
+
}
|
|
9789
|
+
),
|
|
9790
|
+
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
9791
|
+
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
9792
|
+
labelValue,
|
|
9793
|
+
":"
|
|
9794
|
+
] }),
|
|
9795
|
+
" ",
|
|
9796
|
+
children
|
|
9797
|
+
] })
|
|
9798
|
+
]
|
|
9799
|
+
}
|
|
9800
|
+
);
|
|
9801
|
+
}
|
|
9802
|
+
);
|
|
9803
|
+
InlineTip.displayName = "InlineTip";
|
|
9804
|
+
const MetadataFieldSchema = objectType({
|
|
9805
|
+
key: stringType(),
|
|
9806
|
+
disabled: booleanType().optional(),
|
|
9807
|
+
value: anyType()
|
|
9808
|
+
});
|
|
9809
|
+
const MetadataSchema = objectType({
|
|
9810
|
+
metadata: arrayType(MetadataFieldSchema)
|
|
9811
|
+
});
|
|
9812
|
+
const Metadata = () => {
|
|
9769
9813
|
const { id } = useParams();
|
|
9770
9814
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9771
|
-
fields: "
|
|
9815
|
+
fields: "metadata"
|
|
9772
9816
|
});
|
|
9773
9817
|
if (isError) {
|
|
9774
9818
|
throw error;
|
|
@@ -9776,26 +9820,33 @@ const Email = () => {
|
|
|
9776
9820
|
const isReady = !isPending && !!order;
|
|
9777
9821
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9778
9822
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9779
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "
|
|
9780
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "
|
|
9823
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
|
|
9824
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
9781
9825
|
] }),
|
|
9782
|
-
isReady
|
|
9826
|
+
!isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
9783
9827
|
] });
|
|
9784
9828
|
};
|
|
9785
|
-
const
|
|
9829
|
+
const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
|
|
9830
|
+
const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
|
|
9831
|
+
const MetadataForm = ({ orderId, metadata }) => {
|
|
9832
|
+
const { handleSuccess } = useRouteModal();
|
|
9833
|
+
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
9834
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
9786
9835
|
const form = useForm({
|
|
9787
9836
|
defaultValues: {
|
|
9788
|
-
|
|
9837
|
+
metadata: getDefaultValues(metadata)
|
|
9789
9838
|
},
|
|
9790
|
-
resolver: zodResolver(
|
|
9839
|
+
resolver: zodResolver(MetadataSchema)
|
|
9791
9840
|
});
|
|
9792
|
-
const
|
|
9793
|
-
|
|
9794
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9841
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
9842
|
+
const parsedData = parseValues(data);
|
|
9795
9843
|
await mutateAsync(
|
|
9796
|
-
{
|
|
9844
|
+
{
|
|
9845
|
+
metadata: parsedData
|
|
9846
|
+
},
|
|
9797
9847
|
{
|
|
9798
9848
|
onSuccess: () => {
|
|
9849
|
+
toast.success("Metadata updated");
|
|
9799
9850
|
handleSuccess();
|
|
9800
9851
|
},
|
|
9801
9852
|
onError: (error) => {
|
|
@@ -9804,113 +9855,344 @@ const EmailForm = ({ order }) => {
|
|
|
9804
9855
|
}
|
|
9805
9856
|
);
|
|
9806
9857
|
});
|
|
9858
|
+
const { fields, insert, remove } = useFieldArray({
|
|
9859
|
+
control: form.control,
|
|
9860
|
+
name: "metadata"
|
|
9861
|
+
});
|
|
9862
|
+
function deleteRow(index) {
|
|
9863
|
+
remove(index);
|
|
9864
|
+
if (fields.length === 1) {
|
|
9865
|
+
insert(0, {
|
|
9866
|
+
key: "",
|
|
9867
|
+
value: "",
|
|
9868
|
+
disabled: false
|
|
9869
|
+
});
|
|
9870
|
+
}
|
|
9871
|
+
}
|
|
9872
|
+
function insertRow(index, position) {
|
|
9873
|
+
insert(index + (position === "above" ? 0 : 1), {
|
|
9874
|
+
key: "",
|
|
9875
|
+
value: "",
|
|
9876
|
+
disabled: false
|
|
9877
|
+
});
|
|
9878
|
+
}
|
|
9807
9879
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9808
9880
|
KeyboundForm,
|
|
9809
9881
|
{
|
|
9882
|
+
onSubmit: handleSubmit,
|
|
9810
9883
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9811
|
-
onSubmit,
|
|
9812
9884
|
children: [
|
|
9813
|
-
/* @__PURE__ */
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
}
|
|
9831
|
-
) });
|
|
9832
|
-
};
|
|
9833
|
-
const schema$3 = objectType({
|
|
9834
|
-
email: stringType().email()
|
|
9835
|
-
});
|
|
9836
|
-
const NumberInput = forwardRef(
|
|
9837
|
-
({
|
|
9838
|
-
value,
|
|
9839
|
-
onChange,
|
|
9840
|
-
size = "base",
|
|
9841
|
-
min = 0,
|
|
9842
|
-
max = 100,
|
|
9843
|
-
step = 1,
|
|
9844
|
-
className,
|
|
9845
|
-
disabled,
|
|
9846
|
-
...props
|
|
9847
|
-
}, ref) => {
|
|
9848
|
-
const handleChange = (event) => {
|
|
9849
|
-
const newValue = event.target.value === "" ? min : Number(event.target.value);
|
|
9850
|
-
if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
|
|
9851
|
-
onChange(newValue);
|
|
9852
|
-
}
|
|
9853
|
-
};
|
|
9854
|
-
const handleIncrement = () => {
|
|
9855
|
-
const newValue = value + step;
|
|
9856
|
-
if (max === void 0 || newValue <= max) {
|
|
9857
|
-
onChange(newValue);
|
|
9858
|
-
}
|
|
9859
|
-
};
|
|
9860
|
-
const handleDecrement = () => {
|
|
9861
|
-
const newValue = value - step;
|
|
9862
|
-
if (min === void 0 || newValue >= min) {
|
|
9863
|
-
onChange(newValue);
|
|
9864
|
-
}
|
|
9865
|
-
};
|
|
9866
|
-
return /* @__PURE__ */ jsxs(
|
|
9867
|
-
"div",
|
|
9868
|
-
{
|
|
9869
|
-
className: clx(
|
|
9870
|
-
"inline-flex rounded-md bg-ui-bg-field shadow-borders-base overflow-hidden divide-x transition-fg",
|
|
9871
|
-
"[&:has(input:focus)]:shadow-borders-interactive-with-active",
|
|
9872
|
-
{
|
|
9873
|
-
"h-7": size === "small",
|
|
9874
|
-
"h-8": size === "base"
|
|
9875
|
-
},
|
|
9876
|
-
className
|
|
9877
|
-
),
|
|
9878
|
-
children: [
|
|
9879
|
-
/* @__PURE__ */ jsx(
|
|
9880
|
-
"input",
|
|
9881
|
-
{
|
|
9882
|
-
ref,
|
|
9883
|
-
type: "number",
|
|
9884
|
-
value,
|
|
9885
|
-
onChange: handleChange,
|
|
9886
|
-
min,
|
|
9887
|
-
max,
|
|
9888
|
-
step,
|
|
9889
|
-
className: clx(
|
|
9890
|
-
"flex-1 px-2 py-1 bg-transparent txt-compact-small text-ui-fg-base outline-none [appearance:textfield]",
|
|
9891
|
-
"[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
9892
|
-
"placeholder:text-ui-fg-muted"
|
|
9893
|
-
),
|
|
9894
|
-
...props
|
|
9895
|
-
}
|
|
9896
|
-
),
|
|
9897
|
-
/* @__PURE__ */ jsxs(
|
|
9898
|
-
"button",
|
|
9899
|
-
{
|
|
9900
|
-
className: clx(
|
|
9901
|
-
"flex items-center justify-center outline-none transition-fg",
|
|
9902
|
-
"disabled:cursor-not-allowed disabled:text-ui-fg-muted",
|
|
9903
|
-
"focus:bg-ui-bg-field-component-hover",
|
|
9904
|
-
"hover:bg-ui-bg-field-component-hover",
|
|
9885
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
|
|
9886
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
|
|
9887
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
|
|
9888
|
+
/* @__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" }) }),
|
|
9889
|
+
/* @__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" }) })
|
|
9890
|
+
] }),
|
|
9891
|
+
fields.map((field, index) => {
|
|
9892
|
+
const isDisabled = field.disabled || false;
|
|
9893
|
+
let placeholder = "-";
|
|
9894
|
+
if (typeof field.value === "object") {
|
|
9895
|
+
placeholder = "{ ... }";
|
|
9896
|
+
}
|
|
9897
|
+
if (Array.isArray(field.value)) {
|
|
9898
|
+
placeholder = "[ ... ]";
|
|
9899
|
+
}
|
|
9900
|
+
return /* @__PURE__ */ jsx(
|
|
9901
|
+
ConditionalTooltip,
|
|
9905
9902
|
{
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9903
|
+
showTooltip: isDisabled,
|
|
9904
|
+
content: "This row is disabled because it contains non-primitive data.",
|
|
9905
|
+
children: /* @__PURE__ */ jsxs("div", { className: "group/table relative", children: [
|
|
9906
|
+
/* @__PURE__ */ jsxs(
|
|
9907
|
+
"div",
|
|
9908
|
+
{
|
|
9909
|
+
className: clx("grid grid-cols-2 divide-x", {
|
|
9910
|
+
"overflow-hidden rounded-b-lg": index === fields.length - 1
|
|
9911
|
+
}),
|
|
9912
|
+
children: [
|
|
9913
|
+
/* @__PURE__ */ jsx(
|
|
9914
|
+
Form$2.Field,
|
|
9915
|
+
{
|
|
9916
|
+
control: form.control,
|
|
9917
|
+
name: `metadata.${index}.key`,
|
|
9918
|
+
render: ({ field: field2 }) => {
|
|
9919
|
+
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
9920
|
+
GridInput,
|
|
9921
|
+
{
|
|
9922
|
+
"aria-labelledby": METADATA_KEY_LABEL_ID,
|
|
9923
|
+
...field2,
|
|
9924
|
+
disabled: isDisabled,
|
|
9925
|
+
placeholder: "Key"
|
|
9926
|
+
}
|
|
9927
|
+
) }) });
|
|
9928
|
+
}
|
|
9929
|
+
}
|
|
9930
|
+
),
|
|
9931
|
+
/* @__PURE__ */ jsx(
|
|
9932
|
+
Form$2.Field,
|
|
9933
|
+
{
|
|
9934
|
+
control: form.control,
|
|
9935
|
+
name: `metadata.${index}.value`,
|
|
9936
|
+
render: ({ field: { value, ...field2 } }) => {
|
|
9937
|
+
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
9938
|
+
GridInput,
|
|
9939
|
+
{
|
|
9940
|
+
"aria-labelledby": METADATA_VALUE_LABEL_ID,
|
|
9941
|
+
...field2,
|
|
9942
|
+
value: isDisabled ? placeholder : value,
|
|
9943
|
+
disabled: isDisabled,
|
|
9944
|
+
placeholder: "Value"
|
|
9945
|
+
}
|
|
9946
|
+
) }) });
|
|
9947
|
+
}
|
|
9948
|
+
}
|
|
9949
|
+
)
|
|
9950
|
+
]
|
|
9951
|
+
}
|
|
9952
|
+
),
|
|
9953
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
9954
|
+
/* @__PURE__ */ jsx(
|
|
9955
|
+
DropdownMenu.Trigger,
|
|
9956
|
+
{
|
|
9957
|
+
className: clx(
|
|
9958
|
+
"invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
|
|
9959
|
+
{
|
|
9960
|
+
hidden: isDisabled
|
|
9961
|
+
}
|
|
9962
|
+
),
|
|
9963
|
+
disabled: isDisabled,
|
|
9964
|
+
asChild: true,
|
|
9965
|
+
children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
|
|
9966
|
+
}
|
|
9967
|
+
),
|
|
9968
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
|
|
9969
|
+
/* @__PURE__ */ jsxs(
|
|
9970
|
+
DropdownMenu.Item,
|
|
9971
|
+
{
|
|
9972
|
+
className: "gap-x-2",
|
|
9973
|
+
onClick: () => insertRow(index, "above"),
|
|
9974
|
+
children: [
|
|
9975
|
+
/* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
|
|
9976
|
+
"Insert row above"
|
|
9977
|
+
]
|
|
9978
|
+
}
|
|
9979
|
+
),
|
|
9980
|
+
/* @__PURE__ */ jsxs(
|
|
9981
|
+
DropdownMenu.Item,
|
|
9982
|
+
{
|
|
9983
|
+
className: "gap-x-2",
|
|
9984
|
+
onClick: () => insertRow(index, "below"),
|
|
9985
|
+
children: [
|
|
9986
|
+
/* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
|
|
9987
|
+
"Insert row below"
|
|
9988
|
+
]
|
|
9989
|
+
}
|
|
9990
|
+
),
|
|
9991
|
+
/* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
|
|
9992
|
+
/* @__PURE__ */ jsxs(
|
|
9993
|
+
DropdownMenu.Item,
|
|
9994
|
+
{
|
|
9995
|
+
className: "gap-x-2",
|
|
9996
|
+
onClick: () => deleteRow(index),
|
|
9997
|
+
children: [
|
|
9998
|
+
/* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
|
|
9999
|
+
"Delete row"
|
|
10000
|
+
]
|
|
10001
|
+
}
|
|
10002
|
+
)
|
|
10003
|
+
] })
|
|
10004
|
+
] })
|
|
10005
|
+
] })
|
|
10006
|
+
},
|
|
10007
|
+
field.id
|
|
10008
|
+
);
|
|
10009
|
+
})
|
|
10010
|
+
] }),
|
|
10011
|
+
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." })
|
|
10012
|
+
] }),
|
|
10013
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
10014
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10015
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10016
|
+
] }) })
|
|
10017
|
+
]
|
|
10018
|
+
}
|
|
10019
|
+
) });
|
|
10020
|
+
};
|
|
10021
|
+
const GridInput = forwardRef(({ className, ...props }, ref) => {
|
|
10022
|
+
return /* @__PURE__ */ jsx(
|
|
10023
|
+
"input",
|
|
10024
|
+
{
|
|
10025
|
+
ref,
|
|
10026
|
+
...props,
|
|
10027
|
+
autoComplete: "off",
|
|
10028
|
+
className: clx(
|
|
10029
|
+
"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",
|
|
10030
|
+
className
|
|
10031
|
+
)
|
|
10032
|
+
}
|
|
10033
|
+
);
|
|
10034
|
+
});
|
|
10035
|
+
GridInput.displayName = "MetadataForm.GridInput";
|
|
10036
|
+
const PlaceholderInner = () => {
|
|
10037
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
10038
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
|
|
10039
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
10040
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
|
|
10041
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
|
|
10042
|
+
] }) })
|
|
10043
|
+
] });
|
|
10044
|
+
};
|
|
10045
|
+
const EDITABLE_TYPES = ["string", "number", "boolean"];
|
|
10046
|
+
function getDefaultValues(metadata) {
|
|
10047
|
+
if (!metadata || !Object.keys(metadata).length) {
|
|
10048
|
+
return [
|
|
10049
|
+
{
|
|
10050
|
+
key: "",
|
|
10051
|
+
value: "",
|
|
10052
|
+
disabled: false
|
|
10053
|
+
}
|
|
10054
|
+
];
|
|
10055
|
+
}
|
|
10056
|
+
return Object.entries(metadata).map(([key, value]) => {
|
|
10057
|
+
if (!EDITABLE_TYPES.includes(typeof value)) {
|
|
10058
|
+
return {
|
|
10059
|
+
key,
|
|
10060
|
+
value,
|
|
10061
|
+
disabled: true
|
|
10062
|
+
};
|
|
10063
|
+
}
|
|
10064
|
+
let stringValue = value;
|
|
10065
|
+
if (typeof value !== "string") {
|
|
10066
|
+
stringValue = JSON.stringify(value);
|
|
10067
|
+
}
|
|
10068
|
+
return {
|
|
10069
|
+
key,
|
|
10070
|
+
value: stringValue,
|
|
10071
|
+
original_key: key
|
|
10072
|
+
};
|
|
10073
|
+
});
|
|
10074
|
+
}
|
|
10075
|
+
function parseValues(values) {
|
|
10076
|
+
const metadata = values.metadata;
|
|
10077
|
+
const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
|
|
10078
|
+
if (isEmpty) {
|
|
10079
|
+
return null;
|
|
10080
|
+
}
|
|
10081
|
+
const update = {};
|
|
10082
|
+
metadata.forEach((field) => {
|
|
10083
|
+
let key = field.key;
|
|
10084
|
+
let value = field.value;
|
|
10085
|
+
const disabled = field.disabled;
|
|
10086
|
+
if (!key || !value) {
|
|
10087
|
+
return;
|
|
10088
|
+
}
|
|
10089
|
+
if (disabled) {
|
|
10090
|
+
update[key] = value;
|
|
10091
|
+
return;
|
|
10092
|
+
}
|
|
10093
|
+
key = key.trim();
|
|
10094
|
+
value = value.trim();
|
|
10095
|
+
if (value === "true") {
|
|
10096
|
+
update[key] = true;
|
|
10097
|
+
} else if (value === "false") {
|
|
10098
|
+
update[key] = false;
|
|
10099
|
+
} else {
|
|
10100
|
+
const parsedNumber = parseFloat(value);
|
|
10101
|
+
if (!isNaN(parsedNumber)) {
|
|
10102
|
+
update[key] = parsedNumber;
|
|
10103
|
+
} else {
|
|
10104
|
+
update[key] = value;
|
|
10105
|
+
}
|
|
10106
|
+
}
|
|
10107
|
+
});
|
|
10108
|
+
return update;
|
|
10109
|
+
}
|
|
10110
|
+
function getHasUneditableRows(metadata) {
|
|
10111
|
+
if (!metadata) {
|
|
10112
|
+
return false;
|
|
10113
|
+
}
|
|
10114
|
+
return Object.values(metadata).some(
|
|
10115
|
+
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
10116
|
+
);
|
|
10117
|
+
}
|
|
10118
|
+
const NumberInput = forwardRef(
|
|
10119
|
+
({
|
|
10120
|
+
value,
|
|
10121
|
+
onChange,
|
|
10122
|
+
size = "base",
|
|
10123
|
+
min = 0,
|
|
10124
|
+
max = 100,
|
|
10125
|
+
step = 1,
|
|
10126
|
+
className,
|
|
10127
|
+
disabled,
|
|
10128
|
+
...props
|
|
10129
|
+
}, ref) => {
|
|
10130
|
+
const handleChange = (event) => {
|
|
10131
|
+
const newValue = event.target.value === "" ? min : Number(event.target.value);
|
|
10132
|
+
if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
|
|
10133
|
+
onChange(newValue);
|
|
10134
|
+
}
|
|
10135
|
+
};
|
|
10136
|
+
const handleIncrement = () => {
|
|
10137
|
+
const newValue = value + step;
|
|
10138
|
+
if (max === void 0 || newValue <= max) {
|
|
10139
|
+
onChange(newValue);
|
|
10140
|
+
}
|
|
10141
|
+
};
|
|
10142
|
+
const handleDecrement = () => {
|
|
10143
|
+
const newValue = value - step;
|
|
10144
|
+
if (min === void 0 || newValue >= min) {
|
|
10145
|
+
onChange(newValue);
|
|
10146
|
+
}
|
|
10147
|
+
};
|
|
10148
|
+
return /* @__PURE__ */ jsxs(
|
|
10149
|
+
"div",
|
|
10150
|
+
{
|
|
10151
|
+
className: clx(
|
|
10152
|
+
"inline-flex rounded-md bg-ui-bg-field shadow-borders-base overflow-hidden divide-x transition-fg",
|
|
10153
|
+
"[&:has(input:focus)]:shadow-borders-interactive-with-active",
|
|
10154
|
+
{
|
|
10155
|
+
"h-7": size === "small",
|
|
10156
|
+
"h-8": size === "base"
|
|
10157
|
+
},
|
|
10158
|
+
className
|
|
10159
|
+
),
|
|
10160
|
+
children: [
|
|
10161
|
+
/* @__PURE__ */ jsx(
|
|
10162
|
+
"input",
|
|
10163
|
+
{
|
|
10164
|
+
ref,
|
|
10165
|
+
type: "number",
|
|
10166
|
+
value,
|
|
10167
|
+
onChange: handleChange,
|
|
10168
|
+
min,
|
|
10169
|
+
max,
|
|
10170
|
+
step,
|
|
10171
|
+
className: clx(
|
|
10172
|
+
"flex-1 px-2 py-1 bg-transparent txt-compact-small text-ui-fg-base outline-none [appearance:textfield]",
|
|
10173
|
+
"[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
10174
|
+
"placeholder:text-ui-fg-muted"
|
|
10175
|
+
),
|
|
10176
|
+
...props
|
|
10177
|
+
}
|
|
10178
|
+
),
|
|
10179
|
+
/* @__PURE__ */ jsxs(
|
|
10180
|
+
"button",
|
|
10181
|
+
{
|
|
10182
|
+
className: clx(
|
|
10183
|
+
"flex items-center justify-center outline-none transition-fg",
|
|
10184
|
+
"disabled:cursor-not-allowed disabled:text-ui-fg-muted",
|
|
10185
|
+
"focus:bg-ui-bg-field-component-hover",
|
|
10186
|
+
"hover:bg-ui-bg-field-component-hover",
|
|
10187
|
+
{
|
|
10188
|
+
"size-7": size === "small",
|
|
10189
|
+
"size-8": size === "base"
|
|
10190
|
+
}
|
|
10191
|
+
),
|
|
10192
|
+
type: "button",
|
|
10193
|
+
onClick: handleDecrement,
|
|
10194
|
+
disabled: min !== void 0 && value <= min || disabled,
|
|
10195
|
+
children: [
|
|
9914
10196
|
/* @__PURE__ */ jsx(Minus, {}),
|
|
9915
10197
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: `Decrease by ${step}` })
|
|
9916
10198
|
]
|
|
@@ -10689,474 +10971,124 @@ const useColumns = () => {
|
|
|
10689
10971
|
},
|
|
10690
10972
|
enableSorting: true,
|
|
10691
10973
|
sortAscLabel: "Oldest first",
|
|
10692
|
-
sortDescLabel: "Newest first"
|
|
10693
|
-
})
|
|
10694
|
-
];
|
|
10695
|
-
}, []);
|
|
10696
|
-
};
|
|
10697
|
-
const CustomItemForm = ({ orderId, currencyCode }) => {
|
|
10698
|
-
const { setIsOpen } = useStackedModal();
|
|
10699
|
-
const { mutateAsync: addItems } = useDraftOrderAddItems(orderId);
|
|
10700
|
-
const form = useForm({
|
|
10701
|
-
defaultValues: {
|
|
10702
|
-
title: "",
|
|
10703
|
-
quantity: 1,
|
|
10704
|
-
unit_price: ""
|
|
10705
|
-
},
|
|
10706
|
-
resolver: zodResolver(customItemSchema)
|
|
10707
|
-
});
|
|
10708
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10709
|
-
await addItems(
|
|
10710
|
-
{
|
|
10711
|
-
items: [
|
|
10712
|
-
{
|
|
10713
|
-
title: data.title,
|
|
10714
|
-
quantity: data.quantity,
|
|
10715
|
-
unit_price: convertNumber(data.unit_price)
|
|
10716
|
-
}
|
|
10717
|
-
]
|
|
10718
|
-
},
|
|
10719
|
-
{
|
|
10720
|
-
onSuccess: () => {
|
|
10721
|
-
setIsOpen(STACKED_MODAL_ID, false);
|
|
10722
|
-
},
|
|
10723
|
-
onError: (e) => {
|
|
10724
|
-
toast.error(e.message);
|
|
10725
|
-
}
|
|
10726
|
-
}
|
|
10727
|
-
);
|
|
10728
|
-
});
|
|
10729
|
-
return /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsx(KeyboundForm, { onSubmit, children: /* @__PURE__ */ jsxs(StackedFocusModal.Content, { children: [
|
|
10730
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
10731
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-2 py-16", children: [
|
|
10732
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10733
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Add custom item" }) }),
|
|
10734
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a custom item to the order. This will add a new line item that is not associated with an existing product." }) })
|
|
10735
|
-
] }),
|
|
10736
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10737
|
-
/* @__PURE__ */ jsx(
|
|
10738
|
-
Form$2.Field,
|
|
10739
|
-
{
|
|
10740
|
-
control: form.control,
|
|
10741
|
-
name: "title",
|
|
10742
|
-
render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
10743
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10744
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Title" }),
|
|
10745
|
-
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the title of the item" })
|
|
10746
|
-
] }),
|
|
10747
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10748
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10749
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10750
|
-
] })
|
|
10751
|
-
] }) })
|
|
10752
|
-
}
|
|
10753
|
-
),
|
|
10754
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10755
|
-
/* @__PURE__ */ jsx(
|
|
10756
|
-
Form$2.Field,
|
|
10757
|
-
{
|
|
10758
|
-
control: form.control,
|
|
10759
|
-
name: "unit_price",
|
|
10760
|
-
render: ({ field: { onChange, ...field } }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
10761
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10762
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Unit price" }),
|
|
10763
|
-
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the unit price of the item" })
|
|
10764
|
-
] }),
|
|
10765
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10766
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10767
|
-
CurrencyInput,
|
|
10768
|
-
{
|
|
10769
|
-
symbol: getNativeSymbol(currencyCode),
|
|
10770
|
-
code: currencyCode,
|
|
10771
|
-
onValueChange: (_value, _name, values) => onChange(values == null ? void 0 : values.value),
|
|
10772
|
-
...field
|
|
10773
|
-
}
|
|
10774
|
-
) }),
|
|
10775
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10776
|
-
] })
|
|
10777
|
-
] }) })
|
|
10778
|
-
}
|
|
10779
|
-
),
|
|
10780
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10781
|
-
/* @__PURE__ */ jsx(
|
|
10782
|
-
Form$2.Field,
|
|
10783
|
-
{
|
|
10784
|
-
control: form.control,
|
|
10785
|
-
name: "quantity",
|
|
10786
|
-
render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
10787
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10788
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Quantity" }),
|
|
10789
|
-
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
|
|
10790
|
-
] }),
|
|
10791
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 w-full", children: [
|
|
10792
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsx(NumberInput, { ...field, className: "w-full" }) }) }),
|
|
10793
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10794
|
-
] })
|
|
10795
|
-
] }) })
|
|
10796
|
-
}
|
|
10797
|
-
)
|
|
10798
|
-
] }) }) }),
|
|
10799
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
|
|
10800
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10801
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
|
|
10802
|
-
] }) })
|
|
10803
|
-
] }) }) });
|
|
10804
|
-
};
|
|
10805
|
-
const customItemSchema = objectType({
|
|
10806
|
-
title: stringType().min(1),
|
|
10807
|
-
quantity: numberType(),
|
|
10808
|
-
unit_price: unionType([numberType(), stringType()])
|
|
10809
|
-
});
|
|
10810
|
-
const InlineTip = forwardRef(
|
|
10811
|
-
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10812
|
-
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
10813
|
-
return /* @__PURE__ */ jsxs(
|
|
10814
|
-
"div",
|
|
10815
|
-
{
|
|
10816
|
-
ref,
|
|
10817
|
-
className: clx(
|
|
10818
|
-
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
10819
|
-
className
|
|
10820
|
-
),
|
|
10821
|
-
...props,
|
|
10822
|
-
children: [
|
|
10823
|
-
/* @__PURE__ */ jsx(
|
|
10824
|
-
"div",
|
|
10825
|
-
{
|
|
10826
|
-
role: "presentation",
|
|
10827
|
-
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
10828
|
-
"bg-ui-tag-orange-icon": variant === "warning"
|
|
10829
|
-
})
|
|
10830
|
-
}
|
|
10831
|
-
),
|
|
10832
|
-
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
10833
|
-
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
10834
|
-
labelValue,
|
|
10835
|
-
":"
|
|
10836
|
-
] }),
|
|
10837
|
-
" ",
|
|
10838
|
-
children
|
|
10839
|
-
] })
|
|
10840
|
-
]
|
|
10841
|
-
}
|
|
10842
|
-
);
|
|
10843
|
-
}
|
|
10844
|
-
);
|
|
10845
|
-
InlineTip.displayName = "InlineTip";
|
|
10846
|
-
const MetadataFieldSchema = objectType({
|
|
10847
|
-
key: stringType(),
|
|
10848
|
-
disabled: booleanType().optional(),
|
|
10849
|
-
value: anyType()
|
|
10850
|
-
});
|
|
10851
|
-
const MetadataSchema = objectType({
|
|
10852
|
-
metadata: arrayType(MetadataFieldSchema)
|
|
10853
|
-
});
|
|
10854
|
-
const Metadata = () => {
|
|
10855
|
-
const { id } = useParams();
|
|
10856
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10857
|
-
fields: "metadata"
|
|
10858
|
-
});
|
|
10859
|
-
if (isError) {
|
|
10860
|
-
throw error;
|
|
10861
|
-
}
|
|
10862
|
-
const isReady = !isPending && !!order;
|
|
10863
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10864
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10865
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
|
|
10866
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
10867
|
-
] }),
|
|
10868
|
-
!isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
10869
|
-
] });
|
|
10870
|
-
};
|
|
10871
|
-
const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
|
|
10872
|
-
const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
|
|
10873
|
-
const MetadataForm = ({ orderId, metadata }) => {
|
|
10874
|
-
const { handleSuccess } = useRouteModal();
|
|
10875
|
-
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
10876
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
10974
|
+
sortDescLabel: "Newest first"
|
|
10975
|
+
})
|
|
10976
|
+
];
|
|
10977
|
+
}, []);
|
|
10978
|
+
};
|
|
10979
|
+
const CustomItemForm = ({ orderId, currencyCode }) => {
|
|
10980
|
+
const { setIsOpen } = useStackedModal();
|
|
10981
|
+
const { mutateAsync: addItems } = useDraftOrderAddItems(orderId);
|
|
10877
10982
|
const form = useForm({
|
|
10878
10983
|
defaultValues: {
|
|
10879
|
-
|
|
10984
|
+
title: "",
|
|
10985
|
+
quantity: 1,
|
|
10986
|
+
unit_price: ""
|
|
10880
10987
|
},
|
|
10881
|
-
resolver: zodResolver(
|
|
10988
|
+
resolver: zodResolver(customItemSchema)
|
|
10882
10989
|
});
|
|
10883
|
-
const
|
|
10884
|
-
|
|
10885
|
-
await mutateAsync(
|
|
10990
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10991
|
+
await addItems(
|
|
10886
10992
|
{
|
|
10887
|
-
|
|
10993
|
+
items: [
|
|
10994
|
+
{
|
|
10995
|
+
title: data.title,
|
|
10996
|
+
quantity: data.quantity,
|
|
10997
|
+
unit_price: convertNumber(data.unit_price)
|
|
10998
|
+
}
|
|
10999
|
+
]
|
|
10888
11000
|
},
|
|
10889
11001
|
{
|
|
10890
11002
|
onSuccess: () => {
|
|
10891
|
-
|
|
10892
|
-
handleSuccess();
|
|
11003
|
+
setIsOpen(STACKED_MODAL_ID, false);
|
|
10893
11004
|
},
|
|
10894
|
-
onError: (
|
|
10895
|
-
toast.error(
|
|
11005
|
+
onError: (e) => {
|
|
11006
|
+
toast.error(e.message);
|
|
10896
11007
|
}
|
|
10897
11008
|
}
|
|
10898
11009
|
);
|
|
10899
11010
|
});
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
value: "",
|
|
10918
|
-
disabled: false
|
|
10919
|
-
});
|
|
10920
|
-
}
|
|
10921
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10922
|
-
KeyboundForm,
|
|
10923
|
-
{
|
|
10924
|
-
onSubmit: handleSubmit,
|
|
10925
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10926
|
-
children: [
|
|
10927
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
|
|
10928
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
|
|
10929
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
|
|
10930
|
-
/* @__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" }) }),
|
|
10931
|
-
/* @__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" }) })
|
|
11011
|
+
return /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsx(KeyboundForm, { onSubmit, children: /* @__PURE__ */ jsxs(StackedFocusModal.Content, { children: [
|
|
11012
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
11013
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-2 py-16", children: [
|
|
11014
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11015
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Add custom item" }) }),
|
|
11016
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a custom item to the order. This will add a new line item that is not associated with an existing product." }) })
|
|
11017
|
+
] }),
|
|
11018
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11019
|
+
/* @__PURE__ */ jsx(
|
|
11020
|
+
Form$2.Field,
|
|
11021
|
+
{
|
|
11022
|
+
control: form.control,
|
|
11023
|
+
name: "title",
|
|
11024
|
+
render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
11025
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11026
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Title" }),
|
|
11027
|
+
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the title of the item" })
|
|
10932
11028
|
] }),
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
11029
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11030
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11031
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11032
|
+
] })
|
|
11033
|
+
] }) })
|
|
11034
|
+
}
|
|
11035
|
+
),
|
|
11036
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11037
|
+
/* @__PURE__ */ jsx(
|
|
11038
|
+
Form$2.Field,
|
|
11039
|
+
{
|
|
11040
|
+
control: form.control,
|
|
11041
|
+
name: "unit_price",
|
|
11042
|
+
render: ({ field: { onChange, ...field } }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
11043
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11044
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Unit price" }),
|
|
11045
|
+
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the unit price of the item" })
|
|
11046
|
+
] }),
|
|
11047
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11048
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11049
|
+
CurrencyInput,
|
|
10944
11050
|
{
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
/* @__PURE__ */ jsx(
|
|
10974
|
-
Form$2.Field,
|
|
10975
|
-
{
|
|
10976
|
-
control: form.control,
|
|
10977
|
-
name: `metadata.${index}.value`,
|
|
10978
|
-
render: ({ field: { value, ...field2 } }) => {
|
|
10979
|
-
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10980
|
-
GridInput,
|
|
10981
|
-
{
|
|
10982
|
-
"aria-labelledby": METADATA_VALUE_LABEL_ID,
|
|
10983
|
-
...field2,
|
|
10984
|
-
value: isDisabled ? placeholder : value,
|
|
10985
|
-
disabled: isDisabled,
|
|
10986
|
-
placeholder: "Value"
|
|
10987
|
-
}
|
|
10988
|
-
) }) });
|
|
10989
|
-
}
|
|
10990
|
-
}
|
|
10991
|
-
)
|
|
10992
|
-
]
|
|
10993
|
-
}
|
|
10994
|
-
),
|
|
10995
|
-
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
10996
|
-
/* @__PURE__ */ jsx(
|
|
10997
|
-
DropdownMenu.Trigger,
|
|
10998
|
-
{
|
|
10999
|
-
className: clx(
|
|
11000
|
-
"invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
|
|
11001
|
-
{
|
|
11002
|
-
hidden: isDisabled
|
|
11003
|
-
}
|
|
11004
|
-
),
|
|
11005
|
-
disabled: isDisabled,
|
|
11006
|
-
asChild: true,
|
|
11007
|
-
children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
|
|
11008
|
-
}
|
|
11009
|
-
),
|
|
11010
|
-
/* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
|
|
11011
|
-
/* @__PURE__ */ jsxs(
|
|
11012
|
-
DropdownMenu.Item,
|
|
11013
|
-
{
|
|
11014
|
-
className: "gap-x-2",
|
|
11015
|
-
onClick: () => insertRow(index, "above"),
|
|
11016
|
-
children: [
|
|
11017
|
-
/* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
|
|
11018
|
-
"Insert row above"
|
|
11019
|
-
]
|
|
11020
|
-
}
|
|
11021
|
-
),
|
|
11022
|
-
/* @__PURE__ */ jsxs(
|
|
11023
|
-
DropdownMenu.Item,
|
|
11024
|
-
{
|
|
11025
|
-
className: "gap-x-2",
|
|
11026
|
-
onClick: () => insertRow(index, "below"),
|
|
11027
|
-
children: [
|
|
11028
|
-
/* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
|
|
11029
|
-
"Insert row below"
|
|
11030
|
-
]
|
|
11031
|
-
}
|
|
11032
|
-
),
|
|
11033
|
-
/* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
|
|
11034
|
-
/* @__PURE__ */ jsxs(
|
|
11035
|
-
DropdownMenu.Item,
|
|
11036
|
-
{
|
|
11037
|
-
className: "gap-x-2",
|
|
11038
|
-
onClick: () => deleteRow(index),
|
|
11039
|
-
children: [
|
|
11040
|
-
/* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
|
|
11041
|
-
"Delete row"
|
|
11042
|
-
]
|
|
11043
|
-
}
|
|
11044
|
-
)
|
|
11045
|
-
] })
|
|
11046
|
-
] })
|
|
11047
|
-
] })
|
|
11048
|
-
},
|
|
11049
|
-
field.id
|
|
11050
|
-
);
|
|
11051
|
-
})
|
|
11052
|
-
] }),
|
|
11053
|
-
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." })
|
|
11054
|
-
] }),
|
|
11055
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
11056
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
11057
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11058
|
-
] }) })
|
|
11059
|
-
]
|
|
11060
|
-
}
|
|
11061
|
-
) });
|
|
11062
|
-
};
|
|
11063
|
-
const GridInput = forwardRef(({ className, ...props }, ref) => {
|
|
11064
|
-
return /* @__PURE__ */ jsx(
|
|
11065
|
-
"input",
|
|
11066
|
-
{
|
|
11067
|
-
ref,
|
|
11068
|
-
...props,
|
|
11069
|
-
autoComplete: "off",
|
|
11070
|
-
className: clx(
|
|
11071
|
-
"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",
|
|
11072
|
-
className
|
|
11051
|
+
symbol: getNativeSymbol(currencyCode),
|
|
11052
|
+
code: currencyCode,
|
|
11053
|
+
onValueChange: (_value, _name, values) => onChange(values == null ? void 0 : values.value),
|
|
11054
|
+
...field
|
|
11055
|
+
}
|
|
11056
|
+
) }),
|
|
11057
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11058
|
+
] })
|
|
11059
|
+
] }) })
|
|
11060
|
+
}
|
|
11061
|
+
),
|
|
11062
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11063
|
+
/* @__PURE__ */ jsx(
|
|
11064
|
+
Form$2.Field,
|
|
11065
|
+
{
|
|
11066
|
+
control: form.control,
|
|
11067
|
+
name: "quantity",
|
|
11068
|
+
render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
11069
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11070
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Quantity" }),
|
|
11071
|
+
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
|
|
11072
|
+
] }),
|
|
11073
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 w-full", children: [
|
|
11074
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsx(NumberInput, { ...field, className: "w-full" }) }) }),
|
|
11075
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11076
|
+
] })
|
|
11077
|
+
] }) })
|
|
11078
|
+
}
|
|
11073
11079
|
)
|
|
11074
|
-
}
|
|
11075
|
-
|
|
11076
|
-
})
|
|
11077
|
-
|
|
11078
|
-
const PlaceholderInner = () => {
|
|
11079
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
11080
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
|
|
11081
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
11082
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
|
|
11083
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
|
|
11080
|
+
] }) }) }),
|
|
11081
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
|
|
11082
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
11083
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
|
|
11084
11084
|
] }) })
|
|
11085
|
-
] });
|
|
11085
|
+
] }) }) });
|
|
11086
11086
|
};
|
|
11087
|
-
const
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11092
|
-
key: "",
|
|
11093
|
-
value: "",
|
|
11094
|
-
disabled: false
|
|
11095
|
-
}
|
|
11096
|
-
];
|
|
11097
|
-
}
|
|
11098
|
-
return Object.entries(metadata).map(([key, value]) => {
|
|
11099
|
-
if (!EDITABLE_TYPES.includes(typeof value)) {
|
|
11100
|
-
return {
|
|
11101
|
-
key,
|
|
11102
|
-
value,
|
|
11103
|
-
disabled: true
|
|
11104
|
-
};
|
|
11105
|
-
}
|
|
11106
|
-
let stringValue = value;
|
|
11107
|
-
if (typeof value !== "string") {
|
|
11108
|
-
stringValue = JSON.stringify(value);
|
|
11109
|
-
}
|
|
11110
|
-
return {
|
|
11111
|
-
key,
|
|
11112
|
-
value: stringValue,
|
|
11113
|
-
original_key: key
|
|
11114
|
-
};
|
|
11115
|
-
});
|
|
11116
|
-
}
|
|
11117
|
-
function parseValues(values) {
|
|
11118
|
-
const metadata = values.metadata;
|
|
11119
|
-
const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
|
|
11120
|
-
if (isEmpty) {
|
|
11121
|
-
return null;
|
|
11122
|
-
}
|
|
11123
|
-
const update = {};
|
|
11124
|
-
metadata.forEach((field) => {
|
|
11125
|
-
let key = field.key;
|
|
11126
|
-
let value = field.value;
|
|
11127
|
-
const disabled = field.disabled;
|
|
11128
|
-
if (!key || !value) {
|
|
11129
|
-
return;
|
|
11130
|
-
}
|
|
11131
|
-
if (disabled) {
|
|
11132
|
-
update[key] = value;
|
|
11133
|
-
return;
|
|
11134
|
-
}
|
|
11135
|
-
key = key.trim();
|
|
11136
|
-
value = value.trim();
|
|
11137
|
-
if (value === "true") {
|
|
11138
|
-
update[key] = true;
|
|
11139
|
-
} else if (value === "false") {
|
|
11140
|
-
update[key] = false;
|
|
11141
|
-
} else {
|
|
11142
|
-
const parsedNumber = parseFloat(value);
|
|
11143
|
-
if (!isNaN(parsedNumber)) {
|
|
11144
|
-
update[key] = parsedNumber;
|
|
11145
|
-
} else {
|
|
11146
|
-
update[key] = value;
|
|
11147
|
-
}
|
|
11148
|
-
}
|
|
11149
|
-
});
|
|
11150
|
-
return update;
|
|
11151
|
-
}
|
|
11152
|
-
function getHasUneditableRows(metadata) {
|
|
11153
|
-
if (!metadata) {
|
|
11154
|
-
return false;
|
|
11155
|
-
}
|
|
11156
|
-
return Object.values(metadata).some(
|
|
11157
|
-
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11158
|
-
);
|
|
11159
|
-
}
|
|
11087
|
+
const customItemSchema = objectType({
|
|
11088
|
+
title: stringType().min(1),
|
|
11089
|
+
quantity: numberType(),
|
|
11090
|
+
unit_price: unionType([numberType(), stringType()])
|
|
11091
|
+
});
|
|
11160
11092
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11161
11093
|
const promotionsQueryKeys = {
|
|
11162
11094
|
list: (query2) => [
|
|
@@ -11387,159 +11319,53 @@ const PromotionItem = ({
|
|
|
11387
11319
|
function getDisplayValue(promotion) {
|
|
11388
11320
|
var _a, _b, _c, _d;
|
|
11389
11321
|
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
11390
|
-
if (!value) {
|
|
11391
|
-
return null;
|
|
11392
|
-
}
|
|
11393
|
-
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
11394
|
-
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
11395
|
-
if (!currency) {
|
|
11396
|
-
return null;
|
|
11397
|
-
}
|
|
11398
|
-
return getLocaleAmount(value, currency);
|
|
11399
|
-
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
11400
|
-
return formatPercentage(value);
|
|
11401
|
-
}
|
|
11402
|
-
return null;
|
|
11403
|
-
}
|
|
11404
|
-
const formatter = new Intl.NumberFormat([], {
|
|
11405
|
-
style: "percent",
|
|
11406
|
-
minimumFractionDigits: 2
|
|
11407
|
-
});
|
|
11408
|
-
const formatPercentage = (value, isPercentageValue = false) => {
|
|
11409
|
-
let val = value || 0;
|
|
11410
|
-
if (!isPercentageValue) {
|
|
11411
|
-
val = val / 100;
|
|
11412
|
-
}
|
|
11413
|
-
return formatter.format(val);
|
|
11414
|
-
};
|
|
11415
|
-
function getPromotionCodes(items, shippingMethods) {
|
|
11416
|
-
const codes = /* @__PURE__ */ new Set();
|
|
11417
|
-
for (const item of items) {
|
|
11418
|
-
if (item.adjustments) {
|
|
11419
|
-
for (const adjustment of item.adjustments) {
|
|
11420
|
-
if (adjustment.code) {
|
|
11421
|
-
codes.add(adjustment.code);
|
|
11422
|
-
}
|
|
11423
|
-
}
|
|
11424
|
-
}
|
|
11425
|
-
}
|
|
11426
|
-
for (const shippingMethod of shippingMethods) {
|
|
11427
|
-
if (shippingMethod.adjustments) {
|
|
11428
|
-
for (const adjustment of shippingMethod.adjustments) {
|
|
11429
|
-
if (adjustment.code) {
|
|
11430
|
-
codes.add(adjustment.code);
|
|
11431
|
-
}
|
|
11432
|
-
}
|
|
11433
|
-
}
|
|
11434
|
-
}
|
|
11435
|
-
return Array.from(codes);
|
|
11436
|
-
}
|
|
11437
|
-
const SalesChannel = () => {
|
|
11438
|
-
const { id } = useParams();
|
|
11439
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11440
|
-
id,
|
|
11441
|
-
{
|
|
11442
|
-
fields: "+sales_channel_id"
|
|
11443
|
-
},
|
|
11444
|
-
{
|
|
11445
|
-
enabled: !!id
|
|
11446
|
-
}
|
|
11447
|
-
);
|
|
11448
|
-
if (isError) {
|
|
11449
|
-
throw error;
|
|
11450
|
-
}
|
|
11451
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
11452
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11453
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11454
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11455
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11456
|
-
] }),
|
|
11457
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11458
|
-
] });
|
|
11459
|
-
};
|
|
11460
|
-
const SalesChannelForm = ({ order }) => {
|
|
11461
|
-
const form = useForm({
|
|
11462
|
-
defaultValues: {
|
|
11463
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
11464
|
-
},
|
|
11465
|
-
resolver: zodResolver(schema$2)
|
|
11466
|
-
});
|
|
11467
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11468
|
-
const { handleSuccess } = useRouteModal();
|
|
11469
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11470
|
-
await mutateAsync(
|
|
11471
|
-
{
|
|
11472
|
-
sales_channel_id: data.sales_channel_id
|
|
11473
|
-
},
|
|
11474
|
-
{
|
|
11475
|
-
onSuccess: () => {
|
|
11476
|
-
toast.success("Sales channel updated");
|
|
11477
|
-
handleSuccess();
|
|
11478
|
-
},
|
|
11479
|
-
onError: (error) => {
|
|
11480
|
-
toast.error(error.message);
|
|
11481
|
-
}
|
|
11482
|
-
}
|
|
11483
|
-
);
|
|
11484
|
-
});
|
|
11485
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11486
|
-
KeyboundForm,
|
|
11487
|
-
{
|
|
11488
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11489
|
-
onSubmit,
|
|
11490
|
-
children: [
|
|
11491
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11492
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11493
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11494
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11495
|
-
] }) })
|
|
11496
|
-
]
|
|
11497
|
-
}
|
|
11498
|
-
) });
|
|
11499
|
-
};
|
|
11500
|
-
const SalesChannelField = ({ control, order }) => {
|
|
11501
|
-
const salesChannels = useComboboxData({
|
|
11502
|
-
queryFn: async (params) => {
|
|
11503
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11504
|
-
},
|
|
11505
|
-
queryKey: ["sales-channels"],
|
|
11506
|
-
getOptions: (data) => {
|
|
11507
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11508
|
-
label: salesChannel.name,
|
|
11509
|
-
value: salesChannel.id
|
|
11510
|
-
}));
|
|
11511
|
-
},
|
|
11512
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11513
|
-
});
|
|
11514
|
-
return /* @__PURE__ */ jsx(
|
|
11515
|
-
Form$2.Field,
|
|
11516
|
-
{
|
|
11517
|
-
control,
|
|
11518
|
-
name: "sales_channel_id",
|
|
11519
|
-
render: ({ field }) => {
|
|
11520
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11521
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11522
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11523
|
-
Combobox,
|
|
11524
|
-
{
|
|
11525
|
-
options: salesChannels.options,
|
|
11526
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11527
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11528
|
-
searchValue: salesChannels.searchValue,
|
|
11529
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11530
|
-
placeholder: "Select sales channel",
|
|
11531
|
-
...field
|
|
11532
|
-
}
|
|
11533
|
-
) }),
|
|
11534
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11535
|
-
] });
|
|
11536
|
-
}
|
|
11322
|
+
if (!value) {
|
|
11323
|
+
return null;
|
|
11324
|
+
}
|
|
11325
|
+
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
11326
|
+
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
11327
|
+
if (!currency) {
|
|
11328
|
+
return null;
|
|
11537
11329
|
}
|
|
11538
|
-
|
|
11539
|
-
}
|
|
11540
|
-
|
|
11541
|
-
|
|
11330
|
+
return getLocaleAmount(value, currency);
|
|
11331
|
+
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
11332
|
+
return formatPercentage(value);
|
|
11333
|
+
}
|
|
11334
|
+
return null;
|
|
11335
|
+
}
|
|
11336
|
+
const formatter = new Intl.NumberFormat([], {
|
|
11337
|
+
style: "percent",
|
|
11338
|
+
minimumFractionDigits: 2
|
|
11542
11339
|
});
|
|
11340
|
+
const formatPercentage = (value, isPercentageValue = false) => {
|
|
11341
|
+
let val = value || 0;
|
|
11342
|
+
if (!isPercentageValue) {
|
|
11343
|
+
val = val / 100;
|
|
11344
|
+
}
|
|
11345
|
+
return formatter.format(val);
|
|
11346
|
+
};
|
|
11347
|
+
function getPromotionCodes(items, shippingMethods) {
|
|
11348
|
+
const codes = /* @__PURE__ */ new Set();
|
|
11349
|
+
for (const item of items) {
|
|
11350
|
+
if (item.adjustments) {
|
|
11351
|
+
for (const adjustment of item.adjustments) {
|
|
11352
|
+
if (adjustment.code) {
|
|
11353
|
+
codes.add(adjustment.code);
|
|
11354
|
+
}
|
|
11355
|
+
}
|
|
11356
|
+
}
|
|
11357
|
+
}
|
|
11358
|
+
for (const shippingMethod of shippingMethods) {
|
|
11359
|
+
if (shippingMethod.adjustments) {
|
|
11360
|
+
for (const adjustment of shippingMethod.adjustments) {
|
|
11361
|
+
if (adjustment.code) {
|
|
11362
|
+
codes.add(adjustment.code);
|
|
11363
|
+
}
|
|
11364
|
+
}
|
|
11365
|
+
}
|
|
11366
|
+
}
|
|
11367
|
+
return Array.from(codes);
|
|
11368
|
+
}
|
|
11543
11369
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11544
11370
|
const Shipping = () => {
|
|
11545
11371
|
var _a;
|
|
@@ -12379,7 +12205,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12379
12205
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12380
12206
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12381
12207
|
},
|
|
12382
|
-
resolver: zodResolver(schema$
|
|
12208
|
+
resolver: zodResolver(schema$3)
|
|
12383
12209
|
});
|
|
12384
12210
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12385
12211
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12549,7 +12375,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12549
12375
|
}
|
|
12550
12376
|
) });
|
|
12551
12377
|
};
|
|
12552
|
-
const schema$
|
|
12378
|
+
const schema$3 = addressSchema;
|
|
12553
12379
|
const TransferOwnership = () => {
|
|
12554
12380
|
const { id } = useParams();
|
|
12555
12381
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12573,7 +12399,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12573
12399
|
defaultValues: {
|
|
12574
12400
|
customer_id: order.customer_id || ""
|
|
12575
12401
|
},
|
|
12576
|
-
resolver: zodResolver(schema)
|
|
12402
|
+
resolver: zodResolver(schema$2)
|
|
12577
12403
|
});
|
|
12578
12404
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12579
12405
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13023,9 +12849,183 @@ const Illustration = () => {
|
|
|
13023
12849
|
}
|
|
13024
12850
|
);
|
|
13025
12851
|
};
|
|
13026
|
-
const schema = objectType({
|
|
12852
|
+
const schema$2 = objectType({
|
|
13027
12853
|
customer_id: stringType().min(1)
|
|
13028
12854
|
});
|
|
12855
|
+
const SalesChannel = () => {
|
|
12856
|
+
const { id } = useParams();
|
|
12857
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12858
|
+
id,
|
|
12859
|
+
{
|
|
12860
|
+
fields: "+sales_channel_id"
|
|
12861
|
+
},
|
|
12862
|
+
{
|
|
12863
|
+
enabled: !!id
|
|
12864
|
+
}
|
|
12865
|
+
);
|
|
12866
|
+
if (isError) {
|
|
12867
|
+
throw error;
|
|
12868
|
+
}
|
|
12869
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12870
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12871
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12872
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12873
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12874
|
+
] }),
|
|
12875
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12876
|
+
] });
|
|
12877
|
+
};
|
|
12878
|
+
const SalesChannelForm = ({ order }) => {
|
|
12879
|
+
const form = useForm({
|
|
12880
|
+
defaultValues: {
|
|
12881
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12882
|
+
},
|
|
12883
|
+
resolver: zodResolver(schema$1)
|
|
12884
|
+
});
|
|
12885
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12886
|
+
const { handleSuccess } = useRouteModal();
|
|
12887
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12888
|
+
await mutateAsync(
|
|
12889
|
+
{
|
|
12890
|
+
sales_channel_id: data.sales_channel_id
|
|
12891
|
+
},
|
|
12892
|
+
{
|
|
12893
|
+
onSuccess: () => {
|
|
12894
|
+
toast.success("Sales channel updated");
|
|
12895
|
+
handleSuccess();
|
|
12896
|
+
},
|
|
12897
|
+
onError: (error) => {
|
|
12898
|
+
toast.error(error.message);
|
|
12899
|
+
}
|
|
12900
|
+
}
|
|
12901
|
+
);
|
|
12902
|
+
});
|
|
12903
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12904
|
+
KeyboundForm,
|
|
12905
|
+
{
|
|
12906
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12907
|
+
onSubmit,
|
|
12908
|
+
children: [
|
|
12909
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12910
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12911
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12912
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12913
|
+
] }) })
|
|
12914
|
+
]
|
|
12915
|
+
}
|
|
12916
|
+
) });
|
|
12917
|
+
};
|
|
12918
|
+
const SalesChannelField = ({ control, order }) => {
|
|
12919
|
+
const salesChannels = useComboboxData({
|
|
12920
|
+
queryFn: async (params) => {
|
|
12921
|
+
return await sdk.admin.salesChannel.list(params);
|
|
12922
|
+
},
|
|
12923
|
+
queryKey: ["sales-channels"],
|
|
12924
|
+
getOptions: (data) => {
|
|
12925
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
12926
|
+
label: salesChannel.name,
|
|
12927
|
+
value: salesChannel.id
|
|
12928
|
+
}));
|
|
12929
|
+
},
|
|
12930
|
+
defaultValue: order.sales_channel_id || void 0
|
|
12931
|
+
});
|
|
12932
|
+
return /* @__PURE__ */ jsx(
|
|
12933
|
+
Form$2.Field,
|
|
12934
|
+
{
|
|
12935
|
+
control,
|
|
12936
|
+
name: "sales_channel_id",
|
|
12937
|
+
render: ({ field }) => {
|
|
12938
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12939
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12940
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
12941
|
+
Combobox,
|
|
12942
|
+
{
|
|
12943
|
+
options: salesChannels.options,
|
|
12944
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
12945
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12946
|
+
searchValue: salesChannels.searchValue,
|
|
12947
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12948
|
+
placeholder: "Select sales channel",
|
|
12949
|
+
...field
|
|
12950
|
+
}
|
|
12951
|
+
) }),
|
|
12952
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12953
|
+
] });
|
|
12954
|
+
}
|
|
12955
|
+
}
|
|
12956
|
+
);
|
|
12957
|
+
};
|
|
12958
|
+
const schema$1 = objectType({
|
|
12959
|
+
sales_channel_id: stringType().min(1)
|
|
12960
|
+
});
|
|
12961
|
+
const Email = () => {
|
|
12962
|
+
const { id } = useParams();
|
|
12963
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12964
|
+
fields: "+email"
|
|
12965
|
+
});
|
|
12966
|
+
if (isError) {
|
|
12967
|
+
throw error;
|
|
12968
|
+
}
|
|
12969
|
+
const isReady = !isPending && !!order;
|
|
12970
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12971
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12972
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12973
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12974
|
+
] }),
|
|
12975
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12976
|
+
] });
|
|
12977
|
+
};
|
|
12978
|
+
const EmailForm = ({ order }) => {
|
|
12979
|
+
const form = useForm({
|
|
12980
|
+
defaultValues: {
|
|
12981
|
+
email: order.email ?? ""
|
|
12982
|
+
},
|
|
12983
|
+
resolver: zodResolver(schema)
|
|
12984
|
+
});
|
|
12985
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12986
|
+
const { handleSuccess } = useRouteModal();
|
|
12987
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12988
|
+
await mutateAsync(
|
|
12989
|
+
{ email: data.email },
|
|
12990
|
+
{
|
|
12991
|
+
onSuccess: () => {
|
|
12992
|
+
handleSuccess();
|
|
12993
|
+
},
|
|
12994
|
+
onError: (error) => {
|
|
12995
|
+
toast.error(error.message);
|
|
12996
|
+
}
|
|
12997
|
+
}
|
|
12998
|
+
);
|
|
12999
|
+
});
|
|
13000
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13001
|
+
KeyboundForm,
|
|
13002
|
+
{
|
|
13003
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13004
|
+
onSubmit,
|
|
13005
|
+
children: [
|
|
13006
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13007
|
+
Form$2.Field,
|
|
13008
|
+
{
|
|
13009
|
+
control: form.control,
|
|
13010
|
+
name: "email",
|
|
13011
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13012
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13013
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13014
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13015
|
+
] })
|
|
13016
|
+
}
|
|
13017
|
+
) }),
|
|
13018
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13019
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13020
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13021
|
+
] }) })
|
|
13022
|
+
]
|
|
13023
|
+
}
|
|
13024
|
+
) });
|
|
13025
|
+
};
|
|
13026
|
+
const schema = objectType({
|
|
13027
|
+
email: stringType().email()
|
|
13028
|
+
});
|
|
13029
13029
|
const widgetModule = { widgets: [] };
|
|
13030
13030
|
const routeModule = {
|
|
13031
13031
|
routes: [
|
|
@@ -13046,33 +13046,25 @@ const routeModule = {
|
|
|
13046
13046
|
handle,
|
|
13047
13047
|
loader,
|
|
13048
13048
|
children: [
|
|
13049
|
-
{
|
|
13050
|
-
Component: CustomItems,
|
|
13051
|
-
path: "/draft-orders/:id/custom-items"
|
|
13052
|
-
},
|
|
13053
13049
|
{
|
|
13054
13050
|
Component: BillingAddress,
|
|
13055
13051
|
path: "/draft-orders/:id/billing-address"
|
|
13056
13052
|
},
|
|
13057
13053
|
{
|
|
13058
|
-
Component:
|
|
13059
|
-
path: "/draft-orders/:id/
|
|
13060
|
-
},
|
|
13061
|
-
{
|
|
13062
|
-
Component: Items,
|
|
13063
|
-
path: "/draft-orders/:id/items"
|
|
13054
|
+
Component: CustomItems,
|
|
13055
|
+
path: "/draft-orders/:id/custom-items"
|
|
13064
13056
|
},
|
|
13065
13057
|
{
|
|
13066
13058
|
Component: Metadata,
|
|
13067
13059
|
path: "/draft-orders/:id/metadata"
|
|
13068
13060
|
},
|
|
13069
13061
|
{
|
|
13070
|
-
Component:
|
|
13071
|
-
path: "/draft-orders/:id/
|
|
13062
|
+
Component: Items,
|
|
13063
|
+
path: "/draft-orders/:id/items"
|
|
13072
13064
|
},
|
|
13073
13065
|
{
|
|
13074
|
-
Component:
|
|
13075
|
-
path: "/draft-orders/:id/
|
|
13066
|
+
Component: Promotions,
|
|
13067
|
+
path: "/draft-orders/:id/promotions"
|
|
13076
13068
|
},
|
|
13077
13069
|
{
|
|
13078
13070
|
Component: Shipping,
|
|
@@ -13085,6 +13077,14 @@ const routeModule = {
|
|
|
13085
13077
|
{
|
|
13086
13078
|
Component: TransferOwnership,
|
|
13087
13079
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13080
|
+
},
|
|
13081
|
+
{
|
|
13082
|
+
Component: SalesChannel,
|
|
13083
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13084
|
+
},
|
|
13085
|
+
{
|
|
13086
|
+
Component: Email,
|
|
13087
|
+
path: "/draft-orders/:id/email"
|
|
13088
13088
|
}
|
|
13089
13089
|
]
|
|
13090
13090
|
}
|