2023-04-25 16:32:51 +02:00
|
|
|
import { mapToTemplate } from '../../../../../components/app/snaps/snap-ui-renderer';
|
2023-04-03 18:04:30 +02:00
|
|
|
import { DelineatorType } from '../../../../../helpers/constants/flask';
|
2022-12-01 16:46:06 +01:00
|
|
|
|
|
|
|
function getValues(pendingApproval, t, actions) {
|
2022-12-20 11:44:22 +01:00
|
|
|
const {
|
|
|
|
snapName,
|
2023-04-17 12:55:08 +02:00
|
|
|
requestData: { content },
|
2022-12-20 11:44:22 +01:00
|
|
|
} = pendingApproval;
|
2023-04-24 12:56:44 +02:00
|
|
|
const elementKeyIndex = { value: 0 };
|
2022-12-01 16:46:06 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
content: [
|
|
|
|
{
|
|
|
|
element: 'Box',
|
|
|
|
key: 'snap-dialog-content-wrapper',
|
|
|
|
props: {
|
|
|
|
marginLeft: 4,
|
|
|
|
marginRight: 4,
|
|
|
|
},
|
|
|
|
children: {
|
|
|
|
element: 'SnapDelineator',
|
|
|
|
key: 'snap-delineator',
|
|
|
|
props: {
|
2023-04-03 18:04:30 +02:00
|
|
|
type: DelineatorType.Content,
|
2022-12-01 16:46:06 +01:00
|
|
|
snapName,
|
|
|
|
},
|
2022-12-20 11:44:22 +01:00
|
|
|
// TODO: Replace with SnapUIRenderer when we don't need to inject the input manually.
|
2023-04-24 12:56:44 +02:00
|
|
|
children: mapToTemplate(content, elementKeyIndex),
|
2022-12-01 16:46:06 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
cancelText: t('reject'),
|
|
|
|
submitText: t('approveButtonText'),
|
|
|
|
onSubmit: () => actions.resolvePendingApproval(pendingApproval.id, true),
|
|
|
|
onCancel: () => actions.resolvePendingApproval(pendingApproval.id, false),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const snapConfirmation = {
|
|
|
|
getValues,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default snapConfirmation;
|