@medusajs/dashboard 2.10.4-preview-20250924031247 → 2.10.4-preview-20250924090158
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.
- package/dist/{add-campaign-promotions-BWIP24MA.mjs → add-campaign-promotions-62IIOR5K.mjs} +3 -3
- package/dist/{api-key-management-detail-WGWZQCFC.mjs → api-key-management-detail-TEW653QF.mjs} +1 -1
- package/dist/{api-key-management-sales-channels-H5TVIHTV.mjs → api-key-management-sales-channels-ESGRJKDT.mjs} +1 -1
- package/dist/app.css +0 -3
- package/dist/app.js +3490 -3464
- package/dist/app.mjs +2 -2
- package/dist/{campaign-detail-EJD7LQCW.mjs → campaign-detail-XYLU3HF4.mjs} +3 -3
- package/dist/{chunk-2252SSK6.mjs → chunk-6W7OL4TX.mjs} +1 -1
- package/dist/{chunk-OQPVQGSH.mjs → chunk-7GBCLBMX.mjs} +24 -11
- package/dist/{chunk-YPSSUJUZ.mjs → chunk-HEBATBOH.mjs} +6 -2
- package/dist/{chunk-U2FXUMKA.mjs → chunk-NDNUJ2UK.mjs} +1 -1
- package/dist/{chunk-CAZKNJTG.mjs → chunk-NKM6CHK6.mjs} +30 -30
- package/dist/{chunk-WP5CXGGO.mjs → chunk-TWP4GTKM.mjs} +1 -1
- package/dist/{chunk-V53HAFWH.mjs → chunk-UOEALCPZ.mjs} +1 -1
- package/dist/{chunk-6RWF7BPW.mjs → chunk-V6JXTITD.mjs} +1 -1
- package/dist/{customer-group-list-UTC5ZCJZ.mjs → customer-group-list-6XY7YF5E.mjs} +1 -1
- package/dist/{inventory-detail-BO5E7KXO.mjs → inventory-detail-WI5T47QL.mjs} +1 -1
- package/dist/{location-edit-RNGPJ26L.mjs → location-edit-X6JBEWIF.mjs} +1 -1
- package/dist/location-list-VNEYHAKV.mjs +323 -0
- package/dist/{location-sales-channels-NSXV65ZM.mjs → location-sales-channels-HVZHZMBY.mjs} +1 -1
- package/dist/{order-detail-6XQLJ5TU.mjs → order-detail-CNQ7HP32.mjs} +30 -22
- package/dist/{order-list-OTPVQKU6.mjs → order-list-YWPAJ7FR.mjs} +2 -2
- package/dist/{product-attributes-5PLACMXK.mjs → product-attributes-6ELSX5OH.mjs} +3 -3
- package/dist/{product-create-6FMLIS5X.mjs → product-create-6NWXJ7AY.mjs} +4 -4
- package/dist/{product-detail-2BJJMCCO.mjs → product-detail-G53SUBEP.mjs} +4 -4
- package/dist/{product-edit-N5P7RVNS.mjs → product-edit-ZYUXMIZP.mjs} +3 -3
- package/dist/{product-list-EUQX3NBE.mjs → product-list-R6IDCNRV.mjs} +2 -2
- package/dist/{product-media-XJGAON6B.mjs → product-media-AKHSFDJQ.mjs} +2 -2
- package/dist/{product-organization-FB6BVKKL.mjs → product-organization-J2UYHJ6I.mjs} +3 -3
- package/dist/{product-sales-channels-QBQDLU7Z.mjs → product-sales-channels-UX7AOJIF.mjs} +1 -1
- package/dist/{product-shipping-profile-UZQSV54B.mjs → product-shipping-profile-FN7L2V4X.mjs} +3 -3
- package/dist/{promotion-detail-VB5GZDCC.mjs → promotion-detail-RISSMGU5.mjs} +112 -63
- package/dist/{promotion-list-NAUTWXNU.mjs → promotion-list-UPVSOD6R.mjs} +3 -3
- package/dist/{refund-reason-list-VBHGRLJJ.mjs → refund-reason-list-RGRFZ5DU.mjs} +9 -4
- package/dist/{reset-password-ZCKXQZNQ.mjs → reset-password-AYCPBCKE.mjs} +1 -1
- package/dist/{sales-channel-list-R4HT6A7P.mjs → sales-channel-list-KNLMJ67Q.mjs} +1 -1
- package/dist/{tax-region-create-2GDG36NQ.mjs → tax-region-create-SP46RW2E.mjs} +1 -1
- package/dist/{user-list-TPBPZ7KJ.mjs → user-list-G4H2RSDX.mjs} +1 -1
- package/package.json +9 -9
- package/src/components/data-table/data-table.tsx +64 -46
- package/src/i18n/translations/$schema.json +19 -2
- package/src/i18n/translations/en.json +6 -2
- package/src/routes/locations/location-edit/components/edit-location-form/edit-location-form.tsx +1 -1
- package/src/routes/locations/location-list/index.ts +0 -1
- package/src/routes/locations/location-list/location-list.tsx +52 -14
- package/src/routes/locations/location-list/use-location-list-table-columns.tsx +185 -0
- package/src/routes/locations/location-list/use-location-list-table-query.tsx +22 -0
- package/src/routes/orders/order-detail/components/order-activity-section/order-timeline.tsx +13 -5
- package/src/routes/refund-reasons/refund-reason-list/components/refund-reason-list-table/refund-reason-list-table.tsx +12 -4
- package/dist/chunk-BKJC5BGQ.mjs +0 -53
- package/dist/location-list-NKIOBHG4.mjs +0 -298
- package/src/routes/locations/location-list/components/location-list-header/index.ts +0 -1
- package/src/routes/locations/location-list/components/location-list-header/location-list-header.tsx +0 -21
- package/src/routes/locations/location-list/loader.ts +0 -36
@@ -1,12 +1,20 @@
|
|
1
1
|
import { PencilSquare, Trash } from "@medusajs/icons"
|
2
2
|
import { HttpTypes } from "@medusajs/types"
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
Container,
|
5
|
+
createDataTableColumnHelper,
|
6
|
+
toast,
|
7
|
+
usePrompt,
|
8
|
+
} from "@medusajs/ui"
|
4
9
|
import { keepPreviousData } from "@tanstack/react-query"
|
5
10
|
import { useCallback, useMemo } from "react"
|
6
11
|
import { useTranslation } from "react-i18next"
|
7
12
|
import { useNavigate } from "react-router-dom"
|
8
13
|
import { DataTable } from "../../../../../components/data-table"
|
9
|
-
import {
|
14
|
+
import {
|
15
|
+
useDeleteRefundReasonLazy,
|
16
|
+
useRefundReasons,
|
17
|
+
} from "../../../../../hooks/api"
|
10
18
|
import { useRefundReasonTableColumns } from "../../../../../hooks/table/columns"
|
11
19
|
import { useRefundReasonTableQuery } from "../../../../../hooks/table/query"
|
12
20
|
|
@@ -18,7 +26,7 @@ export const RefundReasonListTable = () => {
|
|
18
26
|
pageSize: PAGE_SIZE,
|
19
27
|
})
|
20
28
|
|
21
|
-
const { refund_reasons, count,
|
29
|
+
const { refund_reasons, count, isLoading, isError, error } = useRefundReasons(
|
22
30
|
searchParams,
|
23
31
|
{
|
24
32
|
placeholderData: keepPreviousData,
|
@@ -56,7 +64,7 @@ export const RefundReasonListTable = () => {
|
|
56
64
|
to: "create",
|
57
65
|
},
|
58
66
|
]}
|
59
|
-
isLoading={
|
67
|
+
isLoading={isLoading}
|
60
68
|
enableSearch={true}
|
61
69
|
/>
|
62
70
|
</Container>
|
package/dist/chunk-BKJC5BGQ.mjs
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
// src/components/common/badge-list-summary/badge-list-summary.tsx
|
2
|
-
import { Badge, Tooltip, clx } from "@medusajs/ui";
|
3
|
-
import { useTranslation } from "react-i18next";
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
5
|
-
var BadgeListSummary = ({
|
6
|
-
list,
|
7
|
-
className,
|
8
|
-
inline,
|
9
|
-
rounded = false,
|
10
|
-
n = 2
|
11
|
-
}) => {
|
12
|
-
const { t } = useTranslation();
|
13
|
-
const title = t("general.plusCount", {
|
14
|
-
count: list.length - n
|
15
|
-
});
|
16
|
-
return /* @__PURE__ */ jsxs(
|
17
|
-
"div",
|
18
|
-
{
|
19
|
-
className: clx(
|
20
|
-
"text-ui-fg-subtle txt-compact-small gap-x-2 overflow-hidden",
|
21
|
-
{
|
22
|
-
"inline-flex": inline,
|
23
|
-
flex: !inline
|
24
|
-
},
|
25
|
-
className
|
26
|
-
),
|
27
|
-
children: [
|
28
|
-
list.slice(0, n).map((item) => {
|
29
|
-
return /* @__PURE__ */ jsx(Badge, { rounded: rounded ? "full" : "base", size: "2xsmall", children: item }, item);
|
30
|
-
}),
|
31
|
-
list.length > n && /* @__PURE__ */ jsx("div", { className: "whitespace-nowrap", children: /* @__PURE__ */ jsx(
|
32
|
-
Tooltip,
|
33
|
-
{
|
34
|
-
content: /* @__PURE__ */ jsx("ul", { children: list.slice(n).map((c) => /* @__PURE__ */ jsx("li", { children: c }, c)) }),
|
35
|
-
children: /* @__PURE__ */ jsx(
|
36
|
-
Badge,
|
37
|
-
{
|
38
|
-
rounded: rounded ? "full" : "base",
|
39
|
-
size: "2xsmall",
|
40
|
-
className: "cursor-default whitespace-nowrap",
|
41
|
-
children: title
|
42
|
-
}
|
43
|
-
)
|
44
|
-
}
|
45
|
-
) })
|
46
|
-
]
|
47
|
-
}
|
48
|
-
);
|
49
|
-
};
|
50
|
-
|
51
|
-
export {
|
52
|
-
BadgeListSummary
|
53
|
-
};
|
@@ -1,298 +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-HWKLNKOY.mjs";
|
11
|
-
import "./chunk-EQTBJSBZ.mjs";
|
12
|
-
import {
|
13
|
-
getFormattedAddress
|
14
|
-
} from "./chunk-B6ZOPCPA.mjs";
|
15
|
-
import {
|
16
|
-
TwoColumnPage
|
17
|
-
} from "./chunk-GIZFNLKK.mjs";
|
18
|
-
import {
|
19
|
-
useExtension
|
20
|
-
} from "./chunk-C5P5PL3E.mjs";
|
21
|
-
import "./chunk-DG7J63J2.mjs";
|
22
|
-
import {
|
23
|
-
ActionMenu
|
24
|
-
} from "./chunk-OZPB6JBL.mjs";
|
25
|
-
import "./chunk-OC7BQLYI.mjs";
|
26
|
-
import "./chunk-S4DMV3ZT.mjs";
|
27
|
-
import {
|
28
|
-
stockLocationsQueryKeys,
|
29
|
-
useDeleteStockLocation,
|
30
|
-
useStockLocations
|
31
|
-
} from "./chunk-32IQRUVY.mjs";
|
32
|
-
import {
|
33
|
-
queryClient
|
34
|
-
} from "./chunk-FXYH54JP.mjs";
|
35
|
-
import "./chunk-774WSTCC.mjs";
|
36
|
-
import {
|
37
|
-
sdk
|
38
|
-
} from "./chunk-DEQUVHHE.mjs";
|
39
|
-
import "./chunk-RPUOO7AV.mjs";
|
40
|
-
|
41
|
-
// src/routes/locations/location-list/loader.ts
|
42
|
-
import { redirect } from "react-router-dom";
|
43
|
-
|
44
|
-
// src/routes/locations/location-list/constants.ts
|
45
|
-
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";
|
46
|
-
|
47
|
-
// src/routes/locations/location-list/loader.ts
|
48
|
-
var shippingListQuery = () => ({
|
49
|
-
queryKey: stockLocationsQueryKeys.lists(),
|
50
|
-
queryFn: async () => {
|
51
|
-
return await sdk.admin.stockLocation.list({
|
52
|
-
// TODO: change this when RQ is fixed
|
53
|
-
fields: LOCATION_LIST_FIELDS
|
54
|
-
}).catch((error) => {
|
55
|
-
if (error.status === 401) {
|
56
|
-
throw redirect("/login");
|
57
|
-
}
|
58
|
-
throw error;
|
59
|
-
});
|
60
|
-
}
|
61
|
-
});
|
62
|
-
var shippingListLoader = async (_) => {
|
63
|
-
const query = shippingListQuery();
|
64
|
-
return queryClient.getQueryData(
|
65
|
-
query.queryKey
|
66
|
-
) ?? await queryClient.fetchQuery(query);
|
67
|
-
};
|
68
|
-
|
69
|
-
// src/routes/locations/location-list/location-list.tsx
|
70
|
-
import { ShoppingBag, TruckFast } from "@medusajs/icons";
|
71
|
-
import { Container as Container3, Heading as Heading2 } from "@medusajs/ui";
|
72
|
-
import { useTranslation as useTranslation3 } from "react-i18next";
|
73
|
-
import { useLoaderData } from "react-router-dom";
|
74
|
-
|
75
|
-
// src/routes/locations/location-list/components/location-list-item/location-list-item.tsx
|
76
|
-
import { Buildings, PencilSquare, Trash } from "@medusajs/icons";
|
77
|
-
import { Container, StatusBadge, Text, toast, usePrompt } from "@medusajs/ui";
|
78
|
-
import { useTranslation } from "react-i18next";
|
79
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
80
|
-
function SalesChannels(props) {
|
81
|
-
const { t } = useTranslation();
|
82
|
-
const { salesChannels } = props;
|
83
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
84
|
-
/* @__PURE__ */ jsx(
|
85
|
-
Text,
|
86
|
-
{
|
87
|
-
size: "small",
|
88
|
-
weight: "plus",
|
89
|
-
className: "text-ui-fg-subtle flex-1",
|
90
|
-
as: "div",
|
91
|
-
children: t(`stockLocations.salesChannels.label`)
|
92
|
-
}
|
93
|
-
),
|
94
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 text-left", children: salesChannels?.length ? /* @__PURE__ */ jsx(
|
95
|
-
BadgeListSummary,
|
96
|
-
{
|
97
|
-
rounded: true,
|
98
|
-
inline: true,
|
99
|
-
n: 3,
|
100
|
-
list: salesChannels.map((s) => s.name)
|
101
|
-
}
|
102
|
-
) : "-" })
|
103
|
-
] }) });
|
104
|
-
}
|
105
|
-
function FulfillmentSet(props) {
|
106
|
-
const { t } = useTranslation();
|
107
|
-
const { fulfillmentSet, type } = props;
|
108
|
-
const fulfillmentSetExists = !!fulfillmentSet;
|
109
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
110
|
-
/* @__PURE__ */ jsx(
|
111
|
-
Text,
|
112
|
-
{
|
113
|
-
size: "small",
|
114
|
-
weight: "plus",
|
115
|
-
className: "text-ui-fg-subtle flex-1",
|
116
|
-
as: "div",
|
117
|
-
children: t(`stockLocations.fulfillmentSets.${type}.header`)
|
118
|
-
}
|
119
|
-
),
|
120
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 text-left", children: /* @__PURE__ */ jsx(StatusBadge, { color: fulfillmentSetExists ? "green" : "grey", children: t(fulfillmentSetExists ? "statuses.enabled" : "statuses.disabled") }) })
|
121
|
-
] }) });
|
122
|
-
}
|
123
|
-
function LocationListItem(props) {
|
124
|
-
const { location } = props;
|
125
|
-
const { t } = useTranslation();
|
126
|
-
const prompt = usePrompt();
|
127
|
-
const { mutateAsync: deleteLocation } = useDeleteStockLocation(location.id);
|
128
|
-
const handleDelete = async () => {
|
129
|
-
const result = await prompt({
|
130
|
-
title: t("general.areYouSure"),
|
131
|
-
description: t("stockLocations.delete.confirmation", {
|
132
|
-
name: location.name
|
133
|
-
}),
|
134
|
-
confirmText: t("actions.remove"),
|
135
|
-
cancelText: t("actions.cancel")
|
136
|
-
});
|
137
|
-
if (!result) {
|
138
|
-
return;
|
139
|
-
}
|
140
|
-
await deleteLocation(void 0, {
|
141
|
-
onSuccess: () => {
|
142
|
-
toast.success(
|
143
|
-
t("shippingProfile.delete.successToast", {
|
144
|
-
name: location.name
|
145
|
-
})
|
146
|
-
);
|
147
|
-
},
|
148
|
-
onError: (e) => {
|
149
|
-
toast.error(e.message);
|
150
|
-
}
|
151
|
-
});
|
152
|
-
};
|
153
|
-
return /* @__PURE__ */ jsxs(Container, { className: "flex flex-col divide-y p-0", children: [
|
154
|
-
/* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between gap-x-4", children: [
|
155
|
-
/* @__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" }) }) }),
|
156
|
-
/* @__PURE__ */ jsxs("div", { className: "grow-1 flex flex-1 flex-col", children: [
|
157
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", children: location.name }),
|
158
|
-
/* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle txt-small", children: getFormattedAddress({ address: location.address }).join(", ") })
|
159
|
-
] }),
|
160
|
-
/* @__PURE__ */ jsxs("div", { className: "flex grow-0 items-center gap-4", children: [
|
161
|
-
/* @__PURE__ */ jsx(
|
162
|
-
ActionMenu,
|
163
|
-
{
|
164
|
-
groups: [
|
165
|
-
{
|
166
|
-
actions: [
|
167
|
-
{
|
168
|
-
label: t("actions.edit"),
|
169
|
-
icon: /* @__PURE__ */ jsx(PencilSquare, {}),
|
170
|
-
to: `/settings/locations/${location.id}/edit`
|
171
|
-
}
|
172
|
-
]
|
173
|
-
},
|
174
|
-
{
|
175
|
-
actions: [
|
176
|
-
{
|
177
|
-
label: t("actions.delete"),
|
178
|
-
icon: /* @__PURE__ */ jsx(Trash, {}),
|
179
|
-
onClick: handleDelete
|
180
|
-
}
|
181
|
-
]
|
182
|
-
}
|
183
|
-
]
|
184
|
-
}
|
185
|
-
),
|
186
|
-
/* @__PURE__ */ jsx("div", { className: "bg-ui-border-strong h-[12px] w-[1px]" }),
|
187
|
-
/* @__PURE__ */ jsx(LinkButton, { to: `/settings/locations/${location.id}`, children: t("actions.viewDetails") })
|
188
|
-
] })
|
189
|
-
] }) }),
|
190
|
-
/* @__PURE__ */ jsx(SalesChannels, { salesChannels: location.sales_channels }),
|
191
|
-
/* @__PURE__ */ jsx(
|
192
|
-
FulfillmentSet,
|
193
|
-
{
|
194
|
-
type: "pickup" /* Pickup */,
|
195
|
-
fulfillmentSet: location.fulfillment_sets?.find(
|
196
|
-
(f) => f.type === "pickup" /* Pickup */
|
197
|
-
)
|
198
|
-
}
|
199
|
-
),
|
200
|
-
/* @__PURE__ */ jsx(
|
201
|
-
FulfillmentSet,
|
202
|
-
{
|
203
|
-
type: "shipping" /* Shipping */,
|
204
|
-
fulfillmentSet: location.fulfillment_sets?.find(
|
205
|
-
(f) => f.type === "shipping" /* Shipping */
|
206
|
-
)
|
207
|
-
}
|
208
|
-
)
|
209
|
-
] });
|
210
|
-
}
|
211
|
-
var location_list_item_default = LocationListItem;
|
212
|
-
|
213
|
-
// src/routes/locations/location-list/components/location-list-header/location-list-header.tsx
|
214
|
-
import { Button, Container as Container2, Heading, Text as Text2 } from "@medusajs/ui";
|
215
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
216
|
-
import { Link } from "react-router-dom";
|
217
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
218
|
-
var LocationListHeader = () => {
|
219
|
-
const { t } = useTranslation2();
|
220
|
-
return /* @__PURE__ */ jsxs2(Container2, { className: "flex h-fit items-center justify-between gap-x-4 px-6 py-4", children: [
|
221
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
222
|
-
/* @__PURE__ */ jsx2(Heading, { children: t("stockLocations.domain") }),
|
223
|
-
/* @__PURE__ */ jsx2(Text2, { className: "text-ui-fg-subtle txt-small", children: t("stockLocations.list.description") })
|
224
|
-
] }),
|
225
|
-
/* @__PURE__ */ jsx2(Button, { size: "small", className: "shrink-0", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx2(Link, { to: "create", children: t("actions.create") }) })
|
226
|
-
] });
|
227
|
-
};
|
228
|
-
|
229
|
-
// src/routes/locations/location-list/location-list.tsx
|
230
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
231
|
-
function LocationList() {
|
232
|
-
const initialData = useLoaderData();
|
233
|
-
const {
|
234
|
-
stock_locations: stockLocations = [],
|
235
|
-
isError,
|
236
|
-
error
|
237
|
-
} = useStockLocations(
|
238
|
-
{
|
239
|
-
fields: LOCATION_LIST_FIELDS
|
240
|
-
},
|
241
|
-
{ initialData }
|
242
|
-
);
|
243
|
-
const { getWidgets } = useExtension();
|
244
|
-
if (isError) {
|
245
|
-
throw error;
|
246
|
-
}
|
247
|
-
return /* @__PURE__ */ jsxs3(
|
248
|
-
TwoColumnPage,
|
249
|
-
{
|
250
|
-
widgets: {
|
251
|
-
after: getWidgets("location.list.after"),
|
252
|
-
before: getWidgets("location.list.before"),
|
253
|
-
sideAfter: getWidgets("location.list.side.after"),
|
254
|
-
sideBefore: getWidgets("location.list.side.before")
|
255
|
-
},
|
256
|
-
showJSON: true,
|
257
|
-
children: [
|
258
|
-
/* @__PURE__ */ jsxs3(TwoColumnPage.Main, { children: [
|
259
|
-
/* @__PURE__ */ jsx3(LocationListHeader, {}),
|
260
|
-
/* @__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)) })
|
261
|
-
] }),
|
262
|
-
/* @__PURE__ */ jsx3(TwoColumnPage.Sidebar, { children: /* @__PURE__ */ jsx3(LinksSection, {}) })
|
263
|
-
]
|
264
|
-
}
|
265
|
-
);
|
266
|
-
}
|
267
|
-
var LinksSection = () => {
|
268
|
-
const { t } = useTranslation3();
|
269
|
-
return /* @__PURE__ */ jsxs3(Container3, { className: "p-0", children: [
|
270
|
-
/* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx3(Heading2, { level: "h2", children: t("stockLocations.sidebar.header") }) }),
|
271
|
-
/* @__PURE__ */ jsx3(
|
272
|
-
SidebarLink,
|
273
|
-
{
|
274
|
-
to: "/settings/locations/shipping-profiles",
|
275
|
-
labelKey: t("stockLocations.sidebar.shippingProfiles.label"),
|
276
|
-
descriptionKey: t(
|
277
|
-
"stockLocations.sidebar.shippingProfiles.description"
|
278
|
-
),
|
279
|
-
icon: /* @__PURE__ */ jsx3(ShoppingBag, {})
|
280
|
-
}
|
281
|
-
),
|
282
|
-
/* @__PURE__ */ jsx3(
|
283
|
-
SidebarLink,
|
284
|
-
{
|
285
|
-
to: "/settings/locations/shipping-option-types",
|
286
|
-
labelKey: t("stockLocations.sidebar.shippingOptionTypes.label"),
|
287
|
-
descriptionKey: t(
|
288
|
-
"stockLocations.sidebar.shippingOptionTypes.description"
|
289
|
-
),
|
290
|
-
icon: /* @__PURE__ */ jsx3(TruckFast, {})
|
291
|
-
}
|
292
|
-
)
|
293
|
-
] });
|
294
|
-
};
|
295
|
-
export {
|
296
|
-
LocationList as Component,
|
297
|
-
shippingListLoader as loader
|
298
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from "./location-list-header"
|
package/src/routes/locations/location-list/components/location-list-header/location-list-header.tsx
DELETED
@@ -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
|
-
}
|