pi-kiosk-shared 1.0.2 → 1.0.3
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.
|
@@ -6,7 +6,6 @@ export interface EnvironmentConfig {
|
|
|
6
6
|
paymentAccountNumber: string;
|
|
7
7
|
showDebugInfo: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare const environments: Record<Environment, EnvironmentConfig>;
|
|
10
9
|
export declare const getCurrentEnvironment: () => Environment;
|
|
11
10
|
export declare const getEnvironmentConfig: () => EnvironmentConfig;
|
|
12
11
|
export declare const isDevelopment: () => boolean;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Simple environment configuration
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.isProduction = exports.isDevelopment = exports.getEnvironmentConfig = exports.getCurrentEnvironment =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
exports.isProduction = exports.isDevelopment = exports.getEnvironmentConfig = exports.getCurrentEnvironment = void 0;
|
|
5
|
+
// Helper function to get environment variables dynamically
|
|
6
|
+
function getEnvVar(key, defaultValue) {
|
|
7
|
+
return process.env[key] || defaultValue;
|
|
8
|
+
}
|
|
9
|
+
function getEnvBool(key, defaultValue) {
|
|
10
|
+
return process.env[key] === 'true' || defaultValue;
|
|
11
|
+
}
|
|
12
|
+
// Get environment configuration dynamically
|
|
13
|
+
function getConfigForEnvironment(env) {
|
|
14
|
+
if (env === 'development') {
|
|
15
|
+
return {
|
|
16
|
+
apiUrl: getEnvVar('REACT_APP_API_URL', 'http://localhost:3015'),
|
|
17
|
+
wsUrl: getEnvVar('REACT_APP_WS_URL', 'ws://localhost:3015'),
|
|
18
|
+
enableMockPayments: getEnvBool('REACT_APP_ENABLE_MOCK_PAYMENTS', true),
|
|
19
|
+
paymentAccountNumber: getEnvVar('REACT_APP_PAYMENT_ACCOUNT', '1234567890'),
|
|
20
|
+
showDebugInfo: getEnvBool('REACT_APP_SHOW_DEBUG_INFO', true),
|
|
21
|
+
};
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
else {
|
|
24
|
+
return {
|
|
25
|
+
apiUrl: getEnvVar('REACT_APP_API_URL', 'https://kiosk-prod.railway.app'),
|
|
26
|
+
wsUrl: getEnvVar('REACT_APP_WS_URL', 'wss://kiosk-prod.railway.app'),
|
|
27
|
+
enableMockPayments: getEnvBool('REACT_APP_ENABLE_MOCK_PAYMENTS', false),
|
|
28
|
+
paymentAccountNumber: getEnvVar('REACT_APP_PAYMENT_ACCOUNT', '1234567890'),
|
|
29
|
+
showDebugInfo: getEnvBool('REACT_APP_SHOW_DEBUG_INFO', false),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
21
33
|
// Simple environment detection
|
|
22
34
|
const getCurrentEnvironment = () => {
|
|
23
35
|
return process.env.NODE_ENV === 'production' ? 'production' : 'development';
|
|
@@ -26,7 +38,7 @@ exports.getCurrentEnvironment = getCurrentEnvironment;
|
|
|
26
38
|
// Get current environment configuration
|
|
27
39
|
const getEnvironmentConfig = () => {
|
|
28
40
|
const env = (0, exports.getCurrentEnvironment)();
|
|
29
|
-
return
|
|
41
|
+
return getConfigForEnvironment(env);
|
|
30
42
|
};
|
|
31
43
|
exports.getEnvironmentConfig = getEnvironmentConfig;
|
|
32
44
|
// Simple environment checks
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-kiosk-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared components and utilities for Pi Kiosk system",
|
|
6
|
-
"keywords": [
|
|
6
|
+
"keywords": [
|
|
7
|
+
"kiosk",
|
|
8
|
+
"react",
|
|
9
|
+
"typescript",
|
|
10
|
+
"components"
|
|
11
|
+
],
|
|
7
12
|
"author": "tehacko@seznam.cz",
|
|
8
13
|
"license": "MIT",
|
|
9
14
|
"repository": {
|
|
@@ -11,7 +16,7 @@
|
|
|
11
16
|
"url": "https://github.com/tehacko/pi-kiosk-shared"
|
|
12
17
|
},
|
|
13
18
|
"main": "dist/index.js",
|
|
14
|
-
"module": "dist/index.js",
|
|
19
|
+
"module": "dist/index.js",
|
|
15
20
|
"types": "dist/index.d.ts",
|
|
16
21
|
"exports": {
|
|
17
22
|
".": {
|