@medusajs/draft-order 2.11.4-preview-20251108120149 → 2.11.4-preview-20251108180137

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.
@@ -9751,74 +9751,6 @@ const BillingAddressForm = ({ order }) => {
9751
9751
  ) });
9752
9752
  };
9753
9753
  const schema$5 = addressSchema;
9754
- const Email = () => {
9755
- const { id } = useParams();
9756
- const { order, isPending, isError, error } = useOrder(id, {
9757
- fields: "+email"
9758
- });
9759
- if (isError) {
9760
- throw error;
9761
- }
9762
- const isReady = !isPending && !!order;
9763
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9764
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9765
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9766
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9767
- ] }),
9768
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9769
- ] });
9770
- };
9771
- const EmailForm = ({ order }) => {
9772
- const form = useForm({
9773
- defaultValues: {
9774
- email: order.email ?? ""
9775
- },
9776
- resolver: zodResolver(schema$4)
9777
- });
9778
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9779
- const { handleSuccess } = useRouteModal();
9780
- const onSubmit = form.handleSubmit(async (data) => {
9781
- await mutateAsync(
9782
- { email: data.email },
9783
- {
9784
- onSuccess: () => {
9785
- handleSuccess();
9786
- },
9787
- onError: (error) => {
9788
- toast.error(error.message);
9789
- }
9790
- }
9791
- );
9792
- });
9793
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9794
- KeyboundForm,
9795
- {
9796
- className: "flex flex-1 flex-col overflow-hidden",
9797
- onSubmit,
9798
- children: [
9799
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9800
- Form$2.Field,
9801
- {
9802
- control: form.control,
9803
- name: "email",
9804
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9805
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9806
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9807
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9808
- ] })
9809
- }
9810
- ) }),
9811
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9812
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9813
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9814
- ] }) })
9815
- ]
9816
- }
9817
- ) });
9818
- };
9819
- const schema$4 = objectType({
9820
- email: stringType().email()
9821
- });
9822
9754
  const CustomItems = () => {
9823
9755
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9824
9756
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9827,7 +9759,7 @@ const CustomItems = () => {
9827
9759
  };
9828
9760
  const CustomItemsForm = () => {
9829
9761
  const form = useForm({
9830
- resolver: zodResolver(schema$3)
9762
+ resolver: zodResolver(schema$4)
9831
9763
  });
9832
9764
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9833
9765
  /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
@@ -9837,7 +9769,7 @@ const CustomItemsForm = () => {
9837
9769
  ] }) })
9838
9770
  ] }) });
9839
9771
  };
9840
- const schema$3 = objectType({
9772
+ const schema$4 = objectType({
9841
9773
  email: stringType().email()
9842
9774
  });
9843
9775
  const NumberInput = forwardRef(
@@ -10814,385 +10746,108 @@ const customItemSchema = objectType({
10814
10746
  quantity: numberType(),
10815
10747
  unit_price: unionType([numberType(), stringType()])
10816
10748
  });
10817
- const PROMOTION_QUERY_KEY = "promotions";
10818
- const promotionsQueryKeys = {
10819
- list: (query2) => [
10820
- PROMOTION_QUERY_KEY,
10821
- query2 ? query2 : void 0
10822
- ],
10823
- detail: (id, query2) => [
10824
- PROMOTION_QUERY_KEY,
10825
- id,
10826
- query2 ? query2 : void 0
10827
- ]
10828
- };
10829
- const usePromotions = (query2, options) => {
10830
- const { data, ...rest } = useQuery({
10831
- queryKey: promotionsQueryKeys.list(query2),
10832
- queryFn: async () => sdk.admin.promotion.list(query2),
10833
- ...options
10834
- });
10835
- return { ...data, ...rest };
10836
- };
10837
- const Promotions = () => {
10749
+ const InlineTip = forwardRef(
10750
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
10751
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10752
+ return /* @__PURE__ */ jsxs(
10753
+ "div",
10754
+ {
10755
+ ref,
10756
+ className: clx(
10757
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10758
+ className
10759
+ ),
10760
+ ...props,
10761
+ children: [
10762
+ /* @__PURE__ */ jsx(
10763
+ "div",
10764
+ {
10765
+ role: "presentation",
10766
+ className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10767
+ "bg-ui-tag-orange-icon": variant === "warning"
10768
+ })
10769
+ }
10770
+ ),
10771
+ /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
10772
+ /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10773
+ labelValue,
10774
+ ":"
10775
+ ] }),
10776
+ " ",
10777
+ children
10778
+ ] })
10779
+ ]
10780
+ }
10781
+ );
10782
+ }
10783
+ );
10784
+ InlineTip.displayName = "InlineTip";
10785
+ const MetadataFieldSchema = objectType({
10786
+ key: stringType(),
10787
+ disabled: booleanType().optional(),
10788
+ value: anyType()
10789
+ });
10790
+ const MetadataSchema = objectType({
10791
+ metadata: arrayType(MetadataFieldSchema)
10792
+ });
10793
+ const Metadata = () => {
10838
10794
  const { id } = useParams();
10839
- const {
10840
- order: preview,
10841
- isError: isPreviewError,
10842
- error: previewError
10843
- } = useOrderPreview(id, void 0);
10844
- useInitiateOrderEdit({ preview });
10845
- const { onCancel } = useCancelOrderEdit({ preview });
10846
- if (isPreviewError) {
10847
- throw previewError;
10795
+ const { order, isPending, isError, error } = useOrder(id, {
10796
+ fields: "metadata"
10797
+ });
10798
+ if (isError) {
10799
+ throw error;
10848
10800
  }
10849
- const isReady = !!preview;
10850
- return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
10851
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
10852
- isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
10801
+ const isReady = !isPending && !!order;
10802
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10803
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10804
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
10805
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10806
+ ] }),
10807
+ !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10853
10808
  ] });
10854
10809
  };
10855
- const PromotionForm = ({ preview }) => {
10856
- const { items, shipping_methods } = preview;
10857
- const [isSubmitting, setIsSubmitting] = useState(false);
10858
- const [comboboxValue, setComboboxValue] = useState("");
10810
+ const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
10811
+ const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
10812
+ const MetadataForm = ({ orderId, metadata }) => {
10859
10813
  const { handleSuccess } = useRouteModal();
10860
- const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
10861
- const promoIds = getPromotionIds(items, shipping_methods);
10862
- const { promotions, isPending, isError, error } = usePromotions(
10863
- {
10864
- id: promoIds
10865
- },
10866
- {
10867
- enabled: !!promoIds.length
10868
- }
10869
- );
10870
- const comboboxData = useComboboxData({
10871
- queryKey: ["promotions", "combobox", promoIds],
10872
- queryFn: async (params) => {
10873
- return await sdk.admin.promotion.list({
10874
- ...params,
10875
- id: {
10876
- $nin: promoIds
10877
- }
10878
- });
10814
+ const hasUneditableRows = getHasUneditableRows(metadata);
10815
+ const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
10816
+ const form = useForm({
10817
+ defaultValues: {
10818
+ metadata: getDefaultValues(metadata)
10879
10819
  },
10880
- getOptions: (data) => {
10881
- return data.promotions.map((promotion) => ({
10882
- label: promotion.code,
10883
- value: promotion.code
10884
- }));
10885
- }
10820
+ resolver: zodResolver(MetadataSchema)
10886
10821
  });
10887
- const add = async (value) => {
10888
- if (!value) {
10889
- return;
10890
- }
10891
- addPromotions(
10822
+ const handleSubmit = form.handleSubmit(async (data) => {
10823
+ const parsedData = parseValues(data);
10824
+ await mutateAsync(
10892
10825
  {
10893
- promo_codes: [value]
10826
+ metadata: parsedData
10894
10827
  },
10895
10828
  {
10896
- onError: (e) => {
10897
- toast.error(e.message);
10898
- comboboxData.onSearchValueChange("");
10899
- setComboboxValue("");
10900
- },
10901
10829
  onSuccess: () => {
10902
- comboboxData.onSearchValueChange("");
10903
- setComboboxValue("");
10830
+ toast.success("Metadata updated");
10831
+ handleSuccess();
10832
+ },
10833
+ onError: (error) => {
10834
+ toast.error(error.message);
10904
10835
  }
10905
10836
  }
10906
10837
  );
10907
- };
10908
- const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
10909
- const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
10910
- const onSubmit = async () => {
10911
- setIsSubmitting(true);
10912
- let requestSucceeded = false;
10913
- await requestOrderEdit(void 0, {
10914
- onError: (e) => {
10915
- toast.error(e.message);
10916
- },
10917
- onSuccess: () => {
10918
- requestSucceeded = true;
10919
- }
10920
- });
10921
- if (!requestSucceeded) {
10922
- setIsSubmitting(false);
10923
- return;
10924
- }
10925
- await confirmOrderEdit(void 0, {
10926
- onError: (e) => {
10927
- toast.error(e.message);
10928
- },
10929
- onSuccess: () => {
10930
- handleSuccess();
10931
- },
10932
- onSettled: () => {
10933
- setIsSubmitting(false);
10934
- }
10935
- });
10936
- };
10937
- if (isError) {
10938
- throw error;
10939
- }
10940
- return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
10941
- /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
10942
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
10943
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
10944
- /* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
10945
- /* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
10946
- ] }),
10947
- /* @__PURE__ */ jsx(
10948
- Combobox,
10949
- {
10950
- id: "promotion-combobox",
10951
- "aria-describedby": "promotion-combobox-hint",
10952
- isFetchingNextPage: comboboxData.isFetchingNextPage,
10953
- fetchNextPage: comboboxData.fetchNextPage,
10954
- options: comboboxData.options,
10955
- onSearchValueChange: comboboxData.onSearchValueChange,
10956
- searchValue: comboboxData.searchValue,
10957
- disabled: comboboxData.disabled || isAddingPromotions,
10958
- onChange: add,
10959
- value: comboboxValue
10960
- }
10961
- )
10962
- ] }),
10963
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
10964
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
10965
- PromotionItem,
10966
- {
10967
- promotion,
10968
- orderId: preview.id,
10969
- isLoading: isPending
10970
- },
10971
- promotion.id
10972
- )) })
10973
- ] }) }),
10974
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10975
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10976
- /* @__PURE__ */ jsx(
10977
- Button,
10978
- {
10979
- size: "small",
10980
- type: "submit",
10981
- isLoading: isSubmitting || isAddingPromotions,
10982
- children: "Save"
10983
- }
10984
- )
10985
- ] }) })
10986
- ] });
10987
- };
10988
- const PromotionItem = ({
10989
- promotion,
10990
- orderId,
10991
- isLoading
10992
- }) => {
10993
- var _a;
10994
- const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
10995
- const onRemove = async () => {
10996
- removePromotions(
10997
- {
10998
- promo_codes: [promotion.code]
10999
- },
11000
- {
11001
- onError: (e) => {
11002
- toast.error(e.message);
11003
- }
11004
- }
11005
- );
11006
- };
11007
- const displayValue = getDisplayValue(promotion);
11008
- return /* @__PURE__ */ jsxs(
11009
- "div",
11010
- {
11011
- className: clx(
11012
- "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
11013
- {
11014
- "animate-pulse": isLoading
11015
- }
11016
- ),
11017
- children: [
11018
- /* @__PURE__ */ jsxs("div", { children: [
11019
- /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
11020
- /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
11021
- displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
11022
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
11023
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
11024
- ] }),
11025
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
11026
- ] })
11027
- ] }),
11028
- /* @__PURE__ */ jsx(
11029
- IconButton,
11030
- {
11031
- size: "small",
11032
- type: "button",
11033
- variant: "transparent",
11034
- onClick: onRemove,
11035
- isLoading: isPending || isLoading,
11036
- children: /* @__PURE__ */ jsx(XMark, {})
11037
- }
11038
- )
11039
- ]
11040
- },
11041
- promotion.id
11042
- );
11043
- };
11044
- function getDisplayValue(promotion) {
11045
- var _a, _b, _c, _d;
11046
- const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
11047
- if (!value) {
11048
- return null;
11049
- }
11050
- if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
11051
- const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
11052
- if (!currency) {
11053
- return null;
11054
- }
11055
- return getLocaleAmount(value, currency);
11056
- } else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
11057
- return formatPercentage(value);
11058
- }
11059
- return null;
11060
- }
11061
- const formatter = new Intl.NumberFormat([], {
11062
- style: "percent",
11063
- minimumFractionDigits: 2
11064
- });
11065
- const formatPercentage = (value, isPercentageValue = false) => {
11066
- let val = value || 0;
11067
- if (!isPercentageValue) {
11068
- val = val / 100;
11069
- }
11070
- return formatter.format(val);
11071
- };
11072
- function getPromotionIds(items, shippingMethods) {
11073
- const promotionIds = /* @__PURE__ */ new Set();
11074
- for (const item of items) {
11075
- if (item.adjustments) {
11076
- for (const adjustment of item.adjustments) {
11077
- if (adjustment.promotion_id) {
11078
- promotionIds.add(adjustment.promotion_id);
11079
- }
11080
- }
11081
- }
11082
- }
11083
- for (const shippingMethod of shippingMethods) {
11084
- if (shippingMethod.adjustments) {
11085
- for (const adjustment of shippingMethod.adjustments) {
11086
- if (adjustment.promotion_id) {
11087
- promotionIds.add(adjustment.promotion_id);
11088
- }
11089
- }
11090
- }
11091
- }
11092
- return Array.from(promotionIds);
11093
- }
11094
- const InlineTip = forwardRef(
11095
- ({ variant = "tip", label, className, children, ...props }, ref) => {
11096
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
11097
- return /* @__PURE__ */ jsxs(
11098
- "div",
11099
- {
11100
- ref,
11101
- className: clx(
11102
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
11103
- className
11104
- ),
11105
- ...props,
11106
- children: [
11107
- /* @__PURE__ */ jsx(
11108
- "div",
11109
- {
11110
- role: "presentation",
11111
- className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
11112
- "bg-ui-tag-orange-icon": variant === "warning"
11113
- })
11114
- }
11115
- ),
11116
- /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
11117
- /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
11118
- labelValue,
11119
- ":"
11120
- ] }),
11121
- " ",
11122
- children
11123
- ] })
11124
- ]
11125
- }
11126
- );
11127
- }
11128
- );
11129
- InlineTip.displayName = "InlineTip";
11130
- const MetadataFieldSchema = objectType({
11131
- key: stringType(),
11132
- disabled: booleanType().optional(),
11133
- value: anyType()
11134
- });
11135
- const MetadataSchema = objectType({
11136
- metadata: arrayType(MetadataFieldSchema)
11137
- });
11138
- const Metadata = () => {
11139
- const { id } = useParams();
11140
- const { order, isPending, isError, error } = useOrder(id, {
11141
- fields: "metadata"
11142
- });
11143
- if (isError) {
11144
- throw error;
11145
- }
11146
- const isReady = !isPending && !!order;
11147
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11148
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11149
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
11150
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
11151
- ] }),
11152
- !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
11153
- ] });
11154
- };
11155
- const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
11156
- const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
11157
- const MetadataForm = ({ orderId, metadata }) => {
11158
- const { handleSuccess } = useRouteModal();
11159
- const hasUneditableRows = getHasUneditableRows(metadata);
11160
- const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
11161
- const form = useForm({
11162
- defaultValues: {
11163
- metadata: getDefaultValues(metadata)
11164
- },
11165
- resolver: zodResolver(MetadataSchema)
11166
- });
11167
- const handleSubmit = form.handleSubmit(async (data) => {
11168
- const parsedData = parseValues(data);
11169
- await mutateAsync(
11170
- {
11171
- metadata: parsedData
11172
- },
11173
- {
11174
- onSuccess: () => {
11175
- toast.success("Metadata updated");
11176
- handleSuccess();
11177
- },
11178
- onError: (error) => {
11179
- toast.error(error.message);
11180
- }
11181
- }
11182
- );
11183
- });
11184
- const { fields, insert, remove } = useFieldArray({
11185
- control: form.control,
11186
- name: "metadata"
11187
- });
11188
- function deleteRow(index) {
11189
- remove(index);
11190
- if (fields.length === 1) {
11191
- insert(0, {
11192
- key: "",
11193
- value: "",
11194
- disabled: false
11195
- });
10838
+ });
10839
+ const { fields, insert, remove } = useFieldArray({
10840
+ control: form.control,
10841
+ name: "metadata"
10842
+ });
10843
+ function deleteRow(index) {
10844
+ remove(index);
10845
+ if (fields.length === 1) {
10846
+ insert(0, {
10847
+ key: "",
10848
+ value: "",
10849
+ disabled: false
10850
+ });
11196
10851
  }
11197
10852
  }
11198
10853
  function insertRow(index, position) {
@@ -11344,102 +10999,447 @@ const MetadataForm = ({ orderId, metadata }) => {
11344
10999
  }
11345
11000
  ) });
11346
11001
  };
11347
- const GridInput = forwardRef(({ className, ...props }, ref) => {
11348
- return /* @__PURE__ */ jsx(
11349
- "input",
11002
+ const GridInput = forwardRef(({ className, ...props }, ref) => {
11003
+ return /* @__PURE__ */ jsx(
11004
+ "input",
11005
+ {
11006
+ ref,
11007
+ ...props,
11008
+ autoComplete: "off",
11009
+ className: clx(
11010
+ "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",
11011
+ className
11012
+ )
11013
+ }
11014
+ );
11015
+ });
11016
+ GridInput.displayName = "MetadataForm.GridInput";
11017
+ const PlaceholderInner = () => {
11018
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
11019
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
11020
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11021
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
11022
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
11023
+ ] }) })
11024
+ ] });
11025
+ };
11026
+ const EDITABLE_TYPES = ["string", "number", "boolean"];
11027
+ function getDefaultValues(metadata) {
11028
+ if (!metadata || !Object.keys(metadata).length) {
11029
+ return [
11030
+ {
11031
+ key: "",
11032
+ value: "",
11033
+ disabled: false
11034
+ }
11035
+ ];
11036
+ }
11037
+ return Object.entries(metadata).map(([key, value]) => {
11038
+ if (!EDITABLE_TYPES.includes(typeof value)) {
11039
+ return {
11040
+ key,
11041
+ value,
11042
+ disabled: true
11043
+ };
11044
+ }
11045
+ let stringValue = value;
11046
+ if (typeof value !== "string") {
11047
+ stringValue = JSON.stringify(value);
11048
+ }
11049
+ return {
11050
+ key,
11051
+ value: stringValue,
11052
+ original_key: key
11053
+ };
11054
+ });
11055
+ }
11056
+ function parseValues(values) {
11057
+ const metadata = values.metadata;
11058
+ const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
11059
+ if (isEmpty) {
11060
+ return null;
11061
+ }
11062
+ const update = {};
11063
+ metadata.forEach((field) => {
11064
+ let key = field.key;
11065
+ let value = field.value;
11066
+ const disabled = field.disabled;
11067
+ if (!key || !value) {
11068
+ return;
11069
+ }
11070
+ if (disabled) {
11071
+ update[key] = value;
11072
+ return;
11073
+ }
11074
+ key = key.trim();
11075
+ value = value.trim();
11076
+ if (value === "true") {
11077
+ update[key] = true;
11078
+ } else if (value === "false") {
11079
+ update[key] = false;
11080
+ } else {
11081
+ const parsedNumber = parseFloat(value);
11082
+ if (!isNaN(parsedNumber)) {
11083
+ update[key] = parsedNumber;
11084
+ } else {
11085
+ update[key] = value;
11086
+ }
11087
+ }
11088
+ });
11089
+ return update;
11090
+ }
11091
+ function getHasUneditableRows(metadata) {
11092
+ if (!metadata) {
11093
+ return false;
11094
+ }
11095
+ return Object.values(metadata).some(
11096
+ (value) => !EDITABLE_TYPES.includes(typeof value)
11097
+ );
11098
+ }
11099
+ const Email = () => {
11100
+ const { id } = useParams();
11101
+ const { order, isPending, isError, error } = useOrder(id, {
11102
+ fields: "+email"
11103
+ });
11104
+ if (isError) {
11105
+ throw error;
11106
+ }
11107
+ const isReady = !isPending && !!order;
11108
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11109
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11110
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
11111
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
11112
+ ] }),
11113
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
11114
+ ] });
11115
+ };
11116
+ const EmailForm = ({ order }) => {
11117
+ const form = useForm({
11118
+ defaultValues: {
11119
+ email: order.email ?? ""
11120
+ },
11121
+ resolver: zodResolver(schema$3)
11122
+ });
11123
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11124
+ const { handleSuccess } = useRouteModal();
11125
+ const onSubmit = form.handleSubmit(async (data) => {
11126
+ await mutateAsync(
11127
+ { email: data.email },
11128
+ {
11129
+ onSuccess: () => {
11130
+ handleSuccess();
11131
+ },
11132
+ onError: (error) => {
11133
+ toast.error(error.message);
11134
+ }
11135
+ }
11136
+ );
11137
+ });
11138
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11139
+ KeyboundForm,
11140
+ {
11141
+ className: "flex flex-1 flex-col overflow-hidden",
11142
+ onSubmit,
11143
+ children: [
11144
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
11145
+ Form$2.Field,
11146
+ {
11147
+ control: form.control,
11148
+ name: "email",
11149
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11150
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
11151
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11152
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11153
+ ] })
11154
+ }
11155
+ ) }),
11156
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11157
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11158
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11159
+ ] }) })
11160
+ ]
11161
+ }
11162
+ ) });
11163
+ };
11164
+ const schema$3 = objectType({
11165
+ email: stringType().email()
11166
+ });
11167
+ const PROMOTION_QUERY_KEY = "promotions";
11168
+ const promotionsQueryKeys = {
11169
+ list: (query2) => [
11170
+ PROMOTION_QUERY_KEY,
11171
+ query2 ? query2 : void 0
11172
+ ],
11173
+ detail: (id, query2) => [
11174
+ PROMOTION_QUERY_KEY,
11175
+ id,
11176
+ query2 ? query2 : void 0
11177
+ ]
11178
+ };
11179
+ const usePromotions = (query2, options) => {
11180
+ const { data, ...rest } = useQuery({
11181
+ queryKey: promotionsQueryKeys.list(query2),
11182
+ queryFn: async () => sdk.admin.promotion.list(query2),
11183
+ ...options
11184
+ });
11185
+ return { ...data, ...rest };
11186
+ };
11187
+ const Promotions = () => {
11188
+ const { id } = useParams();
11189
+ const {
11190
+ order: preview,
11191
+ isError: isPreviewError,
11192
+ error: previewError
11193
+ } = useOrderPreview(id, void 0);
11194
+ useInitiateOrderEdit({ preview });
11195
+ const { onCancel } = useCancelOrderEdit({ preview });
11196
+ if (isPreviewError) {
11197
+ throw previewError;
11198
+ }
11199
+ const isReady = !!preview;
11200
+ return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
11201
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
11202
+ isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
11203
+ ] });
11204
+ };
11205
+ const PromotionForm = ({ preview }) => {
11206
+ const { items, shipping_methods } = preview;
11207
+ const [isSubmitting, setIsSubmitting] = useState(false);
11208
+ const [comboboxValue, setComboboxValue] = useState("");
11209
+ const { handleSuccess } = useRouteModal();
11210
+ const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
11211
+ const promoIds = getPromotionIds(items, shipping_methods);
11212
+ const { promotions, isPending, isError, error } = usePromotions(
11350
11213
  {
11351
- ref,
11352
- ...props,
11353
- autoComplete: "off",
11354
- className: clx(
11355
- "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",
11356
- className
11357
- )
11214
+ id: promoIds
11215
+ },
11216
+ {
11217
+ enabled: !!promoIds.length
11358
11218
  }
11359
11219
  );
11360
- });
11361
- GridInput.displayName = "MetadataForm.GridInput";
11362
- const PlaceholderInner = () => {
11363
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
11364
- /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
11365
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11366
- /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
11367
- /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
11220
+ const comboboxData = useComboboxData({
11221
+ queryKey: ["promotions", "combobox", promoIds],
11222
+ queryFn: async (params) => {
11223
+ return await sdk.admin.promotion.list({
11224
+ ...params,
11225
+ id: {
11226
+ $nin: promoIds
11227
+ }
11228
+ });
11229
+ },
11230
+ getOptions: (data) => {
11231
+ return data.promotions.map((promotion) => ({
11232
+ label: promotion.code,
11233
+ value: promotion.code
11234
+ }));
11235
+ }
11236
+ });
11237
+ const add = async (value) => {
11238
+ if (!value) {
11239
+ return;
11240
+ }
11241
+ addPromotions(
11242
+ {
11243
+ promo_codes: [value]
11244
+ },
11245
+ {
11246
+ onError: (e) => {
11247
+ toast.error(e.message);
11248
+ comboboxData.onSearchValueChange("");
11249
+ setComboboxValue("");
11250
+ },
11251
+ onSuccess: () => {
11252
+ comboboxData.onSearchValueChange("");
11253
+ setComboboxValue("");
11254
+ }
11255
+ }
11256
+ );
11257
+ };
11258
+ const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11259
+ const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
11260
+ const onSubmit = async () => {
11261
+ setIsSubmitting(true);
11262
+ let requestSucceeded = false;
11263
+ await requestOrderEdit(void 0, {
11264
+ onError: (e) => {
11265
+ toast.error(e.message);
11266
+ },
11267
+ onSuccess: () => {
11268
+ requestSucceeded = true;
11269
+ }
11270
+ });
11271
+ if (!requestSucceeded) {
11272
+ setIsSubmitting(false);
11273
+ return;
11274
+ }
11275
+ await confirmOrderEdit(void 0, {
11276
+ onError: (e) => {
11277
+ toast.error(e.message);
11278
+ },
11279
+ onSuccess: () => {
11280
+ handleSuccess();
11281
+ },
11282
+ onSettled: () => {
11283
+ setIsSubmitting(false);
11284
+ }
11285
+ });
11286
+ };
11287
+ if (isError) {
11288
+ throw error;
11289
+ }
11290
+ return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
11291
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
11292
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
11293
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
11294
+ /* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
11295
+ /* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
11296
+ ] }),
11297
+ /* @__PURE__ */ jsx(
11298
+ Combobox,
11299
+ {
11300
+ id: "promotion-combobox",
11301
+ "aria-describedby": "promotion-combobox-hint",
11302
+ isFetchingNextPage: comboboxData.isFetchingNextPage,
11303
+ fetchNextPage: comboboxData.fetchNextPage,
11304
+ options: comboboxData.options,
11305
+ onSearchValueChange: comboboxData.onSearchValueChange,
11306
+ searchValue: comboboxData.searchValue,
11307
+ disabled: comboboxData.disabled || isAddingPromotions,
11308
+ onChange: add,
11309
+ value: comboboxValue
11310
+ }
11311
+ )
11312
+ ] }),
11313
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
11314
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
11315
+ PromotionItem,
11316
+ {
11317
+ promotion,
11318
+ orderId: preview.id,
11319
+ isLoading: isPending
11320
+ },
11321
+ promotion.id
11322
+ )) })
11323
+ ] }) }),
11324
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11325
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11326
+ /* @__PURE__ */ jsx(
11327
+ Button,
11328
+ {
11329
+ size: "small",
11330
+ type: "submit",
11331
+ isLoading: isSubmitting || isAddingPromotions,
11332
+ children: "Save"
11333
+ }
11334
+ )
11368
11335
  ] }) })
11369
11336
  ] });
11370
11337
  };
11371
- const EDITABLE_TYPES = ["string", "number", "boolean"];
11372
- function getDefaultValues(metadata) {
11373
- if (!metadata || !Object.keys(metadata).length) {
11374
- return [
11338
+ const PromotionItem = ({
11339
+ promotion,
11340
+ orderId,
11341
+ isLoading
11342
+ }) => {
11343
+ var _a;
11344
+ const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
11345
+ const onRemove = async () => {
11346
+ removePromotions(
11375
11347
  {
11376
- key: "",
11377
- value: "",
11378
- disabled: false
11348
+ promo_codes: [promotion.code]
11349
+ },
11350
+ {
11351
+ onError: (e) => {
11352
+ toast.error(e.message);
11353
+ }
11379
11354
  }
11380
- ];
11355
+ );
11356
+ };
11357
+ const displayValue = getDisplayValue(promotion);
11358
+ return /* @__PURE__ */ jsxs(
11359
+ "div",
11360
+ {
11361
+ className: clx(
11362
+ "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
11363
+ {
11364
+ "animate-pulse": isLoading
11365
+ }
11366
+ ),
11367
+ children: [
11368
+ /* @__PURE__ */ jsxs("div", { children: [
11369
+ /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
11370
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
11371
+ displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
11372
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
11373
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
11374
+ ] }),
11375
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
11376
+ ] })
11377
+ ] }),
11378
+ /* @__PURE__ */ jsx(
11379
+ IconButton,
11380
+ {
11381
+ size: "small",
11382
+ type: "button",
11383
+ variant: "transparent",
11384
+ onClick: onRemove,
11385
+ isLoading: isPending || isLoading,
11386
+ children: /* @__PURE__ */ jsx(XMark, {})
11387
+ }
11388
+ )
11389
+ ]
11390
+ },
11391
+ promotion.id
11392
+ );
11393
+ };
11394
+ function getDisplayValue(promotion) {
11395
+ var _a, _b, _c, _d;
11396
+ const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
11397
+ if (!value) {
11398
+ return null;
11381
11399
  }
11382
- return Object.entries(metadata).map(([key, value]) => {
11383
- if (!EDITABLE_TYPES.includes(typeof value)) {
11384
- return {
11385
- key,
11386
- value,
11387
- disabled: true
11388
- };
11389
- }
11390
- let stringValue = value;
11391
- if (typeof value !== "string") {
11392
- stringValue = JSON.stringify(value);
11400
+ if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
11401
+ const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
11402
+ if (!currency) {
11403
+ return null;
11393
11404
  }
11394
- return {
11395
- key,
11396
- value: stringValue,
11397
- original_key: key
11398
- };
11399
- });
11405
+ return getLocaleAmount(value, currency);
11406
+ } else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
11407
+ return formatPercentage(value);
11408
+ }
11409
+ return null;
11400
11410
  }
11401
- function parseValues(values) {
11402
- const metadata = values.metadata;
11403
- const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
11404
- if (isEmpty) {
11405
- return null;
11411
+ const formatter = new Intl.NumberFormat([], {
11412
+ style: "percent",
11413
+ minimumFractionDigits: 2
11414
+ });
11415
+ const formatPercentage = (value, isPercentageValue = false) => {
11416
+ let val = value || 0;
11417
+ if (!isPercentageValue) {
11418
+ val = val / 100;
11406
11419
  }
11407
- const update = {};
11408
- metadata.forEach((field) => {
11409
- let key = field.key;
11410
- let value = field.value;
11411
- const disabled = field.disabled;
11412
- if (!key || !value) {
11413
- return;
11414
- }
11415
- if (disabled) {
11416
- update[key] = value;
11417
- return;
11420
+ return formatter.format(val);
11421
+ };
11422
+ function getPromotionIds(items, shippingMethods) {
11423
+ const promotionIds = /* @__PURE__ */ new Set();
11424
+ for (const item of items) {
11425
+ if (item.adjustments) {
11426
+ for (const adjustment of item.adjustments) {
11427
+ if (adjustment.promotion_id) {
11428
+ promotionIds.add(adjustment.promotion_id);
11429
+ }
11430
+ }
11418
11431
  }
11419
- key = key.trim();
11420
- value = value.trim();
11421
- if (value === "true") {
11422
- update[key] = true;
11423
- } else if (value === "false") {
11424
- update[key] = false;
11425
- } else {
11426
- const parsedNumber = parseFloat(value);
11427
- if (!isNaN(parsedNumber)) {
11428
- update[key] = parsedNumber;
11429
- } else {
11430
- update[key] = value;
11432
+ }
11433
+ for (const shippingMethod of shippingMethods) {
11434
+ if (shippingMethod.adjustments) {
11435
+ for (const adjustment of shippingMethod.adjustments) {
11436
+ if (adjustment.promotion_id) {
11437
+ promotionIds.add(adjustment.promotion_id);
11438
+ }
11431
11439
  }
11432
11440
  }
11433
- });
11434
- return update;
11435
- }
11436
- function getHasUneditableRows(metadata) {
11437
- if (!metadata) {
11438
- return false;
11439
11441
  }
11440
- return Object.values(metadata).some(
11441
- (value) => !EDITABLE_TYPES.includes(typeof value)
11442
- );
11442
+ return Array.from(promotionIds);
11443
11443
  }
11444
11444
  const SalesChannel = () => {
11445
11445
  const { id } = useParams();
@@ -12337,226 +12337,23 @@ const CustomAmountField = ({
12337
12337
  render: ({ field: { onChange, ...field } }) => {
12338
12338
  return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
12339
12339
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
12340
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
12341
- /* @__PURE__ */ jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
12342
- ] }),
12343
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12344
- CurrencyInput,
12345
- {
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
- ] })
12536
- }
12537
- ),
12538
- /* @__PURE__ */ jsx(
12539
- Form$2.Field,
12340
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
12341
+ /* @__PURE__ */ jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
12342
+ ] }),
12343
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12344
+ CurrencyInput,
12540
12345
  {
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
- ] })
12346
+ ...field,
12347
+ onValueChange: (value) => onChange(value),
12348
+ symbol: getNativeSymbol(currencyCode),
12349
+ code: currencyCode
12548
12350
  }
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
- ]
12351
+ ) })
12352
+ ] });
12353
+ }
12556
12354
  }
12557
- ) });
12355
+ );
12558
12356
  };
12559
- const schema$1 = addressSchema;
12560
12357
  const TransferOwnership = () => {
12561
12358
  const { id } = useParams();
12562
12359
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12580,7 +12377,7 @@ const TransferOwnershipForm = ({ order }) => {
12580
12377
  defaultValues: {
12581
12378
  customer_id: order.customer_id || ""
12582
12379
  },
12583
- resolver: zodResolver(schema)
12380
+ resolver: zodResolver(schema$1)
12584
12381
  });
12585
12382
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12586
12383
  const { handleSuccess } = useRouteModal();
@@ -13030,9 +12827,212 @@ const Illustration = () => {
13030
12827
  }
13031
12828
  );
13032
12829
  };
13033
- const schema = objectType({
12830
+ const schema$1 = objectType({
13034
12831
  customer_id: stringType().min(1)
13035
12832
  });
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: [
@@ -13057,10 +13057,6 @@ const routeModule = {
13057
13057
  Component: BillingAddress,
13058
13058
  path: "/draft-orders/:id/billing-address"
13059
13059
  },
13060
- {
13061
- Component: Email,
13062
- path: "/draft-orders/:id/email"
13063
- },
13064
13060
  {
13065
13061
  Component: CustomItems,
13066
13062
  path: "/draft-orders/:id/custom-items"
@@ -13069,14 +13065,18 @@ const routeModule = {
13069
13065
  Component: Items,
13070
13066
  path: "/draft-orders/:id/items"
13071
13067
  },
13072
- {
13073
- Component: Promotions,
13074
- path: "/draft-orders/:id/promotions"
13075
- },
13076
13068
  {
13077
13069
  Component: Metadata,
13078
13070
  path: "/draft-orders/:id/metadata"
13079
13071
  },
13072
+ {
13073
+ Component: Email,
13074
+ path: "/draft-orders/:id/email"
13075
+ },
13076
+ {
13077
+ Component: Promotions,
13078
+ path: "/draft-orders/:id/promotions"
13079
+ },
13080
13080
  {
13081
13081
  Component: SalesChannel,
13082
13082
  path: "/draft-orders/:id/sales-channel"
@@ -13085,13 +13085,13 @@ const routeModule = {
13085
13085
  Component: Shipping,
13086
13086
  path: "/draft-orders/:id/shipping"
13087
13087
  },
13088
- {
13089
- Component: ShippingAddress,
13090
- path: "/draft-orders/:id/shipping-address"
13091
- },
13092
13088
  {
13093
13089
  Component: TransferOwnership,
13094
13090
  path: "/draft-orders/:id/transfer-ownership"
13091
+ },
13092
+ {
13093
+ Component: ShippingAddress,
13094
+ path: "/draft-orders/:id/shipping-address"
13095
13095
  }
13096
13096
  ]
13097
13097
  }