@mercurjs/admin 2.3.2-canary.1 → 2.3.2-canary.2
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-NZ62V2LH.js → add-campaign-promotions-DAJLAYTG.js} +3 -3
- package/dist/{api-key-management-list-AHXOCLBO.js → api-key-management-list-P4FQQKIV.js} +1 -1
- package/dist/{attribute-list-6ELFWDHO.js → attribute-list-PVC4KUYQ.js} +1 -1
- package/dist/{campaign-detail-KZWQLIS5.js → campaign-detail-V6RISO2Y.js} +4 -4
- package/dist/{campaign-list-7L2DGBHW.js → campaign-list-WFFH3VPJ.js} +1 -1
- package/dist/{category-list-3IL2MERS.js → category-list-RBFOTJFJ.js} +1 -1
- package/dist/{chunk-CR7TRBEB.js → chunk-2YEBREEY.js} +2 -1
- package/dist/chunk-4F6SHS7A.js +83 -0
- package/dist/{chunk-EAZ6YM6D.js → chunk-5SDHNLEC.js} +2 -1
- package/dist/{chunk-ADI5XIXM.js → chunk-6DBL7KIL.js} +1 -1
- package/dist/{chunk-ZBRRK3Y6.js → chunk-AB34V74P.js} +3 -2
- package/dist/{chunk-AV6HBMRX.js → chunk-AMKTWSOZ.js} +1 -1
- package/dist/{chunk-3W4T2KGY.js → chunk-BNYVXSFC.js} +1 -1
- package/dist/{chunk-MIVPIACG.js → chunk-CGT2IRFI.js} +1 -1
- package/dist/{chunk-N3ZYLAGA.js → chunk-GQ45JPQR.js} +3 -2
- package/dist/{chunk-4KULFU3V.js → chunk-GVKW5SUK.js} +3 -2
- package/dist/{chunk-UGDC6FPU.js → chunk-JIVTFB67.js} +2 -1
- package/dist/{chunk-23KZGNNG.js → chunk-KHMHTJZG.js} +2 -1
- package/dist/{chunk-OQLWF43Y.js → chunk-MUSHUJHY.js} +51 -0
- package/dist/{chunk-LAIT7Y53.js → chunk-NO64DRH4.js} +25 -7
- package/dist/{chunk-AJNXQUOR.js → chunk-O56RWFFI.js} +3 -2
- package/dist/{chunk-OJQSOFYG.js → chunk-PC5GU4HP.js} +2 -1
- package/dist/{chunk-PNLDVYCP.js → chunk-R3E7BMQB.js} +1 -1
- package/dist/{chunk-IP5YNQ5R.js → chunk-RQCYGC2H.js} +3 -2
- package/dist/{chunk-EF23N7II.js → chunk-S4W3RVQV.js} +3 -2
- package/dist/{chunk-HBNQ3R3P.js → chunk-T36KFL5R.js} +2 -1
- package/dist/{chunk-CMBHUF6P.js → chunk-T3KB4DCM.js} +4 -1
- package/dist/{chunk-LIMG2EY2.js → chunk-VB4A2G7A.js} +3 -2
- package/dist/{chunk-PB24YMA4.js → chunk-VYD6M7TF.js} +2 -1
- package/dist/{chunk-73N66XQD.js → chunk-WCA5Z4MT.js} +2 -1
- package/dist/{chunk-43SWJ765.js → chunk-XBEI6JKV.js} +2 -1
- package/dist/{chunk-GYHF5XBU.js → chunk-XVBLVV7Y.js} +1 -1
- package/dist/{chunk-HFMAEJN2.js → chunk-Y5T5NATQ.js} +2 -1
- package/dist/{chunk-WYRUCSGW.js → chunk-YS6DRI7V.js} +2 -1
- package/dist/{collection-list-GMAYML6Z.js → collection-list-C2EQXJTN.js} +1 -1
- package/dist/{commissions-list-X54FEOEZ.js → commissions-list-VBQOQF2D.js} +1 -1
- package/dist/{customer-group-list-KBZBSGTQ.js → customer-group-list-NZ3D2ZAR.js} +1 -1
- package/dist/{customer-list-IJJEZDOZ.js → customer-list-DFONJE23.js} +1 -1
- package/dist/index.css +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1501 -1296
- package/dist/{order-edit-billing-address-QCVPGEL6.js → order-edit-billing-address-ZT7HAEXB.js} +1 -1
- package/dist/pages/index.d.ts +22 -22
- package/dist/pages/index.js +27 -27
- package/dist/{price-list-list-JC5EDBH6.js → price-list-list-UEEYIP5R.js} +1 -1
- package/dist/{product-create-QS5KIHET.js → product-create-LBKJTFOY.js} +3 -3
- package/dist/{product-list-2FOZLWYH.js → product-list-YHJ7DW6D.js} +1 -1
- package/dist/{product-media-UHDJ6RSG.js → product-media-NEAAG6IC.js} +2 -2
- package/dist/{product-organization-IX5XCZW4.js → product-organization-SVOLE5TG.js} +1 -1
- package/dist/{product-tag-list-3HOXFHMN.js → product-tag-list-GDIVZYEB.js} +1 -1
- package/dist/{product-type-list-NNNFCCWS.js → product-type-list-VSCQHI3D.js} +1 -1
- package/dist/{promotion-detail-ADTUSGD4.js → promotion-detail-HVQKXMJL.js} +3 -3
- package/dist/{promotion-list-MRNS47TP.js → promotion-list-KB2E4AEZ.js} +4 -4
- package/dist/{reservation-list-CRPRHIMT.js → reservation-list-APKRLKOF.js} +1 -1
- package/dist/{reset-password-N4LXTU3G.js → reset-password-BIAORJOF.js} +1 -1
- package/dist/{return-reason-list-AVCC44CH.js → return-reason-list-IQ2JGNEN.js} +1 -1
- package/dist/{shipping-option-type-list-R4JPQOAA.js → shipping-option-type-list-VQ5UVOUU.js} +1 -1
- package/dist/{shipping-profiles-list-UKD47NUF.js → shipping-profiles-list-AK6KXUGF.js} +1 -1
- package/dist/{store-edit-B54LFFLE.js → store-edit-LXGZTR3G.js} +2 -2
- package/dist/{store-list-3KZCD7UB.js → store-list-XXRF6JAZ.js} +1 -1
- package/dist/{tax-region-create-DVBIX7IX.js → tax-region-create-SFRD4AJB.js} +1 -1
- package/dist/{tax-region-list-JC4QYF5B.js → tax-region-list-TM23Q4HH.js} +1 -1
- package/dist/{user-invite-WHBNPT4I.js → user-invite-A7TBRKWI.js} +2 -2
- package/dist/{user-list-P7JCBIOR.js → user-list-ECF647TZ.js} +1 -1
- package/package.json +6 -6
- package/dist/chunk-PVEB24HU.js +0 -208
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePromotionTableColumns,
|
|
3
3
|
usePromotionTableQuery
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XVBLVV7Y.js";
|
|
5
5
|
import {
|
|
6
6
|
usePromotionTableFilters
|
|
7
7
|
} from "./chunk-J4SYK3RT.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-6DBL7KIL.js";
|
|
9
9
|
import "./chunk-JHIMVLB2.js";
|
|
10
10
|
import "./chunk-MDABSESI.js";
|
|
11
11
|
import "./chunk-FMFVTERD.js";
|
|
12
12
|
import "./chunk-PHOCVOZ5.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-MUSHUJHY.js";
|
|
14
14
|
import "./chunk-TKGWSUEI.js";
|
|
15
15
|
import {
|
|
16
16
|
KeyboundForm
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CAMPAIGN_DETAIL_FIELDS,
|
|
3
3
|
CampaignDetailPage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AMKTWSOZ.js";
|
|
5
5
|
import "./chunk-WP3B4NEU.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-XVBLVV7Y.js";
|
|
7
7
|
import "./chunk-J4SYK3RT.js";
|
|
8
8
|
import "./chunk-RK5N3XIX.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-6DBL7KIL.js";
|
|
10
10
|
import "./chunk-JHIMVLB2.js";
|
|
11
11
|
import "./chunk-MDABSESI.js";
|
|
12
12
|
import "./chunk-FMFVTERD.js";
|
|
13
13
|
import "./chunk-PHOCVOZ5.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-MUSHUJHY.js";
|
|
15
15
|
import "./chunk-E74OUNA3.js";
|
|
16
16
|
import "./chunk-H6MYB7GB.js";
|
|
17
17
|
import "./chunk-THHRRYRS.js";
|
|
@@ -48,6 +48,7 @@ import { Container } from "@medusajs/ui";
|
|
|
48
48
|
import { Children } from "react";
|
|
49
49
|
import { Button, Heading, Text } from "@medusajs/ui";
|
|
50
50
|
import { useTranslation } from "react-i18next";
|
|
51
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
51
52
|
import { Link } from "react-router-dom";
|
|
52
53
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
53
54
|
var CategoryListTitle = () => {
|
|
@@ -63,7 +64,7 @@ var CategoryListActions = ({
|
|
|
63
64
|
const { t } = useTranslation();
|
|
64
65
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
66
|
/* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "organize", children: t("categories.organize.action") }) }),
|
|
66
|
-
/* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) })
|
|
67
|
+
/* @__PURE__ */ jsx(PermissionGuard, { resource: "product_category", operation: "create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) }) })
|
|
67
68
|
] }) });
|
|
68
69
|
};
|
|
69
70
|
var CategoryListHeader = ({
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchQuery,
|
|
3
|
+
sdk
|
|
4
|
+
} from "./chunk-DTGEFKK4.js";
|
|
5
|
+
|
|
6
|
+
// src/providers/feature-flag-provider/index.tsx
|
|
7
|
+
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
8
|
+
|
|
9
|
+
// src/hooks/api/feature-flags.tsx
|
|
10
|
+
import { useQuery } from "@tanstack/react-query";
|
|
11
|
+
var useFeatureFlags = () => {
|
|
12
|
+
return useQuery({
|
|
13
|
+
queryKey: ["admin", "feature-flags"],
|
|
14
|
+
queryFn: async () => {
|
|
15
|
+
const response = await fetchQuery("/admin/feature-flags", {
|
|
16
|
+
method: "GET"
|
|
17
|
+
});
|
|
18
|
+
return response.feature_flags;
|
|
19
|
+
},
|
|
20
|
+
staleTime: 5 * 60 * 1e3,
|
|
21
|
+
gcTime: 10 * 60 * 1e3
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/providers/feature-flag-provider/index.tsx
|
|
26
|
+
import { jsx } from "react/jsx-runtime";
|
|
27
|
+
var FeatureFlagContext = createContext(null);
|
|
28
|
+
var useFeatureFlag = (flag) => {
|
|
29
|
+
const context = useContext(FeatureFlagContext);
|
|
30
|
+
if (!context) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return context.isFeatureEnabled(flag);
|
|
34
|
+
};
|
|
35
|
+
var FeatureFlagProvider = ({
|
|
36
|
+
children
|
|
37
|
+
}) => {
|
|
38
|
+
const { data: flags = {}, isLoading } = useFeatureFlags();
|
|
39
|
+
const isFeatureEnabled = useCallback(
|
|
40
|
+
(flag) => {
|
|
41
|
+
return flags[flag] === true;
|
|
42
|
+
},
|
|
43
|
+
[flags]
|
|
44
|
+
);
|
|
45
|
+
const value = useMemo(
|
|
46
|
+
() => ({ flags, isLoading, isFeatureEnabled }),
|
|
47
|
+
[flags, isLoading, isFeatureEnabled]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ jsx(FeatureFlagContext.Provider, { value, children });
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/hooks/api/rbac-roles.tsx
|
|
53
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
54
|
+
var ME_PERMISSIONS_QUERY_KEY = ["rbac_me_permissions"];
|
|
55
|
+
var mePermissionsQueryKey = ME_PERMISSIONS_QUERY_KEY;
|
|
56
|
+
var useMePermissions = (options) => {
|
|
57
|
+
return useQuery2({
|
|
58
|
+
queryFn: () => sdk.admin.rbac.me.permissions.query(
|
|
59
|
+
{}
|
|
60
|
+
),
|
|
61
|
+
queryKey: mePermissionsQueryKey,
|
|
62
|
+
staleTime: 5 * 60 * 1e3,
|
|
63
|
+
...options
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
var ASSIGNABLE_ROLES_QUERY_KEY = ["rbac_assignable_roles"];
|
|
67
|
+
var useRbacAssignableRoles = (query, options) => {
|
|
68
|
+
return useQuery2({
|
|
69
|
+
queryFn: () => sdk.admin.rbac.roles.assignable.query({
|
|
70
|
+
...query
|
|
71
|
+
}),
|
|
72
|
+
queryKey: [...ASSIGNABLE_ROLES_QUERY_KEY, query],
|
|
73
|
+
staleTime: 5 * 60 * 1e3,
|
|
74
|
+
...options
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
useFeatureFlag,
|
|
80
|
+
FeatureFlagProvider,
|
|
81
|
+
useMePermissions,
|
|
82
|
+
useRbacAssignableRoles
|
|
83
|
+
};
|
|
@@ -61,6 +61,7 @@ var TaxRegionListDataTable = () => {
|
|
|
61
61
|
import { Children } from "react";
|
|
62
62
|
import { Button, Heading, Text } from "@medusajs/ui";
|
|
63
63
|
import { useTranslation } from "react-i18next";
|
|
64
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
64
65
|
import { Link } from "react-router-dom";
|
|
65
66
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
66
67
|
var TaxRegionListTitle = () => {
|
|
@@ -74,7 +75,7 @@ var TaxRegionListActions = ({
|
|
|
74
75
|
children
|
|
75
76
|
}) => {
|
|
76
77
|
const { t } = useTranslation();
|
|
77
|
-
return /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx2(Link, { to: "create", children: /* @__PURE__ */ jsx2(Button, { size: "small", variant: "secondary", children: t("actions.create") }) }) });
|
|
78
|
+
return /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx2(PermissionGuard, { resource: "tax_region", operation: "create", children: /* @__PURE__ */ jsx2(Link, { to: "create", children: /* @__PURE__ */ jsx2(Button, { size: "small", variant: "secondary", children: t("actions.create") }) }) }) });
|
|
78
79
|
};
|
|
79
80
|
var TaxRegionListHeader = ({
|
|
80
81
|
children
|
|
@@ -147,6 +147,7 @@ var useColumns = () => {
|
|
|
147
147
|
import { Children } from "react";
|
|
148
148
|
import { Button, Heading, Text } from "@medusajs/ui";
|
|
149
149
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
150
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
150
151
|
import { Link } from "react-router-dom";
|
|
151
152
|
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
152
153
|
var ProductTypeListTitle = () => {
|
|
@@ -168,7 +169,7 @@ var ProductTypeListActions = ({
|
|
|
168
169
|
children
|
|
169
170
|
}) => {
|
|
170
171
|
const { t } = useTranslation3();
|
|
171
|
-
return /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx3(
|
|
172
|
+
return /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx3(PermissionGuard, { resource: "product_type", operation: "create", children: /* @__PURE__ */ jsx3(
|
|
172
173
|
Button,
|
|
173
174
|
{
|
|
174
175
|
size: "small",
|
|
@@ -177,7 +178,7 @@ var ProductTypeListActions = ({
|
|
|
177
178
|
"data-testid": "product-type-list-table-create-button",
|
|
178
179
|
children: /* @__PURE__ */ jsx3(Link, { to: "create", children: t("actions.create") })
|
|
179
180
|
}
|
|
180
|
-
) });
|
|
181
|
+
) }) });
|
|
181
182
|
};
|
|
182
183
|
var ProductTypeListHeader = ({
|
|
183
184
|
children
|
|
@@ -218,6 +218,7 @@ var ShippingProfileListDataTable = () => {
|
|
|
218
218
|
import { Children } from "react";
|
|
219
219
|
import { Button, Heading, Text } from "@medusajs/ui";
|
|
220
220
|
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
221
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
221
222
|
import { Link } from "react-router-dom";
|
|
222
223
|
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
223
224
|
var ShippingProfileListTitle = () => {
|
|
@@ -239,7 +240,7 @@ var ShippingProfileListActions = ({
|
|
|
239
240
|
children
|
|
240
241
|
}) => {
|
|
241
242
|
const { t } = useTranslation5();
|
|
242
|
-
return /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx4(
|
|
243
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx4(PermissionGuard, { resource: "shipping_profile", operation: "create", children: /* @__PURE__ */ jsx4(
|
|
243
244
|
Button,
|
|
244
245
|
{
|
|
245
246
|
size: "small",
|
|
@@ -248,7 +249,7 @@ var ShippingProfileListActions = ({
|
|
|
248
249
|
"data-testid": "shipping-profile-list-table-create-button",
|
|
249
250
|
children: /* @__PURE__ */ jsx4(Link, { to: "create", children: t("actions.create") })
|
|
250
251
|
}
|
|
251
|
-
) });
|
|
252
|
+
) }) });
|
|
252
253
|
};
|
|
253
254
|
var ShippingProfileListHeader = ({
|
|
254
255
|
children
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePromotionTableColumns,
|
|
3
3
|
usePromotionTableQuery
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XVBLVV7Y.js";
|
|
5
5
|
import {
|
|
6
6
|
usePromotionTableFilters
|
|
7
7
|
} from "./chunk-J4SYK3RT.js";
|
|
@@ -33,6 +33,7 @@ import { Children, useMemo } from "react";
|
|
|
33
33
|
import { useTranslation } from "react-i18next";
|
|
34
34
|
import { Link, Outlet, useLoaderData, useNavigate } from "react-router-dom";
|
|
35
35
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
36
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
36
37
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
37
38
|
var PAGE_SIZE = 20;
|
|
38
39
|
var PromotionListTitle = () => {
|
|
@@ -41,7 +42,7 @@ var PromotionListTitle = () => {
|
|
|
41
42
|
};
|
|
42
43
|
var PromotionListCreateButton = () => {
|
|
43
44
|
const { t } = useTranslation();
|
|
44
|
-
return /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, "data-testid": "promotion-list-table-create-button", children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) });
|
|
45
|
+
return /* @__PURE__ */ jsx(PermissionGuard, { resource: "promotion", operation: "create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, "data-testid": "promotion-list-table-create-button", children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) }) });
|
|
45
46
|
};
|
|
46
47
|
var PromotionListActions = ({ children }) => {
|
|
47
48
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(PromotionListCreateButton, {}) });
|
|
@@ -42,6 +42,7 @@ import { Container } from "@medusajs/ui";
|
|
|
42
42
|
import { Children } from "react";
|
|
43
43
|
import { Button, Heading } from "@medusajs/ui";
|
|
44
44
|
import { useTranslation } from "react-i18next";
|
|
45
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
45
46
|
import { Link } from "react-router-dom";
|
|
46
47
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
47
48
|
var StoreListTitle = () => {
|
|
@@ -52,7 +53,7 @@ var StoreListActions = ({
|
|
|
52
53
|
children
|
|
53
54
|
}) => {
|
|
54
55
|
const { t } = useTranslation();
|
|
55
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(Link, { to: "create", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", children: t("actions.create") }) }) });
|
|
56
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(PermissionGuard, { resource: "seller", operation: "create", children: /* @__PURE__ */ jsx(Link, { to: "create", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", children: t("actions.create") }) }) }) });
|
|
56
57
|
};
|
|
57
58
|
var StoreListHeader = ({
|
|
58
59
|
children
|
|
@@ -40,6 +40,7 @@ import { Container } from "@medusajs/ui";
|
|
|
40
40
|
import { Children } from "react";
|
|
41
41
|
import { Button, Heading } from "@medusajs/ui";
|
|
42
42
|
import { useTranslation } from "react-i18next";
|
|
43
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
43
44
|
import { Link } from "react-router-dom";
|
|
44
45
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
45
46
|
var PriceListListTitle = () => {
|
|
@@ -50,7 +51,7 @@ var PriceListListActions = ({
|
|
|
50
51
|
children
|
|
51
52
|
}) => {
|
|
52
53
|
const { t } = useTranslation();
|
|
53
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) }) });
|
|
54
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(PermissionGuard, { resource: "price_list", operation: "create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) }) }) });
|
|
54
55
|
};
|
|
55
56
|
var PriceListListHeader = ({
|
|
56
57
|
children
|
|
@@ -17135,6 +17135,57 @@ var en_default = {
|
|
|
17135
17135
|
low_stock: "Low stock",
|
|
17136
17136
|
out_of_stock: "Out of stock"
|
|
17137
17137
|
}
|
|
17138
|
+
},
|
|
17139
|
+
permissions: {
|
|
17140
|
+
accessDenied: {
|
|
17141
|
+
title: "Access Denied",
|
|
17142
|
+
description: "You don't have permission to access this page.",
|
|
17143
|
+
requiredPermission: "Required permission: {{permission}}",
|
|
17144
|
+
action: "You don't have permission to perform this action."
|
|
17145
|
+
},
|
|
17146
|
+
requiredPermissions: {
|
|
17147
|
+
title: "Required permissions",
|
|
17148
|
+
none: "No permissions declared in this view.",
|
|
17149
|
+
anyOf: "Any of",
|
|
17150
|
+
allOf: "All of",
|
|
17151
|
+
source: "Source: {{source}}"
|
|
17152
|
+
},
|
|
17153
|
+
resources: {
|
|
17154
|
+
customer: "Customer",
|
|
17155
|
+
customer_group: "Customer Group",
|
|
17156
|
+
order: "Order",
|
|
17157
|
+
product: "Product",
|
|
17158
|
+
product_category: "Product Category",
|
|
17159
|
+
product_collection: "Product Collection",
|
|
17160
|
+
product_tag: "Product Tag",
|
|
17161
|
+
product_type: "Product Type",
|
|
17162
|
+
inventory: "Inventory",
|
|
17163
|
+
reservation: "Reservation",
|
|
17164
|
+
promotion: "Promotion",
|
|
17165
|
+
campaign: "Campaign",
|
|
17166
|
+
price_list: "Price List",
|
|
17167
|
+
region: "Region",
|
|
17168
|
+
store: "Store",
|
|
17169
|
+
user: "User",
|
|
17170
|
+
rbac_role: "Role",
|
|
17171
|
+
rbac_policy: "Policy",
|
|
17172
|
+
sales_channel: "Sales Channel",
|
|
17173
|
+
stock_location: "Stock Location",
|
|
17174
|
+
shipping_profile: "Shipping Profile",
|
|
17175
|
+
shipping_option: "Shipping Option",
|
|
17176
|
+
tax_region: "Tax Region",
|
|
17177
|
+
api_key: "API Key",
|
|
17178
|
+
return_reason: "Return Reason",
|
|
17179
|
+
refund_reason: "Refund Reason",
|
|
17180
|
+
workflow: "Workflow",
|
|
17181
|
+
translation: "Translation"
|
|
17182
|
+
},
|
|
17183
|
+
actions: {
|
|
17184
|
+
read: "Read",
|
|
17185
|
+
create: "Create",
|
|
17186
|
+
update: "Update",
|
|
17187
|
+
delete: "Delete"
|
|
17188
|
+
}
|
|
17138
17189
|
}
|
|
17139
17190
|
};
|
|
17140
17191
|
|
|
@@ -31,6 +31,7 @@ import { Children } from "react";
|
|
|
31
31
|
import { Button, Heading } from "@medusajs/ui";
|
|
32
32
|
import { useTranslation } from "react-i18next";
|
|
33
33
|
import { Link } from "react-router-dom";
|
|
34
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
34
35
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
35
36
|
var UserListTitle = () => {
|
|
36
37
|
const { t } = useTranslation();
|
|
@@ -40,7 +41,7 @@ var UserListActions = ({
|
|
|
40
41
|
children
|
|
41
42
|
}) => {
|
|
42
43
|
const { t } = useTranslation();
|
|
43
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(Link, { to: "invite", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("users.invite") }) }) });
|
|
44
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(PermissionGuard, { resource: "user", operation: "create", children: /* @__PURE__ */ jsx(Link, { to: "invite", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("users.invite") }) }) }) });
|
|
44
45
|
};
|
|
45
46
|
var UserListHeader = ({
|
|
46
47
|
children
|
|
@@ -56,6 +57,7 @@ import { useMemo as useMemo2 } from "react";
|
|
|
56
57
|
import { PencilSquare } from "@medusajs/icons";
|
|
57
58
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
58
59
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
60
|
+
import { useExtendableTable, useLinkQuery } from "@mercurjs/dashboard-shared";
|
|
59
61
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
60
62
|
import { useNavigate } from "react-router-dom";
|
|
61
63
|
|
|
@@ -108,14 +110,19 @@ var UserListDataTable = () => {
|
|
|
108
110
|
const { searchParams, raw } = useUserTableQuery({ pageSize: PAGE_SIZE });
|
|
109
111
|
const { users, count, isPending, isError, error } = useUsers(
|
|
110
112
|
{
|
|
111
|
-
...searchParams
|
|
113
|
+
...searchParams,
|
|
114
|
+
...useLinkQuery("user")
|
|
112
115
|
},
|
|
113
116
|
{
|
|
114
117
|
placeholderData: keepPreviousData
|
|
115
118
|
}
|
|
116
119
|
);
|
|
117
|
-
const
|
|
118
|
-
const columns = useColumns();
|
|
120
|
+
const baseFilters = useUserTableFilters();
|
|
121
|
+
const { columns, filters: extFilters } = useColumns();
|
|
122
|
+
const filters = useMemo2(
|
|
123
|
+
() => [...baseFilters, ...extFilters],
|
|
124
|
+
[baseFilters, extFilters]
|
|
125
|
+
);
|
|
119
126
|
const { table } = useDataTable({
|
|
120
127
|
data: users ?? [],
|
|
121
128
|
columns,
|
|
@@ -156,7 +163,7 @@ var UserListDataTable = () => {
|
|
|
156
163
|
var columnHelper = createColumnHelper();
|
|
157
164
|
var useColumns = () => {
|
|
158
165
|
const { t } = useTranslation3();
|
|
159
|
-
|
|
166
|
+
const base = useMemo2(
|
|
160
167
|
() => [
|
|
161
168
|
columnHelper.accessor("email", {
|
|
162
169
|
header: () => /* @__PURE__ */ jsx2("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx2("span", { children: t("fields.email") }) }),
|
|
@@ -189,7 +196,17 @@ var useColumns = () => {
|
|
|
189
196
|
const date = getValue();
|
|
190
197
|
return /* @__PURE__ */ jsx2(DateCell, { date: date ? new Date(date) : null });
|
|
191
198
|
}
|
|
192
|
-
})
|
|
199
|
+
})
|
|
200
|
+
],
|
|
201
|
+
[t]
|
|
202
|
+
);
|
|
203
|
+
const { columns: extended, filters } = useExtendableTable({
|
|
204
|
+
model: "user",
|
|
205
|
+
columns: base
|
|
206
|
+
});
|
|
207
|
+
const columns = useMemo2(
|
|
208
|
+
() => [
|
|
209
|
+
...extended,
|
|
193
210
|
columnHelper.display({
|
|
194
211
|
id: "actions",
|
|
195
212
|
cell: ({ row }) => {
|
|
@@ -197,8 +214,9 @@ var useColumns = () => {
|
|
|
197
214
|
}
|
|
198
215
|
})
|
|
199
216
|
],
|
|
200
|
-
[
|
|
217
|
+
[extended]
|
|
201
218
|
);
|
|
219
|
+
return { columns, filters };
|
|
202
220
|
};
|
|
203
221
|
var UserActions = ({ user }) => {
|
|
204
222
|
const { t } = useTranslation3();
|
|
@@ -139,6 +139,7 @@ var useColumns = () => {
|
|
|
139
139
|
import { Children } from "react";
|
|
140
140
|
import { Button, Heading } from "@medusajs/ui";
|
|
141
141
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
142
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
142
143
|
import { Link } from "react-router-dom";
|
|
143
144
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
144
145
|
var ProductTagListTitle = () => {
|
|
@@ -149,7 +150,7 @@ var ProductTagListActions = ({
|
|
|
149
150
|
children
|
|
150
151
|
}) => {
|
|
151
152
|
const { t } = useTranslation2();
|
|
152
|
-
return /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx2(
|
|
153
|
+
return /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx2(PermissionGuard, { resource: "product_tag", operation: "create", children: /* @__PURE__ */ jsx2(
|
|
153
154
|
Button,
|
|
154
155
|
{
|
|
155
156
|
variant: "secondary",
|
|
@@ -158,7 +159,7 @@ var ProductTagListActions = ({
|
|
|
158
159
|
"data-testid": "product-tag-list-table-create-button",
|
|
159
160
|
children: /* @__PURE__ */ jsx2(Link, { to: "create", children: t("actions.create") })
|
|
160
161
|
}
|
|
161
|
-
) });
|
|
162
|
+
) }) });
|
|
162
163
|
};
|
|
163
164
|
var ProductTagListHeader = ({
|
|
164
165
|
children
|
|
@@ -34,6 +34,7 @@ import { Container } from "@medusajs/ui";
|
|
|
34
34
|
import { Children } from "react";
|
|
35
35
|
import { Button, Heading, Text } from "@medusajs/ui";
|
|
36
36
|
import { useTranslation } from "react-i18next";
|
|
37
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
37
38
|
import { Link } from "react-router-dom";
|
|
38
39
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
39
40
|
var CollectionListTitle = () => {
|
|
@@ -47,7 +48,7 @@ var CollectionListActions = ({
|
|
|
47
48
|
children
|
|
48
49
|
}) => {
|
|
49
50
|
const { t } = useTranslation();
|
|
50
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(Link, { to: "/collections/create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.create") }) }) });
|
|
51
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(PermissionGuard, { resource: "product_collection", operation: "create", children: /* @__PURE__ */ jsx(Link, { to: "/collections/create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.create") }) }) }) });
|
|
51
52
|
};
|
|
52
53
|
var CollectionListHeader = ({
|
|
53
54
|
children
|
|
@@ -48,6 +48,7 @@ import { useExtendableTable } from "@mercurjs/dashboard-shared";
|
|
|
48
48
|
import { useMemo, useState, Children } from "react";
|
|
49
49
|
import { useTranslation } from "react-i18next";
|
|
50
50
|
import { Link, Outlet, useLoaderData, useNavigate } from "react-router-dom";
|
|
51
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
51
52
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
52
53
|
var PAGE_SIZE = 20;
|
|
53
54
|
var ProductListTitle = () => {
|
|
@@ -56,7 +57,7 @@ var ProductListTitle = () => {
|
|
|
56
57
|
};
|
|
57
58
|
var ProductListCreateButton = () => {
|
|
58
59
|
const { t } = useTranslation();
|
|
59
|
-
return /* @__PURE__ */ jsx(
|
|
60
|
+
return /* @__PURE__ */ jsx(PermissionGuard, { resource: "product", operation: "create", children: /* @__PURE__ */ jsx(
|
|
60
61
|
Button,
|
|
61
62
|
{
|
|
62
63
|
size: "small",
|
|
@@ -65,7 +66,7 @@ var ProductListCreateButton = () => {
|
|
|
65
66
|
"data-testid": "products-create-button",
|
|
66
67
|
children: /* @__PURE__ */ jsx(Link, { to: "create", "data-testid": "products-create-link", children: t("actions.create") })
|
|
67
68
|
}
|
|
68
|
-
);
|
|
69
|
+
) });
|
|
69
70
|
};
|
|
70
71
|
var ProductListActions = ({ children }) => {
|
|
71
72
|
return /* @__PURE__ */ jsx(
|
|
@@ -220,6 +220,7 @@ var useColumns = () => {
|
|
|
220
220
|
import { Children } from "react";
|
|
221
221
|
import { Button, Heading, Text } from "@medusajs/ui";
|
|
222
222
|
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
223
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
223
224
|
import { Link } from "react-router-dom";
|
|
224
225
|
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
225
226
|
var ShippingOptionTypeListTitle = () => {
|
|
@@ -241,7 +242,7 @@ var ShippingOptionTypeListActions = ({
|
|
|
241
242
|
children
|
|
242
243
|
}) => {
|
|
243
244
|
const { t } = useTranslation4();
|
|
244
|
-
return /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx4(
|
|
245
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx4(PermissionGuard, { resource: "shipping_option_type", operation: "create", children: /* @__PURE__ */ jsx4(
|
|
245
246
|
Button,
|
|
246
247
|
{
|
|
247
248
|
size: "small",
|
|
@@ -250,7 +251,7 @@ var ShippingOptionTypeListActions = ({
|
|
|
250
251
|
"data-testid": "shipping-option-type-list-table-create-button",
|
|
251
252
|
children: /* @__PURE__ */ jsx4(Link, { to: "create", children: t("actions.create") })
|
|
252
253
|
}
|
|
253
|
-
) });
|
|
254
|
+
) }) });
|
|
254
255
|
};
|
|
255
256
|
var ShippingOptionTypeListHeader = ({
|
|
256
257
|
children
|
|
@@ -34,6 +34,7 @@ import { useExtendableTable, useLinkQuery } from "@mercurjs/dashboard-shared";
|
|
|
34
34
|
import { useMemo, Children } from "react";
|
|
35
35
|
import { useTranslation } from "react-i18next";
|
|
36
36
|
import { Link } from "react-router-dom";
|
|
37
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
37
38
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
38
39
|
var PAGE_SIZE = 20;
|
|
39
40
|
var CustomerListTitle = () => {
|
|
@@ -42,7 +43,7 @@ var CustomerListTitle = () => {
|
|
|
42
43
|
};
|
|
43
44
|
var CustomerListCreateButton = () => {
|
|
44
45
|
const { t } = useTranslation();
|
|
45
|
-
return /* @__PURE__ */ jsx(Link, { to: "/customers/create", "data-testid": "customer-list-create-link", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", "data-testid": "customer-list-create-button", children: t("actions.create") }) });
|
|
46
|
+
return /* @__PURE__ */ jsx(PermissionGuard, { resource: "customer", operation: "create", children: /* @__PURE__ */ jsx(Link, { to: "/customers/create", "data-testid": "customer-list-create-link", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", "data-testid": "customer-list-create-button", children: t("actions.create") }) }) });
|
|
46
47
|
};
|
|
47
48
|
var CustomerListActions = ({ children }) => {
|
|
48
49
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(CustomerListCreateButton, {}) });
|
|
@@ -241,6 +241,9 @@ var useReservationTableFilters = () => {
|
|
|
241
241
|
return filters;
|
|
242
242
|
};
|
|
243
243
|
|
|
244
|
+
// src/pages/reservations/reservation-list/components/reservation-list-table/reservation-list-table.tsx
|
|
245
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
246
|
+
|
|
244
247
|
// src/pages/reservations/reservation-list/components/reservation-list-table/use-reservation-table-query.tsx
|
|
245
248
|
var useReservationTableQuery = ({
|
|
246
249
|
pageSize = 20,
|
|
@@ -288,7 +291,7 @@ var ReservationListTitle = () => {
|
|
|
288
291
|
};
|
|
289
292
|
var ReservationListCreateButton = () => {
|
|
290
293
|
const { t } = useTranslation4();
|
|
291
|
-
return /* @__PURE__ */ jsx3(Button, { variant: "secondary", size: "small", asChild: true, children: /* @__PURE__ */ jsx3(Link, { to: "create", children: t("actions.create") }) });
|
|
294
|
+
return /* @__PURE__ */ jsx3(PermissionGuard, { resource: "reservation_item", operation: "create", children: /* @__PURE__ */ jsx3(Button, { variant: "secondary", size: "small", asChild: true, children: /* @__PURE__ */ jsx3(Link, { to: "create", children: t("actions.create") }) }) });
|
|
292
295
|
};
|
|
293
296
|
var ReservationListActions = ({ children }) => {
|
|
294
297
|
return /* @__PURE__ */ jsx3("div", { className: "flex items-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx3(ReservationListCreateButton, {}) });
|