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,197 @@
"use strict";
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule BaseEventEmitter
* @typechecks
*/
var EmitterSubscription = require("./EmitterSubscription.js");
var EventSubscriptionVendor = require("./EventSubscriptionVendor.js");
var invariant = require("fbjs/lib/invariant");
var emptyFunction = require("fbjs/lib/emptyFunction");
/**
* @class BaseEventEmitter
* @description
* An EventEmitter is responsible for managing a set of listeners and publishing
* events to them when it is told that such events happened. In addition to the
* data for the given event it also sends a event control object which allows
* the listeners/handlers to prevent the default behavior of the given event.
*
* The emitter is designed to be generic enough to support all the different
* contexts in which one might want to emit events. It is a simple multicast
* mechanism on top of which extra functionality can be composed. For example, a
* more advanced emitter may use an EventHolder and EventFactory.
*/
var BaseEventEmitter = /*#__PURE__*/function () {
/**
* @constructor
*/
function BaseEventEmitter() {
this._subscriber = new EventSubscriptionVendor();
this._currentSubscription = null;
}
/**
* Adds a listener to be invoked when events of the specified type are
* emitted. An optional calling context may be provided. The data arguments
* emitted will be passed to the listener function.
*
* TODO: Annotate the listener arg's type. This is tricky because listeners
* can be invoked with varargs.
*
* @param {string} eventType - Name of the event to listen to
* @param {function} listener - Function to invoke when the specified event is
* emitted
* @param {*} context - Optional context object to use when invoking the
* listener
*/
var _proto = BaseEventEmitter.prototype;
_proto.addListener = function addListener(eventType, listener, context) {
return this._subscriber.addSubscription(eventType, new EmitterSubscription(this._subscriber, listener, context));
}
/**
* Similar to addListener, except that the listener is removed after it is
* invoked once.
*
* @param {string} eventType - Name of the event to listen to
* @param {function} listener - Function to invoke only once when the
* specified event is emitted
* @param {*} context - Optional context object to use when invoking the
* listener
*/
;
_proto.once = function once(eventType, listener, context) {
var emitter = this;
return this.addListener(eventType, function () {
emitter.removeCurrentListener();
listener.apply(context, arguments);
});
}
/**
* Removes all of the registered listeners, including those registered as
* listener maps.
*
* @param {?string} eventType - Optional name of the event whose registered
* listeners to remove
*/
;
_proto.removeAllListeners = function removeAllListeners(eventType) {
this._subscriber.removeAllSubscriptions(eventType);
}
/**
* Provides an API that can be called during an eventing cycle to remove the
* last listener that was invoked. This allows a developer to provide an event
* object that can remove the listener (or listener map) during the
* invocation.
*
* If it is called when not inside of an emitting cycle it will throw.
*
* @throws {Error} When called not during an eventing cycle
*
* @example
* var subscription = emitter.addListenerMap({
* someEvent: function(data, event) {
* console.log(data);
* emitter.removeCurrentListener();
* }
* });
*
* emitter.emit('someEvent', 'abc'); // logs 'abc'
* emitter.emit('someEvent', 'def'); // does not log anything
*/
;
_proto.removeCurrentListener = function removeCurrentListener() {
!!!this._currentSubscription ? process.env.NODE_ENV !== "production" ? invariant(false, 'Not in an emitting cycle; there is no current subscription') : invariant(false) : void 0;
this._subscriber.removeSubscription(this._currentSubscription);
}
/**
* Returns an array of listeners that are currently registered for the given
* event.
*
* @param {string} eventType - Name of the event to query
* @return {array}
*/
;
_proto.listeners = function listeners(eventType)
/* TODO: Array<EventSubscription> */
{
var subscriptions = this._subscriber.getSubscriptionsForType(eventType);
return subscriptions ? subscriptions.filter(emptyFunction.thatReturnsTrue).map(function (subscription) {
return subscription.listener;
}) : [];
}
/**
* Emits an event of the given type with the given data. All handlers of that
* particular type will be notified.
*
* @param {string} eventType - Name of the event to emit
* @param {*} Arbitrary arguments to be passed to each registered listener
*
* @example
* emitter.addListener('someEvent', function(message) {
* console.log(message);
* });
*
* emitter.emit('someEvent', 'abc'); // logs 'abc'
*/
;
_proto.emit = function emit(eventType) {
var subscriptions = this._subscriber.getSubscriptionsForType(eventType);
if (subscriptions) {
var keys = Object.keys(subscriptions);
for (var ii = 0; ii < keys.length; ii++) {
var key = keys[ii];
var subscription = subscriptions[key]; // The subscription may have been removed during this event loop.
if (subscription) {
this._currentSubscription = subscription;
this.__emitToSubscription.apply(this, [subscription].concat(Array.prototype.slice.call(arguments)));
}
}
this._currentSubscription = null;
}
}
/**
* Provides a hook to override how the emitter emits an event to a specific
* subscription. This allows you to set up logging and error boundaries
* specific to your environment.
*
* @param {EmitterSubscription} subscription
* @param {string} eventType
* @param {*} Arbitrary arguments to be passed to each registered listener
*/
;
_proto.__emitToSubscription = function __emitToSubscription(subscription, eventType) {
var args = Array.prototype.slice.call(arguments, 2);
subscription.listener.apply(subscription.context, args);
};
return BaseEventEmitter;
}();
module.exports = BaseEventEmitter;

View File

@@ -0,0 +1,45 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EmitterSubscription
* @typechecks
*/
'use strict';
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
var EventSubscription = require("./EventSubscription.js");
/**
* EmitterSubscription represents a subscription with listener and context data.
*/
var EmitterSubscription = /*#__PURE__*/function (_EventSubscription) {
_inheritsLoose(EmitterSubscription, _EventSubscription);
/**
* @param {EventSubscriptionVendor} subscriber - The subscriber that controls
* this subscription
* @param {function} listener - Function to invoke when the specified event is
* emitted
* @param {*} context - Optional context object to use when invoking the
* listener
*/
function EmitterSubscription(subscriber, listener, context) {
var _this;
_this = _EventSubscription.call(this, subscriber) || this;
_this.listener = listener;
_this.context = context;
return _this;
}
return EmitterSubscription;
}(EventSubscription);
module.exports = EmitterSubscription;

View File

@@ -0,0 +1,43 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventSubscription
* @typechecks
*/
'use strict';
/**
* EventSubscription represents a subscription to a particular event. It can
* remove its own subscription.
*/
var EventSubscription = /*#__PURE__*/function () {
/**
* @param {EventSubscriptionVendor} subscriber the subscriber that controls
* this subscription.
*/
function EventSubscription(subscriber) {
this.subscriber = subscriber;
}
/**
* Removes this subscription from the subscriber that controls it.
*/
var _proto = EventSubscription.prototype;
_proto.remove = function remove() {
if (this.subscriber) {
this.subscriber.removeSubscription(this);
this.subscriber = null;
}
};
return EventSubscription;
}();
module.exports = EventSubscription;

View File

@@ -0,0 +1,104 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventSubscriptionVendor
* @typechecks
*/
'use strict';
var invariant = require("fbjs/lib/invariant");
/**
* EventSubscriptionVendor stores a set of EventSubscriptions that are
* subscribed to a particular event type.
*/
var EventSubscriptionVendor = /*#__PURE__*/function () {
function EventSubscriptionVendor() {
this._subscriptionsForType = {};
this._currentSubscription = null;
}
/**
* Adds a subscription keyed by an event type.
*
* @param {string} eventType
* @param {EventSubscription} subscription
*/
var _proto = EventSubscriptionVendor.prototype;
_proto.addSubscription = function addSubscription(eventType, subscription) {
!(subscription.subscriber === this) ? process.env.NODE_ENV !== "production" ? invariant(false, 'The subscriber of the subscription is incorrectly set.') : invariant(false) : void 0;
if (!this._subscriptionsForType[eventType]) {
this._subscriptionsForType[eventType] = [];
}
var key = this._subscriptionsForType[eventType].length;
this._subscriptionsForType[eventType].push(subscription);
subscription.eventType = eventType;
subscription.key = key;
return subscription;
}
/**
* Removes a bulk set of the subscriptions.
*
* @param {?string} eventType - Optional name of the event type whose
* registered supscriptions to remove, if null remove all subscriptions.
*/
;
_proto.removeAllSubscriptions = function removeAllSubscriptions(eventType) {
if (eventType === undefined) {
this._subscriptionsForType = {};
} else {
delete this._subscriptionsForType[eventType];
}
}
/**
* Removes a specific subscription. Instead of calling this function, call
* `subscription.remove()` directly.
*
* @param {object} subscription
*/
;
_proto.removeSubscription = function removeSubscription(subscription) {
var eventType = subscription.eventType;
var key = subscription.key;
var subscriptionsForType = this._subscriptionsForType[eventType];
if (subscriptionsForType) {
delete subscriptionsForType[key];
}
}
/**
* Returns the array of subscriptions that are currently registered for the
* given event type.
*
* Note: This array can be potentially sparse as subscriptions are deleted
* from it when they are removed.
*
* TODO: This returns a nullable array. wat?
*
* @param {string} eventType
* @return {?array}
*/
;
_proto.getSubscriptionsForType = function getSubscriptionsForType(eventType) {
return this._subscriptionsForType[eventType];
};
return EventSubscriptionVendor;
}();
module.exports = EventSubscriptionVendor;