Module: features/decorators/bonusDecorator
Interfaces
BaseBonusAmountFeature
• BaseBonusAmountFeature: Object
Name | Type |
---|---|
amount | Ref <DecimalSource > |
bonusAmount | ProcessedComputable <DecimalSource > |
totalAmount? | Ref <DecimalSource > |
Defined in
profectus/src/features/decorators/bonusDecorator.ts:21
BaseBonusCompletionsFeature
• BaseBonusCompletionsFeature: Object
Name | Type |
---|---|
bonusCompletions | ProcessedComputable <DecimalSource > |
completions | Ref <DecimalSource > |
totalCompletions? | Ref <DecimalSource > |
Defined in
profectus/src/features/decorators/bonusDecorator.ts:26
BonusAmountFeatureOptions
• BonusAmountFeatureOptions: Object
Name | Type |
---|---|
bonusAmount | Computable <DecimalSource > |
totalAmount? | Computable <DecimalSource > |
Defined in
profectus/src/features/decorators/bonusDecorator.ts:12
BonusCompletionsFeatureOptions
• BonusCompletionsFeatureOptions: Object
Name | Type |
---|---|
bonusCompletions | Computable <DecimalSource > |
totalCompletions? | Computable <DecimalSource > |
Defined in
profectus/src/features/decorators/bonusDecorator.ts:16
Type Aliases
BonusAmountFeature
Ƭ BonusAmountFeature<T
>: Replace
<T
, { bonusAmount
: GetComputableType
<T
["bonusAmount"
]> }>
Type parameters
Name | Type |
---|---|
T | extends BonusAmountFeatureOptions |
Defined in
profectus/src/features/decorators/bonusDecorator.ts:32
BonusCompletionsFeature
Ƭ BonusCompletionsFeature<T
>: Replace
<T
, { bonusAmount
: GetComputableType
<T
["bonusCompletions"
]> }>
Type parameters
Name | Type |
---|---|
T | extends BonusCompletionsFeatureOptions |
Defined in
profectus/src/features/decorators/bonusDecorator.ts:36
GenericBonusAmountFeature
Ƭ GenericBonusAmountFeature: Replace
<BonusAmountFeature
<BonusAmountFeatureOptions
>, { bonusAmount
: ProcessedComputable
<DecimalSource
> ; totalAmount
: ProcessedComputable
<DecimalSource
> }>
Defined in
profectus/src/features/decorators/bonusDecorator.ts:41
GenericBonusCompletionsFeature
Ƭ GenericBonusCompletionsFeature: Replace
<BonusCompletionsFeature
<BonusCompletionsFeatureOptions
>, { bonusCompletions
: ProcessedComputable
<DecimalSource
> ; totalCompletions
: ProcessedComputable
<DecimalSource
> }>
Defined in
profectus/src/features/decorators/bonusDecorator.ts:48
Variables
bonusAmountDecorator
• Const
bonusAmountDecorator: Decorator
<BonusAmountFeatureOptions
, BaseBonusAmountFeature
, GenericBonusAmountFeature
>
Allows the addition of "bonus levels" to the decorated feature, with an accompanying "total amount". To function properly, the createFeature()
function must have its generic type extended by BonusAmountFeatureOptions
. Additionally, the base feature must have an amount
property. To allow access to the decorated values outside the createFeature()
function, the output type must be extended by GenericBonusAmountFeature
.
Example
createRepeatable<RepeatableOptions & BonusAmountFeatureOptions>(() => ({
bonusAmount: noPersist(otherRepeatable.amount),
...
}), bonusAmountDecorator) as GenericRepeatable & GenericBonusAmountFeature
#### Defined in
[profectus/src/features/decorators/bonusDecorator.ts:67](https://github.com/profectus-engine/Profectus/blob/5c11524/src/features/decorators/bonusDecorator.ts#L67)
___
### bonusCompletionsDecorator
• `Const` **bonusCompletionsDecorator**: [`Decorator`](./common#decorator)<[`BonusCompletionsFeatureOptions`](./bonusDecorator#bonuscompletionsfeatureoptions), [`BaseBonusCompletionsFeature`](./bonusDecorator#basebonuscompletionsfeature), [`GenericBonusCompletionsFeature`](./bonusDecorator#genericbonuscompletionsfeature)\>
Allows the addition of "bonus levels" to the decorated feature, with an accompanying "total amount".
To function properly, the `createFeature()` function must have its generic type extended by BonusCompletionFeatureOptions.
To allow access to the decorated values outside the `createFeature()` function, the output type must be extended by GenericBonusCompletionFeature.
**`Example`**
```ts
createChallenge<ChallengeOptions & BonusCompletionFeatureOptions>(() => ({
bonusCompletions: noPersist(otherChallenge.completions),
...
}), bonusCompletionDecorator) as GenericChallenge & GenericBonusCompletionFeature