Detects when user changes same config setting 3+ times within 24 hours. Shows non-intrusive prompt offering help with guided calibration flow. Guided calibration features: - Test for false positives (walk around room) - Test for missed motion (sit still) - Suggest optimal value based on diurnal baseline SNR and link health - Apply suggested value button Files: - dashboard/js/proactive.js: Complete implementation with localStorage tracking Acceptance: - Help prompt fires after 3+ changes in 24h - Calibration flow tests both directions - Suggests value based on system data - Apply button works
46 lines
1.7 KiB
JavaScript
46 lines
1.7 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.buildDynamicImport = buildDynamicImport;
|
|
var _core = require("@babel/core");
|
|
exports.getDynamicImportSource = function getDynamicImportSource(node) {
|
|
const [source] = node.arguments;
|
|
return _core.types.isStringLiteral(source) || _core.types.isTemplateLiteral(source) ? source : _core.template.expression.ast`\`\${${source}}\``;
|
|
};
|
|
function buildDynamicImport(node, deferToThen, wrapWithPromise, builder) {
|
|
const specifier = _core.types.isCallExpression(node) ? node.arguments[0] : node.source;
|
|
if (_core.types.isStringLiteral(specifier) || _core.types.isTemplateLiteral(specifier) && specifier.quasis.length === 0) {
|
|
if (deferToThen) {
|
|
return _core.template.expression.ast`
|
|
Promise.resolve().then(() => ${builder(specifier)})
|
|
`;
|
|
} else return builder(specifier);
|
|
}
|
|
const specifierToString = _core.types.isTemplateLiteral(specifier) ? _core.types.identifier("specifier") : _core.types.templateLiteral([_core.types.templateElement({
|
|
raw: ""
|
|
}), _core.types.templateElement({
|
|
raw: ""
|
|
})], [_core.types.identifier("specifier")]);
|
|
if (deferToThen) {
|
|
return _core.template.expression.ast`
|
|
(specifier =>
|
|
new Promise(r => r(${specifierToString}))
|
|
.then(s => ${builder(_core.types.identifier("s"))})
|
|
)(${specifier})
|
|
`;
|
|
} else if (wrapWithPromise) {
|
|
return _core.template.expression.ast`
|
|
(specifier =>
|
|
new Promise(r => r(${builder(specifierToString)}))
|
|
)(${specifier})
|
|
`;
|
|
} else {
|
|
return _core.template.expression.ast`
|
|
(specifier => ${builder(specifierToString)})(${specifier})
|
|
`;
|
|
}
|
|
}
|
|
|
|
//# sourceMappingURL=dynamic-import.js.map
|