Skip to content
On this page

Module: features/decorators/bonusDecorator

Interfaces

BaseBonusAmountFeature

BaseBonusAmountFeature: Object

NameType
amountRef<DecimalSource>
bonusAmountProcessedComputable<DecimalSource>
totalAmount?Ref<DecimalSource>

Defined in

profectus/src/features/decorators/bonusDecorator.ts:21


BaseBonusCompletionsFeature

BaseBonusCompletionsFeature: Object

NameType
bonusCompletionsProcessedComputable<DecimalSource>
completionsRef<DecimalSource>
totalCompletions?Ref<DecimalSource>

Defined in

profectus/src/features/decorators/bonusDecorator.ts:26


BonusAmountFeatureOptions

BonusAmountFeatureOptions: Object

NameType
bonusAmountComputable<DecimalSource>
totalAmount?Computable<DecimalSource>

Defined in

profectus/src/features/decorators/bonusDecorator.ts:12


BonusCompletionsFeatureOptions

BonusCompletionsFeatureOptions: Object

NameType
bonusCompletionsComputable<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

NameType
Textends BonusAmountFeatureOptions

Defined in

profectus/src/features/decorators/bonusDecorator.ts:32


BonusCompletionsFeature

Ƭ BonusCompletionsFeature<T>: Replace<T, { bonusAmount: GetComputableType<T["bonusCompletions"]> }>

Type parameters

NameType
Textends 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

ts
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

Defined in

profectus/src/features/decorators/bonusDecorator.ts:101