- 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
98 lines
2.2 KiB
JavaScript
Executable File
98 lines
2.2 KiB
JavaScript
Executable File
'use strict';
|
|
|
|
const Decode = require('./decode');
|
|
const Domain = require('./domain');
|
|
const Email = require('./email');
|
|
const Errors = require('./errors');
|
|
const Ip = require('./ip');
|
|
const Tlds = require('./tlds');
|
|
const Uri = require('./uri');
|
|
|
|
|
|
const internals = {
|
|
defaultTlds: { allow: Tlds, deny: null }
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
errors: Errors.codes,
|
|
|
|
domain: {
|
|
analyze(domain, options) {
|
|
|
|
options = internals.options(options);
|
|
return Domain.analyze(domain, options);
|
|
},
|
|
|
|
isValid(domain, options) {
|
|
|
|
options = internals.options(options);
|
|
return Domain.isValid(domain, options);
|
|
}
|
|
},
|
|
email: {
|
|
analyze(email, options) {
|
|
|
|
options = internals.options(options);
|
|
return Email.analyze(email, options);
|
|
},
|
|
|
|
isValid(email, options) {
|
|
|
|
options = internals.options(options);
|
|
return Email.isValid(email, options);
|
|
}
|
|
},
|
|
ip: {
|
|
regex: Ip.regex
|
|
},
|
|
uri: {
|
|
decode: Decode.decode,
|
|
regex: Uri.regex
|
|
}
|
|
};
|
|
|
|
|
|
internals.options = function (options) {
|
|
|
|
if (!options) {
|
|
return { tlds: internals.defaultTlds };
|
|
}
|
|
|
|
if (options.tlds === false) { // Defaults to true
|
|
return options;
|
|
}
|
|
|
|
if (!options.tlds ||
|
|
options.tlds === true) {
|
|
|
|
return Object.assign({}, options, { tlds: internals.defaultTlds });
|
|
}
|
|
|
|
if (typeof options.tlds !== 'object') {
|
|
throw new Error('Invalid options: tlds must be a boolean or an object');
|
|
}
|
|
|
|
if (options.tlds.deny) {
|
|
if (options.tlds.deny instanceof Set === false) {
|
|
throw new Error('Invalid options: tlds.deny must be a Set object');
|
|
}
|
|
|
|
if (options.tlds.allow) {
|
|
throw new Error('Invalid options: cannot specify both tlds.allow and tlds.deny lists');
|
|
}
|
|
|
|
return options;
|
|
}
|
|
|
|
if (options.tlds.allow === true) {
|
|
return Object.assign({}, options, { tlds: internals.defaultTlds });
|
|
}
|
|
|
|
if (options.tlds.allow instanceof Set === false) {
|
|
throw new Error('Invalid options: tlds.allow must be a Set object or true');
|
|
}
|
|
|
|
return options;
|
|
};
|