@medusajs/draft-order 2.23.1 → 2.23.2-preview-20261201140510

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.
@@ -6,12 +6,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
11
+ desc = __getOwnPropDesc(from, key);
12
+ __defProp(to, key, {
13
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
14
+ enumerable: !desc || desc.enumerable
15
+ });
16
+ }
15
17
  }
16
18
  return to;
17
19
  };
@@ -25,13 +27,11 @@ let _medusajs_dashboard_hooks = require("@medusajs/dashboard/hooks");
25
27
  let _medusajs_ui = require("@medusajs/ui");
26
28
  let _tanstack_react_query = require("@tanstack/react-query");
27
29
  let react = require("react");
28
- react = __toESM(react);
29
30
  let react_i18next = require("react-i18next");
30
31
  let react_router_dom = require("react-router-dom");
31
32
  let _medusajs_icons = require("@medusajs/icons");
32
33
  let react_jsx_runtime = require("react/jsx-runtime");
33
34
  let _medusajs_js_sdk = require("@medusajs/js-sdk");
34
- _medusajs_js_sdk = __toESM(_medusajs_js_sdk);
35
35
  let date_fns = require("date-fns");
36
36
  let date_fns_locale = require("date-fns/locale");
37
37
  let _hookform_resolvers_zod = require("@hookform/resolvers/zod");
@@ -41,10 +41,12 @@ let radix_ui = require("radix-ui");
41
41
  let _ariakit_react = require("@ariakit/react");
42
42
  let match_sorter = require("match-sorter");
43
43
  let lodash_debounce = require("lodash.debounce");
44
- lodash_debounce = __toESM(lodash_debounce);
45
44
  let _uiw_react_json_view = require("@uiw/react-json-view");
46
- _uiw_react_json_view = __toESM(_uiw_react_json_view);
47
45
  let dequal = require("dequal");
46
+ react = __toESM(react);
47
+ _medusajs_js_sdk = __toESM(_medusajs_js_sdk);
48
+ lodash_debounce = __toESM(lodash_debounce);
49
+ _uiw_react_json_view = __toESM(_uiw_react_json_view);
48
50
  // src/admin/hooks/common/use-query-params.tsx
49
51
  function useQueryParams(keys, prefix) {
50
52
  const [params] = (0, react_router_dom.useSearchParams)();
@@ -1,7 +1,7 @@
1
1
  import { defineRouteConfig } from "@medusajs/admin-sdk";
2
2
  import { LayoutComposer } from "@medusajs/dashboard/components";
3
3
  import { PermissionGuard, usePermissions } from "@medusajs/dashboard/hooks";
4
- import { Avatar, Badge, Button, Container, Copy, CurrencyInput, DataTable, Divider, Drawer, DropdownMenu, FocusModal, Heading, Hint, IconButton, Input, Kbd, Label, Prompt, Select, Skeleton, StatusBadge, Switch, Text, Tooltip, clx, createDataTableColumnHelper, createDataTableFilterHelper, toast, useDataTable, usePrompt } from "@medusajs/ui";
4
+ import { Avatar, Badge, Button, Container, Copy, CurrencyInput, DataTable as DataTable$1, Divider, Drawer, DropdownMenu, FocusModal, Heading, Hint as Hint$1, IconButton, Input, Kbd, Label as Label$1, Prompt, Select, Skeleton, StatusBadge, Switch, Text, Tooltip, clx, createDataTableColumnHelper, createDataTableFilterHelper, toast, useDataTable, usePrompt } from "@medusajs/ui";
5
5
  import { keepPreviousData, useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
6
6
  import React, { Fragment, Suspense, createContext, forwardRef, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useMemo, useRef, useState, useTransition } from "react";
7
7
  import { useTranslation } from "react-i18next";
@@ -15,7 +15,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
15
15
  import { Controller, FormProvider, useFieldArray, useForm, useFormContext, useFormState, useWatch } from "react-hook-form";
16
16
  import { z } from "zod";
17
17
  import { Accordion, Collapsible, Slot } from "radix-ui";
18
- import { Combobox, ComboboxDisclosure, ComboboxItem, ComboboxItemCheck, ComboboxItemValue, ComboboxPopover, ComboboxProvider, Separator } from "@ariakit/react";
18
+ import { Combobox as Combobox$1, ComboboxDisclosure, ComboboxItem, ComboboxItemCheck, ComboboxItemValue, ComboboxPopover, ComboboxProvider, Separator } from "@ariakit/react";
19
19
  import { matchSorter } from "match-sorter";
20
20
  import debounce from "lodash.debounce";
21
21
  import Primitive from "@uiw/react-json-view";
@@ -82,7 +82,7 @@ var ActionMenu = ({ groups, variant = "transparent", children }) => {
82
82
  }) })] });
83
83
  };
84
84
  // src/admin/components/common/data-table.tsx
85
- var DataTable$1 = ({ data = [], columns, filters, commands, action, actionMenu, getRowId, rowCount = 0, enablePagination = true, enableSearch = true, autoFocusSearch = false, rowHref, heading, subHeading, prefix, pageSize = 10, emptyState, rowSelection, isLoading = false, layout = "auto" }) => {
85
+ var DataTable = ({ data = [], columns, filters, commands, action, actionMenu, getRowId, rowCount = 0, enablePagination = true, enableSearch = true, autoFocusSearch = false, rowHref, heading, subHeading, prefix, pageSize = 10, emptyState, rowSelection, isLoading = false, layout = "auto" }) => {
86
86
  const { t } = useTranslation();
87
87
  const enableFiltering = filters && filters.length > 0;
88
88
  const enableCommands = commands && commands.length > 0;
@@ -183,11 +183,11 @@ var DataTable$1 = ({ data = [], columns, filters, commands, action, actionMenu,
183
183
  isLoading
184
184
  });
185
185
  const shouldRenderHeading = heading || subHeading;
186
- return /* @__PURE__ */ jsxs(DataTable, {
186
+ return /* @__PURE__ */ jsxs(DataTable$1, {
187
187
  instance,
188
188
  className: clx({ "h-full [&_tr]:last-of-type:!border-b": layout === "fill" }),
189
189
  children: [
190
- /* @__PURE__ */ jsxs(DataTable.Toolbar, {
190
+ /* @__PURE__ */ jsxs(DataTable$1.Toolbar, {
191
191
  className: "flex flex-col items-start justify-between gap-2 md:flex-row md:items-center",
192
192
  translations: {
193
193
  clearAll: t("actions.clearAll"),
@@ -204,8 +204,8 @@ var DataTable$1 = ({ data = [], columns, filters, commands, action, actionMenu,
204
204
  })] }), /* @__PURE__ */ jsxs("div", {
205
205
  className: "flex items-center justify-end gap-x-2 md:hidden",
206
206
  children: [
207
- enableFiltering && /* @__PURE__ */ jsx(DataTable.FilterMenu, { tooltip: t("filters.filterLabel") }),
208
- /* @__PURE__ */ jsx(DataTable.SortingMenu, { tooltip: t("filters.sortLabel") }),
207
+ enableFiltering && /* @__PURE__ */ jsx(DataTable$1.FilterMenu, { tooltip: t("filters.filterLabel") }),
208
+ /* @__PURE__ */ jsx(DataTable$1.SortingMenu, { tooltip: t("filters.sortLabel") }),
209
209
  actionMenu && /* @__PURE__ */ jsx(ActionMenu, {
210
210
  variant: "primary",
211
211
  ...actionMenu
@@ -217,7 +217,7 @@ var DataTable$1 = ({ data = [], columns, filters, commands, action, actionMenu,
217
217
  className: "flex w-full items-center gap-2 md:justify-end",
218
218
  children: [enableSearch && /* @__PURE__ */ jsx("div", {
219
219
  className: "w-full md:w-auto",
220
- children: /* @__PURE__ */ jsx(DataTable.Search, {
220
+ children: /* @__PURE__ */ jsx(DataTable$1.Search, {
221
221
  "data-modal-id": "modal-search-input",
222
222
  placeholder: t("filters.searchLabel"),
223
223
  autoFocus: autoFocusSearch
@@ -225,8 +225,8 @@ var DataTable$1 = ({ data = [], columns, filters, commands, action, actionMenu,
225
225
  }), /* @__PURE__ */ jsxs("div", {
226
226
  className: "hidden items-center gap-x-2 md:flex",
227
227
  children: [
228
- enableFiltering && /* @__PURE__ */ jsx(DataTable.FilterMenu, { tooltip: t("filters.filterLabel") }),
229
- /* @__PURE__ */ jsx(DataTable.SortingMenu, { tooltip: t("filters.sortLabel") }),
228
+ enableFiltering && /* @__PURE__ */ jsx(DataTable$1.FilterMenu, { tooltip: t("filters.filterLabel") }),
229
+ /* @__PURE__ */ jsx(DataTable$1.SortingMenu, { tooltip: t("filters.sortLabel") }),
230
230
  actionMenu && /* @__PURE__ */ jsx(ActionMenu, {
231
231
  variant: "primary",
232
232
  ...actionMenu
@@ -236,15 +236,15 @@ var DataTable$1 = ({ data = [], columns, filters, commands, action, actionMenu,
236
236
  })]
237
237
  })]
238
238
  }),
239
- /* @__PURE__ */ jsx(DataTable.Table, { emptyState }),
240
- enablePagination && /* @__PURE__ */ jsx(DataTable.Pagination, { translations: {
239
+ /* @__PURE__ */ jsx(DataTable$1.Table, { emptyState }),
240
+ enablePagination && /* @__PURE__ */ jsx(DataTable$1.Pagination, { translations: {
241
241
  of: t("general.of"),
242
242
  results: t("general.results"),
243
243
  pages: t("general.pages"),
244
244
  prev: t("general.prev"),
245
245
  next: t("general.next")
246
246
  } }),
247
- enableCommands && /* @__PURE__ */ jsx(DataTable.CommandBar, { selectedLabel: (count) => `${count} selected` })
247
+ enableCommands && /* @__PURE__ */ jsx(DataTable$1.CommandBar, { selectedLabel: (count) => `${count} selected` })
248
248
  ]
249
249
  });
250
250
  };
@@ -949,7 +949,7 @@ var List = () => {
949
949
  id: "DraftOrderListTable",
950
950
  children: /* @__PURE__ */ jsx(Container, {
951
951
  className: "p-0",
952
- children: /* @__PURE__ */ jsx(DataTable$1, {
952
+ children: /* @__PURE__ */ jsx(DataTable, {
953
953
  data: draft_orders,
954
954
  getRowId: (row) => row.id,
955
955
  columns,
@@ -3045,12 +3045,12 @@ var Item$2 = forwardRef(({ className, ...props }, ref) => {
3045
3045
  });
3046
3046
  });
3047
3047
  Item$2.displayName = "Form.Item";
3048
- var Label$1 = forwardRef(({ className, optional = false, tooltip, icon, variant = "default", ...props }, ref) => {
3048
+ var Label = forwardRef(({ className, optional = false, tooltip, icon, variant = "default", ...props }, ref) => {
3049
3049
  const { formLabelId, formItemId } = useFormField();
3050
3050
  return /* @__PURE__ */ jsxs("div", {
3051
3051
  className: "flex items-center gap-x-1",
3052
3052
  children: [
3053
- /* @__PURE__ */ jsx(Label, {
3053
+ /* @__PURE__ */ jsx(Label$1, {
3054
3054
  id: formLabelId,
3055
3055
  ref,
3056
3056
  className: clx({ "text-ui-fg-subtle": variant === "subtle" }, className),
@@ -3073,7 +3073,7 @@ var Label$1 = forwardRef(({ className, optional = false, tooltip, icon, variant
3073
3073
  ]
3074
3074
  });
3075
3075
  });
3076
- Label$1.displayName = "Form.Label";
3076
+ Label.displayName = "Form.Label";
3077
3077
  var Control = forwardRef(({ ...props }, ref) => {
3078
3078
  const { error, formItemId, formDescriptionId, formErrorMessageId, formLabelId } = useFormField();
3079
3079
  return /* @__PURE__ */ jsx(Slot.Root, {
@@ -3086,21 +3086,21 @@ var Control = forwardRef(({ ...props }, ref) => {
3086
3086
  });
3087
3087
  });
3088
3088
  Control.displayName = "Form.Control";
3089
- var Hint$1 = forwardRef(({ className, ...props }, ref) => {
3089
+ var Hint = forwardRef(({ className, ...props }, ref) => {
3090
3090
  const { formDescriptionId } = useFormField();
3091
- return /* @__PURE__ */ jsx(Hint, {
3091
+ return /* @__PURE__ */ jsx(Hint$1, {
3092
3092
  ref,
3093
3093
  id: formDescriptionId,
3094
3094
  className,
3095
3095
  ...props
3096
3096
  });
3097
3097
  });
3098
- Hint$1.displayName = "Form.Hint";
3098
+ Hint.displayName = "Form.Hint";
3099
3099
  var ErrorMessage = forwardRef(({ className, children, ...props }, ref) => {
3100
3100
  const { error, formErrorMessageId } = useFormField();
3101
3101
  const msg = error ? String(error?.message) : children;
3102
3102
  if (!msg || msg === "undefined") return null;
3103
- return /* @__PURE__ */ jsx(Hint, {
3103
+ return /* @__PURE__ */ jsx(Hint$1, {
3104
3104
  ref,
3105
3105
  id: formErrorMessageId,
3106
3106
  className,
@@ -3112,9 +3112,9 @@ var ErrorMessage = forwardRef(({ className, children, ...props }, ref) => {
3112
3112
  ErrorMessage.displayName = "Form.ErrorMessage";
3113
3113
  var Form$2 = Object.assign(Provider, {
3114
3114
  Item: Item$2,
3115
- Label: Label$1,
3115
+ Label,
3116
3116
  Control,
3117
- Hint: Hint$1,
3117
+ Hint,
3118
3118
  ErrorMessage,
3119
3119
  Field
3120
3120
  });
@@ -3271,7 +3271,7 @@ var ComboboxImpl = ({ value: controlledValue, onChange, searchValue: controlledS
3271
3271
  children: selectedLabel
3272
3272
  })
3273
3273
  }),
3274
- /* @__PURE__ */ jsx(Combobox, {
3274
+ /* @__PURE__ */ jsx(Combobox$1, {
3275
3275
  autoSelect: true,
3276
3276
  ref: comboboxRef,
3277
3277
  onFocus: () => setOpen(true),
@@ -3356,7 +3356,7 @@ var ComboboxImpl = ({ value: controlledValue, onChange, searchValue: controlledS
3356
3356
  })]
3357
3357
  });
3358
3358
  };
3359
- var Combobox$1 = genericForwardRef(ComboboxImpl);
3359
+ var Combobox = genericForwardRef(ComboboxImpl);
3360
3360
  // src/admin/components/inputs/country-select.tsx
3361
3361
  var CountrySelect = forwardRef(({ className, disabled, placeholder, value, defaultValue, ...props }, ref) => {
3362
3362
  const innerRef = useRef(null);
@@ -3923,7 +3923,7 @@ var CreateForm = () => {
3923
3923
  render: ({ field }) => {
3924
3924
  return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", {
3925
3925
  className: "grid grid-cols-2 gap-x-3",
3926
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Label, { children: "Region" }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose region" })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox$1, {
3926
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Label, { children: "Region" }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose region" })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox, {
3927
3927
  options: regions.options,
3928
3928
  fetchNextPage: regions.fetchNextPage,
3929
3929
  isFetchingNextPage: regions.isFetchingNextPage,
@@ -3943,7 +3943,7 @@ var CreateForm = () => {
3943
3943
  render: ({ field }) => {
3944
3944
  return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", {
3945
3945
  className: "grid grid-cols-2 gap-x-3",
3946
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose sales channel" })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox$1, {
3946
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose sales channel" })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox, {
3947
3947
  options: salesChannels.options,
3948
3948
  fetchNextPage: salesChannels.fetchNextPage,
3949
3949
  isFetchingNextPage: salesChannels.isFetchingNextPage,
@@ -4071,7 +4071,7 @@ var CustomerField$1 = ({ control, setValue }) => {
4071
4071
  }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose an existing customer" })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Control, { children: customerId ? /* @__PURE__ */ jsx(CustomerCard, {
4072
4072
  customerId,
4073
4073
  onRemove
4074
- }) : /* @__PURE__ */ jsx(Combobox$1, {
4074
+ }) : /* @__PURE__ */ jsx(Combobox, {
4075
4075
  options: customers.options,
4076
4076
  fetchNextPage: customers.fetchNextPage,
4077
4077
  isFetchingNextPage: customers.isFetchingNextPage,
@@ -4141,11 +4141,11 @@ var AddressField = ({ type, control, setValue }) => {
4141
4141
  className: "grid grid-cols-2 gap-x-3",
4142
4142
  children: [/* @__PURE__ */ jsxs("div", {
4143
4143
  className: "flex flex-col gap-y-1",
4144
- children: [/* @__PURE__ */ jsx(Label, {
4144
+ children: [/* @__PURE__ */ jsx(Label$1, {
4145
4145
  size: "small",
4146
4146
  weight: "plus",
4147
4147
  children: type === "shipping_address" ? "Shipping address" : "Billing address"
4148
- }), /* @__PURE__ */ jsxs(Hint, { children: [
4148
+ }), /* @__PURE__ */ jsxs(Hint$1, { children: [
4149
4149
  "Address used for",
4150
4150
  " ",
4151
4151
  type === "shipping_address" ? "shipping" : "billing"
@@ -4200,7 +4200,7 @@ var AddressField = ({ type, control, setValue }) => {
4200
4200
  children: "Saved addresses"
4201
4201
  }),
4202
4202
  /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose one of the customers saved addresses." }),
4203
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox$1, {
4203
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox, {
4204
4204
  options: addresses.options,
4205
4205
  fetchNextPage: addresses.fetchNextPage,
4206
4206
  isFetchingNextPage: addresses.isFetchingNextPage,
@@ -6878,7 +6878,7 @@ var ExistingItemsForm = ({ orderId, items }) => {
6878
6878
  })] }),
6879
6879
  /* @__PURE__ */ jsx(StackedFocusModal.Body, {
6880
6880
  className: "flex-1 overflow-hidden",
6881
- children: /* @__PURE__ */ jsx(DataTable$1, {
6881
+ children: /* @__PURE__ */ jsx(DataTable, {
6882
6882
  data: variants,
6883
6883
  columns,
6884
6884
  isLoading: isPending,
@@ -7139,6 +7139,248 @@ var customItemSchema = z.object({
7139
7139
  unit_price: z.union([z.number(), z.string()])
7140
7140
  });
7141
7141
  var handle$6 = { permissions: EDIT_DRAFT_ORDER_PERMISSIONS };
7142
+ // src/admin/hooks/api/promotions.tsx
7143
+ var PROMOTION_QUERY_KEY = "promotions";
7144
+ var promotionsQueryKeys = {
7145
+ list: (query) => [PROMOTION_QUERY_KEY, query ? query : void 0],
7146
+ detail: (id, query) => [
7147
+ PROMOTION_QUERY_KEY,
7148
+ id,
7149
+ query ? query : void 0
7150
+ ]
7151
+ };
7152
+ var usePromotions = (query, options) => {
7153
+ const { data, ...rest } = useQuery({
7154
+ queryKey: promotionsQueryKeys.list(query),
7155
+ queryFn: async () => sdk.admin.promotion.list(query),
7156
+ ...options
7157
+ });
7158
+ return {
7159
+ ...data,
7160
+ ...rest
7161
+ };
7162
+ };
7163
+ // src/admin/routes/draft-orders/[id]/@promotions/page.tsx
7164
+ var Promotions = () => {
7165
+ const { id } = useParams();
7166
+ const { order: preview, isError: isPreviewError, error: previewError } = useOrderPreview(id, void 0);
7167
+ useInitiateOrderEdit({ preview });
7168
+ const { onCancel } = useCancelOrderEdit({ preview });
7169
+ if (isPreviewError) throw previewError;
7170
+ const isReady = !!preview;
7171
+ return /* @__PURE__ */ jsxs(RouteDrawer, {
7172
+ onClose: onCancel,
7173
+ children: [/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, {
7174
+ asChild: true,
7175
+ children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" })
7176
+ }) }), isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })]
7177
+ });
7178
+ };
7179
+ var PromotionForm = ({ preview }) => {
7180
+ const { items, shipping_methods } = preview;
7181
+ const [isSubmitting, setIsSubmitting] = useState(false);
7182
+ const [comboboxValue, setComboboxValue] = useState("");
7183
+ const { handleSuccess } = useRouteModal();
7184
+ const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
7185
+ const promoIds = getPromotionIds(items, shipping_methods);
7186
+ const { promotions, isPending, isError, error } = usePromotions({ id: promoIds }, { enabled: !!promoIds.length });
7187
+ const comboboxData = useComboboxData({
7188
+ queryKey: [
7189
+ "promotions",
7190
+ "combobox",
7191
+ promoIds
7192
+ ],
7193
+ queryFn: async (params) => {
7194
+ return await sdk.admin.promotion.list({
7195
+ ...params,
7196
+ id: { $nin: promoIds }
7197
+ });
7198
+ },
7199
+ getOptions: (data) => {
7200
+ return data.promotions.map((promotion) => ({
7201
+ label: promotion.code,
7202
+ value: promotion.code
7203
+ }));
7204
+ }
7205
+ });
7206
+ const add = async (value) => {
7207
+ if (!value) return;
7208
+ addPromotions({ promo_codes: [value] }, {
7209
+ onError: (e) => {
7210
+ toast.error(e.message);
7211
+ comboboxData.onSearchValueChange("");
7212
+ setComboboxValue("");
7213
+ },
7214
+ onSuccess: () => {
7215
+ comboboxData.onSearchValueChange("");
7216
+ setComboboxValue("");
7217
+ }
7218
+ });
7219
+ };
7220
+ const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
7221
+ const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
7222
+ const onSubmit = async () => {
7223
+ setIsSubmitting(true);
7224
+ let requestSucceeded = false;
7225
+ await requestOrderEdit(void 0, {
7226
+ onError: (e) => {
7227
+ toast.error(e.message);
7228
+ },
7229
+ onSuccess: () => {
7230
+ requestSucceeded = true;
7231
+ }
7232
+ });
7233
+ if (!requestSucceeded) {
7234
+ setIsSubmitting(false);
7235
+ return;
7236
+ }
7237
+ await confirmOrderEdit(void 0, {
7238
+ onError: (e) => {
7239
+ toast.error(e.message);
7240
+ },
7241
+ onSuccess: () => {
7242
+ handleSuccess();
7243
+ },
7244
+ onSettled: () => {
7245
+ setIsSubmitting(false);
7246
+ }
7247
+ });
7248
+ };
7249
+ if (isError) throw error;
7250
+ return /* @__PURE__ */ jsxs(KeyboundForm, {
7251
+ className: "flex flex-1 flex-col",
7252
+ onSubmit,
7253
+ children: [/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", {
7254
+ className: "flex flex-col gap-4",
7255
+ children: [
7256
+ /* @__PURE__ */ jsxs("div", {
7257
+ className: "flex flex-col gap-3",
7258
+ children: [/* @__PURE__ */ jsxs("div", {
7259
+ className: "flex flex-col",
7260
+ children: [/* @__PURE__ */ jsx(Label$1, {
7261
+ size: "small",
7262
+ weight: "plus",
7263
+ htmlFor: "promotion-combobox",
7264
+ children: "Apply promotions"
7265
+ }), /* @__PURE__ */ jsx(Hint$1, {
7266
+ id: "promotion-combobox-hint",
7267
+ children: "Manage promotions that should be applied to the order."
7268
+ })]
7269
+ }), /* @__PURE__ */ jsx(Combobox, {
7270
+ id: "promotion-combobox",
7271
+ "aria-describedby": "promotion-combobox-hint",
7272
+ isFetchingNextPage: comboboxData.isFetchingNextPage,
7273
+ fetchNextPage: comboboxData.fetchNextPage,
7274
+ options: comboboxData.options,
7275
+ onSearchValueChange: comboboxData.onSearchValueChange,
7276
+ searchValue: comboboxData.searchValue,
7277
+ disabled: comboboxData.disabled || isAddingPromotions,
7278
+ onChange: add,
7279
+ value: comboboxValue
7280
+ })]
7281
+ }),
7282
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
7283
+ /* @__PURE__ */ jsx("div", {
7284
+ className: "flex flex-col gap-2",
7285
+ children: promotions?.map((promotion) => /* @__PURE__ */ jsx(PromotionItem, {
7286
+ promotion,
7287
+ orderId: preview.id,
7288
+ isLoading: isPending
7289
+ }, promotion.id))
7290
+ })
7291
+ ]
7292
+ }) }), /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", {
7293
+ className: "flex justify-end gap-2",
7294
+ children: [/* @__PURE__ */ jsx(RouteDrawer.Close, {
7295
+ asChild: true,
7296
+ children: /* @__PURE__ */ jsx(Button, {
7297
+ size: "small",
7298
+ variant: "secondary",
7299
+ children: "Cancel"
7300
+ })
7301
+ }), /* @__PURE__ */ jsx(Button, {
7302
+ size: "small",
7303
+ type: "submit",
7304
+ isLoading: isSubmitting || isAddingPromotions,
7305
+ children: "Save"
7306
+ })]
7307
+ }) })]
7308
+ });
7309
+ };
7310
+ var PromotionItem = ({ promotion, orderId, isLoading }) => {
7311
+ const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
7312
+ const onRemove = async () => {
7313
+ removePromotions({ promo_codes: [promotion.code] }, { onError: (e) => {
7314
+ toast.error(e.message);
7315
+ } });
7316
+ };
7317
+ const displayValue = getDisplayValue(promotion);
7318
+ return /* @__PURE__ */ jsxs("div", {
7319
+ className: clx("bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2", { "animate-pulse": isLoading }),
7320
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Text, {
7321
+ size: "small",
7322
+ weight: "plus",
7323
+ leading: "compact",
7324
+ children: promotion.code
7325
+ }), /* @__PURE__ */ jsxs("div", {
7326
+ className: "text-ui-fg-subtle flex items-center gap-1.5",
7327
+ children: [displayValue && /* @__PURE__ */ jsxs("div", {
7328
+ className: "flex items-center gap-1.5",
7329
+ children: [/* @__PURE__ */ jsx(Text, {
7330
+ size: "small",
7331
+ leading: "compact",
7332
+ children: displayValue
7333
+ }), /* @__PURE__ */ jsx(Text, {
7334
+ size: "small",
7335
+ leading: "compact",
7336
+ children: "·"
7337
+ })]
7338
+ }), /* @__PURE__ */ jsx(Text, {
7339
+ size: "small",
7340
+ leading: "compact",
7341
+ className: "capitalize",
7342
+ children: promotion.application_method?.allocation
7343
+ })]
7344
+ })] }), /* @__PURE__ */ jsx(IconButton, {
7345
+ size: "small",
7346
+ type: "button",
7347
+ variant: "transparent",
7348
+ onClick: onRemove,
7349
+ isLoading: isPending || isLoading,
7350
+ children: /* @__PURE__ */ jsx(XMark, {})
7351
+ })]
7352
+ }, promotion.id);
7353
+ };
7354
+ function getDisplayValue(promotion) {
7355
+ const value = promotion.application_method?.value;
7356
+ if (!value) return null;
7357
+ if (promotion.application_method?.type === "fixed") {
7358
+ const currency = promotion.application_method?.currency_code;
7359
+ if (!currency) return null;
7360
+ return getLocaleAmount(value, currency);
7361
+ } else if (promotion.application_method?.type === "percentage") return formatPercentage(value);
7362
+ return null;
7363
+ }
7364
+ var formatter = new Intl.NumberFormat([], {
7365
+ style: "percent",
7366
+ minimumFractionDigits: 2
7367
+ });
7368
+ var formatPercentage = (value, isPercentageValue = false) => {
7369
+ let val = value || 0;
7370
+ if (!isPercentageValue) val = val / 100;
7371
+ return formatter.format(val);
7372
+ };
7373
+ function getPromotionIds(items, shippingMethods) {
7374
+ const promotionIds = /* @__PURE__ */ new Set();
7375
+ for (const item of items) if (item.adjustments) {
7376
+ for (const adjustment of item.adjustments) if (adjustment.promotion_id) promotionIds.add(adjustment.promotion_id);
7377
+ }
7378
+ for (const shippingMethod of shippingMethods) if (shippingMethod.adjustments) {
7379
+ for (const adjustment of shippingMethod.adjustments) if (adjustment.promotion_id) promotionIds.add(adjustment.promotion_id);
7380
+ }
7381
+ return Array.from(promotionIds);
7382
+ }
7383
+ var handle$5 = { permissions: EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS };
7142
7384
  // src/admin/components/common/inline-tip.tsx
7143
7385
  /**
7144
7386
  * A component for rendering inline tips. Useful for providing additional information or context.
@@ -7430,249 +7672,7 @@ function getHasUneditableRows(metadata) {
7430
7672
  if (!metadata) return false;
7431
7673
  return Object.values(metadata).some((value) => !EDITABLE_TYPES.includes(typeof value));
7432
7674
  }
7433
- var handle$5 = { permissions: EDIT_DRAFT_ORDER_PERMISSIONS };
7434
- // src/admin/hooks/api/promotions.tsx
7435
- var PROMOTION_QUERY_KEY = "promotions";
7436
- var promotionsQueryKeys = {
7437
- list: (query) => [PROMOTION_QUERY_KEY, query ? query : void 0],
7438
- detail: (id, query) => [
7439
- PROMOTION_QUERY_KEY,
7440
- id,
7441
- query ? query : void 0
7442
- ]
7443
- };
7444
- var usePromotions = (query, options) => {
7445
- const { data, ...rest } = useQuery({
7446
- queryKey: promotionsQueryKeys.list(query),
7447
- queryFn: async () => sdk.admin.promotion.list(query),
7448
- ...options
7449
- });
7450
- return {
7451
- ...data,
7452
- ...rest
7453
- };
7454
- };
7455
- // src/admin/routes/draft-orders/[id]/@promotions/page.tsx
7456
- var Promotions = () => {
7457
- const { id } = useParams();
7458
- const { order: preview, isError: isPreviewError, error: previewError } = useOrderPreview(id, void 0);
7459
- useInitiateOrderEdit({ preview });
7460
- const { onCancel } = useCancelOrderEdit({ preview });
7461
- if (isPreviewError) throw previewError;
7462
- const isReady = !!preview;
7463
- return /* @__PURE__ */ jsxs(RouteDrawer, {
7464
- onClose: onCancel,
7465
- children: [/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, {
7466
- asChild: true,
7467
- children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" })
7468
- }) }), isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })]
7469
- });
7470
- };
7471
- var PromotionForm = ({ preview }) => {
7472
- const { items, shipping_methods } = preview;
7473
- const [isSubmitting, setIsSubmitting] = useState(false);
7474
- const [comboboxValue, setComboboxValue] = useState("");
7475
- const { handleSuccess } = useRouteModal();
7476
- const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
7477
- const promoIds = getPromotionIds(items, shipping_methods);
7478
- const { promotions, isPending, isError, error } = usePromotions({ id: promoIds }, { enabled: !!promoIds.length });
7479
- const comboboxData = useComboboxData({
7480
- queryKey: [
7481
- "promotions",
7482
- "combobox",
7483
- promoIds
7484
- ],
7485
- queryFn: async (params) => {
7486
- return await sdk.admin.promotion.list({
7487
- ...params,
7488
- id: { $nin: promoIds }
7489
- });
7490
- },
7491
- getOptions: (data) => {
7492
- return data.promotions.map((promotion) => ({
7493
- label: promotion.code,
7494
- value: promotion.code
7495
- }));
7496
- }
7497
- });
7498
- const add = async (value) => {
7499
- if (!value) return;
7500
- addPromotions({ promo_codes: [value] }, {
7501
- onError: (e) => {
7502
- toast.error(e.message);
7503
- comboboxData.onSearchValueChange("");
7504
- setComboboxValue("");
7505
- },
7506
- onSuccess: () => {
7507
- comboboxData.onSearchValueChange("");
7508
- setComboboxValue("");
7509
- }
7510
- });
7511
- };
7512
- const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
7513
- const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
7514
- const onSubmit = async () => {
7515
- setIsSubmitting(true);
7516
- let requestSucceeded = false;
7517
- await requestOrderEdit(void 0, {
7518
- onError: (e) => {
7519
- toast.error(e.message);
7520
- },
7521
- onSuccess: () => {
7522
- requestSucceeded = true;
7523
- }
7524
- });
7525
- if (!requestSucceeded) {
7526
- setIsSubmitting(false);
7527
- return;
7528
- }
7529
- await confirmOrderEdit(void 0, {
7530
- onError: (e) => {
7531
- toast.error(e.message);
7532
- },
7533
- onSuccess: () => {
7534
- handleSuccess();
7535
- },
7536
- onSettled: () => {
7537
- setIsSubmitting(false);
7538
- }
7539
- });
7540
- };
7541
- if (isError) throw error;
7542
- return /* @__PURE__ */ jsxs(KeyboundForm, {
7543
- className: "flex flex-1 flex-col",
7544
- onSubmit,
7545
- children: [/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", {
7546
- className: "flex flex-col gap-4",
7547
- children: [
7548
- /* @__PURE__ */ jsxs("div", {
7549
- className: "flex flex-col gap-3",
7550
- children: [/* @__PURE__ */ jsxs("div", {
7551
- className: "flex flex-col",
7552
- children: [/* @__PURE__ */ jsx(Label, {
7553
- size: "small",
7554
- weight: "plus",
7555
- htmlFor: "promotion-combobox",
7556
- children: "Apply promotions"
7557
- }), /* @__PURE__ */ jsx(Hint, {
7558
- id: "promotion-combobox-hint",
7559
- children: "Manage promotions that should be applied to the order."
7560
- })]
7561
- }), /* @__PURE__ */ jsx(Combobox$1, {
7562
- id: "promotion-combobox",
7563
- "aria-describedby": "promotion-combobox-hint",
7564
- isFetchingNextPage: comboboxData.isFetchingNextPage,
7565
- fetchNextPage: comboboxData.fetchNextPage,
7566
- options: comboboxData.options,
7567
- onSearchValueChange: comboboxData.onSearchValueChange,
7568
- searchValue: comboboxData.searchValue,
7569
- disabled: comboboxData.disabled || isAddingPromotions,
7570
- onChange: add,
7571
- value: comboboxValue
7572
- })]
7573
- }),
7574
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
7575
- /* @__PURE__ */ jsx("div", {
7576
- className: "flex flex-col gap-2",
7577
- children: promotions?.map((promotion) => /* @__PURE__ */ jsx(PromotionItem, {
7578
- promotion,
7579
- orderId: preview.id,
7580
- isLoading: isPending
7581
- }, promotion.id))
7582
- })
7583
- ]
7584
- }) }), /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", {
7585
- className: "flex justify-end gap-2",
7586
- children: [/* @__PURE__ */ jsx(RouteDrawer.Close, {
7587
- asChild: true,
7588
- children: /* @__PURE__ */ jsx(Button, {
7589
- size: "small",
7590
- variant: "secondary",
7591
- children: "Cancel"
7592
- })
7593
- }), /* @__PURE__ */ jsx(Button, {
7594
- size: "small",
7595
- type: "submit",
7596
- isLoading: isSubmitting || isAddingPromotions,
7597
- children: "Save"
7598
- })]
7599
- }) })]
7600
- });
7601
- };
7602
- var PromotionItem = ({ promotion, orderId, isLoading }) => {
7603
- const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
7604
- const onRemove = async () => {
7605
- removePromotions({ promo_codes: [promotion.code] }, { onError: (e) => {
7606
- toast.error(e.message);
7607
- } });
7608
- };
7609
- const displayValue = getDisplayValue(promotion);
7610
- return /* @__PURE__ */ jsxs("div", {
7611
- className: clx("bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2", { "animate-pulse": isLoading }),
7612
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Text, {
7613
- size: "small",
7614
- weight: "plus",
7615
- leading: "compact",
7616
- children: promotion.code
7617
- }), /* @__PURE__ */ jsxs("div", {
7618
- className: "text-ui-fg-subtle flex items-center gap-1.5",
7619
- children: [displayValue && /* @__PURE__ */ jsxs("div", {
7620
- className: "flex items-center gap-1.5",
7621
- children: [/* @__PURE__ */ jsx(Text, {
7622
- size: "small",
7623
- leading: "compact",
7624
- children: displayValue
7625
- }), /* @__PURE__ */ jsx(Text, {
7626
- size: "small",
7627
- leading: "compact",
7628
- children: "·"
7629
- })]
7630
- }), /* @__PURE__ */ jsx(Text, {
7631
- size: "small",
7632
- leading: "compact",
7633
- className: "capitalize",
7634
- children: promotion.application_method?.allocation
7635
- })]
7636
- })] }), /* @__PURE__ */ jsx(IconButton, {
7637
- size: "small",
7638
- type: "button",
7639
- variant: "transparent",
7640
- onClick: onRemove,
7641
- isLoading: isPending || isLoading,
7642
- children: /* @__PURE__ */ jsx(XMark, {})
7643
- })]
7644
- }, promotion.id);
7645
- };
7646
- function getDisplayValue(promotion) {
7647
- const value = promotion.application_method?.value;
7648
- if (!value) return null;
7649
- if (promotion.application_method?.type === "fixed") {
7650
- const currency = promotion.application_method?.currency_code;
7651
- if (!currency) return null;
7652
- return getLocaleAmount(value, currency);
7653
- } else if (promotion.application_method?.type === "percentage") return formatPercentage(value);
7654
- return null;
7655
- }
7656
- var formatter = new Intl.NumberFormat([], {
7657
- style: "percent",
7658
- minimumFractionDigits: 2
7659
- });
7660
- var formatPercentage = (value, isPercentageValue = false) => {
7661
- let val = value || 0;
7662
- if (!isPercentageValue) val = val / 100;
7663
- return formatter.format(val);
7664
- };
7665
- function getPromotionIds(items, shippingMethods) {
7666
- const promotionIds = /* @__PURE__ */ new Set();
7667
- for (const item of items) if (item.adjustments) {
7668
- for (const adjustment of item.adjustments) if (adjustment.promotion_id) promotionIds.add(adjustment.promotion_id);
7669
- }
7670
- for (const shippingMethod of shippingMethods) if (shippingMethod.adjustments) {
7671
- for (const adjustment of shippingMethod.adjustments) if (adjustment.promotion_id) promotionIds.add(adjustment.promotion_id);
7672
- }
7673
- return Array.from(promotionIds);
7674
- }
7675
- var handle$4 = { permissions: EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS };
7675
+ var handle$4 = { permissions: EDIT_DRAFT_ORDER_PERMISSIONS };
7676
7676
  // src/admin/routes/draft-orders/[id]/@sales-channel/page.tsx
7677
7677
  var SalesChannel = () => {
7678
7678
  const { id } = useParams();
@@ -7758,7 +7758,7 @@ var SalesChannelField = ({ control, order }) => {
7758
7758
  render: ({ field }) => {
7759
7759
  return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
7760
7760
  /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
7761
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox$1, {
7761
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox, {
7762
7762
  options: salesChannels.options,
7763
7763
  fetchNextPage: salesChannels.fetchNextPage,
7764
7764
  isFetchingNextPage: salesChannels.isFetchingNextPage,
@@ -8406,7 +8406,7 @@ var LocationField = ({ control, setValue }) => {
8406
8406
  render: ({ field: { onChange, ...field } }) => {
8407
8407
  return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", {
8408
8408
  className: "grid grid-cols-2 gap-x-3",
8409
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Label, { children: "Location" }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose where you want to ship the items from." })] }), /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox$1, {
8409
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form$2.Label, { children: "Location" }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose where you want to ship the items from." })] }), /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox, {
8410
8410
  options: locations.options,
8411
8411
  fetchNextPage: locations.fetchNextPage,
8412
8412
  isFetchingNextPage: locations.isFetchingNextPage,
@@ -8469,7 +8469,7 @@ var ShippingOptionField = ({ shippingProfileId, preview, control }) => {
8469
8469
  }), /* @__PURE__ */ jsx(ConditionalTooltip, {
8470
8470
  content: tooltipContent,
8471
8471
  showTooltip: !locationId || !shippingProfileId,
8472
- children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox$1, {
8472
+ children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox, {
8473
8473
  options: shippingOptions.options,
8474
8474
  fetchNextPage: shippingOptions.fetchNextPage,
8475
8475
  isFetchingNextPage: shippingOptions.isFetchingNextPage,
@@ -8759,12 +8759,12 @@ var TransferOwnershipForm = ({ order }) => {
8759
8759
  className: "flex flex-col gap-y-3",
8760
8760
  children: [/* @__PURE__ */ jsxs("div", {
8761
8761
  className: "flex flex-col",
8762
- children: [/* @__PURE__ */ jsx(Label, {
8762
+ children: [/* @__PURE__ */ jsx(Label$1, {
8763
8763
  size: "small",
8764
8764
  weight: "plus",
8765
8765
  htmlFor: "current-customer",
8766
8766
  children: "Current owner"
8767
- }), /* @__PURE__ */ jsx(Hint, { children: "The customer that is currently associated with this draft order." })]
8767
+ }), /* @__PURE__ */ jsx(Hint$1, { children: "The customer that is currently associated with this draft order." })]
8768
8768
  }), /* @__PURE__ */ jsxs(Select, {
8769
8769
  disabled: true,
8770
8770
  value: currentCustomer.value,
@@ -8830,7 +8830,7 @@ var CustomerField = ({ control, currentCustomerId }) => {
8830
8830
  className: "flex flex-col",
8831
8831
  children: [/* @__PURE__ */ jsx(Form$2.Label, { children: "New customer" }), /* @__PURE__ */ jsx(Form$2.Hint, { children: "The customer to transfer this draft order to." })]
8832
8832
  }),
8833
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox$1, {
8833
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Combobox, {
8834
8834
  options: customers.options,
8835
8835
  fetchNextPage: customers.fetchNextPage,
8836
8836
  isFetchingNextPage: customers.isFetchingNextPage,
@@ -9597,13 +9597,13 @@ var plugin = {
9597
9597
  handle: handle$6
9598
9598
  },
9599
9599
  {
9600
- Component: Metadata,
9601
- path: "/draft-orders/:id/metadata",
9600
+ Component: Promotions,
9601
+ path: "/draft-orders/:id/promotions",
9602
9602
  handle: handle$5
9603
9603
  },
9604
9604
  {
9605
- Component: Promotions,
9606
- path: "/draft-orders/:id/promotions",
9605
+ Component: Metadata,
9606
+ path: "/draft-orders/:id/metadata",
9607
9607
  handle: handle$4
9608
9608
  },
9609
9609
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.23.1",
3
+ "version": "2.23.2-preview-20261201140510",
4
4
  "description": "A draft order plugin for Medusa.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  "@ariakit/react": "^0.4.15",
51
51
  "@babel/runtime": "^8.0.10",
52
52
  "@hookform/resolvers": "6.0.0",
53
- "@medusajs/js-sdk": "2.23.1",
53
+ "@medusajs/js-sdk": "2.23.2-preview-20261201140510",
54
54
  "@tanstack/react-query": "5.107.1",
55
55
  "@uiw/react-json-view": "^2.0.0-alpha.17",
56
56
  "date-fns": "^4.4.0",
@@ -62,25 +62,25 @@
62
62
  "zod": "4.6.7"
63
63
  },
64
64
  "devDependencies": {
65
- "@medusajs/admin-sdk": "2.23.1",
66
- "@medusajs/cli": "2.23.1",
67
- "@medusajs/dashboard": "2.23.1",
68
- "@medusajs/framework": "2.23.1",
69
- "@medusajs/icons": "2.23.1",
70
- "@medusajs/test-utils": "2.23.1",
71
- "@medusajs/types": "2.23.1",
72
- "@medusajs/ui": "4.3.1",
73
- "@medusajs/ui-preset": "2.23.1",
65
+ "@medusajs/admin-sdk": "2.23.2-preview-20261201140510",
66
+ "@medusajs/cli": "2.23.2-preview-20261201140510",
67
+ "@medusajs/dashboard": "2.23.2-preview-20261201140510",
68
+ "@medusajs/framework": "2.23.2-preview-20261201140510",
69
+ "@medusajs/icons": "2.23.2-preview-20261201140510",
70
+ "@medusajs/test-utils": "2.23.2-preview-20261201140510",
71
+ "@medusajs/types": "2.23.2-preview-20261201140510",
72
+ "@medusajs/ui": "4.3.2-preview-20261201140510",
73
+ "@medusajs/ui-preset": "2.23.2-preview-20261201140510",
74
74
  "cross-env": "^10.1.0"
75
75
  },
76
76
  "peerDependencies": {
77
- "@medusajs/admin-sdk": "2.23.1",
78
- "@medusajs/cli": "2.23.1",
79
- "@medusajs/dashboard": "2.23.1",
80
- "@medusajs/framework": "2.23.1",
81
- "@medusajs/icons": "2.23.1",
82
- "@medusajs/test-utils": "2.23.1",
83
- "@medusajs/ui": "4.3.1",
77
+ "@medusajs/admin-sdk": "2.23.2-preview-20261201140510",
78
+ "@medusajs/cli": "2.23.2-preview-20261201140510",
79
+ "@medusajs/dashboard": "2.23.2-preview-20261201140510",
80
+ "@medusajs/framework": "2.23.2-preview-20261201140510",
81
+ "@medusajs/icons": "2.23.2-preview-20261201140510",
82
+ "@medusajs/test-utils": "2.23.2-preview-20261201140510",
83
+ "@medusajs/ui": "4.3.2-preview-20261201140510",
84
84
  "react": "^19.3.1",
85
85
  "react-dom": "^19.3.1",
86
86
  "react-router-dom": "^6.30.4 || ^7.0.0"