2023-04-25 16:32:51 +02:00
|
|
|
import { mapToTemplate } from '../../../../../components/app/snaps/snap-ui-renderer';
|
2023-05-03 10:53:58 +02:00
|
|
|
import { DelineatorType } from '../../../../../helpers/constants/snaps';
|
2022-12-01 16:46:06 +01:00
|
|
|
|
|
|
|
function getValues(pendingApproval, t, actions) {
|
2022-12-20 11:44:22 +01:00
|
|
|
const {
|
|
|
|
snapName,
|
|
|
|
requestData: { content },
|
|
|
|
} = 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: {
|
2023-06-07 15:18:49 +02:00
|
|
|
marginTop: 4,
|
2022-12-01 16:46:06 +01:00
|
|
|
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
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2023-06-07 15:18:49 +02:00
|
|
|
submitText: t('ok').toUpperCase(),
|
2022-12-01 16:46:06 +01:00
|
|
|
onSubmit: () => actions.resolvePendingApproval(pendingApproval.id, null),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const snapAlert = {
|
|
|
|
getValues,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default snapAlert;
|