ensure success
is a boolean
This commit is contained in:
parent
1c41f4ea6d
commit
e76b741a5e
@ -30,9 +30,13 @@ let disruption = "";
|
|||||||
* @param {function} noExistCallback
|
* @param {function} noExistCallback
|
||||||
*/
|
*/
|
||||||
const ensureSettingsProp = (prop, existCallback, noExistCallback) => {
|
const ensureSettingsProp = (prop, existCallback, noExistCallback) => {
|
||||||
settings.get(prop).then(foundKeys => {
|
return settings.get(prop).then(foundKeys => {
|
||||||
console.debug("storage returned", foundKeys);
|
console.debug("storage returned", foundKeys);
|
||||||
return (prop in foundKeys ? existCallback(foundKeys[prop]) : noExistCallback());
|
if (prop in foundKeys){
|
||||||
|
return existCallback(foundKeys[prop]);
|
||||||
|
} else {
|
||||||
|
return noExistCallback();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,13 +68,16 @@ const bankDetailConfigKeys = ["pymt__iban", "pymt__bic"];
|
|||||||
function processSingleAddedNode(n) {
|
function processSingleAddedNode(n) {
|
||||||
if (currentStage.match(n)) {
|
if (currentStage.match(n)) {
|
||||||
console.info(currentStage.name, "matched: ", n);
|
console.info(currentStage.name, "matched: ", n);
|
||||||
const success = currentStage.execute(n)
|
const success = currentStage.execute(n);
|
||||||
if (success) {
|
Promise.resolve(success).then((result => {
|
||||||
|
if (result === true) {
|
||||||
console.info(currentStage.name, "executed successfully");
|
console.info(currentStage.name, "executed successfully");
|
||||||
} else {
|
} else {
|
||||||
console.error(currentStage.name, "failed");
|
console.error(currentStage.name, "failed");
|
||||||
}
|
}
|
||||||
nextStage();
|
nextStage();
|
||||||
|
}));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.debug(currentStage.name, "did not match: ", n);
|
console.debug(currentStage.name, "did not match: ", n);
|
||||||
}
|
}
|
||||||
@ -103,7 +110,7 @@ function processMutations(mutationList, observer) {
|
|||||||
if (currentStage.expects == 'mutation') {
|
if (currentStage.expects == 'mutation') {
|
||||||
if (currentStage.match(mutation)) {
|
if (currentStage.match(mutation)) {
|
||||||
console.info(currentStage.name, "matched: ", mutation);
|
console.info(currentStage.name, "matched: ", mutation);
|
||||||
success = currentStage.execute(mutation);
|
let success = currentStage.execute(mutation);
|
||||||
if (success){
|
if (success){
|
||||||
console.info(currentStage.name, "executed successfully");
|
console.info(currentStage.name, "executed successfully");
|
||||||
} else {
|
} else {
|
||||||
@ -349,14 +356,15 @@ const jumpToTimeInput = {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** @type Stage */
|
||||||
const activateAppellationDropdown = {
|
const activateAppellationDropdown = {
|
||||||
name: "activateAppellationDropdown",
|
name: "activateAppellationDropdown",
|
||||||
match: node => node.classList.contains("persoenlicheangaben") && hasConfiguredPersonalData,
|
match: node => node.classList.contains("persoenlicheangaben") && hasConfiguredPersonalData,
|
||||||
execute: node => {
|
execute: node => {
|
||||||
return ensureSettingsProp("addr__appellation", () => {
|
return ensureSettingsProp("addr__appellation", () => {
|
||||||
const selectList = node.querySelector('.test-name-anrede.db-web-select');
|
const button = node.querySelector('.test-name-anrede.db-web-select button');
|
||||||
selectList.querySelector('button').dispatchEvent(_clickEv());
|
button.dispatchEvent(_clickEv());
|
||||||
|
return true;
|
||||||
}, () => true);
|
}, () => true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user