pi-kiosk-shared 1.0.19 → 1.0.20
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 +6 -6
- package/dist/config/deployment.js +3 -3
- package/dist/types.d.ts +4 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pi-kiosk-shared
|
|
2
2
|
|
|
3
3
|
Shared components, utilities, and types for the Pi Kiosk system.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install pi-kiosk-shared
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -13,7 +13,7 @@ npm install @pi-kiosk/shared
|
|
|
13
13
|
### Components
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
|
-
import { ErrorDisplay, LoadingSpinner } from '
|
|
16
|
+
import { ErrorDisplay, LoadingSpinner } from 'pi-kiosk-shared';
|
|
17
17
|
|
|
18
18
|
function MyComponent() {
|
|
19
19
|
return (
|
|
@@ -28,7 +28,7 @@ function MyComponent() {
|
|
|
28
28
|
### Types
|
|
29
29
|
|
|
30
30
|
```tsx
|
|
31
|
-
import { Product, ApiResponse, KioskStatus } from '
|
|
31
|
+
import { Product, ApiResponse, KioskStatus } from 'pi-kiosk-shared';
|
|
32
32
|
|
|
33
33
|
const product: Product = {
|
|
34
34
|
id: 1,
|
|
@@ -45,7 +45,7 @@ const product: Product = {
|
|
|
45
45
|
### Hooks
|
|
46
46
|
|
|
47
47
|
```tsx
|
|
48
|
-
import { useApi, useErrorHandler } from '
|
|
48
|
+
import { useApi, useErrorHandler } from 'pi-kiosk-shared';
|
|
49
49
|
|
|
50
50
|
function MyComponent() {
|
|
51
51
|
const api = useApi();
|
|
@@ -58,7 +58,7 @@ function MyComponent() {
|
|
|
58
58
|
### Utilities
|
|
59
59
|
|
|
60
60
|
```tsx
|
|
61
|
-
import { formatPrice, validateEmail } from '
|
|
61
|
+
import { formatPrice, validateEmail } from 'pi-kiosk-shared';
|
|
62
62
|
|
|
63
63
|
const price = formatPrice(25.5); // "25,50 Kč"
|
|
64
64
|
const isValid = validateEmail('user@example.com'); // true
|
|
@@ -30,8 +30,8 @@ export const deploymentConfig = {
|
|
|
30
30
|
production: {
|
|
31
31
|
'NODE_ENV': 'production',
|
|
32
32
|
'REACT_APP_ENVIRONMENT': 'production',
|
|
33
|
-
'REACT_APP_API_URL': 'https://
|
|
34
|
-
'REACT_APP_WS_URL': 'wss://
|
|
33
|
+
'REACT_APP_API_URL': 'https://rpapp-bckend-production.up.railway.app',
|
|
34
|
+
'REACT_APP_WS_URL': 'wss://rpapp-bckend-production.up.railway.app',
|
|
35
35
|
'REACT_APP_PAYMENT_MODE': 'production',
|
|
36
36
|
'REACT_APP_ENABLE_MOCK_PAYMENTS': 'false',
|
|
37
37
|
'REACT_APP_SHOW_DEBUG_INFO': 'false',
|
|
@@ -131,7 +131,7 @@ export const railwayConfigs = {
|
|
|
131
131
|
source: './packages/backend',
|
|
132
132
|
env: {
|
|
133
133
|
...deploymentConfig.environmentVariables.production,
|
|
134
|
-
PORT: '
|
|
134
|
+
PORT: '3015'
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
{
|
package/dist/types.d.ts
CHANGED
|
@@ -124,36 +124,12 @@ export interface KioskStatus {
|
|
|
124
124
|
lastSeen: Date;
|
|
125
125
|
salesToday: number;
|
|
126
126
|
}
|
|
127
|
-
export type WebSocketMessage =
|
|
128
|
-
|
|
127
|
+
export type WebSocketMessage = {
|
|
128
|
+
type: string;
|
|
129
129
|
kioskId?: number;
|
|
130
130
|
timestamp?: string;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
type: 'product_update';
|
|
134
|
-
updateType: 'product_created' | 'product_updated' | 'product_deleted' | 'inventory_updated' | 'payment_completed' | 'payment_timeout' | 'payment_failed';
|
|
135
|
-
data?: {
|
|
136
|
-
productId?: number;
|
|
137
|
-
name?: string;
|
|
138
|
-
price?: number;
|
|
139
|
-
paymentId?: string;
|
|
140
|
-
amount?: number;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
export interface PaymentStatusMessage extends BaseWebSocketMessage {
|
|
144
|
-
type: 'payment_status';
|
|
145
|
-
paymentId: string;
|
|
146
|
-
status: TransactionStatus;
|
|
147
|
-
data?: {
|
|
148
|
-
amount?: number;
|
|
149
|
-
customerEmail?: string;
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
export interface SystemMessage extends BaseWebSocketMessage {
|
|
153
|
-
type: 'system';
|
|
154
|
-
message: string;
|
|
155
|
-
level: 'info' | 'warning' | 'error';
|
|
156
|
-
}
|
|
131
|
+
[key: string]: any;
|
|
132
|
+
};
|
|
157
133
|
export type ScreenType = 'products' | 'payment' | 'confirmation' | 'admin-login' | 'admin-dashboard';
|
|
158
134
|
export interface CreateQRPaymentRequest {
|
|
159
135
|
productId: number;
|