@medusajs/dashboard 2.10.4-snapshot-20250922165717 → 2.10.4-snapshot-20250923121159

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.
Files changed (48) hide show
  1. package/dist/{add-campaign-promotions-FE4BXGVN.mjs → add-campaign-promotions-JOVLXLS4.mjs} +3 -3
  2. package/dist/{api-key-management-detail-SAVBCKX7.mjs → api-key-management-detail-I7T67TXF.mjs} +1 -1
  3. package/dist/{api-key-management-sales-channels-WL5L5XWM.mjs → api-key-management-sales-channels-6GN6RVZ2.mjs} +1 -1
  4. package/dist/app.css +0 -3
  5. package/dist/app.js +3330 -3318
  6. package/dist/app.mjs +2 -2
  7. package/dist/{campaign-detail-KTOLZNTA.mjs → campaign-detail-NRZHGINV.mjs} +3 -3
  8. package/dist/{chunk-JO6QASTJ.mjs → chunk-37UXEJF2.mjs} +1 -1
  9. package/dist/{chunk-7YZF3THS.mjs → chunk-BHZAQZYP.mjs} +1 -1
  10. package/dist/{chunk-KMUDF36P.mjs → chunk-JIQQKKLO.mjs} +1 -1
  11. package/dist/{chunk-S45XMWVD.mjs → chunk-JMQ6V54O.mjs} +1 -1
  12. package/dist/{chunk-CGK6IVLN.mjs → chunk-OLUNPPBR.mjs} +1 -1
  13. package/dist/{chunk-IINWRJA6.mjs → chunk-RVOPC44F.mjs} +27 -27
  14. package/dist/{chunk-UNM3LPTG.mjs → chunk-YM4QJC6Y.mjs} +24 -11
  15. package/dist/{chunk-JELVERJM.mjs → chunk-ZJA7VBUR.mjs} +6 -2
  16. package/dist/{customer-group-list-GPIKR66X.mjs → customer-group-list-D26UKQMR.mjs} +1 -1
  17. package/dist/{inventory-detail-5433AAQ2.mjs → inventory-detail-QHL7TJFZ.mjs} +1 -1
  18. package/dist/location-list-62KBWY4T.mjs +316 -0
  19. package/dist/{location-sales-channels-2BOIPBBG.mjs → location-sales-channels-O5XLIPAR.mjs} +1 -1
  20. package/dist/{order-list-ZCMNSZYB.mjs → order-list-73DBATIK.mjs} +2 -2
  21. package/dist/{product-attributes-ZZPEBDCK.mjs → product-attributes-FQDJCNUB.mjs} +3 -3
  22. package/dist/{product-create-FCDCIDCH.mjs → product-create-W37RQLON.mjs} +4 -4
  23. package/dist/{product-detail-2ZUONC23.mjs → product-detail-TANIKAEK.mjs} +4 -4
  24. package/dist/{product-edit-G3Z6FCN6.mjs → product-edit-DO76GHBI.mjs} +3 -3
  25. package/dist/{product-list-WGX66SGI.mjs → product-list-KJ3HXPLB.mjs} +2 -2
  26. package/dist/{product-media-APQKPFTT.mjs → product-media-VG4YM2W6.mjs} +2 -2
  27. package/dist/{product-organization-BYT4TKMZ.mjs → product-organization-OOVUGXNP.mjs} +3 -3
  28. package/dist/{product-sales-channels-UGPAXFAV.mjs → product-sales-channels-QEJRSCAU.mjs} +1 -1
  29. package/dist/{product-shipping-profile-YDN4X6S2.mjs → product-shipping-profile-FFMKOF6B.mjs} +3 -3
  30. package/dist/{promotion-detail-6ZD7Z6BF.mjs → promotion-detail-GONXLJZ2.mjs} +112 -63
  31. package/dist/{promotion-list-GI64LDWI.mjs → promotion-list-NNEMVJ6I.mjs} +3 -3
  32. package/dist/{reset-password-SXA6YKTJ.mjs → reset-password-ANJHGYUE.mjs} +1 -1
  33. package/dist/{sales-channel-list-ADIJMXNV.mjs → sales-channel-list-LKVHXUXW.mjs} +1 -1
  34. package/dist/{tax-region-create-W3K5IFD3.mjs → tax-region-create-IWM4755I.mjs} +1 -1
  35. package/dist/{user-list-3YFYZFSK.mjs → user-list-MKJLB5CQ.mjs} +1 -1
  36. package/package.json +9 -9
  37. package/src/components/data-table/data-table.tsx +64 -46
  38. package/src/i18n/translations/$schema.json +90 -67
  39. package/src/i18n/translations/en.json +6 -2
  40. package/src/routes/locations/location-list/index.ts +0 -1
  41. package/src/routes/locations/location-list/location-list.tsx +51 -19
  42. package/src/routes/locations/location-list/use-location-list-table-columns.tsx +185 -0
  43. package/src/routes/locations/location-list/use-location-list-table-query.tsx +22 -0
  44. package/dist/chunk-BKJC5BGQ.mjs +0 -53
  45. package/dist/location-list-BKK2PAKF.mjs +0 -297
  46. package/src/routes/locations/location-list/components/location-list-header/index.ts +0 -1
  47. package/src/routes/locations/location-list/components/location-list-header/location-list-header.tsx +0 -21
  48. package/src/routes/locations/location-list/loader.ts +0 -36
@@ -1,297 +0,0 @@
1
- import {
2
- BadgeListSummary
3
- } from "./chunk-BKJC5BGQ.mjs";
4
- import "./chunk-PYIO3TDQ.mjs";
5
- import {
6
- LinkButton
7
- } from "./chunk-6WKBBTKM.mjs";
8
- import {
9
- SidebarLink
10
- } from "./chunk-LBIOZZPA.mjs";
11
- import "./chunk-EQTBJSBZ.mjs";
12
- import {
13
- getFormattedAddress
14
- } from "./chunk-B6ZOPCPA.mjs";
15
- import {
16
- TwoColumnPage
17
- } from "./chunk-2RQLKDBF.mjs";
18
- import {
19
- useExtension
20
- } from "./chunk-C5P5PL3E.mjs";
21
- import "./chunk-DG7J63J2.mjs";
22
- import {
23
- ActionMenu
24
- } from "./chunk-3NJTXRIY.mjs";
25
- import "./chunk-OC7BQLYI.mjs";
26
- import {
27
- stockLocationsQueryKeys,
28
- useDeleteStockLocation,
29
- useStockLocations
30
- } from "./chunk-32IQRUVY.mjs";
31
- import {
32
- queryClient
33
- } from "./chunk-FXYH54JP.mjs";
34
- import "./chunk-774WSTCC.mjs";
35
- import {
36
- sdk
37
- } from "./chunk-DEQUVHHE.mjs";
38
- import "./chunk-RPUOO7AV.mjs";
39
-
40
- // src/routes/locations/location-list/loader.ts
41
- import { redirect } from "react-router-dom";
42
-
43
- // src/routes/locations/location-list/constants.ts
44
- var LOCATION_LIST_FIELDS = "name,*sales_channels,*address,*fulfillment_sets,*fulfillment_sets.service_zones,*fulfillment_sets.service_zones.shipping_options,*fulfillment_sets.service_zones.shipping_options.shipping_profile";
45
-
46
- // src/routes/locations/location-list/loader.ts
47
- var shippingListQuery = () => ({
48
- queryKey: stockLocationsQueryKeys.lists(),
49
- queryFn: async () => {
50
- return await sdk.admin.stockLocation.list({
51
- // TODO: change this when RQ is fixed
52
- fields: LOCATION_LIST_FIELDS
53
- }).catch((error) => {
54
- if (error.status === 401) {
55
- throw redirect("/login");
56
- }
57
- throw error;
58
- });
59
- }
60
- });
61
- var shippingListLoader = async (_) => {
62
- const query = shippingListQuery();
63
- return queryClient.getQueryData(
64
- query.queryKey
65
- ) ?? await queryClient.fetchQuery(query);
66
- };
67
-
68
- // src/routes/locations/location-list/location-list.tsx
69
- import { ShoppingBag, TruckFast } from "@medusajs/icons";
70
- import { Container as Container3, Heading as Heading2 } from "@medusajs/ui";
71
- import { useTranslation as useTranslation3 } from "react-i18next";
72
- import { useLoaderData } from "react-router-dom";
73
-
74
- // src/routes/locations/location-list/components/location-list-item/location-list-item.tsx
75
- import { Buildings, PencilSquare, Trash } from "@medusajs/icons";
76
- import { Container, StatusBadge, Text, toast, usePrompt } from "@medusajs/ui";
77
- import { useTranslation } from "react-i18next";
78
- import { jsx, jsxs } from "react/jsx-runtime";
79
- function SalesChannels(props) {
80
- const { t } = useTranslation();
81
- const { salesChannels } = props;
82
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
83
- /* @__PURE__ */ jsx(
84
- Text,
85
- {
86
- size: "small",
87
- weight: "plus",
88
- className: "text-ui-fg-subtle flex-1",
89
- as: "div",
90
- children: t(`stockLocations.salesChannels.label`)
91
- }
92
- ),
93
- /* @__PURE__ */ jsx("div", { className: "flex-1 text-left", children: salesChannels?.length ? /* @__PURE__ */ jsx(
94
- BadgeListSummary,
95
- {
96
- rounded: true,
97
- inline: true,
98
- n: 3,
99
- list: salesChannels.map((s) => s.name)
100
- }
101
- ) : "-" })
102
- ] }) });
103
- }
104
- function FulfillmentSet(props) {
105
- const { t } = useTranslation();
106
- const { fulfillmentSet, type } = props;
107
- const fulfillmentSetExists = !!fulfillmentSet;
108
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
109
- /* @__PURE__ */ jsx(
110
- Text,
111
- {
112
- size: "small",
113
- weight: "plus",
114
- className: "text-ui-fg-subtle flex-1",
115
- as: "div",
116
- children: t(`stockLocations.fulfillmentSets.${type}.header`)
117
- }
118
- ),
119
- /* @__PURE__ */ jsx("div", { className: "flex-1 text-left", children: /* @__PURE__ */ jsx(StatusBadge, { color: fulfillmentSetExists ? "green" : "grey", children: t(fulfillmentSetExists ? "statuses.enabled" : "statuses.disabled") }) })
120
- ] }) });
121
- }
122
- function LocationListItem(props) {
123
- const { location } = props;
124
- const { t } = useTranslation();
125
- const prompt = usePrompt();
126
- const { mutateAsync: deleteLocation } = useDeleteStockLocation(location.id);
127
- const handleDelete = async () => {
128
- const result = await prompt({
129
- title: t("general.areYouSure"),
130
- description: t("stockLocations.delete.confirmation", {
131
- name: location.name
132
- }),
133
- confirmText: t("actions.remove"),
134
- cancelText: t("actions.cancel")
135
- });
136
- if (!result) {
137
- return;
138
- }
139
- await deleteLocation(void 0, {
140
- onSuccess: () => {
141
- toast.success(
142
- t("shippingProfile.delete.successToast", {
143
- name: location.name
144
- })
145
- );
146
- },
147
- onError: (e) => {
148
- toast.error(e.message);
149
- }
150
- });
151
- };
152
- return /* @__PURE__ */ jsxs(Container, { className: "flex flex-col divide-y p-0", children: [
153
- /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between gap-x-4", children: [
154
- /* @__PURE__ */ jsx("div", { className: "shadow-borders-base flex size-7 items-center justify-center rounded-md", children: /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field flex size-6 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx(Buildings, { className: "text-ui-fg-subtle" }) }) }),
155
- /* @__PURE__ */ jsxs("div", { className: "grow-1 flex flex-1 flex-col", children: [
156
- /* @__PURE__ */ jsx(Text, { weight: "plus", children: location.name }),
157
- /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle txt-small", children: getFormattedAddress({ address: location.address }).join(", ") })
158
- ] }),
159
- /* @__PURE__ */ jsxs("div", { className: "flex grow-0 items-center gap-4", children: [
160
- /* @__PURE__ */ jsx(
161
- ActionMenu,
162
- {
163
- groups: [
164
- {
165
- actions: [
166
- {
167
- label: t("actions.edit"),
168
- icon: /* @__PURE__ */ jsx(PencilSquare, {}),
169
- to: `/settings/locations/${location.id}/edit`
170
- }
171
- ]
172
- },
173
- {
174
- actions: [
175
- {
176
- label: t("actions.delete"),
177
- icon: /* @__PURE__ */ jsx(Trash, {}),
178
- onClick: handleDelete
179
- }
180
- ]
181
- }
182
- ]
183
- }
184
- ),
185
- /* @__PURE__ */ jsx("div", { className: "bg-ui-border-strong h-[12px] w-[1px]" }),
186
- /* @__PURE__ */ jsx(LinkButton, { to: `/settings/locations/${location.id}`, children: t("actions.viewDetails") })
187
- ] })
188
- ] }) }),
189
- /* @__PURE__ */ jsx(SalesChannels, { salesChannels: location.sales_channels }),
190
- /* @__PURE__ */ jsx(
191
- FulfillmentSet,
192
- {
193
- type: "pickup" /* Pickup */,
194
- fulfillmentSet: location.fulfillment_sets?.find(
195
- (f) => f.type === "pickup" /* Pickup */
196
- )
197
- }
198
- ),
199
- /* @__PURE__ */ jsx(
200
- FulfillmentSet,
201
- {
202
- type: "shipping" /* Shipping */,
203
- fulfillmentSet: location.fulfillment_sets?.find(
204
- (f) => f.type === "shipping" /* Shipping */
205
- )
206
- }
207
- )
208
- ] });
209
- }
210
- var location_list_item_default = LocationListItem;
211
-
212
- // src/routes/locations/location-list/components/location-list-header/location-list-header.tsx
213
- import { Button, Container as Container2, Heading, Text as Text2 } from "@medusajs/ui";
214
- import { useTranslation as useTranslation2 } from "react-i18next";
215
- import { Link } from "react-router-dom";
216
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
217
- var LocationListHeader = () => {
218
- const { t } = useTranslation2();
219
- return /* @__PURE__ */ jsxs2(Container2, { className: "flex h-fit items-center justify-between gap-x-4 px-6 py-4", children: [
220
- /* @__PURE__ */ jsxs2("div", { children: [
221
- /* @__PURE__ */ jsx2(Heading, { children: t("stockLocations.domain") }),
222
- /* @__PURE__ */ jsx2(Text2, { className: "text-ui-fg-subtle txt-small", children: t("stockLocations.list.description") })
223
- ] }),
224
- /* @__PURE__ */ jsx2(Button, { size: "small", className: "shrink-0", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx2(Link, { to: "create", children: t("actions.create") }) })
225
- ] });
226
- };
227
-
228
- // src/routes/locations/location-list/location-list.tsx
229
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
230
- function LocationList() {
231
- const initialData = useLoaderData();
232
- const {
233
- stock_locations: stockLocations = [],
234
- isError,
235
- error
236
- } = useStockLocations(
237
- {
238
- fields: LOCATION_LIST_FIELDS
239
- },
240
- { initialData }
241
- );
242
- const { getWidgets } = useExtension();
243
- if (isError) {
244
- throw error;
245
- }
246
- return /* @__PURE__ */ jsxs3(
247
- TwoColumnPage,
248
- {
249
- widgets: {
250
- after: getWidgets("location.list.after"),
251
- before: getWidgets("location.list.before"),
252
- sideAfter: getWidgets("location.list.side.after"),
253
- sideBefore: getWidgets("location.list.side.before")
254
- },
255
- showJSON: true,
256
- children: [
257
- /* @__PURE__ */ jsxs3(TwoColumnPage.Main, { children: [
258
- /* @__PURE__ */ jsx3(LocationListHeader, {}),
259
- /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-3 lg:col-span-2", children: stockLocations.map((location) => /* @__PURE__ */ jsx3(location_list_item_default, { location }, location.id)) })
260
- ] }),
261
- /* @__PURE__ */ jsx3(TwoColumnPage.Sidebar, { children: /* @__PURE__ */ jsx3(LinksSection, {}) })
262
- ]
263
- }
264
- );
265
- }
266
- var LinksSection = () => {
267
- const { t } = useTranslation3();
268
- return /* @__PURE__ */ jsxs3(Container3, { className: "p-0", children: [
269
- /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx3(Heading2, { level: "h2", children: t("stockLocations.sidebar.header") }) }),
270
- /* @__PURE__ */ jsx3(
271
- SidebarLink,
272
- {
273
- to: "/settings/locations/shipping-profiles",
274
- labelKey: t("stockLocations.sidebar.shippingProfiles.label"),
275
- descriptionKey: t(
276
- "stockLocations.sidebar.shippingProfiles.description"
277
- ),
278
- icon: /* @__PURE__ */ jsx3(ShoppingBag, {})
279
- }
280
- ),
281
- /* @__PURE__ */ jsx3(
282
- SidebarLink,
283
- {
284
- to: "/settings/locations/shipping-option-types",
285
- labelKey: t("stockLocations.sidebar.shippingOptionTypes.label"),
286
- descriptionKey: t(
287
- "stockLocations.sidebar.shippingOptionTypes.description"
288
- ),
289
- icon: /* @__PURE__ */ jsx3(TruckFast, {})
290
- }
291
- )
292
- ] });
293
- };
294
- export {
295
- LocationList as Component,
296
- shippingListLoader as loader
297
- };
@@ -1 +0,0 @@
1
- export * from "./location-list-header"
@@ -1,21 +0,0 @@
1
- import { Button, Container, Heading, Text } from "@medusajs/ui"
2
- import { useTranslation } from "react-i18next"
3
- import { Link } from "react-router-dom"
4
-
5
- export const LocationListHeader = () => {
6
- const { t } = useTranslation()
7
-
8
- return (
9
- <Container className="flex h-fit items-center justify-between gap-x-4 px-6 py-4">
10
- <div>
11
- <Heading>{t("stockLocations.domain")}</Heading>
12
- <Text className="text-ui-fg-subtle txt-small">
13
- {t("stockLocations.list.description")}
14
- </Text>
15
- </div>
16
- <Button size="small" className="shrink-0" variant="secondary" asChild>
17
- <Link to="create">{t("actions.create")}</Link>
18
- </Button>
19
- </Container>
20
- )
21
- }
@@ -1,36 +0,0 @@
1
- import { FetchError } from "@medusajs/js-sdk"
2
- import { LoaderFunctionArgs, redirect } from "react-router-dom"
3
-
4
- import { HttpTypes } from "@medusajs/types"
5
- import { stockLocationsQueryKeys } from "../../../hooks/api/stock-locations"
6
- import { sdk } from "../../../lib/client"
7
- import { queryClient } from "../../../lib/query-client"
8
- import { LOCATION_LIST_FIELDS } from "./constants"
9
-
10
- const shippingListQuery = () => ({
11
- queryKey: stockLocationsQueryKeys.lists(),
12
- queryFn: async () => {
13
- return await sdk.admin.stockLocation
14
- .list({
15
- // TODO: change this when RQ is fixed
16
- fields: LOCATION_LIST_FIELDS,
17
- })
18
- .catch((error: FetchError) => {
19
- if (error.status === 401) {
20
- throw redirect("/login")
21
- }
22
-
23
- throw error
24
- })
25
- },
26
- })
27
-
28
- export const shippingListLoader = async (_: LoaderFunctionArgs) => {
29
- const query = shippingListQuery()
30
-
31
- return (
32
- queryClient.getQueryData<HttpTypes.AdminStockLocationListResponse>(
33
- query.queryKey
34
- ) ?? (await queryClient.fetchQuery(query))
35
- )
36
- }