mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
18 lines
579 B
JavaScript
18 lines
579 B
JavaScript
|
import ElementCondition from "./condition/ElementCondition";
|
||
|
import BoolCondition from "./condition/BoolCondition";
|
||
|
|
||
|
class ConditionFactory {
|
||
|
static make(conditionConfig, triggerUpdate) {
|
||
|
switch (conditionConfig.type) {
|
||
|
case 'element':
|
||
|
return new ElementCondition(conditionConfig, triggerUpdate);
|
||
|
case 'bool':
|
||
|
return new BoolCondition(conditionConfig, triggerUpdate);
|
||
|
}
|
||
|
|
||
|
throw new Error('[ConditionFactory] Unknown condition: ' + conditionConfig.type);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default ConditionFactory;
|