Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/7715-permission-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Export `AllPermissionKeys` type from `@metamask/7715-permission-types`, a union of all permission schema i18n label keys ([#279](https://github.com/MetaMask/smart-accounts-kit/pull/279))

## [0.9.0]

### Added
Expand Down
1 change: 1 addition & 0 deletions packages/7715-permission-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ export type {
TextField,
TokenResolution,
TokenVariant,
TranslationKeys,
} from './permissions/schema';
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type {
TextField,
TokenResolution,
TokenVariant,
TranslationKeys,
} from './types';
export {
convertAmountPerSecondToAmountPerPeriod,
Expand Down
31 changes: 30 additions & 1 deletion packages/7715-permission-types/src/permissions/schema/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,39 @@ export type PermissionRenderContext = {
/** Whether an amount field is for a native token or an ERC20 token. */
export type TokenVariant = 'native' | 'erc20';

/**
* Union of all i18n label keys used across permission schema field definitions.
* Useful for building exhaustive `Record<TranslationKeys, ...>` translation maps.
*/
export type TranslationKeys =
| 'account'
| 'amount'
| 'confirmFieldAllowance'
| 'confirmFieldAvailablePerDay'
| 'confirmFieldFrequency'
| 'confirmFieldTotalExposure'
| 'gatorPermissionsExpirationDate'
| 'gatorPermissionsInitialAllowance'
| 'gatorPermissionsJustification'
| 'gatorPermissionsMaxAllowance'
| 'gatorPermissionsRevocationMethods'
| 'gatorPermissionsStartDate'
| 'gatorPermissionsStreamingAmountLabel'
| 'gatorPermissionsStreamRate'
| 'gatorPermissionTokenPeriodicFrequencyLabel'
| 'gatorPermissionTokenStreamFrequencyLabel'
| 'payee'
| 'recipient'
| 'redeemer'
| 'redeemers'
| 'requestFrom'
| 'revokeTokenApprovals'
| 'unknownPermissionType';

/** Shared config for schema rows that read a value from render context. */
export type BaseField<TType extends string, TValueType> = {
type: TType;
labelKey: string;
labelKey: TranslationKeys;
testId: string;
getValue: (ctx: PermissionRenderContext) => TValueType;
isVisible: (ctx: PermissionRenderContext) => boolean;
Expand Down
Loading