@medusajs/draft-order 2.11.4-snapshot-20251105174837 → 2.11.4-snapshot-20251106121614

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.
@@ -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, Minus, PencilSquare, EllipsisVertical, ArrowUpMini, ArrowDownMini } from "@medusajs/icons";
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";
@@ -9772,10 +9772,54 @@ const CustomItemsForm = () => {
9772
9772
  const schema$4 = objectType({
9773
9773
  email: stringType().email()
9774
9774
  });
9775
- const Email = () => {
9775
+ const InlineTip = forwardRef(
9776
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
9777
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
9778
+ return /* @__PURE__ */ jsxs(
9779
+ "div",
9780
+ {
9781
+ ref,
9782
+ className: clx(
9783
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
9784
+ className
9785
+ ),
9786
+ ...props,
9787
+ children: [
9788
+ /* @__PURE__ */ jsx(
9789
+ "div",
9790
+ {
9791
+ role: "presentation",
9792
+ className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
9793
+ "bg-ui-tag-orange-icon": variant === "warning"
9794
+ })
9795
+ }
9796
+ ),
9797
+ /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
9798
+ /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
9799
+ labelValue,
9800
+ ":"
9801
+ ] }),
9802
+ " ",
9803
+ children
9804
+ ] })
9805
+ ]
9806
+ }
9807
+ );
9808
+ }
9809
+ );
9810
+ InlineTip.displayName = "InlineTip";
9811
+ const MetadataFieldSchema = objectType({
9812
+ key: stringType(),
9813
+ disabled: booleanType().optional(),
9814
+ value: anyType()
9815
+ });
9816
+ const MetadataSchema = objectType({
9817
+ metadata: arrayType(MetadataFieldSchema)
9818
+ });
9819
+ const Metadata = () => {
9776
9820
  const { id } = useParams();
9777
9821
  const { order, isPending, isError, error } = useOrder(id, {
9778
- fields: "+email"
9822
+ fields: "metadata"
9779
9823
  });
9780
9824
  if (isError) {
9781
9825
  throw error;
@@ -9783,26 +9827,33 @@ const Email = () => {
9783
9827
  const isReady = !isPending && !!order;
9784
9828
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9785
9829
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9786
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9787
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9830
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
9831
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
9788
9832
  ] }),
9789
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9833
+ !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
9790
9834
  ] });
9791
9835
  };
9792
- const EmailForm = ({ order }) => {
9836
+ const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
9837
+ const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
9838
+ const MetadataForm = ({ orderId, metadata }) => {
9839
+ const { handleSuccess } = useRouteModal();
9840
+ const hasUneditableRows = getHasUneditableRows(metadata);
9841
+ const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
9793
9842
  const form = useForm({
9794
9843
  defaultValues: {
9795
- email: order.email ?? ""
9844
+ metadata: getDefaultValues(metadata)
9796
9845
  },
9797
- resolver: zodResolver(schema$3)
9846
+ resolver: zodResolver(MetadataSchema)
9798
9847
  });
9799
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9800
- const { handleSuccess } = useRouteModal();
9801
- const onSubmit = form.handleSubmit(async (data) => {
9848
+ const handleSubmit = form.handleSubmit(async (data) => {
9849
+ const parsedData = parseValues(data);
9802
9850
  await mutateAsync(
9803
- { email: data.email },
9851
+ {
9852
+ metadata: parsedData
9853
+ },
9804
9854
  {
9805
9855
  onSuccess: () => {
9856
+ toast.success("Metadata updated");
9806
9857
  handleSuccess();
9807
9858
  },
9808
9859
  onError: (error) => {
@@ -9811,46 +9862,345 @@ const EmailForm = ({ order }) => {
9811
9862
  }
9812
9863
  );
9813
9864
  });
9865
+ const { fields, insert, remove } = useFieldArray({
9866
+ control: form.control,
9867
+ name: "metadata"
9868
+ });
9869
+ function deleteRow(index) {
9870
+ remove(index);
9871
+ if (fields.length === 1) {
9872
+ insert(0, {
9873
+ key: "",
9874
+ value: "",
9875
+ disabled: false
9876
+ });
9877
+ }
9878
+ }
9879
+ function insertRow(index, position) {
9880
+ insert(index + (position === "above" ? 0 : 1), {
9881
+ key: "",
9882
+ value: "",
9883
+ disabled: false
9884
+ });
9885
+ }
9814
9886
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9815
9887
  KeyboundForm,
9816
9888
  {
9889
+ onSubmit: handleSubmit,
9817
9890
  className: "flex flex-1 flex-col overflow-hidden",
9818
- onSubmit,
9819
9891
  children: [
9820
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9821
- Form$2.Field,
9822
- {
9823
- control: form.control,
9824
- name: "email",
9825
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9826
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9827
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9828
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9829
- ] })
9830
- }
9831
- ) }),
9832
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9833
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9892
+ /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
9893
+ /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
9894
+ /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
9895
+ /* @__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" }) }),
9896
+ /* @__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" }) })
9897
+ ] }),
9898
+ fields.map((field, index) => {
9899
+ const isDisabled = field.disabled || false;
9900
+ let placeholder = "-";
9901
+ if (typeof field.value === "object") {
9902
+ placeholder = "{ ... }";
9903
+ }
9904
+ if (Array.isArray(field.value)) {
9905
+ placeholder = "[ ... ]";
9906
+ }
9907
+ return /* @__PURE__ */ jsx(
9908
+ ConditionalTooltip,
9909
+ {
9910
+ showTooltip: isDisabled,
9911
+ content: "This row is disabled because it contains non-primitive data.",
9912
+ children: /* @__PURE__ */ jsxs("div", { className: "group/table relative", children: [
9913
+ /* @__PURE__ */ jsxs(
9914
+ "div",
9915
+ {
9916
+ className: clx("grid grid-cols-2 divide-x", {
9917
+ "overflow-hidden rounded-b-lg": index === fields.length - 1
9918
+ }),
9919
+ children: [
9920
+ /* @__PURE__ */ jsx(
9921
+ Form$2.Field,
9922
+ {
9923
+ control: form.control,
9924
+ name: `metadata.${index}.key`,
9925
+ render: ({ field: field2 }) => {
9926
+ return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
9927
+ GridInput,
9928
+ {
9929
+ "aria-labelledby": METADATA_KEY_LABEL_ID,
9930
+ ...field2,
9931
+ disabled: isDisabled,
9932
+ placeholder: "Key"
9933
+ }
9934
+ ) }) });
9935
+ }
9936
+ }
9937
+ ),
9938
+ /* @__PURE__ */ jsx(
9939
+ Form$2.Field,
9940
+ {
9941
+ control: form.control,
9942
+ name: `metadata.${index}.value`,
9943
+ render: ({ field: { value, ...field2 } }) => {
9944
+ return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
9945
+ GridInput,
9946
+ {
9947
+ "aria-labelledby": METADATA_VALUE_LABEL_ID,
9948
+ ...field2,
9949
+ value: isDisabled ? placeholder : value,
9950
+ disabled: isDisabled,
9951
+ placeholder: "Value"
9952
+ }
9953
+ ) }) });
9954
+ }
9955
+ }
9956
+ )
9957
+ ]
9958
+ }
9959
+ ),
9960
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
9961
+ /* @__PURE__ */ jsx(
9962
+ DropdownMenu.Trigger,
9963
+ {
9964
+ className: clx(
9965
+ "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
9966
+ {
9967
+ hidden: isDisabled
9968
+ }
9969
+ ),
9970
+ disabled: isDisabled,
9971
+ asChild: true,
9972
+ children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
9973
+ }
9974
+ ),
9975
+ /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
9976
+ /* @__PURE__ */ jsxs(
9977
+ DropdownMenu.Item,
9978
+ {
9979
+ className: "gap-x-2",
9980
+ onClick: () => insertRow(index, "above"),
9981
+ children: [
9982
+ /* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
9983
+ "Insert row above"
9984
+ ]
9985
+ }
9986
+ ),
9987
+ /* @__PURE__ */ jsxs(
9988
+ DropdownMenu.Item,
9989
+ {
9990
+ className: "gap-x-2",
9991
+ onClick: () => insertRow(index, "below"),
9992
+ children: [
9993
+ /* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
9994
+ "Insert row below"
9995
+ ]
9996
+ }
9997
+ ),
9998
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
9999
+ /* @__PURE__ */ jsxs(
10000
+ DropdownMenu.Item,
10001
+ {
10002
+ className: "gap-x-2",
10003
+ onClick: () => deleteRow(index),
10004
+ children: [
10005
+ /* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
10006
+ "Delete row"
10007
+ ]
10008
+ }
10009
+ )
10010
+ ] })
10011
+ ] })
10012
+ ] })
10013
+ },
10014
+ field.id
10015
+ );
10016
+ })
10017
+ ] }),
10018
+ 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." })
10019
+ ] }),
10020
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10021
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
9834
10022
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9835
10023
  ] }) })
9836
10024
  ]
9837
10025
  }
9838
10026
  ) });
9839
10027
  };
9840
- const schema$3 = objectType({
9841
- email: stringType().email()
9842
- });
9843
- const NumberInput = forwardRef(
9844
- ({
9845
- value,
9846
- onChange,
9847
- size = "base",
9848
- min = 0,
9849
- max = 100,
9850
- step = 1,
9851
- className,
9852
- disabled,
9853
- ...props
10028
+ const GridInput = forwardRef(({ className, ...props }, ref) => {
10029
+ return /* @__PURE__ */ jsx(
10030
+ "input",
10031
+ {
10032
+ ref,
10033
+ ...props,
10034
+ autoComplete: "off",
10035
+ className: clx(
10036
+ "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",
10037
+ className
10038
+ )
10039
+ }
10040
+ );
10041
+ });
10042
+ GridInput.displayName = "MetadataForm.GridInput";
10043
+ const PlaceholderInner = () => {
10044
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
10045
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
10046
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10047
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
10048
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
10049
+ ] }) })
10050
+ ] });
10051
+ };
10052
+ const EDITABLE_TYPES = ["string", "number", "boolean"];
10053
+ function getDefaultValues(metadata) {
10054
+ if (!metadata || !Object.keys(metadata).length) {
10055
+ return [
10056
+ {
10057
+ key: "",
10058
+ value: "",
10059
+ disabled: false
10060
+ }
10061
+ ];
10062
+ }
10063
+ return Object.entries(metadata).map(([key, value]) => {
10064
+ if (!EDITABLE_TYPES.includes(typeof value)) {
10065
+ return {
10066
+ key,
10067
+ value,
10068
+ disabled: true
10069
+ };
10070
+ }
10071
+ let stringValue = value;
10072
+ if (typeof value !== "string") {
10073
+ stringValue = JSON.stringify(value);
10074
+ }
10075
+ return {
10076
+ key,
10077
+ value: stringValue,
10078
+ original_key: key
10079
+ };
10080
+ });
10081
+ }
10082
+ function parseValues(values) {
10083
+ const metadata = values.metadata;
10084
+ const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
10085
+ if (isEmpty) {
10086
+ return null;
10087
+ }
10088
+ const update = {};
10089
+ metadata.forEach((field) => {
10090
+ let key = field.key;
10091
+ let value = field.value;
10092
+ const disabled = field.disabled;
10093
+ if (!key || !value) {
10094
+ return;
10095
+ }
10096
+ if (disabled) {
10097
+ update[key] = value;
10098
+ return;
10099
+ }
10100
+ key = key.trim();
10101
+ value = value.trim();
10102
+ if (value === "true") {
10103
+ update[key] = true;
10104
+ } else if (value === "false") {
10105
+ update[key] = false;
10106
+ } else {
10107
+ const parsedNumber = parseFloat(value);
10108
+ if (!isNaN(parsedNumber)) {
10109
+ update[key] = parsedNumber;
10110
+ } else {
10111
+ update[key] = value;
10112
+ }
10113
+ }
10114
+ });
10115
+ return update;
10116
+ }
10117
+ function getHasUneditableRows(metadata) {
10118
+ if (!metadata) {
10119
+ return false;
10120
+ }
10121
+ return Object.values(metadata).some(
10122
+ (value) => !EDITABLE_TYPES.includes(typeof value)
10123
+ );
10124
+ }
10125
+ const Email = () => {
10126
+ const { id } = useParams();
10127
+ const { order, isPending, isError, error } = useOrder(id, {
10128
+ fields: "+email"
10129
+ });
10130
+ if (isError) {
10131
+ throw error;
10132
+ }
10133
+ const isReady = !isPending && !!order;
10134
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10135
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10136
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
10137
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
10138
+ ] }),
10139
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
10140
+ ] });
10141
+ };
10142
+ const EmailForm = ({ order }) => {
10143
+ const form = useForm({
10144
+ defaultValues: {
10145
+ email: order.email ?? ""
10146
+ },
10147
+ resolver: zodResolver(schema$3)
10148
+ });
10149
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10150
+ const { handleSuccess } = useRouteModal();
10151
+ const onSubmit = form.handleSubmit(async (data) => {
10152
+ await mutateAsync(
10153
+ { email: data.email },
10154
+ {
10155
+ onSuccess: () => {
10156
+ handleSuccess();
10157
+ },
10158
+ onError: (error) => {
10159
+ toast.error(error.message);
10160
+ }
10161
+ }
10162
+ );
10163
+ });
10164
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10165
+ KeyboundForm,
10166
+ {
10167
+ className: "flex flex-1 flex-col overflow-hidden",
10168
+ onSubmit,
10169
+ children: [
10170
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
10171
+ Form$2.Field,
10172
+ {
10173
+ control: form.control,
10174
+ name: "email",
10175
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10176
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
10177
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10178
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10179
+ ] })
10180
+ }
10181
+ ) }),
10182
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10183
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10184
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10185
+ ] }) })
10186
+ ]
10187
+ }
10188
+ ) });
10189
+ };
10190
+ const schema$3 = objectType({
10191
+ email: stringType().email()
10192
+ });
10193
+ const NumberInput = forwardRef(
10194
+ ({
10195
+ value,
10196
+ onChange,
10197
+ size = "base",
10198
+ min = 0,
10199
+ max = 100,
10200
+ step = 1,
10201
+ className,
10202
+ disabled,
10203
+ ...props
9854
10204
  }, ref) => {
9855
10205
  const handleChange = (event) => {
9856
10206
  const newValue = event.target.value === "" ? min : Number(event.target.value);
@@ -10740,430 +11090,80 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
10740
11090
  /* @__PURE__ */ jsx(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Add custom item" }) }),
10741
11091
  /* @__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." }) })
10742
11092
  ] }),
10743
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
10744
- /* @__PURE__ */ jsx(
10745
- Form$2.Field,
10746
- {
10747
- control: form.control,
10748
- name: "title",
10749
- render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10750
- /* @__PURE__ */ jsxs("div", { children: [
10751
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Title" }),
10752
- /* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the title of the item" })
10753
- ] }),
10754
- /* @__PURE__ */ jsxs("div", { children: [
10755
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10756
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10757
- ] })
10758
- ] }) })
10759
- }
10760
- ),
10761
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
10762
- /* @__PURE__ */ jsx(
10763
- Form$2.Field,
10764
- {
10765
- control: form.control,
10766
- name: "unit_price",
10767
- render: ({ field: { onChange, ...field } }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10768
- /* @__PURE__ */ jsxs("div", { children: [
10769
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Unit price" }),
10770
- /* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the unit price of the item" })
10771
- ] }),
10772
- /* @__PURE__ */ jsxs("div", { children: [
10773
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
10774
- CurrencyInput,
10775
- {
10776
- symbol: getNativeSymbol(currencyCode),
10777
- code: currencyCode,
10778
- onValueChange: (_value, _name, values) => onChange(values == null ? void 0 : values.value),
10779
- ...field
10780
- }
10781
- ) }),
10782
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10783
- ] })
10784
- ] }) })
10785
- }
10786
- ),
10787
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
10788
- /* @__PURE__ */ jsx(
10789
- Form$2.Field,
10790
- {
10791
- control: form.control,
10792
- name: "quantity",
10793
- render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10794
- /* @__PURE__ */ jsxs("div", { children: [
10795
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Quantity" }),
10796
- /* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
10797
- ] }),
10798
- /* @__PURE__ */ jsxs("div", { className: "w-full flex-1", children: [
10799
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10800
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10801
- ] })
10802
- ] }) })
10803
- }
10804
- )
10805
- ] }) }) }),
10806
- /* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10807
- /* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10808
- /* @__PURE__ */ jsx(Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10809
- ] }) })
10810
- ] }) }) });
10811
- };
10812
- const customItemSchema = objectType({
10813
- title: stringType().min(1),
10814
- quantity: numberType(),
10815
- unit_price: unionType([numberType(), stringType()])
10816
- });
10817
- const InlineTip = forwardRef(
10818
- ({ variant = "tip", label, className, children, ...props }, ref) => {
10819
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10820
- return /* @__PURE__ */ jsxs(
10821
- "div",
10822
- {
10823
- ref,
10824
- className: clx(
10825
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10826
- className
10827
- ),
10828
- ...props,
10829
- children: [
10830
- /* @__PURE__ */ jsx(
10831
- "div",
10832
- {
10833
- role: "presentation",
10834
- className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10835
- "bg-ui-tag-orange-icon": variant === "warning"
10836
- })
10837
- }
10838
- ),
10839
- /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
10840
- /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10841
- labelValue,
10842
- ":"
10843
- ] }),
10844
- " ",
10845
- children
10846
- ] })
10847
- ]
10848
- }
10849
- );
10850
- }
10851
- );
10852
- InlineTip.displayName = "InlineTip";
10853
- const MetadataFieldSchema = objectType({
10854
- key: stringType(),
10855
- disabled: booleanType().optional(),
10856
- value: anyType()
10857
- });
10858
- const MetadataSchema = objectType({
10859
- metadata: arrayType(MetadataFieldSchema)
10860
- });
10861
- const Metadata = () => {
10862
- const { id } = useParams();
10863
- const { order, isPending, isError, error } = useOrder(id, {
10864
- fields: "metadata"
10865
- });
10866
- if (isError) {
10867
- throw error;
10868
- }
10869
- const isReady = !isPending && !!order;
10870
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10871
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10872
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
10873
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10874
- ] }),
10875
- !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10876
- ] });
10877
- };
10878
- const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
10879
- const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
10880
- const MetadataForm = ({ orderId, metadata }) => {
10881
- const { handleSuccess } = useRouteModal();
10882
- const hasUneditableRows = getHasUneditableRows(metadata);
10883
- const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
10884
- const form = useForm({
10885
- defaultValues: {
10886
- metadata: getDefaultValues(metadata)
10887
- },
10888
- resolver: zodResolver(MetadataSchema)
10889
- });
10890
- const handleSubmit = form.handleSubmit(async (data) => {
10891
- const parsedData = parseValues(data);
10892
- await mutateAsync(
10893
- {
10894
- metadata: parsedData
10895
- },
10896
- {
10897
- onSuccess: () => {
10898
- toast.success("Metadata updated");
10899
- handleSuccess();
10900
- },
10901
- onError: (error) => {
10902
- toast.error(error.message);
10903
- }
10904
- }
10905
- );
10906
- });
10907
- const { fields, insert, remove } = useFieldArray({
10908
- control: form.control,
10909
- name: "metadata"
10910
- });
10911
- function deleteRow(index) {
10912
- remove(index);
10913
- if (fields.length === 1) {
10914
- insert(0, {
10915
- key: "",
10916
- value: "",
10917
- disabled: false
10918
- });
10919
- }
10920
- }
10921
- function insertRow(index, position) {
10922
- insert(index + (position === "above" ? 0 : 1), {
10923
- key: "",
10924
- value: "",
10925
- disabled: false
10926
- });
10927
- }
10928
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10929
- KeyboundForm,
10930
- {
10931
- onSubmit: handleSubmit,
10932
- className: "flex flex-1 flex-col overflow-hidden",
10933
- children: [
10934
- /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
10935
- /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
10936
- /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
10937
- /* @__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" }) }),
10938
- /* @__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" }) })
10939
- ] }),
10940
- fields.map((field, index) => {
10941
- const isDisabled = field.disabled || false;
10942
- let placeholder = "-";
10943
- if (typeof field.value === "object") {
10944
- placeholder = "{ ... }";
10945
- }
10946
- if (Array.isArray(field.value)) {
10947
- placeholder = "[ ... ]";
10948
- }
10949
- return /* @__PURE__ */ jsx(
10950
- ConditionalTooltip,
10951
- {
10952
- showTooltip: isDisabled,
10953
- content: "This row is disabled because it contains non-primitive data.",
10954
- children: /* @__PURE__ */ jsxs("div", { className: "group/table relative", children: [
10955
- /* @__PURE__ */ jsxs(
10956
- "div",
10957
- {
10958
- className: clx("grid grid-cols-2 divide-x", {
10959
- "overflow-hidden rounded-b-lg": index === fields.length - 1
10960
- }),
10961
- children: [
10962
- /* @__PURE__ */ jsx(
10963
- Form$2.Field,
10964
- {
10965
- control: form.control,
10966
- name: `metadata.${index}.key`,
10967
- render: ({ field: field2 }) => {
10968
- return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
10969
- GridInput,
10970
- {
10971
- "aria-labelledby": METADATA_KEY_LABEL_ID,
10972
- ...field2,
10973
- disabled: isDisabled,
10974
- placeholder: "Key"
10975
- }
10976
- ) }) });
10977
- }
10978
- }
10979
- ),
10980
- /* @__PURE__ */ jsx(
10981
- Form$2.Field,
10982
- {
10983
- control: form.control,
10984
- name: `metadata.${index}.value`,
10985
- render: ({ field: { value, ...field2 } }) => {
10986
- return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
10987
- GridInput,
10988
- {
10989
- "aria-labelledby": METADATA_VALUE_LABEL_ID,
10990
- ...field2,
10991
- value: isDisabled ? placeholder : value,
10992
- disabled: isDisabled,
10993
- placeholder: "Value"
10994
- }
10995
- ) }) });
10996
- }
10997
- }
10998
- )
10999
- ]
11000
- }
11001
- ),
11002
- /* @__PURE__ */ jsxs(DropdownMenu, { children: [
11003
- /* @__PURE__ */ jsx(
11004
- DropdownMenu.Trigger,
11005
- {
11006
- className: clx(
11007
- "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
11008
- {
11009
- hidden: isDisabled
11010
- }
11011
- ),
11012
- disabled: isDisabled,
11013
- asChild: true,
11014
- children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
11015
- }
11016
- ),
11017
- /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
11018
- /* @__PURE__ */ jsxs(
11019
- DropdownMenu.Item,
11020
- {
11021
- className: "gap-x-2",
11022
- onClick: () => insertRow(index, "above"),
11023
- children: [
11024
- /* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
11025
- "Insert row above"
11026
- ]
11027
- }
11028
- ),
11029
- /* @__PURE__ */ jsxs(
11030
- DropdownMenu.Item,
11031
- {
11032
- className: "gap-x-2",
11033
- onClick: () => insertRow(index, "below"),
11034
- children: [
11035
- /* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
11036
- "Insert row below"
11037
- ]
11038
- }
11039
- ),
11040
- /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
11041
- /* @__PURE__ */ jsxs(
11042
- DropdownMenu.Item,
11043
- {
11044
- className: "gap-x-2",
11045
- onClick: () => deleteRow(index),
11046
- children: [
11047
- /* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
11048
- "Delete row"
11049
- ]
11050
- }
11051
- )
11052
- ] })
11053
- ] })
11054
- ] })
11055
- },
11056
- field.id
11057
- );
11058
- })
11059
- ] }),
11060
- 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." })
11061
- ] }),
11062
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11063
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
11064
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11065
- ] }) })
11066
- ]
11067
- }
11068
- ) });
11069
- };
11070
- const GridInput = forwardRef(({ className, ...props }, ref) => {
11071
- return /* @__PURE__ */ jsx(
11072
- "input",
11073
- {
11074
- ref,
11075
- ...props,
11076
- autoComplete: "off",
11077
- className: clx(
11078
- "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",
11079
- className
11080
- )
11081
- }
11082
- );
11083
- });
11084
- GridInput.displayName = "MetadataForm.GridInput";
11085
- const PlaceholderInner = () => {
11086
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
11087
- /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
11088
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11089
- /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
11090
- /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
11091
- ] }) })
11092
- ] });
11093
- };
11094
- const EDITABLE_TYPES = ["string", "number", "boolean"];
11095
- function getDefaultValues(metadata) {
11096
- if (!metadata || !Object.keys(metadata).length) {
11097
- return [
11098
- {
11099
- key: "",
11100
- value: "",
11101
- disabled: false
11102
- }
11103
- ];
11104
- }
11105
- return Object.entries(metadata).map(([key, value]) => {
11106
- if (!EDITABLE_TYPES.includes(typeof value)) {
11107
- return {
11108
- key,
11109
- value,
11110
- disabled: true
11111
- };
11112
- }
11113
- let stringValue = value;
11114
- if (typeof value !== "string") {
11115
- stringValue = JSON.stringify(value);
11116
- }
11117
- return {
11118
- key,
11119
- value: stringValue,
11120
- original_key: key
11121
- };
11122
- });
11123
- }
11124
- function parseValues(values) {
11125
- const metadata = values.metadata;
11126
- const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
11127
- if (isEmpty) {
11128
- return null;
11129
- }
11130
- const update = {};
11131
- metadata.forEach((field) => {
11132
- let key = field.key;
11133
- let value = field.value;
11134
- const disabled = field.disabled;
11135
- if (!key || !value) {
11136
- return;
11137
- }
11138
- if (disabled) {
11139
- update[key] = value;
11140
- return;
11141
- }
11142
- key = key.trim();
11143
- value = value.trim();
11144
- if (value === "true") {
11145
- update[key] = true;
11146
- } else if (value === "false") {
11147
- update[key] = false;
11148
- } else {
11149
- const parsedNumber = parseFloat(value);
11150
- if (!isNaN(parsedNumber)) {
11151
- update[key] = parsedNumber;
11152
- } else {
11153
- update[key] = value;
11154
- }
11155
- }
11156
- });
11157
- return update;
11158
- }
11159
- function getHasUneditableRows(metadata) {
11160
- if (!metadata) {
11161
- return false;
11162
- }
11163
- return Object.values(metadata).some(
11164
- (value) => !EDITABLE_TYPES.includes(typeof value)
11165
- );
11166
- }
11093
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
11094
+ /* @__PURE__ */ jsx(
11095
+ Form$2.Field,
11096
+ {
11097
+ control: form.control,
11098
+ name: "title",
11099
+ render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
11100
+ /* @__PURE__ */ jsxs("div", { children: [
11101
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Title" }),
11102
+ /* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the title of the item" })
11103
+ ] }),
11104
+ /* @__PURE__ */ jsxs("div", { children: [
11105
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11106
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11107
+ ] })
11108
+ ] }) })
11109
+ }
11110
+ ),
11111
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
11112
+ /* @__PURE__ */ jsx(
11113
+ Form$2.Field,
11114
+ {
11115
+ control: form.control,
11116
+ name: "unit_price",
11117
+ render: ({ field: { onChange, ...field } }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
11118
+ /* @__PURE__ */ jsxs("div", { children: [
11119
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Unit price" }),
11120
+ /* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the unit price of the item" })
11121
+ ] }),
11122
+ /* @__PURE__ */ jsxs("div", { children: [
11123
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
11124
+ CurrencyInput,
11125
+ {
11126
+ symbol: getNativeSymbol(currencyCode),
11127
+ code: currencyCode,
11128
+ onValueChange: (_value, _name, values) => onChange(values == null ? void 0 : values.value),
11129
+ ...field
11130
+ }
11131
+ ) }),
11132
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11133
+ ] })
11134
+ ] }) })
11135
+ }
11136
+ ),
11137
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
11138
+ /* @__PURE__ */ jsx(
11139
+ Form$2.Field,
11140
+ {
11141
+ control: form.control,
11142
+ name: "quantity",
11143
+ render: ({ field }) => /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
11144
+ /* @__PURE__ */ jsxs("div", { children: [
11145
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Quantity" }),
11146
+ /* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
11147
+ ] }),
11148
+ /* @__PURE__ */ jsxs("div", { className: "w-full flex-1", children: [
11149
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsx(NumberInput, { ...field, className: "w-full" }) }) }),
11150
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11151
+ ] })
11152
+ ] }) })
11153
+ }
11154
+ )
11155
+ ] }) }) }),
11156
+ /* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11157
+ /* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
11158
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
11159
+ ] }) })
11160
+ ] }) }) });
11161
+ };
11162
+ const customItemSchema = objectType({
11163
+ title: stringType().min(1),
11164
+ quantity: numberType(),
11165
+ unit_price: unionType([numberType(), stringType()])
11166
+ });
11167
11167
  const PROMOTION_QUERY_KEY = "promotions";
11168
11168
  const promotionsQueryKeys = {
11169
11169
  list: (query2) => [
@@ -12343,17 +12343,220 @@ const CustomAmountField = ({
12343
12343
  /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12344
12344
  CurrencyInput,
12345
12345
  {
12346
- ...field,
12347
- onValueChange: (value) => onChange(value),
12348
- symbol: getNativeSymbol(currencyCode),
12349
- code: currencyCode
12346
+ ...field,
12347
+ onValueChange: (value) => onChange(value),
12348
+ symbol: getNativeSymbol(currencyCode),
12349
+ code: currencyCode
12350
+ }
12351
+ ) })
12352
+ ] });
12353
+ }
12354
+ }
12355
+ );
12356
+ };
12357
+ const ShippingAddress = () => {
12358
+ const { id } = useParams();
12359
+ const { order, isPending, isError, error } = useOrder(id, {
12360
+ fields: "+shipping_address"
12361
+ });
12362
+ if (isError) {
12363
+ throw error;
12364
+ }
12365
+ const isReady = !isPending && !!order;
12366
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12367
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12368
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12369
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12370
+ ] }),
12371
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12372
+ ] });
12373
+ };
12374
+ const ShippingAddressForm = ({ order }) => {
12375
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12376
+ const form = useForm({
12377
+ defaultValues: {
12378
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12379
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12380
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12381
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12382
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12383
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12384
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12385
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12386
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12387
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12388
+ },
12389
+ resolver: zodResolver(schema$1)
12390
+ });
12391
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12392
+ const { handleSuccess } = useRouteModal();
12393
+ const onSubmit = form.handleSubmit(async (data) => {
12394
+ await mutateAsync(
12395
+ {
12396
+ shipping_address: {
12397
+ first_name: data.first_name,
12398
+ last_name: data.last_name,
12399
+ company: data.company,
12400
+ address_1: data.address_1,
12401
+ address_2: data.address_2,
12402
+ city: data.city,
12403
+ province: data.province,
12404
+ country_code: data.country_code,
12405
+ postal_code: data.postal_code,
12406
+ phone: data.phone
12407
+ }
12408
+ },
12409
+ {
12410
+ onSuccess: () => {
12411
+ handleSuccess();
12412
+ },
12413
+ onError: (error) => {
12414
+ toast.error(error.message);
12415
+ }
12416
+ }
12417
+ );
12418
+ });
12419
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12420
+ KeyboundForm,
12421
+ {
12422
+ className: "flex flex-1 flex-col overflow-hidden",
12423
+ onSubmit,
12424
+ children: [
12425
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12426
+ /* @__PURE__ */ jsx(
12427
+ Form$2.Field,
12428
+ {
12429
+ control: form.control,
12430
+ name: "country_code",
12431
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12432
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12433
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12434
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12435
+ ] })
12436
+ }
12437
+ ),
12438
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12439
+ /* @__PURE__ */ jsx(
12440
+ Form$2.Field,
12441
+ {
12442
+ control: form.control,
12443
+ name: "first_name",
12444
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12445
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12446
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12447
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12448
+ ] })
12449
+ }
12450
+ ),
12451
+ /* @__PURE__ */ jsx(
12452
+ Form$2.Field,
12453
+ {
12454
+ control: form.control,
12455
+ name: "last_name",
12456
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12457
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12458
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12459
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12460
+ ] })
12461
+ }
12462
+ )
12463
+ ] }),
12464
+ /* @__PURE__ */ jsx(
12465
+ Form$2.Field,
12466
+ {
12467
+ control: form.control,
12468
+ name: "company",
12469
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12470
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12471
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12472
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12473
+ ] })
12474
+ }
12475
+ ),
12476
+ /* @__PURE__ */ jsx(
12477
+ Form$2.Field,
12478
+ {
12479
+ control: form.control,
12480
+ name: "address_1",
12481
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12482
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12483
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12484
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12485
+ ] })
12486
+ }
12487
+ ),
12488
+ /* @__PURE__ */ jsx(
12489
+ Form$2.Field,
12490
+ {
12491
+ control: form.control,
12492
+ name: "address_2",
12493
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12494
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12495
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12496
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12497
+ ] })
12498
+ }
12499
+ ),
12500
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12501
+ /* @__PURE__ */ jsx(
12502
+ Form$2.Field,
12503
+ {
12504
+ control: form.control,
12505
+ name: "postal_code",
12506
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12507
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12508
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12509
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12510
+ ] })
12511
+ }
12512
+ ),
12513
+ /* @__PURE__ */ jsx(
12514
+ Form$2.Field,
12515
+ {
12516
+ control: form.control,
12517
+ name: "city",
12518
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12519
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12520
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12521
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12522
+ ] })
12523
+ }
12524
+ )
12525
+ ] }),
12526
+ /* @__PURE__ */ jsx(
12527
+ Form$2.Field,
12528
+ {
12529
+ control: form.control,
12530
+ name: "province",
12531
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12532
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12533
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12534
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12535
+ ] })
12350
12536
  }
12351
- ) })
12352
- ] });
12353
- }
12537
+ ),
12538
+ /* @__PURE__ */ jsx(
12539
+ Form$2.Field,
12540
+ {
12541
+ control: form.control,
12542
+ name: "phone",
12543
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12544
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12545
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12546
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12547
+ ] })
12548
+ }
12549
+ )
12550
+ ] }) }),
12551
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12552
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12553
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12554
+ ] }) })
12555
+ ]
12354
12556
  }
12355
- );
12557
+ ) });
12356
12558
  };
12559
+ const schema$1 = addressSchema;
12357
12560
  const TransferOwnership = () => {
12358
12561
  const { id } = useParams();
12359
12562
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12377,7 +12580,7 @@ const TransferOwnershipForm = ({ order }) => {
12377
12580
  defaultValues: {
12378
12581
  customer_id: order.customer_id || ""
12379
12582
  },
12380
- resolver: zodResolver(schema$1)
12583
+ resolver: zodResolver(schema)
12381
12584
  });
12382
12585
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12383
12586
  const { handleSuccess } = useRouteModal();
@@ -12827,212 +13030,9 @@ const Illustration = () => {
12827
13030
  }
12828
13031
  );
12829
13032
  };
12830
- const schema$1 = objectType({
13033
+ const schema = objectType({
12831
13034
  customer_id: stringType().min(1)
12832
13035
  });
12833
- const ShippingAddress = () => {
12834
- const { id } = useParams();
12835
- const { order, isPending, isError, error } = useOrder(id, {
12836
- fields: "+shipping_address"
12837
- });
12838
- if (isError) {
12839
- throw error;
12840
- }
12841
- const isReady = !isPending && !!order;
12842
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12843
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12844
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12845
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12846
- ] }),
12847
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12848
- ] });
12849
- };
12850
- const ShippingAddressForm = ({ order }) => {
12851
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12852
- const form = useForm({
12853
- defaultValues: {
12854
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12855
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12856
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12857
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12858
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12859
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12860
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12861
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12862
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12863
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12864
- },
12865
- resolver: zodResolver(schema)
12866
- });
12867
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12868
- const { handleSuccess } = useRouteModal();
12869
- const onSubmit = form.handleSubmit(async (data) => {
12870
- await mutateAsync(
12871
- {
12872
- shipping_address: {
12873
- first_name: data.first_name,
12874
- last_name: data.last_name,
12875
- company: data.company,
12876
- address_1: data.address_1,
12877
- address_2: data.address_2,
12878
- city: data.city,
12879
- province: data.province,
12880
- country_code: data.country_code,
12881
- postal_code: data.postal_code,
12882
- phone: data.phone
12883
- }
12884
- },
12885
- {
12886
- onSuccess: () => {
12887
- handleSuccess();
12888
- },
12889
- onError: (error) => {
12890
- toast.error(error.message);
12891
- }
12892
- }
12893
- );
12894
- });
12895
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12896
- KeyboundForm,
12897
- {
12898
- className: "flex flex-1 flex-col overflow-hidden",
12899
- onSubmit,
12900
- children: [
12901
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12902
- /* @__PURE__ */ jsx(
12903
- Form$2.Field,
12904
- {
12905
- control: form.control,
12906
- name: "country_code",
12907
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12908
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12909
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12910
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12911
- ] })
12912
- }
12913
- ),
12914
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12915
- /* @__PURE__ */ jsx(
12916
- Form$2.Field,
12917
- {
12918
- control: form.control,
12919
- name: "first_name",
12920
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12921
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12922
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12923
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12924
- ] })
12925
- }
12926
- ),
12927
- /* @__PURE__ */ jsx(
12928
- Form$2.Field,
12929
- {
12930
- control: form.control,
12931
- name: "last_name",
12932
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12933
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12934
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12935
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12936
- ] })
12937
- }
12938
- )
12939
- ] }),
12940
- /* @__PURE__ */ jsx(
12941
- Form$2.Field,
12942
- {
12943
- control: form.control,
12944
- name: "company",
12945
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12946
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12947
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12948
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12949
- ] })
12950
- }
12951
- ),
12952
- /* @__PURE__ */ jsx(
12953
- Form$2.Field,
12954
- {
12955
- control: form.control,
12956
- name: "address_1",
12957
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12958
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12959
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12960
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12961
- ] })
12962
- }
12963
- ),
12964
- /* @__PURE__ */ jsx(
12965
- Form$2.Field,
12966
- {
12967
- control: form.control,
12968
- name: "address_2",
12969
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12970
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12971
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12972
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12973
- ] })
12974
- }
12975
- ),
12976
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12977
- /* @__PURE__ */ jsx(
12978
- Form$2.Field,
12979
- {
12980
- control: form.control,
12981
- name: "postal_code",
12982
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12983
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12984
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12985
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12986
- ] })
12987
- }
12988
- ),
12989
- /* @__PURE__ */ jsx(
12990
- Form$2.Field,
12991
- {
12992
- control: form.control,
12993
- name: "city",
12994
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12995
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12996
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12997
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12998
- ] })
12999
- }
13000
- )
13001
- ] }),
13002
- /* @__PURE__ */ jsx(
13003
- Form$2.Field,
13004
- {
13005
- control: form.control,
13006
- name: "province",
13007
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13008
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13009
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13010
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13011
- ] })
13012
- }
13013
- ),
13014
- /* @__PURE__ */ jsx(
13015
- Form$2.Field,
13016
- {
13017
- control: form.control,
13018
- name: "phone",
13019
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13020
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13021
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13022
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13023
- ] })
13024
- }
13025
- )
13026
- ] }) }),
13027
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13028
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13029
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13030
- ] }) })
13031
- ]
13032
- }
13033
- ) });
13034
- };
13035
- const schema = addressSchema;
13036
13036
  const widgetModule = { widgets: [] };
13037
13037
  const routeModule = {
13038
13038
  routes: [
@@ -13061,6 +13061,10 @@ const routeModule = {
13061
13061
  Component: CustomItems,
13062
13062
  path: "/draft-orders/:id/custom-items"
13063
13063
  },
13064
+ {
13065
+ Component: Metadata,
13066
+ path: "/draft-orders/:id/metadata"
13067
+ },
13064
13068
  {
13065
13069
  Component: Email,
13066
13070
  path: "/draft-orders/:id/email"
@@ -13069,10 +13073,6 @@ const routeModule = {
13069
13073
  Component: Items,
13070
13074
  path: "/draft-orders/:id/items"
13071
13075
  },
13072
- {
13073
- Component: Metadata,
13074
- path: "/draft-orders/:id/metadata"
13075
- },
13076
13076
  {
13077
13077
  Component: Promotions,
13078
13078
  path: "/draft-orders/:id/promotions"
@@ -13085,13 +13085,13 @@ const routeModule = {
13085
13085
  Component: Shipping,
13086
13086
  path: "/draft-orders/:id/shipping"
13087
13087
  },
13088
- {
13089
- Component: TransferOwnership,
13090
- path: "/draft-orders/:id/transfer-ownership"
13091
- },
13092
13088
  {
13093
13089
  Component: ShippingAddress,
13094
13090
  path: "/draft-orders/:id/shipping-address"
13091
+ },
13092
+ {
13093
+ Component: TransferOwnership,
13094
+ path: "/draft-orders/:id/transfer-ownership"
13095
13095
  }
13096
13096
  ]
13097
13097
  }