@medusajs/draft-order 2.11.4-preview-20251118150138 → 2.11.4-preview-20251118180132

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.
@@ -9762,27 +9762,6 @@ const BillingAddressForm = ({ order }) => {
9762
9762
  ) });
9763
9763
  };
9764
9764
  const schema$5 = addressSchema;
9765
- const CustomItems = () => {
9766
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9767
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9768
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9769
- ] });
9770
- };
9771
- const CustomItemsForm = () => {
9772
- const form = reactHookForm.useForm({
9773
- resolver: zod.zodResolver(schema$4)
9774
- });
9775
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9776
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9777
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9778
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9779
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9780
- ] }) })
9781
- ] }) });
9782
- };
9783
- const schema$4 = objectType({
9784
- email: stringType().email()
9785
- });
9786
9765
  const Email = () => {
9787
9766
  const { id } = reactRouterDom.useParams();
9788
9767
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9805,7 +9784,7 @@ const EmailForm = ({ order }) => {
9805
9784
  defaultValues: {
9806
9785
  email: order.email ?? ""
9807
9786
  },
9808
- resolver: zod.zodResolver(schema$3)
9787
+ resolver: zod.zodResolver(schema$4)
9809
9788
  });
9810
9789
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9811
9790
  const { handleSuccess } = useRouteModal();
@@ -9848,6 +9827,27 @@ const EmailForm = ({ order }) => {
9848
9827
  }
9849
9828
  ) });
9850
9829
  };
9830
+ const schema$4 = objectType({
9831
+ email: stringType().email()
9832
+ });
9833
+ const CustomItems = () => {
9834
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9835
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9836
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9837
+ ] });
9838
+ };
9839
+ const CustomItemsForm = () => {
9840
+ const form = reactHookForm.useForm({
9841
+ resolver: zod.zodResolver(schema$3)
9842
+ });
9843
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9844
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9845
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9846
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9847
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9848
+ ] }) })
9849
+ ] }) });
9850
+ };
9851
9851
  const schema$3 = objectType({
9852
9852
  email: stringType().email()
9853
9853
  });
@@ -10825,478 +10825,128 @@ const customItemSchema = objectType({
10825
10825
  quantity: numberType(),
10826
10826
  unit_price: unionType([numberType(), stringType()])
10827
10827
  });
10828
- const InlineTip = React.forwardRef(
10829
- ({ variant = "tip", label, className, children, ...props }, ref) => {
10830
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10831
- return /* @__PURE__ */ jsxRuntime.jsxs(
10832
- "div",
10833
- {
10834
- ref,
10835
- className: ui.clx(
10836
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10837
- className
10838
- ),
10839
- ...props,
10840
- children: [
10841
- /* @__PURE__ */ jsxRuntime.jsx(
10842
- "div",
10843
- {
10844
- role: "presentation",
10845
- className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10846
- "bg-ui-tag-orange-icon": variant === "warning"
10847
- })
10848
- }
10849
- ),
10850
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
10851
- /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10852
- labelValue,
10853
- ":"
10854
- ] }),
10855
- " ",
10856
- children
10857
- ] })
10858
- ]
10859
- }
10860
- );
10861
- }
10862
- );
10863
- InlineTip.displayName = "InlineTip";
10864
- const MetadataFieldSchema = objectType({
10865
- key: stringType(),
10866
- disabled: booleanType().optional(),
10867
- value: anyType()
10868
- });
10869
- const MetadataSchema = objectType({
10870
- metadata: arrayType(MetadataFieldSchema)
10871
- });
10872
- const Metadata = () => {
10873
- const { id } = reactRouterDom.useParams();
10874
- const { order, isPending, isError, error } = useOrder(id, {
10875
- fields: "metadata"
10828
+ const PROMOTION_QUERY_KEY = "promotions";
10829
+ const promotionsQueryKeys = {
10830
+ list: (query2) => [
10831
+ PROMOTION_QUERY_KEY,
10832
+ query2 ? query2 : void 0
10833
+ ],
10834
+ detail: (id, query2) => [
10835
+ PROMOTION_QUERY_KEY,
10836
+ id,
10837
+ query2 ? query2 : void 0
10838
+ ]
10839
+ };
10840
+ const usePromotions = (query2, options) => {
10841
+ const { data, ...rest } = reactQuery.useQuery({
10842
+ queryKey: promotionsQueryKeys.list(query2),
10843
+ queryFn: async () => sdk.admin.promotion.list(query2),
10844
+ ...options
10876
10845
  });
10877
- if (isError) {
10878
- throw error;
10846
+ return { ...data, ...rest };
10847
+ };
10848
+ const Promotions = () => {
10849
+ const { id } = reactRouterDom.useParams();
10850
+ const {
10851
+ order: preview,
10852
+ isError: isPreviewError,
10853
+ error: previewError
10854
+ } = useOrderPreview(id, void 0);
10855
+ useInitiateOrderEdit({ preview });
10856
+ const { onCancel } = useCancelOrderEdit({ preview });
10857
+ if (isPreviewError) {
10858
+ throw previewError;
10879
10859
  }
10880
- const isReady = !isPending && !!order;
10881
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10882
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10883
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Metadata" }) }),
10884
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10885
- ] }),
10886
- !isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10860
+ const isReady = !!preview;
10861
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { onClose: onCancel, children: [
10862
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Promotions" }) }) }),
10863
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(PromotionForm, { preview })
10887
10864
  ] });
10888
10865
  };
10889
- const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
10890
- const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
10891
- const MetadataForm = ({ orderId, metadata }) => {
10866
+ const PromotionForm = ({ preview }) => {
10867
+ const { items, shipping_methods } = preview;
10868
+ const [isSubmitting, setIsSubmitting] = React.useState(false);
10869
+ const [comboboxValue, setComboboxValue] = React.useState("");
10892
10870
  const { handleSuccess } = useRouteModal();
10893
- const hasUneditableRows = getHasUneditableRows(metadata);
10894
- const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
10895
- const form = reactHookForm.useForm({
10896
- defaultValues: {
10897
- metadata: getDefaultValues(metadata)
10871
+ const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
10872
+ const promoIds = getPromotionIds(items, shipping_methods);
10873
+ const { promotions, isPending, isError, error } = usePromotions(
10874
+ {
10875
+ id: promoIds
10898
10876
  },
10899
- resolver: zod.zodResolver(MetadataSchema)
10877
+ {
10878
+ enabled: !!promoIds.length
10879
+ }
10880
+ );
10881
+ const comboboxData = useComboboxData({
10882
+ queryKey: ["promotions", "combobox", promoIds],
10883
+ queryFn: async (params) => {
10884
+ return await sdk.admin.promotion.list({
10885
+ ...params,
10886
+ id: {
10887
+ $nin: promoIds
10888
+ }
10889
+ });
10890
+ },
10891
+ getOptions: (data) => {
10892
+ return data.promotions.map((promotion) => ({
10893
+ label: promotion.code,
10894
+ value: promotion.code
10895
+ }));
10896
+ }
10900
10897
  });
10901
- const handleSubmit = form.handleSubmit(async (data) => {
10902
- const parsedData = parseValues(data);
10903
- await mutateAsync(
10898
+ const add = async (value) => {
10899
+ if (!value) {
10900
+ return;
10901
+ }
10902
+ addPromotions(
10904
10903
  {
10905
- metadata: parsedData
10904
+ promo_codes: [value]
10906
10905
  },
10907
10906
  {
10908
- onSuccess: () => {
10909
- ui.toast.success("Metadata updated");
10910
- handleSuccess();
10907
+ onError: (e) => {
10908
+ ui.toast.error(e.message);
10909
+ comboboxData.onSearchValueChange("");
10910
+ setComboboxValue("");
10911
10911
  },
10912
- onError: (error) => {
10913
- ui.toast.error(error.message);
10912
+ onSuccess: () => {
10913
+ comboboxData.onSearchValueChange("");
10914
+ setComboboxValue("");
10914
10915
  }
10915
10916
  }
10916
10917
  );
10917
- });
10918
- const { fields, insert, remove } = reactHookForm.useFieldArray({
10919
- control: form.control,
10920
- name: "metadata"
10921
- });
10922
- function deleteRow(index) {
10923
- remove(index);
10924
- if (fields.length === 1) {
10925
- insert(0, {
10926
- key: "",
10927
- value: "",
10928
- disabled: false
10929
- });
10918
+ };
10919
+ const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
10920
+ const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
10921
+ const onSubmit = async () => {
10922
+ setIsSubmitting(true);
10923
+ let requestSucceeded = false;
10924
+ await requestOrderEdit(void 0, {
10925
+ onError: (e) => {
10926
+ ui.toast.error(e.message);
10927
+ },
10928
+ onSuccess: () => {
10929
+ requestSucceeded = true;
10930
+ }
10931
+ });
10932
+ if (!requestSucceeded) {
10933
+ setIsSubmitting(false);
10934
+ return;
10930
10935
  }
10931
- }
10932
- function insertRow(index, position) {
10933
- insert(index + (position === "above" ? 0 : 1), {
10934
- key: "",
10935
- value: "",
10936
- disabled: false
10936
+ await confirmOrderEdit(void 0, {
10937
+ onError: (e) => {
10938
+ ui.toast.error(e.message);
10939
+ },
10940
+ onSuccess: () => {
10941
+ handleSuccess();
10942
+ },
10943
+ onSettled: () => {
10944
+ setIsSubmitting(false);
10945
+ }
10937
10946
  });
10938
- }
10939
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10940
- KeyboundForm,
10941
- {
10942
- onSubmit: handleSubmit,
10943
- className: "flex flex-1 flex-col overflow-hidden",
10944
- children: [
10945
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
10946
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
10947
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
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_KEY_LABEL_ID, children: "Key" }) }),
10949
- /* @__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" }) })
10950
- ] }),
10951
- fields.map((field, index) => {
10952
- const isDisabled = field.disabled || false;
10953
- let placeholder = "-";
10954
- if (typeof field.value === "object") {
10955
- placeholder = "{ ... }";
10956
- }
10957
- if (Array.isArray(field.value)) {
10958
- placeholder = "[ ... ]";
10959
- }
10960
- return /* @__PURE__ */ jsxRuntime.jsx(
10961
- ConditionalTooltip,
10962
- {
10963
- showTooltip: isDisabled,
10964
- content: "This row is disabled because it contains non-primitive data.",
10965
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
10966
- /* @__PURE__ */ jsxRuntime.jsxs(
10967
- "div",
10968
- {
10969
- className: ui.clx("grid grid-cols-2 divide-x", {
10970
- "overflow-hidden rounded-b-lg": index === fields.length - 1
10971
- }),
10972
- children: [
10973
- /* @__PURE__ */ jsxRuntime.jsx(
10974
- Form$2.Field,
10975
- {
10976
- control: form.control,
10977
- name: `metadata.${index}.key`,
10978
- render: ({ field: field2 }) => {
10979
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
10980
- GridInput,
10981
- {
10982
- "aria-labelledby": METADATA_KEY_LABEL_ID,
10983
- ...field2,
10984
- disabled: isDisabled,
10985
- placeholder: "Key"
10986
- }
10987
- ) }) });
10988
- }
10989
- }
10990
- ),
10991
- /* @__PURE__ */ jsxRuntime.jsx(
10992
- Form$2.Field,
10993
- {
10994
- control: form.control,
10995
- name: `metadata.${index}.value`,
10996
- render: ({ field: { value, ...field2 } }) => {
10997
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
10998
- GridInput,
10999
- {
11000
- "aria-labelledby": METADATA_VALUE_LABEL_ID,
11001
- ...field2,
11002
- value: isDisabled ? placeholder : value,
11003
- disabled: isDisabled,
11004
- placeholder: "Value"
11005
- }
11006
- ) }) });
11007
- }
11008
- }
11009
- )
11010
- ]
11011
- }
11012
- ),
11013
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
11014
- /* @__PURE__ */ jsxRuntime.jsx(
11015
- ui.DropdownMenu.Trigger,
11016
- {
11017
- className: ui.clx(
11018
- "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
11019
- {
11020
- hidden: isDisabled
11021
- }
11022
- ),
11023
- disabled: isDisabled,
11024
- asChild: true,
11025
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
11026
- }
11027
- ),
11028
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
11029
- /* @__PURE__ */ jsxRuntime.jsxs(
11030
- ui.DropdownMenu.Item,
11031
- {
11032
- className: "gap-x-2",
11033
- onClick: () => insertRow(index, "above"),
11034
- children: [
11035
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
11036
- "Insert row above"
11037
- ]
11038
- }
11039
- ),
11040
- /* @__PURE__ */ jsxRuntime.jsxs(
11041
- ui.DropdownMenu.Item,
11042
- {
11043
- className: "gap-x-2",
11044
- onClick: () => insertRow(index, "below"),
11045
- children: [
11046
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
11047
- "Insert row below"
11048
- ]
11049
- }
11050
- ),
11051
- /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
11052
- /* @__PURE__ */ jsxRuntime.jsxs(
11053
- ui.DropdownMenu.Item,
11054
- {
11055
- className: "gap-x-2",
11056
- onClick: () => deleteRow(index),
11057
- children: [
11058
- /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
11059
- "Delete row"
11060
- ]
11061
- }
11062
- )
11063
- ] })
11064
- ] })
11065
- ] })
11066
- },
11067
- field.id
11068
- );
11069
- })
11070
- ] }),
11071
- 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." })
11072
- ] }),
11073
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11074
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
11075
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11076
- ] }) })
11077
- ]
11078
- }
11079
- ) });
11080
- };
11081
- const GridInput = React.forwardRef(({ className, ...props }, ref) => {
11082
- return /* @__PURE__ */ jsxRuntime.jsx(
11083
- "input",
11084
- {
11085
- ref,
11086
- ...props,
11087
- autoComplete: "off",
11088
- className: ui.clx(
11089
- "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",
11090
- className
11091
- )
11092
- }
11093
- );
11094
- });
11095
- GridInput.displayName = "MetadataForm.GridInput";
11096
- const PlaceholderInner = () => {
11097
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
11098
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
11099
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11100
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
11101
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
11102
- ] }) })
11103
- ] });
11104
- };
11105
- const EDITABLE_TYPES = ["string", "number", "boolean"];
11106
- function getDefaultValues(metadata) {
11107
- if (!metadata || !Object.keys(metadata).length) {
11108
- return [
11109
- {
11110
- key: "",
11111
- value: "",
11112
- disabled: false
11113
- }
11114
- ];
11115
- }
11116
- return Object.entries(metadata).map(([key, value]) => {
11117
- if (!EDITABLE_TYPES.includes(typeof value)) {
11118
- return {
11119
- key,
11120
- value,
11121
- disabled: true
11122
- };
11123
- }
11124
- let stringValue = value;
11125
- if (typeof value !== "string") {
11126
- stringValue = JSON.stringify(value);
11127
- }
11128
- return {
11129
- key,
11130
- value: stringValue,
11131
- original_key: key
11132
- };
11133
- });
11134
- }
11135
- function parseValues(values) {
11136
- const metadata = values.metadata;
11137
- const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
11138
- if (isEmpty) {
11139
- return null;
11140
- }
11141
- const update = {};
11142
- metadata.forEach((field) => {
11143
- let key = field.key;
11144
- let value = field.value;
11145
- const disabled = field.disabled;
11146
- if (!key || !value) {
11147
- return;
11148
- }
11149
- if (disabled) {
11150
- update[key] = value;
11151
- return;
11152
- }
11153
- key = key.trim();
11154
- value = value.trim();
11155
- if (value === "true") {
11156
- update[key] = true;
11157
- } else if (value === "false") {
11158
- update[key] = false;
11159
- } else {
11160
- const parsedNumber = parseFloat(value);
11161
- if (!isNaN(parsedNumber)) {
11162
- update[key] = parsedNumber;
11163
- } else {
11164
- update[key] = value;
11165
- }
11166
- }
11167
- });
11168
- return update;
11169
- }
11170
- function getHasUneditableRows(metadata) {
11171
- if (!metadata) {
11172
- return false;
11173
- }
11174
- return Object.values(metadata).some(
11175
- (value) => !EDITABLE_TYPES.includes(typeof value)
11176
- );
11177
- }
11178
- const PROMOTION_QUERY_KEY = "promotions";
11179
- const promotionsQueryKeys = {
11180
- list: (query2) => [
11181
- PROMOTION_QUERY_KEY,
11182
- query2 ? query2 : void 0
11183
- ],
11184
- detail: (id, query2) => [
11185
- PROMOTION_QUERY_KEY,
11186
- id,
11187
- query2 ? query2 : void 0
11188
- ]
11189
- };
11190
- const usePromotions = (query2, options) => {
11191
- const { data, ...rest } = reactQuery.useQuery({
11192
- queryKey: promotionsQueryKeys.list(query2),
11193
- queryFn: async () => sdk.admin.promotion.list(query2),
11194
- ...options
11195
- });
11196
- return { ...data, ...rest };
11197
- };
11198
- const Promotions = () => {
11199
- const { id } = reactRouterDom.useParams();
11200
- const {
11201
- order: preview,
11202
- isError: isPreviewError,
11203
- error: previewError
11204
- } = useOrderPreview(id, void 0);
11205
- useInitiateOrderEdit({ preview });
11206
- const { onCancel } = useCancelOrderEdit({ preview });
11207
- if (isPreviewError) {
11208
- throw previewError;
11209
- }
11210
- const isReady = !!preview;
11211
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { onClose: onCancel, children: [
11212
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Promotions" }) }) }),
11213
- isReady && /* @__PURE__ */ jsxRuntime.jsx(PromotionForm, { preview })
11214
- ] });
11215
- };
11216
- const PromotionForm = ({ preview }) => {
11217
- const { items, shipping_methods } = preview;
11218
- const [isSubmitting, setIsSubmitting] = React.useState(false);
11219
- const [comboboxValue, setComboboxValue] = React.useState("");
11220
- const { handleSuccess } = useRouteModal();
11221
- const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
11222
- const promoIds = getPromotionIds(items, shipping_methods);
11223
- const { promotions, isPending, isError, error } = usePromotions(
11224
- {
11225
- id: promoIds
11226
- },
11227
- {
11228
- enabled: !!promoIds.length
11229
- }
11230
- );
11231
- const comboboxData = useComboboxData({
11232
- queryKey: ["promotions", "combobox", promoIds],
11233
- queryFn: async (params) => {
11234
- return await sdk.admin.promotion.list({
11235
- ...params,
11236
- id: {
11237
- $nin: promoIds
11238
- }
11239
- });
11240
- },
11241
- getOptions: (data) => {
11242
- return data.promotions.map((promotion) => ({
11243
- label: promotion.code,
11244
- value: promotion.code
11245
- }));
11246
- }
11247
- });
11248
- const add = async (value) => {
11249
- if (!value) {
11250
- return;
11251
- }
11252
- addPromotions(
11253
- {
11254
- promo_codes: [value]
11255
- },
11256
- {
11257
- onError: (e) => {
11258
- ui.toast.error(e.message);
11259
- comboboxData.onSearchValueChange("");
11260
- setComboboxValue("");
11261
- },
11262
- onSuccess: () => {
11263
- comboboxData.onSearchValueChange("");
11264
- setComboboxValue("");
11265
- }
11266
- }
11267
- );
11268
- };
11269
- const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11270
- const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
11271
- const onSubmit = async () => {
11272
- setIsSubmitting(true);
11273
- let requestSucceeded = false;
11274
- await requestOrderEdit(void 0, {
11275
- onError: (e) => {
11276
- ui.toast.error(e.message);
11277
- },
11278
- onSuccess: () => {
11279
- requestSucceeded = true;
11280
- }
11281
- });
11282
- if (!requestSucceeded) {
11283
- setIsSubmitting(false);
11284
- return;
11285
- }
11286
- await confirmOrderEdit(void 0, {
11287
- onError: (e) => {
11288
- ui.toast.error(e.message);
11289
- },
11290
- onSuccess: () => {
11291
- handleSuccess();
11292
- },
11293
- onSettled: () => {
11294
- setIsSubmitting(false);
11295
- }
11296
- });
11297
- };
11298
- if (isError) {
11299
- throw error;
10947
+ };
10948
+ if (isError) {
10949
+ throw error;
11300
10950
  }
11301
10951
  return /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
11302
10952
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
@@ -13039,11 +12689,361 @@ const Illustration = () => {
13039
12689
  ] })
13040
12690
  ]
13041
12691
  }
13042
- );
12692
+ );
12693
+ };
12694
+ const schema = objectType({
12695
+ customer_id: stringType().min(1)
12696
+ });
12697
+ const InlineTip = React.forwardRef(
12698
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
12699
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
12700
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12701
+ "div",
12702
+ {
12703
+ ref,
12704
+ className: ui.clx(
12705
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
12706
+ className
12707
+ ),
12708
+ ...props,
12709
+ children: [
12710
+ /* @__PURE__ */ jsxRuntime.jsx(
12711
+ "div",
12712
+ {
12713
+ role: "presentation",
12714
+ className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
12715
+ "bg-ui-tag-orange-icon": variant === "warning"
12716
+ })
12717
+ }
12718
+ ),
12719
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
12720
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
12721
+ labelValue,
12722
+ ":"
12723
+ ] }),
12724
+ " ",
12725
+ children
12726
+ ] })
12727
+ ]
12728
+ }
12729
+ );
12730
+ }
12731
+ );
12732
+ InlineTip.displayName = "InlineTip";
12733
+ const MetadataFieldSchema = objectType({
12734
+ key: stringType(),
12735
+ disabled: booleanType().optional(),
12736
+ value: anyType()
12737
+ });
12738
+ const MetadataSchema = objectType({
12739
+ metadata: arrayType(MetadataFieldSchema)
12740
+ });
12741
+ const Metadata = () => {
12742
+ const { id } = reactRouterDom.useParams();
12743
+ const { order, isPending, isError, error } = useOrder(id, {
12744
+ fields: "metadata"
12745
+ });
12746
+ if (isError) {
12747
+ throw error;
12748
+ }
12749
+ const isReady = !isPending && !!order;
12750
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12751
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12752
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Metadata" }) }),
12753
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
12754
+ ] }),
12755
+ !isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
12756
+ ] });
12757
+ };
12758
+ const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
12759
+ const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
12760
+ const MetadataForm = ({ orderId, metadata }) => {
12761
+ const { handleSuccess } = useRouteModal();
12762
+ const hasUneditableRows = getHasUneditableRows(metadata);
12763
+ const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
12764
+ const form = reactHookForm.useForm({
12765
+ defaultValues: {
12766
+ metadata: getDefaultValues(metadata)
12767
+ },
12768
+ resolver: zod.zodResolver(MetadataSchema)
12769
+ });
12770
+ const handleSubmit = form.handleSubmit(async (data) => {
12771
+ const parsedData = parseValues(data);
12772
+ await mutateAsync(
12773
+ {
12774
+ metadata: parsedData
12775
+ },
12776
+ {
12777
+ onSuccess: () => {
12778
+ ui.toast.success("Metadata updated");
12779
+ handleSuccess();
12780
+ },
12781
+ onError: (error) => {
12782
+ ui.toast.error(error.message);
12783
+ }
12784
+ }
12785
+ );
12786
+ });
12787
+ const { fields, insert, remove } = reactHookForm.useFieldArray({
12788
+ control: form.control,
12789
+ name: "metadata"
12790
+ });
12791
+ function deleteRow(index) {
12792
+ remove(index);
12793
+ if (fields.length === 1) {
12794
+ insert(0, {
12795
+ key: "",
12796
+ value: "",
12797
+ disabled: false
12798
+ });
12799
+ }
12800
+ }
12801
+ function insertRow(index, position) {
12802
+ insert(index + (position === "above" ? 0 : 1), {
12803
+ key: "",
12804
+ value: "",
12805
+ disabled: false
12806
+ });
12807
+ }
12808
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12809
+ KeyboundForm,
12810
+ {
12811
+ onSubmit: handleSubmit,
12812
+ className: "flex flex-1 flex-col overflow-hidden",
12813
+ children: [
12814
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
12815
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
12816
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
12817
+ /* @__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" }) }),
12818
+ /* @__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" }) })
12819
+ ] }),
12820
+ fields.map((field, index) => {
12821
+ const isDisabled = field.disabled || false;
12822
+ let placeholder = "-";
12823
+ if (typeof field.value === "object") {
12824
+ placeholder = "{ ... }";
12825
+ }
12826
+ if (Array.isArray(field.value)) {
12827
+ placeholder = "[ ... ]";
12828
+ }
12829
+ return /* @__PURE__ */ jsxRuntime.jsx(
12830
+ ConditionalTooltip,
12831
+ {
12832
+ showTooltip: isDisabled,
12833
+ content: "This row is disabled because it contains non-primitive data.",
12834
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
12835
+ /* @__PURE__ */ jsxRuntime.jsxs(
12836
+ "div",
12837
+ {
12838
+ className: ui.clx("grid grid-cols-2 divide-x", {
12839
+ "overflow-hidden rounded-b-lg": index === fields.length - 1
12840
+ }),
12841
+ children: [
12842
+ /* @__PURE__ */ jsxRuntime.jsx(
12843
+ Form$2.Field,
12844
+ {
12845
+ control: form.control,
12846
+ name: `metadata.${index}.key`,
12847
+ render: ({ field: field2 }) => {
12848
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12849
+ GridInput,
12850
+ {
12851
+ "aria-labelledby": METADATA_KEY_LABEL_ID,
12852
+ ...field2,
12853
+ disabled: isDisabled,
12854
+ placeholder: "Key"
12855
+ }
12856
+ ) }) });
12857
+ }
12858
+ }
12859
+ ),
12860
+ /* @__PURE__ */ jsxRuntime.jsx(
12861
+ Form$2.Field,
12862
+ {
12863
+ control: form.control,
12864
+ name: `metadata.${index}.value`,
12865
+ render: ({ field: { value, ...field2 } }) => {
12866
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12867
+ GridInput,
12868
+ {
12869
+ "aria-labelledby": METADATA_VALUE_LABEL_ID,
12870
+ ...field2,
12871
+ value: isDisabled ? placeholder : value,
12872
+ disabled: isDisabled,
12873
+ placeholder: "Value"
12874
+ }
12875
+ ) }) });
12876
+ }
12877
+ }
12878
+ )
12879
+ ]
12880
+ }
12881
+ ),
12882
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
12883
+ /* @__PURE__ */ jsxRuntime.jsx(
12884
+ ui.DropdownMenu.Trigger,
12885
+ {
12886
+ className: ui.clx(
12887
+ "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
12888
+ {
12889
+ hidden: isDisabled
12890
+ }
12891
+ ),
12892
+ disabled: isDisabled,
12893
+ asChild: true,
12894
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
12895
+ }
12896
+ ),
12897
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
12898
+ /* @__PURE__ */ jsxRuntime.jsxs(
12899
+ ui.DropdownMenu.Item,
12900
+ {
12901
+ className: "gap-x-2",
12902
+ onClick: () => insertRow(index, "above"),
12903
+ children: [
12904
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
12905
+ "Insert row above"
12906
+ ]
12907
+ }
12908
+ ),
12909
+ /* @__PURE__ */ jsxRuntime.jsxs(
12910
+ ui.DropdownMenu.Item,
12911
+ {
12912
+ className: "gap-x-2",
12913
+ onClick: () => insertRow(index, "below"),
12914
+ children: [
12915
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
12916
+ "Insert row below"
12917
+ ]
12918
+ }
12919
+ ),
12920
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
12921
+ /* @__PURE__ */ jsxRuntime.jsxs(
12922
+ ui.DropdownMenu.Item,
12923
+ {
12924
+ className: "gap-x-2",
12925
+ onClick: () => deleteRow(index),
12926
+ children: [
12927
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
12928
+ "Delete row"
12929
+ ]
12930
+ }
12931
+ )
12932
+ ] })
12933
+ ] })
12934
+ ] })
12935
+ },
12936
+ field.id
12937
+ );
12938
+ })
12939
+ ] }),
12940
+ 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." })
12941
+ ] }),
12942
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
12943
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
12944
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12945
+ ] }) })
12946
+ ]
12947
+ }
12948
+ ) });
13043
12949
  };
13044
- const schema = objectType({
13045
- customer_id: stringType().min(1)
12950
+ const GridInput = React.forwardRef(({ className, ...props }, ref) => {
12951
+ return /* @__PURE__ */ jsxRuntime.jsx(
12952
+ "input",
12953
+ {
12954
+ ref,
12955
+ ...props,
12956
+ autoComplete: "off",
12957
+ className: ui.clx(
12958
+ "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",
12959
+ className
12960
+ )
12961
+ }
12962
+ );
13046
12963
  });
12964
+ GridInput.displayName = "MetadataForm.GridInput";
12965
+ const PlaceholderInner = () => {
12966
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
12967
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
12968
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
12969
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
12970
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
12971
+ ] }) })
12972
+ ] });
12973
+ };
12974
+ const EDITABLE_TYPES = ["string", "number", "boolean"];
12975
+ function getDefaultValues(metadata) {
12976
+ if (!metadata || !Object.keys(metadata).length) {
12977
+ return [
12978
+ {
12979
+ key: "",
12980
+ value: "",
12981
+ disabled: false
12982
+ }
12983
+ ];
12984
+ }
12985
+ return Object.entries(metadata).map(([key, value]) => {
12986
+ if (!EDITABLE_TYPES.includes(typeof value)) {
12987
+ return {
12988
+ key,
12989
+ value,
12990
+ disabled: true
12991
+ };
12992
+ }
12993
+ let stringValue = value;
12994
+ if (typeof value !== "string") {
12995
+ stringValue = JSON.stringify(value);
12996
+ }
12997
+ return {
12998
+ key,
12999
+ value: stringValue,
13000
+ original_key: key
13001
+ };
13002
+ });
13003
+ }
13004
+ function parseValues(values) {
13005
+ const metadata = values.metadata;
13006
+ const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
13007
+ if (isEmpty) {
13008
+ return null;
13009
+ }
13010
+ const update = {};
13011
+ metadata.forEach((field) => {
13012
+ let key = field.key;
13013
+ let value = field.value;
13014
+ const disabled = field.disabled;
13015
+ if (!key || !value) {
13016
+ return;
13017
+ }
13018
+ if (disabled) {
13019
+ update[key] = value;
13020
+ return;
13021
+ }
13022
+ key = key.trim();
13023
+ value = value.trim();
13024
+ if (value === "true") {
13025
+ update[key] = true;
13026
+ } else if (value === "false") {
13027
+ update[key] = false;
13028
+ } else {
13029
+ const parsedNumber = parseFloat(value);
13030
+ if (!isNaN(parsedNumber)) {
13031
+ update[key] = parsedNumber;
13032
+ } else {
13033
+ update[key] = value;
13034
+ }
13035
+ }
13036
+ });
13037
+ return update;
13038
+ }
13039
+ function getHasUneditableRows(metadata) {
13040
+ if (!metadata) {
13041
+ return false;
13042
+ }
13043
+ return Object.values(metadata).some(
13044
+ (value) => !EDITABLE_TYPES.includes(typeof value)
13045
+ );
13046
+ }
13047
13047
  const widgetModule = { widgets: [] };
13048
13048
  const routeModule = {
13049
13049
  routes: [
@@ -13068,21 +13068,17 @@ const routeModule = {
13068
13068
  Component: BillingAddress,
13069
13069
  path: "/draft-orders/:id/billing-address"
13070
13070
  },
13071
- {
13072
- Component: CustomItems,
13073
- path: "/draft-orders/:id/custom-items"
13074
- },
13075
13071
  {
13076
13072
  Component: Email,
13077
13073
  path: "/draft-orders/:id/email"
13078
13074
  },
13079
13075
  {
13080
- Component: Items,
13081
- path: "/draft-orders/:id/items"
13076
+ Component: CustomItems,
13077
+ path: "/draft-orders/:id/custom-items"
13082
13078
  },
13083
13079
  {
13084
- Component: Metadata,
13085
- path: "/draft-orders/:id/metadata"
13080
+ Component: Items,
13081
+ path: "/draft-orders/:id/items"
13086
13082
  },
13087
13083
  {
13088
13084
  Component: Promotions,
@@ -13103,6 +13099,10 @@ const routeModule = {
13103
13099
  {
13104
13100
  Component: TransferOwnership,
13105
13101
  path: "/draft-orders/:id/transfer-ownership"
13102
+ },
13103
+ {
13104
+ Component: Metadata,
13105
+ path: "/draft-orders/:id/metadata"
13106
13106
  }
13107
13107
  ]
13108
13108
  }