@medusajs/draft-order 2.11.1-preview-20251022032035 → 2.11.1-preview-20251022060205

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.
@@ -9761,54 +9761,31 @@ const BillingAddressForm = ({ order }) => {
9761
9761
  ) });
9762
9762
  };
9763
9763
  const schema$5 = addressSchema;
9764
- const InlineTip = React.forwardRef(
9765
- ({ variant = "tip", label, className, children, ...props }, ref) => {
9766
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
9767
- return /* @__PURE__ */ jsxRuntime.jsxs(
9768
- "div",
9769
- {
9770
- ref,
9771
- className: ui.clx(
9772
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
9773
- className
9774
- ),
9775
- ...props,
9776
- children: [
9777
- /* @__PURE__ */ jsxRuntime.jsx(
9778
- "div",
9779
- {
9780
- role: "presentation",
9781
- className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
9782
- "bg-ui-tag-orange-icon": variant === "warning"
9783
- })
9784
- }
9785
- ),
9786
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
9787
- /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
9788
- labelValue,
9789
- ":"
9790
- ] }),
9791
- " ",
9792
- children
9793
- ] })
9794
- ]
9795
- }
9796
- );
9797
- }
9798
- );
9799
- InlineTip.displayName = "InlineTip";
9800
- const MetadataFieldSchema = objectType({
9801
- key: stringType(),
9802
- disabled: booleanType().optional(),
9803
- value: anyType()
9804
- });
9805
- const MetadataSchema = objectType({
9806
- metadata: arrayType(MetadataFieldSchema)
9764
+ const CustomItems = () => {
9765
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9766
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9767
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9768
+ ] });
9769
+ };
9770
+ const CustomItemsForm = () => {
9771
+ const form = reactHookForm.useForm({
9772
+ resolver: zod.zodResolver(schema$4)
9773
+ });
9774
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9775
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9776
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9777
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9778
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9779
+ ] }) })
9780
+ ] }) });
9781
+ };
9782
+ const schema$4 = objectType({
9783
+ email: stringType().email()
9807
9784
  });
9808
- const Metadata = () => {
9785
+ const Email = () => {
9809
9786
  const { id } = reactRouterDom.useParams();
9810
9787
  const { order, isPending, isError, error } = useOrder(id, {
9811
- fields: "metadata"
9788
+ fields: "+email"
9812
9789
  });
9813
9790
  if (isError) {
9814
9791
  throw error;
@@ -9816,33 +9793,26 @@ const Metadata = () => {
9816
9793
  const isReady = !isPending && !!order;
9817
9794
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9818
9795
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9819
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Metadata" }) }),
9820
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
9796
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9797
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9821
9798
  ] }),
9822
- !isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
9799
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9823
9800
  ] });
9824
9801
  };
9825
- const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
9826
- const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
9827
- const MetadataForm = ({ orderId, metadata }) => {
9828
- const { handleSuccess } = useRouteModal();
9829
- const hasUneditableRows = getHasUneditableRows(metadata);
9830
- const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
9802
+ const EmailForm = ({ order }) => {
9831
9803
  const form = reactHookForm.useForm({
9832
9804
  defaultValues: {
9833
- metadata: getDefaultValues(metadata)
9805
+ email: order.email ?? ""
9834
9806
  },
9835
- resolver: zod.zodResolver(MetadataSchema)
9807
+ resolver: zod.zodResolver(schema$3)
9836
9808
  });
9837
- const handleSubmit = form.handleSubmit(async (data) => {
9838
- const parsedData = parseValues(data);
9809
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9810
+ const { handleSuccess } = useRouteModal();
9811
+ const onSubmit = form.handleSubmit(async (data) => {
9839
9812
  await mutateAsync(
9840
- {
9841
- metadata: parsedData
9842
- },
9813
+ { email: data.email },
9843
9814
  {
9844
9815
  onSuccess: () => {
9845
- ui.toast.success("Metadata updated");
9846
9816
  handleSuccess();
9847
9817
  },
9848
9818
  onError: (error) => {
@@ -9851,266 +9821,35 @@ const MetadataForm = ({ orderId, metadata }) => {
9851
9821
  }
9852
9822
  );
9853
9823
  });
9854
- const { fields, insert, remove } = reactHookForm.useFieldArray({
9855
- control: form.control,
9856
- name: "metadata"
9857
- });
9858
- function deleteRow(index) {
9859
- remove(index);
9860
- if (fields.length === 1) {
9861
- insert(0, {
9862
- key: "",
9863
- value: "",
9864
- disabled: false
9865
- });
9866
- }
9867
- }
9868
- function insertRow(index, position) {
9869
- insert(index + (position === "above" ? 0 : 1), {
9870
- key: "",
9871
- value: "",
9872
- disabled: false
9873
- });
9874
- }
9875
9824
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9876
9825
  KeyboundForm,
9877
9826
  {
9878
- onSubmit: handleSubmit,
9879
9827
  className: "flex flex-1 flex-col overflow-hidden",
9828
+ onSubmit,
9880
9829
  children: [
9881
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
9882
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
9883
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
9884
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
9885
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
9886
- ] }),
9887
- fields.map((field, index) => {
9888
- const isDisabled = field.disabled || false;
9889
- let placeholder = "-";
9890
- if (typeof field.value === "object") {
9891
- placeholder = "{ ... }";
9892
- }
9893
- if (Array.isArray(field.value)) {
9894
- placeholder = "[ ... ]";
9895
- }
9896
- return /* @__PURE__ */ jsxRuntime.jsx(
9897
- ConditionalTooltip,
9898
- {
9899
- showTooltip: isDisabled,
9900
- content: "This row is disabled because it contains non-primitive data.",
9901
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
9902
- /* @__PURE__ */ jsxRuntime.jsxs(
9903
- "div",
9904
- {
9905
- className: ui.clx("grid grid-cols-2 divide-x", {
9906
- "overflow-hidden rounded-b-lg": index === fields.length - 1
9907
- }),
9908
- children: [
9909
- /* @__PURE__ */ jsxRuntime.jsx(
9910
- Form$2.Field,
9911
- {
9912
- control: form.control,
9913
- name: `metadata.${index}.key`,
9914
- render: ({ field: field2 }) => {
9915
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
9916
- GridInput,
9917
- {
9918
- "aria-labelledby": METADATA_KEY_LABEL_ID,
9919
- ...field2,
9920
- disabled: isDisabled,
9921
- placeholder: "Key"
9922
- }
9923
- ) }) });
9924
- }
9925
- }
9926
- ),
9927
- /* @__PURE__ */ jsxRuntime.jsx(
9928
- Form$2.Field,
9929
- {
9930
- control: form.control,
9931
- name: `metadata.${index}.value`,
9932
- render: ({ field: { value, ...field2 } }) => {
9933
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
9934
- GridInput,
9935
- {
9936
- "aria-labelledby": METADATA_VALUE_LABEL_ID,
9937
- ...field2,
9938
- value: isDisabled ? placeholder : value,
9939
- disabled: isDisabled,
9940
- placeholder: "Value"
9941
- }
9942
- ) }) });
9943
- }
9944
- }
9945
- )
9946
- ]
9947
- }
9948
- ),
9949
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
9950
- /* @__PURE__ */ jsxRuntime.jsx(
9951
- ui.DropdownMenu.Trigger,
9952
- {
9953
- className: ui.clx(
9954
- "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
9955
- {
9956
- hidden: isDisabled
9957
- }
9958
- ),
9959
- disabled: isDisabled,
9960
- asChild: true,
9961
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
9962
- }
9963
- ),
9964
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
9965
- /* @__PURE__ */ jsxRuntime.jsxs(
9966
- ui.DropdownMenu.Item,
9967
- {
9968
- className: "gap-x-2",
9969
- onClick: () => insertRow(index, "above"),
9970
- children: [
9971
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
9972
- "Insert row above"
9973
- ]
9974
- }
9975
- ),
9976
- /* @__PURE__ */ jsxRuntime.jsxs(
9977
- ui.DropdownMenu.Item,
9978
- {
9979
- className: "gap-x-2",
9980
- onClick: () => insertRow(index, "below"),
9981
- children: [
9982
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
9983
- "Insert row below"
9984
- ]
9985
- }
9986
- ),
9987
- /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
9988
- /* @__PURE__ */ jsxRuntime.jsxs(
9989
- ui.DropdownMenu.Item,
9990
- {
9991
- className: "gap-x-2",
9992
- onClick: () => deleteRow(index),
9993
- children: [
9994
- /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
9995
- "Delete row"
9996
- ]
9997
- }
9998
- )
9999
- ] })
10000
- ] })
10001
- ] })
10002
- },
10003
- field.id
10004
- );
10005
- })
10006
- ] }),
10007
- hasUneditableRows && /* @__PURE__ */ jsxRuntime.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." })
10008
- ] }),
10009
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10010
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10011
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10012
- ] }) })
10013
- ]
10014
- }
10015
- ) });
10016
- };
10017
- const GridInput = React.forwardRef(({ className, ...props }, ref) => {
10018
- return /* @__PURE__ */ jsxRuntime.jsx(
10019
- "input",
10020
- {
10021
- ref,
10022
- ...props,
10023
- autoComplete: "off",
10024
- className: ui.clx(
10025
- "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",
10026
- className
10027
- )
10028
- }
10029
- );
10030
- });
10031
- GridInput.displayName = "MetadataForm.GridInput";
10032
- const PlaceholderInner = () => {
10033
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
10034
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
10035
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10036
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
10037
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
10038
- ] }) })
10039
- ] });
10040
- };
10041
- const EDITABLE_TYPES = ["string", "number", "boolean"];
10042
- function getDefaultValues(metadata) {
10043
- if (!metadata || !Object.keys(metadata).length) {
10044
- return [
10045
- {
10046
- key: "",
10047
- value: "",
10048
- disabled: false
10049
- }
10050
- ];
10051
- }
10052
- return Object.entries(metadata).map(([key, value]) => {
10053
- if (!EDITABLE_TYPES.includes(typeof value)) {
10054
- return {
10055
- key,
10056
- value,
10057
- disabled: true
10058
- };
10059
- }
10060
- let stringValue = value;
10061
- if (typeof value !== "string") {
10062
- stringValue = JSON.stringify(value);
10063
- }
10064
- return {
10065
- key,
10066
- value: stringValue,
10067
- original_key: key
10068
- };
10069
- });
10070
- }
10071
- function parseValues(values) {
10072
- const metadata = values.metadata;
10073
- const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
10074
- if (isEmpty) {
10075
- return null;
10076
- }
10077
- const update = {};
10078
- metadata.forEach((field) => {
10079
- let key = field.key;
10080
- let value = field.value;
10081
- const disabled = field.disabled;
10082
- if (!key || !value) {
10083
- return;
10084
- }
10085
- if (disabled) {
10086
- update[key] = value;
10087
- return;
10088
- }
10089
- key = key.trim();
10090
- value = value.trim();
10091
- if (value === "true") {
10092
- update[key] = true;
10093
- } else if (value === "false") {
10094
- update[key] = false;
10095
- } else {
10096
- const parsedNumber = parseFloat(value);
10097
- if (!isNaN(parsedNumber)) {
10098
- update[key] = parsedNumber;
10099
- } else {
10100
- update[key] = value;
10101
- }
9830
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9831
+ Form$2.Field,
9832
+ {
9833
+ control: form.control,
9834
+ name: "email",
9835
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9836
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9837
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9838
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9839
+ ] })
9840
+ }
9841
+ ) }),
9842
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9843
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9844
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9845
+ ] }) })
9846
+ ]
10102
9847
  }
10103
- });
10104
- return update;
10105
- }
10106
- function getHasUneditableRows(metadata) {
10107
- if (!metadata) {
10108
- return false;
10109
- }
10110
- return Object.values(metadata).some(
10111
- (value) => !EDITABLE_TYPES.includes(typeof value)
10112
- );
10113
- }
9848
+ ) });
9849
+ };
9850
+ const schema$3 = objectType({
9851
+ email: stringType().email()
9852
+ });
10114
9853
  const NumberInput = React.forwardRef(
10115
9854
  ({
10116
9855
  value,
@@ -11073,18 +10812,368 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
11073
10812
  ] }) })
11074
10813
  }
11075
10814
  )
11076
- ] }) }) }),
11077
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11078
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
11079
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10815
+ ] }) }) }),
10816
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10817
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10818
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10819
+ ] }) })
10820
+ ] }) }) });
10821
+ };
10822
+ const customItemSchema = objectType({
10823
+ title: stringType().min(1),
10824
+ quantity: numberType(),
10825
+ unit_price: unionType([numberType(), stringType()])
10826
+ });
10827
+ const InlineTip = React.forwardRef(
10828
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
10829
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10830
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10831
+ "div",
10832
+ {
10833
+ ref,
10834
+ className: ui.clx(
10835
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10836
+ className
10837
+ ),
10838
+ ...props,
10839
+ children: [
10840
+ /* @__PURE__ */ jsxRuntime.jsx(
10841
+ "div",
10842
+ {
10843
+ role: "presentation",
10844
+ className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10845
+ "bg-ui-tag-orange-icon": variant === "warning"
10846
+ })
10847
+ }
10848
+ ),
10849
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
10850
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10851
+ labelValue,
10852
+ ":"
10853
+ ] }),
10854
+ " ",
10855
+ children
10856
+ ] })
10857
+ ]
10858
+ }
10859
+ );
10860
+ }
10861
+ );
10862
+ InlineTip.displayName = "InlineTip";
10863
+ const MetadataFieldSchema = objectType({
10864
+ key: stringType(),
10865
+ disabled: booleanType().optional(),
10866
+ value: anyType()
10867
+ });
10868
+ const MetadataSchema = objectType({
10869
+ metadata: arrayType(MetadataFieldSchema)
10870
+ });
10871
+ const Metadata = () => {
10872
+ const { id } = reactRouterDom.useParams();
10873
+ const { order, isPending, isError, error } = useOrder(id, {
10874
+ fields: "metadata"
10875
+ });
10876
+ if (isError) {
10877
+ throw error;
10878
+ }
10879
+ const isReady = !isPending && !!order;
10880
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10881
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10882
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Metadata" }) }),
10883
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10884
+ ] }),
10885
+ !isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10886
+ ] });
10887
+ };
10888
+ const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
10889
+ const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
10890
+ const MetadataForm = ({ orderId, metadata }) => {
10891
+ const { handleSuccess } = useRouteModal();
10892
+ const hasUneditableRows = getHasUneditableRows(metadata);
10893
+ const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
10894
+ const form = reactHookForm.useForm({
10895
+ defaultValues: {
10896
+ metadata: getDefaultValues(metadata)
10897
+ },
10898
+ resolver: zod.zodResolver(MetadataSchema)
10899
+ });
10900
+ const handleSubmit = form.handleSubmit(async (data) => {
10901
+ const parsedData = parseValues(data);
10902
+ await mutateAsync(
10903
+ {
10904
+ metadata: parsedData
10905
+ },
10906
+ {
10907
+ onSuccess: () => {
10908
+ ui.toast.success("Metadata updated");
10909
+ handleSuccess();
10910
+ },
10911
+ onError: (error) => {
10912
+ ui.toast.error(error.message);
10913
+ }
10914
+ }
10915
+ );
10916
+ });
10917
+ const { fields, insert, remove } = reactHookForm.useFieldArray({
10918
+ control: form.control,
10919
+ name: "metadata"
10920
+ });
10921
+ function deleteRow(index) {
10922
+ remove(index);
10923
+ if (fields.length === 1) {
10924
+ insert(0, {
10925
+ key: "",
10926
+ value: "",
10927
+ disabled: false
10928
+ });
10929
+ }
10930
+ }
10931
+ function insertRow(index, position) {
10932
+ insert(index + (position === "above" ? 0 : 1), {
10933
+ key: "",
10934
+ value: "",
10935
+ disabled: false
10936
+ });
10937
+ }
10938
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10939
+ KeyboundForm,
10940
+ {
10941
+ onSubmit: handleSubmit,
10942
+ className: "flex flex-1 flex-col overflow-hidden",
10943
+ children: [
10944
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
10945
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
10946
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
10947
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
10948
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
10949
+ ] }),
10950
+ fields.map((field, index) => {
10951
+ const isDisabled = field.disabled || false;
10952
+ let placeholder = "-";
10953
+ if (typeof field.value === "object") {
10954
+ placeholder = "{ ... }";
10955
+ }
10956
+ if (Array.isArray(field.value)) {
10957
+ placeholder = "[ ... ]";
10958
+ }
10959
+ return /* @__PURE__ */ jsxRuntime.jsx(
10960
+ ConditionalTooltip,
10961
+ {
10962
+ showTooltip: isDisabled,
10963
+ content: "This row is disabled because it contains non-primitive data.",
10964
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
10965
+ /* @__PURE__ */ jsxRuntime.jsxs(
10966
+ "div",
10967
+ {
10968
+ className: ui.clx("grid grid-cols-2 divide-x", {
10969
+ "overflow-hidden rounded-b-lg": index === fields.length - 1
10970
+ }),
10971
+ children: [
10972
+ /* @__PURE__ */ jsxRuntime.jsx(
10973
+ Form$2.Field,
10974
+ {
10975
+ control: form.control,
10976
+ name: `metadata.${index}.key`,
10977
+ render: ({ field: field2 }) => {
10978
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
10979
+ GridInput,
10980
+ {
10981
+ "aria-labelledby": METADATA_KEY_LABEL_ID,
10982
+ ...field2,
10983
+ disabled: isDisabled,
10984
+ placeholder: "Key"
10985
+ }
10986
+ ) }) });
10987
+ }
10988
+ }
10989
+ ),
10990
+ /* @__PURE__ */ jsxRuntime.jsx(
10991
+ Form$2.Field,
10992
+ {
10993
+ control: form.control,
10994
+ name: `metadata.${index}.value`,
10995
+ render: ({ field: { value, ...field2 } }) => {
10996
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
10997
+ GridInput,
10998
+ {
10999
+ "aria-labelledby": METADATA_VALUE_LABEL_ID,
11000
+ ...field2,
11001
+ value: isDisabled ? placeholder : value,
11002
+ disabled: isDisabled,
11003
+ placeholder: "Value"
11004
+ }
11005
+ ) }) });
11006
+ }
11007
+ }
11008
+ )
11009
+ ]
11010
+ }
11011
+ ),
11012
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
11013
+ /* @__PURE__ */ jsxRuntime.jsx(
11014
+ ui.DropdownMenu.Trigger,
11015
+ {
11016
+ className: ui.clx(
11017
+ "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
11018
+ {
11019
+ hidden: isDisabled
11020
+ }
11021
+ ),
11022
+ disabled: isDisabled,
11023
+ asChild: true,
11024
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
11025
+ }
11026
+ ),
11027
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
11028
+ /* @__PURE__ */ jsxRuntime.jsxs(
11029
+ ui.DropdownMenu.Item,
11030
+ {
11031
+ className: "gap-x-2",
11032
+ onClick: () => insertRow(index, "above"),
11033
+ children: [
11034
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
11035
+ "Insert row above"
11036
+ ]
11037
+ }
11038
+ ),
11039
+ /* @__PURE__ */ jsxRuntime.jsxs(
11040
+ ui.DropdownMenu.Item,
11041
+ {
11042
+ className: "gap-x-2",
11043
+ onClick: () => insertRow(index, "below"),
11044
+ children: [
11045
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
11046
+ "Insert row below"
11047
+ ]
11048
+ }
11049
+ ),
11050
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
11051
+ /* @__PURE__ */ jsxRuntime.jsxs(
11052
+ ui.DropdownMenu.Item,
11053
+ {
11054
+ className: "gap-x-2",
11055
+ onClick: () => deleteRow(index),
11056
+ children: [
11057
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
11058
+ "Delete row"
11059
+ ]
11060
+ }
11061
+ )
11062
+ ] })
11063
+ ] })
11064
+ ] })
11065
+ },
11066
+ field.id
11067
+ );
11068
+ })
11069
+ ] }),
11070
+ hasUneditableRows && /* @__PURE__ */ jsxRuntime.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." })
11071
+ ] }),
11072
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11073
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
11074
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11075
+ ] }) })
11076
+ ]
11077
+ }
11078
+ ) });
11079
+ };
11080
+ const GridInput = React.forwardRef(({ className, ...props }, ref) => {
11081
+ return /* @__PURE__ */ jsxRuntime.jsx(
11082
+ "input",
11083
+ {
11084
+ ref,
11085
+ ...props,
11086
+ autoComplete: "off",
11087
+ className: ui.clx(
11088
+ "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",
11089
+ className
11090
+ )
11091
+ }
11092
+ );
11093
+ });
11094
+ GridInput.displayName = "MetadataForm.GridInput";
11095
+ const PlaceholderInner = () => {
11096
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
11097
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
11098
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11099
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
11100
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
11080
11101
  ] }) })
11081
- ] }) }) });
11102
+ ] });
11082
11103
  };
11083
- const customItemSchema = objectType({
11084
- title: stringType().min(1),
11085
- quantity: numberType(),
11086
- unit_price: unionType([numberType(), stringType()])
11087
- });
11104
+ const EDITABLE_TYPES = ["string", "number", "boolean"];
11105
+ function getDefaultValues(metadata) {
11106
+ if (!metadata || !Object.keys(metadata).length) {
11107
+ return [
11108
+ {
11109
+ key: "",
11110
+ value: "",
11111
+ disabled: false
11112
+ }
11113
+ ];
11114
+ }
11115
+ return Object.entries(metadata).map(([key, value]) => {
11116
+ if (!EDITABLE_TYPES.includes(typeof value)) {
11117
+ return {
11118
+ key,
11119
+ value,
11120
+ disabled: true
11121
+ };
11122
+ }
11123
+ let stringValue = value;
11124
+ if (typeof value !== "string") {
11125
+ stringValue = JSON.stringify(value);
11126
+ }
11127
+ return {
11128
+ key,
11129
+ value: stringValue,
11130
+ original_key: key
11131
+ };
11132
+ });
11133
+ }
11134
+ function parseValues(values) {
11135
+ const metadata = values.metadata;
11136
+ const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
11137
+ if (isEmpty) {
11138
+ return null;
11139
+ }
11140
+ const update = {};
11141
+ metadata.forEach((field) => {
11142
+ let key = field.key;
11143
+ let value = field.value;
11144
+ const disabled = field.disabled;
11145
+ if (!key || !value) {
11146
+ return;
11147
+ }
11148
+ if (disabled) {
11149
+ update[key] = value;
11150
+ return;
11151
+ }
11152
+ key = key.trim();
11153
+ value = value.trim();
11154
+ if (value === "true") {
11155
+ update[key] = true;
11156
+ } else if (value === "false") {
11157
+ update[key] = false;
11158
+ } else {
11159
+ const parsedNumber = parseFloat(value);
11160
+ if (!isNaN(parsedNumber)) {
11161
+ update[key] = parsedNumber;
11162
+ } else {
11163
+ update[key] = value;
11164
+ }
11165
+ }
11166
+ });
11167
+ return update;
11168
+ }
11169
+ function getHasUneditableRows(metadata) {
11170
+ if (!metadata) {
11171
+ return false;
11172
+ }
11173
+ return Object.values(metadata).some(
11174
+ (value) => !EDITABLE_TYPES.includes(typeof value)
11175
+ );
11176
+ }
11088
11177
  const PROMOTION_QUERY_KEY = "promotions";
11089
11178
  const promotionsQueryKeys = {
11090
11179
  list: (query2) => [
@@ -11390,7 +11479,7 @@ const SalesChannelForm = ({ order }) => {
11390
11479
  defaultValues: {
11391
11480
  sales_channel_id: order.sales_channel_id || ""
11392
11481
  },
11393
- resolver: zod.zodResolver(schema$4)
11482
+ resolver: zod.zodResolver(schema$2)
11394
11483
  });
11395
11484
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11396
11485
  const { handleSuccess } = useRouteModal();
@@ -11465,7 +11554,7 @@ const SalesChannelField = ({ control, order }) => {
11465
11554
  }
11466
11555
  );
11467
11556
  };
11468
- const schema$4 = objectType({
11557
+ const schema$2 = objectType({
11469
11558
  sales_channel_id: stringType().min(1)
11470
11559
  });
11471
11560
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12307,7 +12396,7 @@ const ShippingAddressForm = ({ order }) => {
12307
12396
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12308
12397
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12309
12398
  },
12310
- resolver: zod.zodResolver(schema$3)
12399
+ resolver: zod.zodResolver(schema$1)
12311
12400
  });
12312
12401
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12313
12402
  const { handleSuccess } = useRouteModal();
@@ -12477,7 +12566,7 @@ const ShippingAddressForm = ({ order }) => {
12477
12566
  }
12478
12567
  ) });
12479
12568
  };
12480
- const schema$3 = addressSchema;
12569
+ const schema$1 = addressSchema;
12481
12570
  const TransferOwnership = () => {
12482
12571
  const { id } = reactRouterDom.useParams();
12483
12572
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12501,7 +12590,7 @@ const TransferOwnershipForm = ({ order }) => {
12501
12590
  defaultValues: {
12502
12591
  customer_id: order.customer_id || ""
12503
12592
  },
12504
- resolver: zod.zodResolver(schema$2)
12593
+ resolver: zod.zodResolver(schema)
12505
12594
  });
12506
12595
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12507
12596
  const { handleSuccess } = useRouteModal();
@@ -12951,97 +13040,8 @@ const Illustration = () => {
12951
13040
  }
12952
13041
  );
12953
13042
  };
12954
- const schema$2 = objectType({
12955
- customer_id: stringType().min(1)
12956
- });
12957
- const CustomItems = () => {
12958
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12959
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
12960
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12961
- ] });
12962
- };
12963
- const CustomItemsForm = () => {
12964
- const form = reactHookForm.useForm({
12965
- resolver: zod.zodResolver(schema$1)
12966
- });
12967
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12968
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
12969
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12970
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
12972
- ] }) })
12973
- ] }) });
12974
- };
12975
- const schema$1 = objectType({
12976
- email: stringType().email()
12977
- });
12978
- const Email = () => {
12979
- const { id } = reactRouterDom.useParams();
12980
- const { order, isPending, isError, error } = useOrder(id, {
12981
- fields: "+email"
12982
- });
12983
- if (isError) {
12984
- throw error;
12985
- }
12986
- const isReady = !isPending && !!order;
12987
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12988
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12989
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
12990
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12991
- ] }),
12992
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12993
- ] });
12994
- };
12995
- const EmailForm = ({ order }) => {
12996
- const form = reactHookForm.useForm({
12997
- defaultValues: {
12998
- email: order.email ?? ""
12999
- },
13000
- resolver: zod.zodResolver(schema)
13001
- });
13002
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
13003
- const { handleSuccess } = useRouteModal();
13004
- const onSubmit = form.handleSubmit(async (data) => {
13005
- await mutateAsync(
13006
- { email: data.email },
13007
- {
13008
- onSuccess: () => {
13009
- handleSuccess();
13010
- },
13011
- onError: (error) => {
13012
- ui.toast.error(error.message);
13013
- }
13014
- }
13015
- );
13016
- });
13017
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
13018
- KeyboundForm,
13019
- {
13020
- className: "flex flex-1 flex-col overflow-hidden",
13021
- onSubmit,
13022
- children: [
13023
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
13024
- Form$2.Field,
13025
- {
13026
- control: form.control,
13027
- name: "email",
13028
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13029
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
13030
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13031
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13032
- ] })
13033
- }
13034
- ) }),
13035
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13036
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13037
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13038
- ] }) })
13039
- ]
13040
- }
13041
- ) });
13042
- };
13043
13043
  const schema = objectType({
13044
- email: stringType().email()
13044
+ customer_id: stringType().min(1)
13045
13045
  });
13046
13046
  const widgetModule = { widgets: [] };
13047
13047
  const routeModule = {
@@ -13068,13 +13068,21 @@ const routeModule = {
13068
13068
  path: "/draft-orders/:id/billing-address"
13069
13069
  },
13070
13070
  {
13071
- Component: Metadata,
13072
- path: "/draft-orders/:id/metadata"
13071
+ Component: CustomItems,
13072
+ path: "/draft-orders/:id/custom-items"
13073
+ },
13074
+ {
13075
+ Component: Email,
13076
+ path: "/draft-orders/:id/email"
13073
13077
  },
13074
13078
  {
13075
13079
  Component: Items,
13076
13080
  path: "/draft-orders/:id/items"
13077
13081
  },
13082
+ {
13083
+ Component: Metadata,
13084
+ path: "/draft-orders/:id/metadata"
13085
+ },
13078
13086
  {
13079
13087
  Component: Promotions,
13080
13088
  path: "/draft-orders/:id/promotions"
@@ -13094,14 +13102,6 @@ const routeModule = {
13094
13102
  {
13095
13103
  Component: TransferOwnership,
13096
13104
  path: "/draft-orders/:id/transfer-ownership"
13097
- },
13098
- {
13099
- Component: CustomItems,
13100
- path: "/draft-orders/:id/custom-items"
13101
- },
13102
- {
13103
- Component: Email,
13104
- path: "/draft-orders/:id/email"
13105
13105
  }
13106
13106
  ]
13107
13107
  }