feat(smart-app): implement complete mobile app MVP

- 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
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,145 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.errorMap = exports.isValidationErrorLike = exports.isValidationError = exports.toValidationError = exports.fromZodError = exports.fromZodIssue = exports.ValidationError = void 0;
const zod = __importStar(require("zod"));
const joinPath_1 = require("./utils/joinPath");
const NonEmptyArray_1 = require("./utils/NonEmptyArray");
const MAX_ISSUES_IN_MESSAGE = 99;
const ISSUE_SEPARATOR = '; ';
const UNION_SEPARATOR = ', or ';
const PREFIX = 'Validation error';
const PREFIX_SEPARATOR = ': ';
class ValidationError extends Error {
details;
name;
constructor(message, details = []) {
super(message);
this.details = details;
this.name = 'ZodValidationError';
}
toString() {
return this.message;
}
}
exports.ValidationError = ValidationError;
function getMessageFromZodIssue(props) {
const { issue, issueSeparator, unionSeparator, includePath } = props;
if (issue.code === 'invalid_union') {
return issue.unionErrors
.reduce((acc, zodError) => {
const newIssues = zodError.issues
.map((issue) => getMessageFromZodIssue({
issue,
issueSeparator,
unionSeparator,
includePath,
}))
.join(issueSeparator);
if (!acc.includes(newIssues)) {
acc.push(newIssues);
}
return acc;
}, [])
.join(unionSeparator);
}
if (includePath && (0, NonEmptyArray_1.isNonEmptyArray)(issue.path)) {
if (issue.path.length === 1) {
const identifier = issue.path[0];
if (typeof identifier === 'number') {
return `${issue.message} at index ${identifier}`;
}
}
return `${issue.message} at "${(0, joinPath_1.joinPath)(issue.path)}"`;
}
return issue.message;
}
function conditionallyPrefixMessage(reason, prefix, prefixSeparator) {
if (prefix !== null) {
if (reason.length > 0) {
return [prefix, reason].join(prefixSeparator);
}
return prefix;
}
if (reason.length > 0) {
return reason;
}
return PREFIX;
}
function fromZodIssue(issue, options = {}) {
const { issueSeparator = ISSUE_SEPARATOR, unionSeparator = UNION_SEPARATOR, prefixSeparator = PREFIX_SEPARATOR, prefix = PREFIX, includePath = true, } = options;
const reason = getMessageFromZodIssue({
issue,
issueSeparator,
unionSeparator,
includePath,
});
const message = conditionallyPrefixMessage(reason, prefix, prefixSeparator);
return new ValidationError(message, [issue]);
}
exports.fromZodIssue = fromZodIssue;
function fromZodError(zodError, options = {}) {
const { maxIssuesInMessage = MAX_ISSUES_IN_MESSAGE, issueSeparator = ISSUE_SEPARATOR, unionSeparator = UNION_SEPARATOR, prefixSeparator = PREFIX_SEPARATOR, prefix = PREFIX, includePath = true, } = options;
const reason = zodError.errors
.slice(0, maxIssuesInMessage)
.map((issue) => getMessageFromZodIssue({
issue,
issueSeparator,
unionSeparator,
includePath,
}))
.join(issueSeparator);
const message = conditionallyPrefixMessage(reason, prefix, prefixSeparator);
return new ValidationError(message, zodError.errors);
}
exports.fromZodError = fromZodError;
const toValidationError = (options = {}) => (err) => {
if (err instanceof zod.ZodError) {
return fromZodError(err, options);
}
if (err instanceof Error) {
return new ValidationError(err.message);
}
return new ValidationError('Unknown error');
};
exports.toValidationError = toValidationError;
function isValidationError(err) {
return err instanceof ValidationError;
}
exports.isValidationError = isValidationError;
function isValidationErrorLike(err) {
return err instanceof Error && err.name === 'ZodValidationError';
}
exports.isValidationErrorLike = isValidationErrorLike;
const errorMap = (issue, ctx) => {
const error = fromZodIssue({
...issue,
message: issue.message ?? ctx.defaultError,
});
return {
message: error.message,
};
};
exports.errorMap = errorMap;

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.errorMap = exports.fromZodIssue = exports.fromZodError = exports.isValidationErrorLike = exports.isValidationError = exports.toValidationError = exports.ValidationError = void 0;
var ValidationError_1 = require("./ValidationError");
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return ValidationError_1.ValidationError; } });
Object.defineProperty(exports, "toValidationError", { enumerable: true, get: function () { return ValidationError_1.toValidationError; } });
Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return ValidationError_1.isValidationError; } });
Object.defineProperty(exports, "isValidationErrorLike", { enumerable: true, get: function () { return ValidationError_1.isValidationErrorLike; } });
Object.defineProperty(exports, "fromZodError", { enumerable: true, get: function () { return ValidationError_1.fromZodError; } });
Object.defineProperty(exports, "fromZodIssue", { enumerable: true, get: function () { return ValidationError_1.fromZodIssue; } });
Object.defineProperty(exports, "errorMap", { enumerable: true, get: function () { return ValidationError_1.errorMap; } });

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNonEmptyArray = void 0;
function isNonEmptyArray(value) {
return value.length !== 0;
}
exports.isNonEmptyArray = isNonEmptyArray;

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.joinPath = void 0;
const identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
function joinPath(path) {
if (path.length === 1) {
return path[0].toString();
}
return path.reduce((acc, item) => {
if (typeof item === 'number') {
return acc + '[' + item.toString() + ']';
}
if (item.includes('"')) {
return acc + '["' + escapeQuotes(item) + '"]';
}
if (!identifierRegex.test(item)) {
return acc + '["' + item + '"]';
}
const separator = acc.length === 0 ? '' : '.';
return acc + separator + item;
}, '');
}
exports.joinPath = joinPath;
function escapeQuotes(str) {
return str.replace(/"/g, '\\"');
}

View File

@@ -0,0 +1,112 @@
import * as zod from 'zod';
import { joinPath } from './utils/joinPath';
import { isNonEmptyArray } from './utils/NonEmptyArray';
const MAX_ISSUES_IN_MESSAGE = 99;
const ISSUE_SEPARATOR = '; ';
const UNION_SEPARATOR = ', or ';
const PREFIX = 'Validation error';
const PREFIX_SEPARATOR = ': ';
export class ValidationError extends Error {
details;
name;
constructor(message, details = []) {
super(message);
this.details = details;
this.name = 'ZodValidationError';
}
toString() {
return this.message;
}
}
function getMessageFromZodIssue(props) {
const { issue, issueSeparator, unionSeparator, includePath } = props;
if (issue.code === 'invalid_union') {
return issue.unionErrors
.reduce((acc, zodError) => {
const newIssues = zodError.issues
.map((issue) => getMessageFromZodIssue({
issue,
issueSeparator,
unionSeparator,
includePath,
}))
.join(issueSeparator);
if (!acc.includes(newIssues)) {
acc.push(newIssues);
}
return acc;
}, [])
.join(unionSeparator);
}
if (includePath && isNonEmptyArray(issue.path)) {
if (issue.path.length === 1) {
const identifier = issue.path[0];
if (typeof identifier === 'number') {
return `${issue.message} at index ${identifier}`;
}
}
return `${issue.message} at "${joinPath(issue.path)}"`;
}
return issue.message;
}
function conditionallyPrefixMessage(reason, prefix, prefixSeparator) {
if (prefix !== null) {
if (reason.length > 0) {
return [prefix, reason].join(prefixSeparator);
}
return prefix;
}
if (reason.length > 0) {
return reason;
}
return PREFIX;
}
export function fromZodIssue(issue, options = {}) {
const { issueSeparator = ISSUE_SEPARATOR, unionSeparator = UNION_SEPARATOR, prefixSeparator = PREFIX_SEPARATOR, prefix = PREFIX, includePath = true, } = options;
const reason = getMessageFromZodIssue({
issue,
issueSeparator,
unionSeparator,
includePath,
});
const message = conditionallyPrefixMessage(reason, prefix, prefixSeparator);
return new ValidationError(message, [issue]);
}
export function fromZodError(zodError, options = {}) {
const { maxIssuesInMessage = MAX_ISSUES_IN_MESSAGE, issueSeparator = ISSUE_SEPARATOR, unionSeparator = UNION_SEPARATOR, prefixSeparator = PREFIX_SEPARATOR, prefix = PREFIX, includePath = true, } = options;
const reason = zodError.errors
.slice(0, maxIssuesInMessage)
.map((issue) => getMessageFromZodIssue({
issue,
issueSeparator,
unionSeparator,
includePath,
}))
.join(issueSeparator);
const message = conditionallyPrefixMessage(reason, prefix, prefixSeparator);
return new ValidationError(message, zodError.errors);
}
export const toValidationError = (options = {}) => (err) => {
if (err instanceof zod.ZodError) {
return fromZodError(err, options);
}
if (err instanceof Error) {
return new ValidationError(err.message);
}
return new ValidationError('Unknown error');
};
export function isValidationError(err) {
return err instanceof ValidationError;
}
export function isValidationErrorLike(err) {
return err instanceof Error && err.name === 'ZodValidationError';
}
export const errorMap = (issue, ctx) => {
const error = fromZodIssue({
...issue,
message: issue.message ?? ctx.defaultError,
});
return {
message: error.message,
};
};

View File

@@ -0,0 +1 @@
export { ValidationError, toValidationError, isValidationError, isValidationErrorLike, fromZodError, fromZodIssue, errorMap, } from './ValidationError';

View File

@@ -0,0 +1,3 @@
export function isNonEmptyArray(value) {
return value.length !== 0;
}

View File

@@ -0,0 +1,22 @@
const identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
export function joinPath(path) {
if (path.length === 1) {
return path[0].toString();
}
return path.reduce((acc, item) => {
if (typeof item === 'number') {
return acc + '[' + item.toString() + ']';
}
if (item.includes('"')) {
return acc + '["' + escapeQuotes(item) + '"]';
}
if (!identifierRegex.test(item)) {
return acc + '["' + item + '"]';
}
const separator = acc.length === 0 ? '' : '.';
return acc + separator + item;
}, '');
}
function escapeQuotes(str) {
return str.replace(/"/g, '\\"');
}

View File

@@ -0,0 +1,26 @@
import * as zod from 'zod';
export type ZodError = zod.ZodError;
export type ZodIssue = zod.ZodIssue;
export declare class ValidationError extends Error {
details: Array<zod.ZodIssue>;
name: 'ZodValidationError';
constructor(message: string, details?: Array<zod.ZodIssue> | undefined);
toString(): string;
}
export type FromZodIssueOptions = {
issueSeparator?: string;
unionSeparator?: string;
prefix?: string | null;
prefixSeparator?: string;
includePath?: boolean;
};
export declare function fromZodIssue(issue: ZodIssue, options?: FromZodIssueOptions): ValidationError;
export type FromZodErrorOptions = FromZodIssueOptions & {
maxIssuesInMessage?: number;
};
export declare function fromZodError(zodError: ZodError, options?: FromZodErrorOptions): ValidationError;
export declare const toValidationError: (options?: Parameters<typeof fromZodError>[1]) => (err: unknown) => ValidationError;
export declare function isValidationError(err: unknown): err is ValidationError;
export declare function isValidationErrorLike(err: unknown): err is ValidationError;
export declare const errorMap: zod.ZodErrorMap;
//# sourceMappingURL=ValidationError.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ValidationError.d.ts","sourceRoot":"","sources":["../../lib/ValidationError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAW3B,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AACpC,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ssue, type FromZodErrorOptions, type FromZodIssueOptions, errorMap, } from './ValidationError';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,QAAQ,GACT,MAAM,mBAAmB,CAAC"}

View File

@@ -0,0 +1,3 @@
export type NonEmptyArray<T> = [T, ...T[]];
export declare function isNonEmptyArray<T>(value: T[]): value is NonEmptyArray<T>;
//# sourceMappingURL=NonEmptyArray.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NonEmptyArray.d.ts","sourceRoot":"","sources":["../../../lib/utils/NonEmptyArray.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAE3C,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,CAExE"}

View File

@@ -0,0 +1,3 @@
import { NonEmptyArray } from './NonEmptyArray';
export declare function joinPath(path: NonEmptyArray<string | number>): string;
//# sourceMappingURL=joinPath.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"joinPath.d.ts","sourceRoot":"","sources":["../../../lib/utils/joinPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOhD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAyBrE"}