@mercurjs/vendor 2.3.2-canary.1 → 2.3.2-canary.3
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/{[id]-4VX7CTRZ.js → [id]-3RA6ZIRC.js} +2 -1
- package/dist/{[id]-HDVONF6C.js → [id]-4XDMVCJV.js} +5 -1
- package/dist/{[id]-QGZ26C6D.js → [id]-EJMM3KYO.js} +2 -1
- package/dist/{[id]-RAJUZUNH.js → [id]-FFMEP35K.js} +1 -1
- package/dist/{[id]-J7JU4NHO.js → [id]-FJGQEQUJ.js} +7 -2
- package/dist/{[id]-6FEVCKQU.js → [id]-GTZJPQTI.js} +7 -1
- package/dist/{[id]-VECAKEQ3.js → [id]-IA4BUZQV.js} +3 -1
- package/dist/{[id]-HAJ3735Z.js → [id]-MXOPY6G5.js} +9 -4
- package/dist/{[id]-Y4HRAAV2.js → [id]-R67KMXFA.js} +7 -3
- package/dist/{[id]-5FP6JZM3.js → [id]-SIY5USJF.js} +4 -4
- package/dist/{[id]-JXASIBQM.js → [id]-VJQTBSXS.js} +3 -1
- package/dist/{[id]-C7IFTDTJ.js → [id]-VQ4CWKQS.js} +2 -1
- package/dist/{[id]-S4XLEA36.js → [id]-ZJWTSRKB.js} +2 -1
- package/dist/{[location_id]-OXNC5E4F.js → [location_id]-LVDP4IEU.js} +7 -1
- package/dist/{[province_id]-VWN4OOGM.js → [province_id]-HO33KA4A.js} +3 -3
- package/dist/{add-LH5PQF7R.js → add-2ODITOAL.js} +2 -2
- package/dist/{add-Y66CX5EI.js → add-7S4M2PHD.js} +2 -2
- package/dist/{add-promotions-DOJS6CEE.js → add-promotions-QTNNFJBY.js} +3 -3
- package/dist/{campaigns-LIPKZKI7.js → campaigns-F5XONWHD.js} +2 -2
- package/dist/{chunk-XWDESNAO.js → chunk-2EKWWAVT.js} +1 -1
- package/dist/{chunk-X4G64W5Q.js → chunk-3SB6USNR.js} +6 -3
- package/dist/{chunk-K2DXXPNA.js → chunk-BPLFO6FP.js} +5 -2
- package/dist/{chunk-43AYUDTL.js → chunk-BY6UE2E6.js} +5 -2
- package/dist/{chunk-BDGZ4EQO.js → chunk-CWCR5ZLS.js} +26 -5
- package/dist/{chunk-RBWIHKUF.js → chunk-CXAOQF6T.js} +1 -1
- package/dist/{chunk-IV57G2CB.js → chunk-DIIC7A2J.js} +1 -1
- package/dist/{chunk-FPBXQIFJ.js → chunk-DJVF754Q.js} +3 -1
- package/dist/{chunk-4L7NRBQ7.js → chunk-FDOJFORY.js} +1 -1
- package/dist/{chunk-2UJ7T3TA.js → chunk-GGTWSLOP.js} +4 -3
- package/dist/{chunk-T37GBZ4L.js → chunk-GW7F5VY6.js} +1 -1
- package/dist/{chunk-SCJBJQCL.js → chunk-K3QSFT3Y.js} +6 -2
- package/dist/{chunk-XHWBTV72.js → chunk-KZT5KNCW.js} +1 -1
- package/dist/{chunk-C5HAUJN3.js → chunk-MGU666OW.js} +1 -1
- package/dist/{chunk-EWJTXSKI.js → chunk-O6URKGV5.js} +95 -0
- package/dist/{chunk-TII3PB6X.js → chunk-OKJAQM7X.js} +3 -1
- package/dist/{chunk-X44P463Q.js → chunk-PXCTLUC4.js} +5 -2
- package/dist/{chunk-IMIPUUZG.js → chunk-QWMMXTJS.js} +5 -2
- package/dist/{chunk-PEXMLTJX.js → chunk-R53PVMSJ.js} +2 -1
- package/dist/{chunk-GYLRZXWS.js → chunk-U24WZUI6.js} +4 -2
- package/dist/{chunk-3JWHERV7.js → chunk-W6JA4VGA.js} +5 -2
- package/dist/{chunk-ZSDHFX2Q.js → chunk-XAJCJEE7.js} +4 -2
- package/dist/{chunk-AQT2G6K2.js → chunk-YERPSW4L.js} +1 -1
- package/dist/{create-A6KZEZMH.js → create-DPBYLG6E.js} +1 -1
- package/dist/{create-NCVZ2JM7.js → create-HBAU3ASL.js} +2 -2
- package/dist/{create-RVZ5RLHX.js → create-NJXDBVXF.js} +5 -5
- package/dist/{create-ZVGYET6W.js → create-PVDPEIQA.js} +1 -1
- package/dist/{create-BTODQ4T4.js → create-SK7Z6MMJ.js} +1 -1
- package/dist/{customer-group-detail-QCPC2YWK.js → customer-group-detail-ORI5NZ2R.js} +2 -2
- package/dist/{customer-groups-6WGUNFHG.js → customer-groups-RN24OFMH.js} +6 -3
- package/dist/{edit-F34KMSTW.js → edit-MZKTHXEK.js} +2 -2
- package/dist/{edit-DRT6VOAA.js → edit-OFYBI6WM.js} +1 -1
- package/dist/index.css +3 -0
- package/dist/index.js +1162 -1033
- package/dist/{inventory-CMIRAJJY.js → inventory-BEJYYVQP.js} +2 -2
- package/dist/{locations-BN2BTULF.js → locations-V4K3ZW3T.js} +2 -2
- package/dist/{media-WVRRRAFL.js → media-46GUVY75.js} +3 -3
- package/dist/{offer-detail-page-AJG6TMJC.js → offer-detail-page-2MRU2HNQ.js} +5 -2
- package/dist/{offer-variant-detail-page-CEOS2MVM.js → offer-variant-detail-page-SOONG4U7.js} +4 -1
- package/dist/{offers-63CGN6AI.js → offers-4VCSQL3K.js} +3 -3
- package/dist/pages/index.js +17 -17
- package/dist/{price-lists-U5ASDHMI.js → price-lists-U4IR3425.js} +2 -2
- package/dist/{product-types-CMI33S32.js → product-types-SS7BPBQH.js} +2 -2
- package/dist/{product-variant-detail-D73ILATK.js → product-variant-detail-XIFGH55M.js} +4 -1
- package/dist/{products-ZZUYHZXZ.js → products-7KCMWKIU.js} +6 -6
- package/dist/{profile-EU46MXFW.js → profile-2M4KL5JF.js} +1 -1
- package/dist/{promotions-ALWQ7J7A.js → promotions-V5T5EY7U.js} +5 -5
- package/dist/{register-RCIO7QRB.js → register-T2YUB5NP.js} +1 -1
- package/dist/{reservations-C326XEVA.js → reservations-C7ZC7XPK.js} +5 -2
- package/dist/{reset-password-ASLKY3GK.js → reset-password-U335V424.js} +1 -1
- package/dist/{return-reasons-OJG5J6H2.js → return-reasons-EQULPT57.js} +5 -2
- package/dist/{sales-channels-LWEVGTY6.js → sales-channels-6MGHGQFY.js} +2 -2
- package/dist/{sales-channels-RJLPZDOZ.js → sales-channels-ZXJKYWQW.js} +2 -2
- package/dist/{settings-KDM7NZLY.js → settings-HUMLDZ2O.js} +4 -4
- package/dist/{shipping-profiles-647FLCNK.js → shipping-profiles-BHEAMDEX.js} +2 -2
- package/dist/{store-V3TTFWYV.js → store-6UZNHYJZ.js} +6 -2
- package/dist/{tax-regions-MKEWVKZ7.js → tax-regions-X3QJ7SHM.js} +3 -3
- package/dist/{team-WKBFUAGW.js → team-ZPOPUKOW.js} +1 -1
- package/package.json +9 -8
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-THHRRYRS.js";
|
|
14
14
|
import {
|
|
15
15
|
ActionMenu
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
17
17
|
import {
|
|
18
18
|
useStockLocations
|
|
19
19
|
} from "./chunk-O72AIZUN.js";
|
|
@@ -34,6 +34,7 @@ import { Outlet } from "react-router-dom";
|
|
|
34
34
|
// src/pages/inventory/_components/inventory-list-header.tsx
|
|
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 { jsx, jsxs } from "react/jsx-runtime";
|
|
39
40
|
var InventoryListHeader = () => {
|
|
@@ -48,7 +49,7 @@ var InventoryListHeader = () => {
|
|
|
48
49
|
};
|
|
49
50
|
var InventoryListCreateButton = () => {
|
|
50
51
|
const { t } = useTranslation();
|
|
51
|
-
return /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) });
|
|
52
|
+
return /* @__PURE__ */ jsx(PermissionGuard, { resource: "inventory_item", operation: "create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) }) });
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
// src/pages/inventory/_components/inventory-list-data-table.tsx
|
|
@@ -99,6 +100,7 @@ var InventoryActions = ({ item }) => {
|
|
|
99
100
|
actions: [
|
|
100
101
|
{
|
|
101
102
|
icon: /* @__PURE__ */ jsx2(PencilSquare, {}),
|
|
103
|
+
permission: "inventory_item:update",
|
|
102
104
|
label: t("actions.edit"),
|
|
103
105
|
to: `${item.id}/edit`
|
|
104
106
|
}
|
|
@@ -108,6 +110,7 @@ var InventoryActions = ({ item }) => {
|
|
|
108
110
|
actions: [
|
|
109
111
|
{
|
|
110
112
|
icon: /* @__PURE__ */ jsx2(Trash, {}),
|
|
113
|
+
permission: "inventory_item:delete",
|
|
111
114
|
label: t("actions.delete"),
|
|
112
115
|
onClick: handleDelete
|
|
113
116
|
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-6GQLSWOO.js";
|
|
18
18
|
import {
|
|
19
19
|
ActionMenu
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
21
21
|
import {
|
|
22
22
|
useDeleteProduct,
|
|
23
23
|
useProducts
|
|
@@ -39,6 +39,7 @@ import { Outlet } from "react-router-dom";
|
|
|
39
39
|
import { Children } from "react";
|
|
40
40
|
import { useTranslation } from "react-i18next";
|
|
41
41
|
import { Link } from "react-router-dom";
|
|
42
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
42
43
|
import { Button, Heading } from "@medusajs/ui";
|
|
43
44
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
44
45
|
var ProductListTitle = () => {
|
|
@@ -47,7 +48,7 @@ var ProductListTitle = () => {
|
|
|
47
48
|
};
|
|
48
49
|
var ProductListCreateButton = () => {
|
|
49
50
|
const { t } = useTranslation();
|
|
50
|
-
return /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) });
|
|
51
|
+
return /* @__PURE__ */ jsx(PermissionGuard, { resource: "product", operation: "create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) }) });
|
|
51
52
|
};
|
|
52
53
|
var ProductListActions = ({ children }) => {
|
|
53
54
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-x-2", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ProductListCreateButton, {}) }) });
|
|
@@ -177,6 +178,7 @@ var ProductActions = ({ product }) => {
|
|
|
177
178
|
actions: [
|
|
178
179
|
{
|
|
179
180
|
icon: /* @__PURE__ */ jsx2(PencilSquare, {}),
|
|
181
|
+
permission: "product:update",
|
|
180
182
|
label: t("actions.edit"),
|
|
181
183
|
to: `/products/${product.id}/edit`
|
|
182
184
|
}
|
|
@@ -186,6 +188,7 @@ var ProductActions = ({ product }) => {
|
|
|
186
188
|
actions: [
|
|
187
189
|
{
|
|
188
190
|
icon: /* @__PURE__ */ jsx2(Trash, {}),
|
|
191
|
+
permission: "product:delete",
|
|
189
192
|
label: t("actions.delete"),
|
|
190
193
|
onClick: handleDelete
|
|
191
194
|
}
|
|
@@ -8,6 +8,22 @@ import {
|
|
|
8
8
|
// src/components/common/action-menu/action-menu.tsx
|
|
9
9
|
import { DropdownMenu, IconButton, clx } from "@medusajs/ui";
|
|
10
10
|
import { EllipsisHorizontal } from "@medusajs/icons";
|
|
11
|
+
import { PermissionsContext } from "@mercurjs/dashboard-shared";
|
|
12
|
+
|
|
13
|
+
// src/components/common/action-menu/filter-action-groups.ts
|
|
14
|
+
var filterActionGroups = (groups, permissions) => {
|
|
15
|
+
const allowed = (action) => {
|
|
16
|
+
if (!action.permission || !permissions) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
const required = Array.isArray(action.permission) ? action.permission : [action.permission];
|
|
20
|
+
return action.requireAll ? permissions.hasAllPermissions(required) : permissions.hasAnyPermission(required);
|
|
21
|
+
};
|
|
22
|
+
return groups.map((group) => ({ ...group, actions: group.actions.filter(allowed) })).filter((group) => group.actions.length);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/components/common/action-menu/action-menu.tsx
|
|
26
|
+
import { useContext, useMemo } from "react";
|
|
11
27
|
import { Link } from "react-router-dom";
|
|
12
28
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
29
|
var ActionMenu = ({
|
|
@@ -16,14 +32,19 @@ var ActionMenu = ({
|
|
|
16
32
|
children
|
|
17
33
|
}) => {
|
|
18
34
|
const direction = useDocumentDirection();
|
|
35
|
+
const permissions = useContext(PermissionsContext);
|
|
36
|
+
const visibleGroups = useMemo(
|
|
37
|
+
() => filterActionGroups(groups, permissions),
|
|
38
|
+
[groups, permissions]
|
|
39
|
+
);
|
|
19
40
|
const inner = children ?? /* @__PURE__ */ jsx(IconButton, { size: "small", variant, children: /* @__PURE__ */ jsx(EllipsisHorizontal, {}) });
|
|
41
|
+
if (!visibleGroups.length) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
20
44
|
return /* @__PURE__ */ jsxs(DropdownMenu, { dir: direction, children: [
|
|
21
45
|
/* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: inner }),
|
|
22
|
-
/* @__PURE__ */ jsx(DropdownMenu.Content, { children:
|
|
23
|
-
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const isLast = index === groups.length - 1;
|
|
46
|
+
/* @__PURE__ */ jsx(DropdownMenu.Content, { children: visibleGroups.map((group, index) => {
|
|
47
|
+
const isLast = index === visibleGroups.length - 1;
|
|
27
48
|
return /* @__PURE__ */ jsxs(DropdownMenu.Group, { children: [
|
|
28
49
|
group.actions.map((action, index2) => {
|
|
29
50
|
const Wrapper = action.disabledTooltip ? ({ children: children2 }) => /* @__PURE__ */ jsx(
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-INNFZYX2.js";
|
|
23
23
|
import {
|
|
24
24
|
ActionMenu
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
26
26
|
import {
|
|
27
27
|
useCustomerGroup,
|
|
28
28
|
useCustomers,
|
|
@@ -359,6 +359,7 @@ var CustomerGroupGeneralSection = ({
|
|
|
359
359
|
actions: [
|
|
360
360
|
{
|
|
361
361
|
icon: /* @__PURE__ */ jsx2(PencilSquare, {}),
|
|
362
|
+
permission: "customer_group:update",
|
|
362
363
|
label: t("actions.edit"),
|
|
363
364
|
to: `/customer-groups/${group.id}/edit`
|
|
364
365
|
}
|
|
@@ -368,6 +369,7 @@ var CustomerGroupGeneralSection = ({
|
|
|
368
369
|
actions: [
|
|
369
370
|
{
|
|
370
371
|
icon: /* @__PURE__ */ jsx2(Trash, {}),
|
|
372
|
+
permission: "customer_group:delete",
|
|
371
373
|
label: t("actions.delete"),
|
|
372
374
|
onClick: handleDelete
|
|
373
375
|
}
|
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
} from "./chunk-OVPAOBZB.js";
|
|
20
20
|
import {
|
|
21
21
|
UploadMediaFormItem
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MGU666OW.js";
|
|
23
23
|
import {
|
|
24
24
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
25
25
|
ProductCreateSchema,
|
|
26
26
|
generateVariantsFromAttributes,
|
|
27
27
|
normalizeProductFormValues
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-GW7F5VY6.js";
|
|
29
29
|
import {
|
|
30
30
|
ChipInput
|
|
31
31
|
} from "./chunk-KDE4HKH2.js";
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
} from "./chunk-JEHVUKYB.js";
|
|
59
59
|
import {
|
|
60
60
|
ActionMenu
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
62
62
|
import {
|
|
63
63
|
useFeatureFlags
|
|
64
64
|
} from "./chunk-6YQR2AWM.js";
|
|
@@ -1220,6 +1220,7 @@ var MediaItem = ({ field, onDelete, onMakeThumbnail }) => {
|
|
|
1220
1220
|
actions: [
|
|
1221
1221
|
{
|
|
1222
1222
|
icon: /* @__PURE__ */ jsx4(Trash, {}),
|
|
1223
|
+
permission: "product:delete",
|
|
1223
1224
|
label: t("actions.delete"),
|
|
1224
1225
|
onClick: onDelete
|
|
1225
1226
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocalizedTablePagination,
|
|
3
3
|
useDeleteTaxRateAction
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R53PVMSJ.js";
|
|
5
5
|
import {
|
|
6
6
|
TaxRateRuleReferenceType
|
|
7
7
|
} from "./chunk-Q4UVXS46.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./chunk-INNFZYX2.js";
|
|
24
24
|
import {
|
|
25
25
|
ActionMenu
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
27
27
|
import {
|
|
28
28
|
useProductTypes
|
|
29
29
|
} from "./chunk-L2NJPDUD.js";
|
|
@@ -66,6 +66,7 @@ var TaxRateActions = ({ taxRate }) => {
|
|
|
66
66
|
{
|
|
67
67
|
actions: [
|
|
68
68
|
{
|
|
69
|
+
permission: "tax_region:update",
|
|
69
70
|
label: t("actions.edit"),
|
|
70
71
|
icon: /* @__PURE__ */ jsx(PencilSquare, {}),
|
|
71
72
|
to: `tax-rates/${taxRate.id}/edit`
|
|
@@ -75,6 +76,7 @@ var TaxRateActions = ({ taxRate }) => {
|
|
|
75
76
|
{
|
|
76
77
|
actions: [
|
|
77
78
|
{
|
|
79
|
+
permission: "tax_region:delete",
|
|
78
80
|
label: t("actions.delete"),
|
|
79
81
|
icon: /* @__PURE__ */ jsx(Trash, {}),
|
|
80
82
|
onClick: handleDelete
|
|
@@ -155,6 +157,7 @@ var TaxOverrideCard = ({ taxRate }) => {
|
|
|
155
157
|
{
|
|
156
158
|
actions: [
|
|
157
159
|
{
|
|
160
|
+
permission: "tax_region:update",
|
|
158
161
|
label: t("actions.edit"),
|
|
159
162
|
icon: /* @__PURE__ */ jsx2(PencilSquare2, {}),
|
|
160
163
|
to: `overrides/${taxRate.id}/edit`
|
|
@@ -164,6 +167,7 @@ var TaxOverrideCard = ({ taxRate }) => {
|
|
|
164
167
|
{
|
|
165
168
|
actions: [
|
|
166
169
|
{
|
|
170
|
+
permission: "tax_region:delete",
|
|
167
171
|
label: t("actions.delete"),
|
|
168
172
|
icon: /* @__PURE__ */ jsx2(Trash2, {}),
|
|
169
173
|
onClick: handleDelete
|
|
@@ -16829,6 +16829,101 @@ var en_default = {
|
|
|
16829
16829
|
toggle: "Toggle",
|
|
16830
16830
|
text_area: "Text Area"
|
|
16831
16831
|
}
|
|
16832
|
+
},
|
|
16833
|
+
permissions: {
|
|
16834
|
+
accessDenied: {
|
|
16835
|
+
title: "Access Denied",
|
|
16836
|
+
description: "You don't have permission to access this page.",
|
|
16837
|
+
requiredPermission: "Required permission: {{permission}}",
|
|
16838
|
+
action: "You don't have permission to perform this action."
|
|
16839
|
+
},
|
|
16840
|
+
requiredPermissions: {
|
|
16841
|
+
title: "Required permissions",
|
|
16842
|
+
none: "No permissions declared in this view.",
|
|
16843
|
+
anyOf: "Any of",
|
|
16844
|
+
allOf: "All of",
|
|
16845
|
+
source: "Source: {{source}}"
|
|
16846
|
+
},
|
|
16847
|
+
resources: {
|
|
16848
|
+
api_key: "API Key",
|
|
16849
|
+
campaign: "Campaign",
|
|
16850
|
+
commission_line: "Commission Line",
|
|
16851
|
+
commission_rate: "Commission Rate",
|
|
16852
|
+
commission_rule: "Commission Rule",
|
|
16853
|
+
currency: "Currency",
|
|
16854
|
+
customer: "Customer",
|
|
16855
|
+
customer_address: "Customer Address",
|
|
16856
|
+
customer_group: "Customer Group",
|
|
16857
|
+
file: "File",
|
|
16858
|
+
fulfillment: "Fulfillment",
|
|
16859
|
+
fulfillment_provider: "Fulfillment Provider",
|
|
16860
|
+
fulfillment_set: "Fulfillment Set",
|
|
16861
|
+
inventory_item: "Inventory Item",
|
|
16862
|
+
inventory_level: "Inventory Level",
|
|
16863
|
+
invite: "Invite",
|
|
16864
|
+
member_invite: "Member Invite",
|
|
16865
|
+
notification: "Notification",
|
|
16866
|
+
offer: "Offer",
|
|
16867
|
+
order: "Order",
|
|
16868
|
+
order_change: "Order Change",
|
|
16869
|
+
order_claim: "Order Claim",
|
|
16870
|
+
order_claim_item: "Order Claim Item",
|
|
16871
|
+
order_exchange: "Order Exchange",
|
|
16872
|
+
order_group: "Order Group",
|
|
16873
|
+
order_item: "Order Item",
|
|
16874
|
+
payment: "Payment",
|
|
16875
|
+
payment_collection: "Payment Collection",
|
|
16876
|
+
payment_method: "Payment Method",
|
|
16877
|
+
payment_session: "Payment Session",
|
|
16878
|
+
payout: "Payout",
|
|
16879
|
+
payout_account: "Payout Account",
|
|
16880
|
+
price: "Price",
|
|
16881
|
+
price_list: "Price List",
|
|
16882
|
+
price_preference: "Price Preference",
|
|
16883
|
+
product: "Product",
|
|
16884
|
+
product_attribute: "Product Attribute",
|
|
16885
|
+
product_attribute_value: "Product Attribute Value",
|
|
16886
|
+
product_category: "Product Category",
|
|
16887
|
+
product_change: "Product Change",
|
|
16888
|
+
product_collection: "Product Collection",
|
|
16889
|
+
product_option: "Product Option",
|
|
16890
|
+
product_option_value: "Product Option Value",
|
|
16891
|
+
product_tag: "Product Tag",
|
|
16892
|
+
product_type: "Product Type",
|
|
16893
|
+
product_variant: "Product Variant",
|
|
16894
|
+
promotion: "Promotion",
|
|
16895
|
+
rbac_policy: "Policy",
|
|
16896
|
+
rbac_role: "Role",
|
|
16897
|
+
refund_reason: "Refund Reason",
|
|
16898
|
+
region: "Region",
|
|
16899
|
+
reservation_item: "Reservation Item",
|
|
16900
|
+
return: "Return",
|
|
16901
|
+
return_reason: "Return Reason",
|
|
16902
|
+
review: "Review",
|
|
16903
|
+
sales_channel: "Sales Channel",
|
|
16904
|
+
seller: "Seller",
|
|
16905
|
+
seller_member: "Seller Member",
|
|
16906
|
+
service_zone: "Service Zone",
|
|
16907
|
+
shipping_option: "Shipping Option",
|
|
16908
|
+
shipping_option_type: "Shipping Option Type",
|
|
16909
|
+
shipping_profile: "Shipping Profile",
|
|
16910
|
+
stock_location: "Stock Location",
|
|
16911
|
+
store: "Store",
|
|
16912
|
+
store_locale: "Store Locale",
|
|
16913
|
+
tax_provider: "Tax Provider",
|
|
16914
|
+
tax_rate: "Tax Rate",
|
|
16915
|
+
tax_region: "Tax Region",
|
|
16916
|
+
translation: "Translation",
|
|
16917
|
+
translation_setting: "Translation Setting",
|
|
16918
|
+
user: "User",
|
|
16919
|
+
workflow_execution: "Workflow Execution"
|
|
16920
|
+
},
|
|
16921
|
+
actions: {
|
|
16922
|
+
read: "Read",
|
|
16923
|
+
create: "Create",
|
|
16924
|
+
update: "Update",
|
|
16925
|
+
delete: "Delete"
|
|
16926
|
+
}
|
|
16832
16927
|
}
|
|
16833
16928
|
};
|
|
16834
16929
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-4TLP3TAA.js";
|
|
4
4
|
import {
|
|
5
5
|
ActionMenu
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
7
7
|
import {
|
|
8
8
|
useDeleteProduct,
|
|
9
9
|
useUpdateProduct
|
|
@@ -283,6 +283,7 @@ var ProductGeneralSection = ({
|
|
|
283
283
|
{
|
|
284
284
|
actions: [
|
|
285
285
|
{
|
|
286
|
+
permission: "product:update",
|
|
286
287
|
label: t("actions.edit"),
|
|
287
288
|
to: "edit",
|
|
288
289
|
icon: /* @__PURE__ */ jsx2(PencilSquare2, {})
|
|
@@ -292,6 +293,7 @@ var ProductGeneralSection = ({
|
|
|
292
293
|
{
|
|
293
294
|
actions: [
|
|
294
295
|
{
|
|
296
|
+
permission: "product:delete",
|
|
295
297
|
label: t("actions.delete"),
|
|
296
298
|
onClick: handleDelete,
|
|
297
299
|
icon: /* @__PURE__ */ jsx2(Trash, {})
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-6GQLSWOO.js";
|
|
14
14
|
import {
|
|
15
15
|
ActionMenu
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
17
17
|
import {
|
|
18
18
|
useCampaigns,
|
|
19
19
|
useDeleteCampaign
|
|
@@ -31,6 +31,7 @@ import { Container } from "@medusajs/ui";
|
|
|
31
31
|
import { Children } from "react";
|
|
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 { Button, Heading } from "@medusajs/ui";
|
|
35
36
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
36
37
|
var CampaignListTitle = () => {
|
|
@@ -39,7 +40,7 @@ var CampaignListTitle = () => {
|
|
|
39
40
|
};
|
|
40
41
|
var CampaignListCreateButton = () => {
|
|
41
42
|
const { t } = useTranslation();
|
|
42
|
-
return /* @__PURE__ */ jsx(Link, { to: "/campaigns/create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.create") }) });
|
|
43
|
+
return /* @__PURE__ */ jsx(PermissionGuard, { resource: "campaign", operation: "create", children: /* @__PURE__ */ jsx(Link, { to: "/campaigns/create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.create") }) }) });
|
|
43
44
|
};
|
|
44
45
|
var CampaignListActions = ({
|
|
45
46
|
children
|
|
@@ -185,6 +186,7 @@ var CampaignActions = ({ campaign }) => {
|
|
|
185
186
|
actions: [
|
|
186
187
|
{
|
|
187
188
|
icon: /* @__PURE__ */ jsx2(PencilSquare, {}),
|
|
189
|
+
permission: "campaign:update",
|
|
188
190
|
label: t("actions.edit"),
|
|
189
191
|
to: `/campaigns/${campaign.id}/edit`
|
|
190
192
|
}
|
|
@@ -194,6 +196,7 @@ var CampaignActions = ({ campaign }) => {
|
|
|
194
196
|
actions: [
|
|
195
197
|
{
|
|
196
198
|
icon: /* @__PURE__ */ jsx2(Trash, {}),
|
|
199
|
+
permission: "campaign:delete",
|
|
197
200
|
label: t("actions.delete"),
|
|
198
201
|
onClick: handleDelete
|
|
199
202
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-YV6MK4PZ.js";
|
|
13
13
|
import {
|
|
14
14
|
ActionMenu
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
16
16
|
import {
|
|
17
17
|
stockLocationsQueryKeys,
|
|
18
18
|
useDeleteStockLocation,
|
|
@@ -131,6 +131,7 @@ function LocationListItem(props) {
|
|
|
131
131
|
{
|
|
132
132
|
actions: [
|
|
133
133
|
{
|
|
134
|
+
permission: "stock_location:update",
|
|
134
135
|
label: t("actions.edit"),
|
|
135
136
|
icon: /* @__PURE__ */ jsx(PencilSquare, {}),
|
|
136
137
|
to: `/settings/locations/${location.id}/edit`
|
|
@@ -140,6 +141,7 @@ function LocationListItem(props) {
|
|
|
140
141
|
{
|
|
141
142
|
actions: [
|
|
142
143
|
{
|
|
144
|
+
permission: "stock_location:delete",
|
|
143
145
|
label: t("actions.delete"),
|
|
144
146
|
icon: /* @__PURE__ */ jsx(Trash, {}),
|
|
145
147
|
onClick: handleDelete
|
|
@@ -178,6 +180,7 @@ var location_list_item_default = LocationListItem;
|
|
|
178
180
|
// src/pages/settings/locations/_components/location-list-header.tsx
|
|
179
181
|
import { Button, Container as Container2, Heading, Text as Text2 } from "@medusajs/ui";
|
|
180
182
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
183
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
181
184
|
import { Link } from "react-router-dom";
|
|
182
185
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
183
186
|
var LocationListHeader = () => {
|
|
@@ -187,7 +190,7 @@ var LocationListHeader = () => {
|
|
|
187
190
|
/* @__PURE__ */ jsx2(Heading, { children: t("stockLocations.domain") }),
|
|
188
191
|
/* @__PURE__ */ jsx2(Text2, { className: "text-ui-fg-subtle txt-small", children: t("stockLocations.list.description") })
|
|
189
192
|
] }),
|
|
190
|
-
/* @__PURE__ */ jsx2(Button, { size: "small", className: "shrink-0", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx2(Link, { to: "create", children: t("actions.create") }) })
|
|
193
|
+
/* @__PURE__ */ jsx2(PermissionGuard, { resource: "stock_location", operation: "create", children: /* @__PURE__ */ jsx2(Button, { size: "small", className: "shrink-0", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx2(Link, { to: "create", children: t("actions.create") }) }) })
|
|
191
194
|
] });
|
|
192
195
|
};
|
|
193
196
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-U2EI2ZLM.js";
|
|
11
11
|
import {
|
|
12
12
|
ActionMenu
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
14
14
|
import {
|
|
15
15
|
useDeleteTaxRate
|
|
16
16
|
} from "./chunk-FV76G2D7.js";
|
|
@@ -218,6 +218,7 @@ var TaxRegionCardActions = ({
|
|
|
218
218
|
actions: [
|
|
219
219
|
{
|
|
220
220
|
icon: /* @__PURE__ */ jsx(Trash, {}),
|
|
221
|
+
permission: "tax_region:delete",
|
|
221
222
|
label: t("actions.delete"),
|
|
222
223
|
onClick: handleDelete
|
|
223
224
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-THHRRYRS.js";
|
|
11
11
|
import {
|
|
12
12
|
ActionMenu
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
14
14
|
import {
|
|
15
15
|
useDeleteShippingProfile,
|
|
16
16
|
useShippingProfiles
|
|
@@ -28,6 +28,7 @@ import { Container } from "@medusajs/ui";
|
|
|
28
28
|
import { Children } from "react";
|
|
29
29
|
import { useTranslation } from "react-i18next";
|
|
30
30
|
import { Link } from "react-router-dom";
|
|
31
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
31
32
|
import { Button, Heading, Text } from "@medusajs/ui";
|
|
32
33
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
34
|
var ShippingProfileListTitle = () => {
|
|
@@ -39,7 +40,7 @@ var ShippingProfileListTitle = () => {
|
|
|
39
40
|
};
|
|
40
41
|
var ShippingProfileListCreateButton = () => {
|
|
41
42
|
const { t } = useTranslation();
|
|
42
|
-
return /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) });
|
|
43
|
+
return /* @__PURE__ */ jsx(PermissionGuard, { resource: "shipping_profile", operation: "create", children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) }) });
|
|
43
44
|
};
|
|
44
45
|
var ShippingProfileListActions = ({
|
|
45
46
|
children
|
|
@@ -110,6 +111,7 @@ var ShippingOptionsRowActions = ({
|
|
|
110
111
|
actions: [
|
|
111
112
|
{
|
|
112
113
|
icon: /* @__PURE__ */ jsx2(Trash, {}),
|
|
114
|
+
permission: "shipping_profile:delete",
|
|
113
115
|
label: t("actions.delete"),
|
|
114
116
|
onClick: handleDelete
|
|
115
117
|
}
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./chunk-THHRRYRS.js";
|
|
24
24
|
import {
|
|
25
25
|
ActionMenu
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
27
27
|
import {
|
|
28
28
|
usePriceLists
|
|
29
29
|
} from "./chunk-NV2RZAHW.js";
|
|
@@ -40,6 +40,7 @@ import { Container } from "@medusajs/ui";
|
|
|
40
40
|
import { Children } from "react";
|
|
41
41
|
import { useTranslation } from "react-i18next";
|
|
42
42
|
import { Link } from "react-router-dom";
|
|
43
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
43
44
|
import { Button, Heading } from "@medusajs/ui";
|
|
44
45
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
45
46
|
var PriceListListTitle = () => {
|
|
@@ -48,7 +49,7 @@ var PriceListListTitle = () => {
|
|
|
48
49
|
};
|
|
49
50
|
var PriceListListCreateButton = () => {
|
|
50
51
|
const { t } = useTranslation();
|
|
51
|
-
return /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: "create", children: t("actions.create") }) });
|
|
52
|
+
return /* @__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") }) }) });
|
|
52
53
|
};
|
|
53
54
|
var PriceListListActions = ({
|
|
54
55
|
children
|
|
@@ -90,6 +91,7 @@ var PriceListListTableActions = ({
|
|
|
90
91
|
{
|
|
91
92
|
actions: [
|
|
92
93
|
{
|
|
94
|
+
permission: "price_list:update",
|
|
93
95
|
label: t("actions.edit"),
|
|
94
96
|
to: `${priceList.id}/edit`,
|
|
95
97
|
icon: /* @__PURE__ */ jsx2(PencilSquare, {})
|
|
@@ -99,6 +101,7 @@ var PriceListListTableActions = ({
|
|
|
99
101
|
{
|
|
100
102
|
actions: [
|
|
101
103
|
{
|
|
104
|
+
permission: "price_list:delete",
|
|
102
105
|
label: t("actions.delete"),
|
|
103
106
|
onClick: handleDelete,
|
|
104
107
|
icon: /* @__PURE__ */ jsx2(Trash, {})
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./chunk-THHRRYRS.js";
|
|
27
27
|
import {
|
|
28
28
|
ActionMenu
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-CWCR5ZLS.js";
|
|
30
30
|
import {
|
|
31
31
|
useBulkDeleteOffers
|
|
32
32
|
} from "./chunk-AHR2FIMC.js";
|
|
@@ -106,6 +106,7 @@ var OfferActions = ({ product }) => {
|
|
|
106
106
|
actions: [
|
|
107
107
|
{
|
|
108
108
|
icon: /* @__PURE__ */ jsx(Trash, {}),
|
|
109
|
+
permission: "offer:delete",
|
|
109
110
|
label: t("actions.delete"),
|
|
110
111
|
onClick: handleDelete,
|
|
111
112
|
disabled: product.offerIds.length === 0
|
|
@@ -323,6 +324,7 @@ var useColumns = () => {
|
|
|
323
324
|
// src/pages/offers/_components/offer-list-header.tsx
|
|
324
325
|
import { Button, Heading } from "@medusajs/ui";
|
|
325
326
|
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
327
|
+
import { PermissionGuard } from "@mercurjs/dashboard-shared";
|
|
326
328
|
import { Link } from "react-router-dom";
|
|
327
329
|
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
328
330
|
var OfferListTitle = () => {
|
|
@@ -331,7 +333,7 @@ var OfferListTitle = () => {
|
|
|
331
333
|
};
|
|
332
334
|
var OfferListActions = () => {
|
|
333
335
|
const { t } = useTranslation4();
|
|
334
|
-
return /* @__PURE__ */ jsx4(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx4(Link, { to: "create", "data-testid": "offer-list-create-button", children: t("offers.actions.create") }) });
|
|
336
|
+
return /* @__PURE__ */ jsx4(PermissionGuard, { resource: "offer", operation: "create", children: /* @__PURE__ */ jsx4(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx4(Link, { to: "create", "data-testid": "offer-list-create-button", children: t("offers.actions.create") }) }) });
|
|
335
337
|
};
|
|
336
338
|
var OfferListHeader = () => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
337
339
|
/* @__PURE__ */ jsx4(OfferListTitle, {}),
|