mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Implement AXO order processing
Implement AXO settings
This commit is contained in:
parent
fe03215799
commit
c71c56973a
20 changed files with 546 additions and 136 deletions
|
@ -1,5 +1,6 @@
|
|||
import ElementCondition from "./condition/ElementCondition";
|
||||
import BoolCondition from "./condition/BoolCondition";
|
||||
import JsVariableCondition from "./condition/JsVariableCondition";
|
||||
|
||||
class ConditionFactory {
|
||||
static make(conditionConfig, triggerUpdate) {
|
||||
|
@ -8,6 +9,8 @@ class ConditionFactory {
|
|||
return new ElementCondition(conditionConfig, triggerUpdate);
|
||||
case 'bool':
|
||||
return new BoolCondition(conditionConfig, triggerUpdate);
|
||||
case 'js_variable':
|
||||
return new JsVariableCondition(conditionConfig, triggerUpdate);
|
||||
}
|
||||
|
||||
throw new Error('[ConditionFactory] Unknown condition: ' + conditionConfig.type);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
import BaseCondition from "./BaseCondition";
|
||||
|
||||
class JsVariableCondition extends BaseCondition {
|
||||
|
||||
register() {
|
||||
jQuery(document).on('ppcp-display-change', () => {
|
||||
const status = this.check();
|
||||
if (status !== this.status) {
|
||||
this.status = status;
|
||||
this.triggerUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
this.status = this.check();
|
||||
}
|
||||
|
||||
check() {
|
||||
let value = document[this.config.variable];
|
||||
return this.config.value === value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default JsVariableCondition;
|
Loading…
Add table
Add a link
Reference in a new issue