- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
113 lines
2.8 KiB
JavaScript
113 lines
2.8 KiB
JavaScript
'use strict';
|
|
|
|
var Promise = require('./core');
|
|
|
|
var DEFAULT_WHITELIST = [
|
|
ReferenceError,
|
|
TypeError,
|
|
RangeError
|
|
];
|
|
|
|
var enabled = false;
|
|
exports.disable = disable;
|
|
function disable() {
|
|
enabled = false;
|
|
Promise._37 = null;
|
|
Promise._87 = null;
|
|
}
|
|
|
|
exports.enable = enable;
|
|
function enable(options) {
|
|
options = options || {};
|
|
if (enabled) disable();
|
|
enabled = true;
|
|
var id = 0;
|
|
var displayId = 0;
|
|
var rejections = {};
|
|
Promise._37 = function (promise) {
|
|
if (
|
|
promise._65 === 2 && // IS REJECTED
|
|
rejections[promise._51]
|
|
) {
|
|
if (rejections[promise._51].logged) {
|
|
onHandled(promise._51);
|
|
} else {
|
|
clearTimeout(rejections[promise._51].timeout);
|
|
}
|
|
delete rejections[promise._51];
|
|
}
|
|
};
|
|
Promise._87 = function (promise, err) {
|
|
if (promise._40 === 0) { // not yet handled
|
|
promise._51 = id++;
|
|
rejections[promise._51] = {
|
|
displayId: null,
|
|
error: err,
|
|
timeout: setTimeout(
|
|
onUnhandled.bind(null, promise._51),
|
|
// For reference errors and type errors, this almost always
|
|
// means the programmer made a mistake, so log them after just
|
|
// 100ms
|
|
// otherwise, wait 2 seconds to see if they get handled
|
|
matchWhitelist(err, DEFAULT_WHITELIST)
|
|
? 100
|
|
: 2000
|
|
),
|
|
logged: false
|
|
};
|
|
}
|
|
};
|
|
function onUnhandled(id) {
|
|
if (
|
|
options.allRejections ||
|
|
matchWhitelist(
|
|
rejections[id].error,
|
|
options.whitelist || DEFAULT_WHITELIST
|
|
)
|
|
) {
|
|
rejections[id].displayId = displayId++;
|
|
if (options.onUnhandled) {
|
|
rejections[id].logged = true;
|
|
options.onUnhandled(
|
|
rejections[id].displayId,
|
|
rejections[id].error
|
|
);
|
|
} else {
|
|
rejections[id].logged = true;
|
|
logError(
|
|
rejections[id].displayId,
|
|
rejections[id].error
|
|
);
|
|
}
|
|
}
|
|
}
|
|
function onHandled(id) {
|
|
if (rejections[id].logged) {
|
|
if (options.onHandled) {
|
|
options.onHandled(rejections[id].displayId, rejections[id].error);
|
|
} else if (!rejections[id].onUnhandled) {
|
|
console.warn(
|
|
'Promise Rejection Handled (id: ' + rejections[id].displayId + '):'
|
|
);
|
|
console.warn(
|
|
' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id ' +
|
|
rejections[id].displayId + '.'
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function logError(id, error) {
|
|
console.warn('Possible Unhandled Promise Rejection (id: ' + id + '):');
|
|
var errStr = (error && (error.stack || error)) + '';
|
|
errStr.split('\n').forEach(function (line) {
|
|
console.warn(' ' + line);
|
|
});
|
|
}
|
|
|
|
function matchWhitelist(error, list) {
|
|
return list.some(function (cls) {
|
|
return error instanceof cls;
|
|
});
|
|
} |