Files
Eric FELIXINE e30ae8ed09 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
2026-06-01 18:00:35 -04:00

129 lines
3.0 KiB
JavaScript
Executable File

#!/usr/bin/env node
const program = require('commander');
const Analytics = require('.').default;
const pkg = require('./package');
const toObject = (str) => JSON.parse(str);
// node cli.js -w "write-key" -h "http://localhost" -t "identify" -u 'id
program
.version(pkg.version)
.option('-w, --writeKey <key>', 'the write key to use')
.option('-h, --host <host>', 'the API hostname to use')
.option('-t, --type <type>', 'the message type')
.option('-u, --userId <id>', 'the user id to send the event as')
.option('-a, --anonymousId <id>', 'the anonymous user id to send the event as')
.option('-c, --context <context>', 'additional context for the event (JSON-encoded)', toObject)
.option(
'-i, --integrations <integrations>',
'additional integrations for the event (JSON-encoded)',
toObject
)
.option('-e, --event <event>', 'the event name to send with the event')
.option('-p, --properties <properties>', 'the event properties to send (JSON-encoded)', toObject)
.option('-n, --name <name>', 'name of the screen or page to send with the message')
.option('-t, --traits <traits>', 'the identify/group traits to send (JSON-encoded)', toObject)
.option('-g, --groupId <groupId>', 'the group id')
.option('-pid, --previousId <previousId>', 'the previous id')
.parse(process.argv);
if (program.args.length !== 0) {
program.help();
}
const writeKey = program.writeKey;
const host = program.host;
const type = program.type;
const userId = program.userId;
const anonymousId = program.anonymousId;
const context = program.context;
const integrations = program.integrations;
const event = program.event;
const properties = program.properties;
const name = program.name;
const traits = program.traits;
const groupId = program.groupId;
const previousId = program.previousId;
const run = (method, args) => {
const analytics = new Analytics(writeKey, host, { flushAt: 1 });
analytics[method](args, (err) => {
if (err) {
console.error(err.stack);
process.exit(1);
}
});
};
switch (type) {
case 'track':
run('track', {
event,
properties,
userId,
anonymousId,
context,
integrations,
});
break;
case 'page':
run('page', {
name,
properties,
userId,
anonymousId,
context,
integrations,
});
break;
case 'screen':
run('screen', {
name,
properties,
userId,
anonymousId,
context,
integrations,
});
break;
case 'identify':
run('identify', {
traits,
userId,
anonymousId,
context,
integrations,
});
break;
case 'group':
run('group', {
groupId,
traits,
userId,
anonymousId,
context,
integrations,
});
break;
case 'alias':
run('alias', {
previousId,
userId,
anonymousId,
context,
integrations,
});
break;
default:
console.error('invalid type:', type);
process.exit(1);
}