- 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
74 lines
2.2 KiB
JavaScript
74 lines
2.2 KiB
JavaScript
(function (name, context, definition) {
|
|
if (typeof module !== 'undefined' && module.exports) module.exports = definition();
|
|
else if (typeof define === 'function' && define.amd) define(definition);
|
|
else context[name] = definition();
|
|
})('urljoin', this, function () {
|
|
|
|
function normalize (strArray) {
|
|
var resultArray = [];
|
|
|
|
// If the first part is a plain protocol, we combine it with the next part.
|
|
if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
|
|
var first = strArray.shift();
|
|
strArray[0] = first + strArray[0];
|
|
}
|
|
|
|
// There must be two or three slashes in the file protocol, two slashes in anything else.
|
|
if (strArray[0].match(/^file:\/\/\//)) {
|
|
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1:///');
|
|
} else {
|
|
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1://');
|
|
}
|
|
|
|
for (var i = 0; i < strArray.length; i++) {
|
|
var component = strArray[i];
|
|
|
|
if (typeof component !== 'string') {
|
|
throw new TypeError('Url must be a string. Received ' + component);
|
|
}
|
|
|
|
if (component === '') { continue; }
|
|
|
|
if (i > 0) {
|
|
// Removing the starting slashes for each component but the first.
|
|
component = component.replace(/^[\/]+/, '');
|
|
}
|
|
if (i < strArray.length - 1) {
|
|
// Removing the ending slashes for each component but the last.
|
|
component = component.replace(/[\/]+$/, '');
|
|
} else {
|
|
// For the last component we will combine multiple slashes to a single one.
|
|
component = component.replace(/[\/]+$/, '/');
|
|
}
|
|
|
|
resultArray.push(component);
|
|
|
|
}
|
|
|
|
var str = resultArray.join('/');
|
|
// Each input component is now separated by a single slash except the possible first plain protocol part.
|
|
|
|
// remove trailing slash before parameters or hash
|
|
str = str.replace(/\/(\?|&|#[^!])/g, '$1');
|
|
|
|
// replace ? in parameters with &
|
|
var parts = str.split('?');
|
|
str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&');
|
|
|
|
return str;
|
|
}
|
|
|
|
return function () {
|
|
var input;
|
|
|
|
if (typeof arguments[0] === 'object') {
|
|
input = arguments[0];
|
|
} else {
|
|
input = [].slice.call(arguments);
|
|
}
|
|
|
|
return normalize(input);
|
|
};
|
|
|
|
});
|