1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00
metamask-extension/ui/pages/permissions-connect/flask/util.js

22 lines
630 B
JavaScript

import { getPermissionDescription } from '../../../helpers/utils/permission';
export function getSnapInstallWarnings(permissions, targetSubjectMetadata, t) {
const weightOneWarnings = Object.entries(permissions).reduce(
(filteredWarnings, [permissionName, permissionValue]) => {
const permissionDescription = getPermissionDescription({
t,
permissionName,
permissionValue,
targetSubjectMetadata,
});
return filteredWarnings.concat(
permissionDescription.filter((description) => description.weight === 1),
);
},
[],
);
return weightOneWarnings;
}