mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
17 lines
579 B
JavaScript
17 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;
|