@yoyomq/ije-react 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,26 +4,199 @@
4
4
 
5
5
  <h1 align="center">@yoyomq/ije-react</h1>
6
6
 
7
- <p align="center">React wrappers for the Ije SDK by <strong>Yoyo</strong>.</p>
7
+ <p align="center">First-class React components for the Ije SDK by <strong>Yoyo</strong>.</p>
8
+
9
+ <p align="center">
10
+ <img src="https://raw.githubusercontent.com/Yoyo-MQ/ije/main/assets/screenshots/tracker.gif" alt="Live device tracking" width="100%" />
11
+ </p>
8
12
 
9
13
  ---
10
14
 
11
- > ⚠️ **Placeholder not yet implemented.** This package currently exports
12
- > nothing. First-class, typed React components are planned.
15
+ ## Get your API key
16
+
17
+ 1. Sign in at [yoyomq.com](https://yoyomq.com)
18
+ 2. Go to **Settings → API Keys**
19
+ 3. Create a new key and copy it
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ npm install @yoyomq/ije-react
25
+ ```
26
+
27
+ React 16.8+ is required as a peer dependency.
28
+
29
+ ## Quick start
13
30
 
14
- In the meantime, the [`@yoyomq/ije-ui`](../ui) Web Components work inside React
15
- directly — initialize once and use the tags as JSX:
31
+ Wrap your app (or the relevant subtree) with `IjeProvider`, then drop in any component:
16
32
 
17
33
  ```tsx
18
- import { useEffect } from 'react';
19
- import { Ije } from '@yoyomq/ije-core';
20
- import '@yoyomq/ije-ui';
34
+ import { IjeProvider, IjeDeviceTrackerView, IjeTelemetryStat } from '@yoyomq/ije-react';
21
35
 
22
- export function Dashboard({ apiKey }: { apiKey: string }) {
23
- useEffect(() => { Ije.init({ apiKey }); }, [apiKey]);
24
- return <ije-map-tracker device-id="truck-001" title="Vehicle Location" />;
36
+ export default function App() {
37
+ return (
38
+ <IjeProvider config={{ apiKey: 'YOUR_YOYO_API_KEY' }}>
39
+ <IjeDeviceTrackerView deviceId={1001} title="Vehicle Location" />
40
+ <IjeTelemetryStat deviceId={1001} metric="speed" title="Speed" unit="km/h" />
41
+ </IjeProvider>
42
+ );
25
43
  }
26
44
  ```
27
45
 
28
- 📖 **Full documentation:** see the [Ije SDK README](../../README.md), including the
29
- [Using with React](../../README.md#using-with-react) section.
46
+ ## Next.js App Router
47
+
48
+ All components include `'use client'` — no extra setup needed. Place `IjeProvider` in a client boundary:
49
+
50
+ ```tsx
51
+ // app/dashboard/layout.tsx
52
+ import { IjeProvider, IjeDeviceTrackerView } from '@yoyomq/ije-react';
53
+
54
+ export default function DashboardLayout({ children }: { children: React.ReactNode }) {
55
+ return (
56
+ <IjeProvider config={{ apiKey: process.env.NEXT_PUBLIC_YOYO_API_KEY! }}>
57
+ {children}
58
+ </IjeProvider>
59
+ );
60
+ }
61
+ ```
62
+
63
+ ## Components
64
+
65
+ ### `<IjeDeviceTrackerView>`
66
+
67
+ Live map showing a device's current position and movement trail. Click the position marker to open an info bubble with speed, heading, altitude, coordinates, and timestamp. Optionally enables historical trip replay mode.
68
+
69
+ <img src="https://raw.githubusercontent.com/Yoyo-MQ/ije/main/assets/screenshots/tracker.png" alt="IjeDeviceTrackerView" width="100%" />
70
+
71
+ ```tsx
72
+ <IjeDeviceTrackerView
73
+ deviceId={1001}
74
+ title="Vehicle Location"
75
+ width="100%"
76
+ height="400px"
77
+ />
78
+ ```
79
+
80
+ | Prop | Type | Description |
81
+ |------|------|-------------|
82
+ | `deviceId` | `number` | **Required.** Numeric device ID |
83
+ | `title` | `string` | Card title |
84
+ | `helpMessage` | `string` | Tooltip shown on hover |
85
+ | `width` | `string` | CSS width (default `100%`) |
86
+ | `height` | `string` | CSS height (default `400px`) |
87
+ | `tripPicker` | `boolean` | Enable historical trip replay mode |
88
+ | `triggerId` | `number` | Trip trigger ID (trip-picker mode) |
89
+ | `triggerName` | `string` | Trip trigger label (trip-picker mode) |
90
+ | `startsAt` | `number` | Trip start Unix timestamp in seconds (trip-picker mode) |
91
+ | `endsAt` | `number` | Trip end Unix timestamp in seconds (trip-picker mode) |
92
+
93
+ ### `<IjeTelemetryStat>`
94
+
95
+ Single live telemetry value (speed, fuel, temperature, etc.).
96
+
97
+ <img src="https://raw.githubusercontent.com/Yoyo-MQ/ije/main/assets/screenshots/stats.png" alt="IjeTelemetryStat" width="100%" />
98
+
99
+ ```tsx
100
+ <IjeTelemetryStat deviceId={1001} metric="speed" title="Speed" unit="km/h" />
101
+ ```
102
+
103
+ | Prop | Type | Description |
104
+ |------|------|-------------|
105
+ | `deviceId` | `number` | **Required.** Numeric device ID |
106
+ | `metric` | `string` | **Required.** Telemetry field name |
107
+ | `title` | `string` | Card title |
108
+ | `unit` | `string` | Unit label (e.g. `km/h`, `°C`) |
109
+ | `helpMessage` | `string` | Tooltip shown on hover |
110
+
111
+ ### `<IjeTelemetryChart>`
112
+
113
+ Live time-series chart for a telemetry metric.
114
+
115
+ <img src="https://raw.githubusercontent.com/Yoyo-MQ/ije/main/assets/screenshots/chart.png" alt="IjeTelemetryChart" width="100%" />
116
+
117
+ ```tsx
118
+ <IjeTelemetryChart deviceId={1001} metric="speed" title="Speed over time" height="200px" />
119
+ ```
120
+
121
+ | Prop | Type | Description |
122
+ |------|------|-------------|
123
+ | `deviceId` | `number` | **Required.** Numeric device ID |
124
+ | `metric` | `string` | Telemetry field name |
125
+ | `title` | `string` | Card title |
126
+ | `helpMessage` | `string` | Tooltip shown on hover |
127
+ | `width` | `string` | CSS width |
128
+ | `height` | `string` | CSS height |
129
+
130
+ ### `<IjeAggregateStat>`
131
+
132
+ Displays a set of aggregate metrics (totals, averages, counts) passed in as data.
133
+
134
+ ```tsx
135
+ import type { AggregateData } from '@yoyomq/ije-react';
136
+
137
+ const data: AggregateData = {
138
+ metrics: [
139
+ { label: 'Total distance', value: 1240, unit: 'km' },
140
+ { label: 'Trips', value: 38 },
141
+ ],
142
+ };
143
+
144
+ <IjeAggregateStat data={data} />
145
+ ```
146
+
147
+ | Prop | Type | Description |
148
+ |------|------|-------------|
149
+ | `data` | `AggregateData` | Metrics to display |
150
+ | `loading` | `boolean` | Show loading skeleton |
151
+
152
+ ### `<IjeBarChart>`
153
+
154
+ Horizontal bar chart for comparing values across categories.
155
+
156
+ ```tsx
157
+ import type { BarChartData } from '@yoyomq/ije-react';
158
+
159
+ const data: BarChartData[] = [
160
+ { label: 'Mon', value: 120 },
161
+ { label: 'Tue', value: 95 },
162
+ ];
163
+
164
+ <IjeBarChart data={data} height="200px" />
165
+ ```
166
+
167
+ | Prop | Type | Description |
168
+ |------|------|-------------|
169
+ | `data` | `BarChartData[]` | Array of `{ label, value }` entries |
170
+ | `loading` | `boolean` | Show loading skeleton |
171
+ | `height` | `string` | CSS height |
172
+
173
+ ### `<IjeChat>`
174
+
175
+ AI-powered fleet assistant chat widget.
176
+
177
+ ```tsx
178
+ <IjeChat title="Fleet Assistant" placeholder="Ask about your fleet…" />
179
+ ```
180
+
181
+ | Prop | Type | Description |
182
+ |------|------|-------------|
183
+ | `title` | `string` | Widget title |
184
+ | `placeholder` | `string` | Input placeholder text |
185
+ | `width` | `string` | CSS width |
186
+ | `height` | `string` | CSS height |
187
+
188
+ ## `IjeProvider`
189
+
190
+ Initializes the SDK once. Place it high in your component tree.
191
+
192
+ ```tsx
193
+ <IjeProvider config={{ apiKey: 'YOUR_YOYO_API_KEY' }}>
194
+ {children}
195
+ </IjeProvider>
196
+ ```
197
+
198
+ The `config` prop accepts a [`SdkConfig`](https://github.com/Yoyo-MQ/ije) object from `@yoyomq/ije-core`.
199
+
200
+ ---
201
+
202
+ 📖 **Full SDK documentation:** [github.com/Yoyo-MQ/ije](https://github.com/Yoyo-MQ/ije)
@@ -1,6 +1,6 @@
1
1
  import type { AggregateData } from '@yoyomq/ije-ui';
2
- export interface AggregateStatProps {
2
+ export interface IjeAggregateStatProps {
3
3
  data?: AggregateData;
4
4
  loading?: boolean;
5
5
  }
6
- export declare function AggregateStat({ data, loading }: AggregateStatProps): import("react").JSX.Element;
6
+ export declare function IjeAggregateStat({ data, loading }: IjeAggregateStatProps): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useRef } from 'react';
4
- export function AggregateStat({ data, loading }) {
4
+ export function IjeAggregateStat({ data, loading }) {
5
5
  const ref = useRef(null);
6
6
  useEffect(() => {
7
7
  if (ref.current && data !== undefined) {
@@ -1,7 +1,7 @@
1
1
  import type { BarChartData } from '@yoyomq/ije-ui';
2
- export interface BarChartProps {
2
+ export interface IjeBarChartProps {
3
3
  data?: BarChartData[];
4
4
  loading?: boolean;
5
5
  height?: string;
6
6
  }
7
- export declare function BarChart({ data, loading, height }: BarChartProps): import("react").JSX.Element;
7
+ export declare function IjeBarChart({ data, loading, height }: IjeBarChartProps): import("react").JSX.Element;
package/dist/BarChart.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useRef } from 'react';
4
- export function BarChart({ data, loading, height }) {
4
+ export function IjeBarChart({ data, loading, height }) {
5
5
  const ref = useRef(null);
6
6
  useEffect(() => {
7
7
  if (ref.current && data !== undefined) {
package/dist/Chat.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export interface ChatProps {
1
+ export interface IjeChatProps {
2
2
  title?: string;
3
3
  placeholder?: string;
4
4
  width?: string;
5
5
  height?: string;
6
6
  }
7
- export declare function Chat({ title, placeholder, width, height }: ChatProps): import("react").JSX.Element;
7
+ export declare function IjeChat({ title, placeholder, width, height }: IjeChatProps): import("react").JSX.Element;
package/dist/Chat.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export function Chat({ title, placeholder, width, height }) {
3
+ export function IjeChat({ title, placeholder, width, height }) {
4
4
  return (_jsx("ije-chat", { title: title, placeholder: placeholder, width: width, height: height }));
5
5
  }
@@ -0,0 +1,14 @@
1
+ export interface IjeDeviceTrackerViewProps {
2
+ deviceId: number;
3
+ title?: string;
4
+ helpMessage?: string;
5
+ width?: string;
6
+ height?: string;
7
+ /** Trip-picker mode: pass trigger-id + optional trigger-name to enable historical trip replay. */
8
+ tripPicker?: boolean;
9
+ triggerId?: number;
10
+ triggerName?: string;
11
+ startsAt?: number;
12
+ endsAt?: number;
13
+ }
14
+ export declare function IjeDeviceTrackerView({ deviceId, title, helpMessage, width, height, tripPicker, triggerId, triggerName, startsAt, endsAt, }: IjeDeviceTrackerViewProps): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export function IjeDeviceTrackerView({ deviceId, title, helpMessage, width, height, tripPicker, triggerId, triggerName, startsAt, endsAt, }) {
4
+ return (_jsx("ije-map-tracker", { "device-id": deviceId, title: title, "help-message": helpMessage, width: width, height: height, "trip-picker": tripPicker ? '' : undefined, "trigger-id": triggerId, "trigger-name": triggerName, "starts-at": startsAt, "ends-at": endsAt }));
5
+ }
@@ -1,6 +1,5 @@
1
- export interface MapTrackerProps {
2
- deviceId: string;
3
- numericDeviceId?: number;
1
+ export interface IjeDeviceTrackerViewProps {
2
+ deviceId: number;
4
3
  title?: string;
5
4
  helpMessage?: string;
6
5
  width?: string;
@@ -12,4 +11,4 @@ export interface MapTrackerProps {
12
11
  startsAt?: number;
13
12
  endsAt?: number;
14
13
  }
15
- export declare function MapTracker({ deviceId, numericDeviceId, title, helpMessage, width, height, tripPicker, triggerId, triggerName, startsAt, endsAt, }: MapTrackerProps): import("react").JSX.Element;
14
+ export declare function IjeDeviceTrackerView({ deviceId, title, helpMessage, width, height, tripPicker, triggerId, triggerName, startsAt, endsAt, }: IjeDeviceTrackerViewProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export function MapTracker({ deviceId, numericDeviceId, title, helpMessage, width, height, tripPicker, triggerId, triggerName, startsAt, endsAt, }) {
4
- return (_jsx("ije-map-tracker", { "device-id": deviceId, "numeric-device-id": numericDeviceId != null ? String(numericDeviceId) : undefined, title: title, "help-message": helpMessage, width: width, height: height, "trip-picker": tripPicker ? '' : undefined, "trigger-id": triggerId != null ? String(triggerId) : undefined, "trigger-name": triggerName, "starts-at": startsAt != null ? String(startsAt) : undefined, "ends-at": endsAt != null ? String(endsAt) : undefined }));
3
+ export function IjeDeviceTrackerView({ deviceId, title, helpMessage, width, height, tripPicker, triggerId, triggerName, startsAt, endsAt, }) {
4
+ return (_jsx("ije-map-tracker", { "device-id": deviceId, title: title, "help-message": helpMessage, width: width, height: height, "trip-picker": tripPicker ? '' : undefined, "trigger-id": triggerId, "trigger-name": triggerName, "starts-at": startsAt, "ends-at": endsAt }));
5
5
  }
@@ -1,9 +1,9 @@
1
- export interface TelemetryChartProps {
2
- deviceId: string;
1
+ export interface IjeTelemetryChartProps {
2
+ deviceId: number;
3
3
  metric?: string;
4
4
  title?: string;
5
5
  helpMessage?: string;
6
6
  width?: string;
7
7
  height?: string;
8
8
  }
9
- export declare function TelemetryChart({ deviceId, metric, title, helpMessage, width, height }: TelemetryChartProps): import("react").JSX.Element;
9
+ export declare function IjeTelemetryChart({ deviceId, metric, title, helpMessage, width, height }: IjeTelemetryChartProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export function TelemetryChart({ deviceId, metric, title, helpMessage, width, height }) {
3
+ export function IjeTelemetryChart({ deviceId, metric, title, helpMessage, width, height }) {
4
4
  return (_jsx("ije-telemetry-chart", { "device-id": deviceId, metric: metric, title: title, "help-message": helpMessage, width: width, height: height }));
5
5
  }
@@ -1,8 +1,8 @@
1
- export interface TelemetryStatProps {
2
- deviceId: string;
1
+ export interface IjeTelemetryStatProps {
2
+ deviceId: number;
3
3
  metric: string;
4
4
  title?: string;
5
5
  unit?: string;
6
6
  helpMessage?: string;
7
7
  }
8
- export declare function TelemetryStat({ deviceId, metric, title, unit, helpMessage }: TelemetryStatProps): import("react").JSX.Element;
8
+ export declare function IjeTelemetryStat({ deviceId, metric, title, unit, helpMessage }: IjeTelemetryStatProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export function TelemetryStat({ deviceId, metric, title, unit, helpMessage }) {
3
+ export function IjeTelemetryStat({ deviceId, metric, title, unit, helpMessage }) {
4
4
  return (_jsx("ije-telemetry-stat", { "device-id": deviceId, metric: metric, title: title, unit: unit, "help-message": helpMessage }));
5
5
  }
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  export { IjeProvider } from './Provider';
2
2
  export type { IjeProviderProps } from './Provider';
3
- export { MapTracker } from './MapTracker';
4
- export type { MapTrackerProps } from './MapTracker';
5
- export { TelemetryStat } from './TelemetryStat';
6
- export type { TelemetryStatProps } from './TelemetryStat';
7
- export { TelemetryChart } from './TelemetryChart';
8
- export type { TelemetryChartProps } from './TelemetryChart';
9
- export { Chat } from './Chat';
10
- export type { ChatProps } from './Chat';
11
- export { AggregateStat } from './AggregateStat';
12
- export type { AggregateStatProps } from './AggregateStat';
13
- export { BarChart } from './BarChart';
14
- export type { BarChartProps } from './BarChart';
3
+ export { IjeDeviceTrackerView } from './DeviceTrackerView';
4
+ export type { IjeDeviceTrackerViewProps } from './DeviceTrackerView';
5
+ export { IjeTelemetryStat } from './TelemetryStat';
6
+ export type { IjeTelemetryStatProps } from './TelemetryStat';
7
+ export { IjeTelemetryChart } from './TelemetryChart';
8
+ export type { IjeTelemetryChartProps } from './TelemetryChart';
9
+ export { IjeChat } from './Chat';
10
+ export type { IjeChatProps } from './Chat';
11
+ export { IjeAggregateStat } from './AggregateStat';
12
+ export type { IjeAggregateStatProps } from './AggregateStat';
13
+ export { IjeBarChart } from './BarChart';
14
+ export type { IjeBarChartProps } from './BarChart';
15
15
  export type { SdkConfig } from '@yoyomq/ije-core';
16
16
  export type { AggregateData, AggregateMetric, BarChartData } from '@yoyomq/ije-ui';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { IjeProvider } from './Provider';
2
- export { MapTracker } from './MapTracker';
3
- export { TelemetryStat } from './TelemetryStat';
4
- export { TelemetryChart } from './TelemetryChart';
5
- export { Chat } from './Chat';
6
- export { AggregateStat } from './AggregateStat';
7
- export { BarChart } from './BarChart';
2
+ export { IjeDeviceTrackerView } from './DeviceTrackerView';
3
+ export { IjeTelemetryStat } from './TelemetryStat';
4
+ export { IjeTelemetryChart } from './TelemetryChart';
5
+ export { IjeChat } from './Chat';
6
+ export { IjeAggregateStat } from './AggregateStat';
7
+ export { IjeBarChart } from './BarChart';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoyomq/ije-react",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "source": "src/index.tsx",
@@ -12,8 +12,8 @@
12
12
  "access": "public"
13
13
  },
14
14
  "dependencies": {
15
- "@yoyomq/ije-core": "0.1.2",
16
- "@yoyomq/ije-ui": "0.1.2"
15
+ "@yoyomq/ije-ui": "0.1.3",
16
+ "@yoyomq/ije-core": "0.1.3"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8.0",