pi-kiosk-shared 1.0.17 → 1.0.18

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/dist/api.d.ts CHANGED
@@ -5,8 +5,13 @@ export declare const API_ENDPOINTS: {
5
5
  readonly PAYMENT_CREATE_MULTI_QR: "/api/payments/create-multi-qr";
6
6
  readonly PAYMENT_CHECK_STATUS: "/api/payments/check-status/:paymentId";
7
7
  readonly PAYMENT_COMPLETE: "/api/payments/complete";
8
+ readonly PAYMENT_COMPLETE_MULTI: "/api/payments/complete-multi";
8
9
  readonly PAYMENT_CANCEL: "/api/payments/cancel";
9
10
  readonly PAYMENT_START_MONITORING: "/api/payments/start-monitoring";
11
+ readonly PAYMENT_THEPAY_CREATE: "/api/payments/create-thepay";
12
+ readonly PAYMENT_THEPAY_STATUS: "/api/payments/thepay-status/:paymentId";
13
+ readonly PAYMENT_THEPAY_CANCEL: "/api/payments/thepay-cancel";
14
+ readonly PAYMENT_THEPAY_METHODS: "/api/payments/thepay-methods";
10
15
  readonly ADMIN_LOGIN: "/admin/login";
11
16
  readonly ADMIN_PRODUCTS: "/admin/products";
12
17
  readonly ADMIN_PRODUCTS_INVENTORY: "/admin/products/inventory/:kioskId";
@@ -15,6 +20,7 @@ export declare const API_ENDPOINTS: {
15
20
  readonly ADMIN_PRODUCT_KIOSK_VISIBILITY: "/admin/products/:productId/kiosk/:kioskId";
16
21
  readonly ADMIN_KIOSKS: "/admin/kiosks";
17
22
  readonly ADMIN_KIOSK_DETAILS: "/admin/kiosks/:id";
23
+ readonly ADMIN_LOGS: "/admin/logs";
18
24
  readonly HEALTH: "/health";
19
25
  readonly CHECK_TRANSACTIONS: "/api/check-new-transactions";
20
26
  readonly EVENTS: "/events/:kioskId";
package/dist/api.js CHANGED
@@ -8,8 +8,14 @@ export const API_ENDPOINTS = {
8
8
  PAYMENT_CREATE_MULTI_QR: '/api/payments/create-multi-qr',
9
9
  PAYMENT_CHECK_STATUS: '/api/payments/check-status/:paymentId',
10
10
  PAYMENT_COMPLETE: '/api/payments/complete',
11
+ PAYMENT_COMPLETE_MULTI: '/api/payments/complete-multi',
11
12
  PAYMENT_CANCEL: '/api/payments/cancel',
12
13
  PAYMENT_START_MONITORING: '/api/payments/start-monitoring',
14
+ // ThePay.eu payment endpoints
15
+ PAYMENT_THEPAY_CREATE: '/api/payments/create-thepay',
16
+ PAYMENT_THEPAY_STATUS: '/api/payments/thepay-status/:paymentId',
17
+ PAYMENT_THEPAY_CANCEL: '/api/payments/thepay-cancel',
18
+ PAYMENT_THEPAY_METHODS: '/api/payments/thepay-methods',
13
19
  // Admin endpoints
14
20
  ADMIN_LOGIN: '/admin/login',
15
21
  ADMIN_PRODUCTS: '/admin/products',
@@ -19,6 +25,7 @@ export const API_ENDPOINTS = {
19
25
  ADMIN_PRODUCT_KIOSK_VISIBILITY: '/admin/products/:productId/kiosk/:kioskId',
20
26
  ADMIN_KIOSKS: '/admin/kiosks',
21
27
  ADMIN_KIOSK_DETAILS: '/admin/kiosks/:id',
28
+ ADMIN_LOGS: '/admin/logs',
22
29
  // System endpoints
23
30
  HEALTH: '/health',
24
31
  CHECK_TRANSACTIONS: '/api/check-new-transactions',
@@ -1,28 +1,25 @@
1
1
  // Centralized environment configuration for all services
2
2
  // This ensures consistency across backend, kiosk, and admin apps
3
- // Helper function to get environment variables dynamically
3
+ // Simplified environment variable helper
4
4
  function getEnvVar(key, defaultValue) {
5
- // Try to get from process.env (Node.js) or import.meta.env (Vite)
6
- let value;
7
5
  // Check for process.env (Node.js environment)
8
6
  if (typeof process !== 'undefined' && process.env) {
9
- value = process.env[key];
7
+ return process.env[key] || defaultValue;
10
8
  }
11
- // If not found and we're in a browser, try to access Vite's environment
12
- if (!value && typeof window !== 'undefined') {
9
+ // Check for import.meta.env (Vite environment)
10
+ if (typeof window !== 'undefined') {
13
11
  try {
14
- // Access import.meta.env safely using dynamic import
15
- // @ts-ignore
12
+ // @ts-ignore - Vite environment
16
13
  const meta = globalThis.import?.meta;
17
14
  if (meta && meta.env) {
18
- value = meta.env[key];
15
+ return meta.env[key] || defaultValue;
19
16
  }
20
17
  }
21
18
  catch (e) {
22
- // Ignore errors, fall back to default
19
+ // Fallback for test environments
23
20
  }
24
21
  }
25
- return value || defaultValue;
22
+ return defaultValue;
26
23
  }
27
24
  function getEnvBool(key, defaultValue) {
28
25
  const value = getEnvVar(key, defaultValue.toString());
@@ -81,35 +78,31 @@ function getConfigForEnvironment(env) {
81
78
  };
82
79
  }
83
80
  }
84
- // Simple environment detection
81
+ // Simplified environment detection
85
82
  export const getCurrentEnvironment = () => {
86
- let nodeEnv;
87
83
  // Check for process.env (Node.js environment)
88
84
  if (typeof process !== 'undefined' && process.env) {
89
- nodeEnv = process.env.NODE_ENV;
85
+ return process.env.NODE_ENV === 'production' ? 'production' : 'development';
90
86
  }
91
- // If not found and we're in a browser, try to access Vite's environment
92
- if (!nodeEnv && typeof window !== 'undefined') {
87
+ // Check for import.meta.env (Vite environment)
88
+ if (typeof window !== 'undefined') {
93
89
  try {
94
- // Access import.meta.env safely using dynamic import
95
- // @ts-ignore
90
+ // @ts-ignore - Vite environment
96
91
  const meta = globalThis.import?.meta;
97
92
  if (meta && meta.env) {
98
- nodeEnv = meta.env.NODE_ENV;
93
+ return meta.env.MODE === 'production' ? 'production' : 'development';
99
94
  }
100
95
  }
101
96
  catch (e) {
102
- // Ignore errors, fall back to default
103
- }
104
- }
105
- // Additional check: if we're on a Railway domain, assume production
106
- if (!nodeEnv && typeof window !== 'undefined' && window.location) {
107
- if (window.location.hostname.includes('railway.app') ||
108
- window.location.hostname.includes('up.railway.app')) {
109
- return 'production';
97
+ // Fallback: check if we're on Railway domain
98
+ if (window.location &&
99
+ (window.location.hostname.includes('railway.app') ||
100
+ window.location.hostname.includes('up.railway.app'))) {
101
+ return 'production';
102
+ }
110
103
  }
111
104
  }
112
- return nodeEnv === 'production' ? 'production' : 'development';
105
+ return 'development';
113
106
  };
114
107
  // Get current environment configuration
115
108
  export const getEnvironmentConfig = () => {
@@ -25,11 +25,13 @@ export declare const UI_MESSAGES: {
25
25
  readonly LOADING_PRODUCTS: "Načítání produktů...";
26
26
  readonly LOADING_PAYMENT: "Zpracovávám platbu...";
27
27
  readonly GENERATING_QR: "Generuji QR kód...";
28
+ readonly PAYMENT_INITIALIZING: "Inicializuji platbu...";
28
29
  readonly PAYMENT_SUCCESS: "Platba byla úspěšně zpracována!";
29
30
  readonly PRODUCT_SAVED: "Produkt byl úspěšně uložen!";
30
31
  readonly NETWORK_ERROR: "Problém s připojením. Zkuste to znovu.";
31
32
  readonly VALIDATION_ERROR: "Zkontrolujte zadané údaje.";
32
33
  readonly UNKNOWN_ERROR: "Něco se pokazilo. Zkuste to znovu.";
34
+ readonly PAYMENT_ERROR: "Chyba při zpracování platby";
33
35
  readonly NO_PRODUCTS: "Žádné produkty nejsou k dispozici";
34
36
  readonly NO_TRANSACTIONS: "Žádné transakce";
35
37
  readonly COMING_SOON: "Připravujeme pro vás...";
@@ -42,6 +44,8 @@ export declare const UI_MESSAGES: {
42
44
  readonly PAYMENT_CONFIRMED: "Platba potvrzena!";
43
45
  readonly CONTINUE_SHOPPING: "Pokračovat v nákupu";
44
46
  readonly BACK_TO_PRODUCTS: "Zpět na produkty";
47
+ readonly RETRY: "Zkusit znovu";
48
+ readonly CANCEL: "Zrušit";
45
49
  };
46
50
  export declare const CSS_CLASSES: {
47
51
  readonly CONTAINER: "container";
@@ -56,8 +60,20 @@ export declare const CSS_CLASSES: {
56
60
  readonly ACTIVE: "active";
57
61
  readonly BUTTON_PRIMARY: "btn-primary";
58
62
  readonly BUTTON_SECONDARY: "btn-secondary";
63
+ readonly BUTTON_SUCCESS: "btn-success";
59
64
  readonly INPUT: "input";
60
65
  readonly CARD: "card";
66
+ readonly PAYMENT_CONTAINER: "payment-container";
67
+ readonly PAYMENT_HEADER: "payment-header";
68
+ readonly PAYMENT_METHODS: "payment-methods";
69
+ readonly PAYMENT_METHOD: "payment-method";
70
+ readonly PAYMENT_DETAILS: "payment-details";
71
+ readonly PAYMENT_ACTIONS: "payment-actions";
72
+ readonly LOADING_CONTAINER: "loading-container";
73
+ readonly LOADING_SPINNER: "loading-spinner";
74
+ readonly ERROR_CONTAINER: "error-container";
75
+ readonly BUTTON_GROUP: "button-group";
76
+ readonly BADGE_SUCCESS: "badge-success";
61
77
  readonly ONLINE: "online";
62
78
  readonly OFFLINE: "offline";
63
79
  readonly CONNECTED: "connected";
package/dist/constants.js CHANGED
@@ -34,6 +34,7 @@ export const UI_MESSAGES = {
34
34
  LOADING_PRODUCTS: 'Načítání produktů...',
35
35
  LOADING_PAYMENT: 'Zpracovávám platbu...',
36
36
  GENERATING_QR: 'Generuji QR kód...',
37
+ PAYMENT_INITIALIZING: 'Inicializuji platbu...',
37
38
  // Success messages
38
39
  PAYMENT_SUCCESS: 'Platba byla úspěšně zpracována!',
39
40
  PRODUCT_SAVED: 'Produkt byl úspěšně uložen!',
@@ -41,6 +42,7 @@ export const UI_MESSAGES = {
41
42
  NETWORK_ERROR: 'Problém s připojením. Zkuste to znovu.',
42
43
  VALIDATION_ERROR: 'Zkontrolujte zadané údaje.',
43
44
  UNKNOWN_ERROR: 'Něco se pokazilo. Zkuste to znovu.',
45
+ PAYMENT_ERROR: 'Chyba při zpracování platby',
44
46
  // Empty states
45
47
  NO_PRODUCTS: 'Žádné produkty nejsou k dispozici',
46
48
  NO_TRANSACTIONS: 'Žádné transakce',
@@ -56,6 +58,9 @@ export const UI_MESSAGES = {
56
58
  PAYMENT_CONFIRMED: 'Platba potvrzena!',
57
59
  CONTINUE_SHOPPING: 'Pokračovat v nákupu',
58
60
  BACK_TO_PRODUCTS: 'Zpět na produkty',
61
+ // Action buttons
62
+ RETRY: 'Zkusit znovu',
63
+ CANCEL: 'Zrušit',
59
64
  };
60
65
  export const CSS_CLASSES = {
61
66
  // Layout
@@ -73,8 +78,21 @@ export const CSS_CLASSES = {
73
78
  // Components
74
79
  BUTTON_PRIMARY: 'btn-primary',
75
80
  BUTTON_SECONDARY: 'btn-secondary',
81
+ BUTTON_SUCCESS: 'btn-success',
76
82
  INPUT: 'input',
77
83
  CARD: 'card',
84
+ // Payment specific
85
+ PAYMENT_CONTAINER: 'payment-container',
86
+ PAYMENT_HEADER: 'payment-header',
87
+ PAYMENT_METHODS: 'payment-methods',
88
+ PAYMENT_METHOD: 'payment-method',
89
+ PAYMENT_DETAILS: 'payment-details',
90
+ PAYMENT_ACTIONS: 'payment-actions',
91
+ LOADING_CONTAINER: 'loading-container',
92
+ LOADING_SPINNER: 'loading-spinner',
93
+ ERROR_CONTAINER: 'error-container',
94
+ BUTTON_GROUP: 'button-group',
95
+ BADGE_SUCCESS: 'badge-success',
78
96
  // Status indicators
79
97
  ONLINE: 'online',
80
98
  OFFLINE: 'offline',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-kiosk-shared",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "private": false,
5
5
  "description": "Shared components and utilities for Pi Kiosk system",
6
6
  "keywords": [