@apptimate/core-lib 6.3.0 → 6.5.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apptimate/core-lib",
3
- "version": "6.3.0",
3
+ "version": "6.5.0",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "publishConfig": {
@@ -72,9 +72,14 @@ export const getAttendanceDays = async (employeeId: string | number, startDate:
72
72
  if (workforceId) params.workforce_id = workforceId;
73
73
  const queryParams = new URLSearchParams(params);
74
74
 
75
- const url = employeeId === 'me'
76
- ? `${BASE_URL}/ess/me/attendance/days?${queryParams.toString()}`
77
- : `${BASE_URL}/attendance/days?${queryParams.toString()}`;
75
+ let url = '';
76
+ if (employeeId === 0 && (projectId || workforceId)) {
77
+ url = `${process.env.NEXT_PUBLIC_API_URL}/api/construction/workforce/attendance-days?${queryParams.toString()}`;
78
+ } else {
79
+ url = employeeId === 'me'
80
+ ? `${BASE_URL}/ess/me/attendance/days?${queryParams.toString()}`
81
+ : `${BASE_URL}/attendance/days?${queryParams.toString()}`;
82
+ }
78
83
 
79
84
  const response = await sendRequest({ url, method: "GET" });
80
85
  return response.responseData as IApiResponse;
@@ -91,6 +91,7 @@ export const MENU_ITEM_REGISTRY: RegistryItem[] = [
91
91
  { key: 'core__terminals', label: 'Terminals', path: '/terminals', module: 'Core', defaultGroup: 'Resources', permission: 'terminal.view' },
92
92
  { key: 'core__currencies', label: 'Currencies', path: '/currencies', module: 'Core', defaultGroup: 'Resources', permission: 'currency.view' },
93
93
  { key: 'core__settings', label: 'Settings', path: '/settings', module: 'Core', defaultGroup: 'Configuration', permission: 'core_setting.view' },
94
+ { key: 'core__field_configs', label: 'Field Configurations', path: '/settings/field-configs', module: 'Core', defaultGroup: 'Configuration', permission: 'entity_field_config.view' },
94
95
  { key: 'core__email_services', label: 'Integrations', path: '/settings/integrations', module: 'Core', defaultGroup: 'Configuration', permission: 'email_connection.view' },
95
96
  { key: 'core__approval_workflows', label: 'Approval Workflows', path: '/settings/approvals', module: 'Core', defaultGroup: 'Configuration', permission: null },
96
97
 
@@ -390,7 +391,7 @@ export const MENU_PRESETS: MenuPreset[] = [
390
391
  'core__warehouses', 'core__terminals',
391
392
  'core__activity_logs', 'core__api_requests', 'core__feature_access_logs',
392
393
  'core__issue_logs', 'core__feature_registry', 'core__menu_config',
393
- 'core__printables', 'core__email_templates', 'core__template_groups', 'core__currencies', 'core__settings', 'core__email_services', 'core__approval_workflows',
394
+ 'core__printables', 'core__email_templates', 'core__template_groups', 'core__currencies', 'core__settings', 'core__field_configs', 'core__email_services', 'core__approval_workflows',
394
395
  ],
395
396
  },
396
397
  {
@@ -57,9 +57,18 @@ export function buildBrowserProxyUrl(rawUrl: string): string {
57
57
  }
58
58
 
59
59
  try {
60
+ // If rawUrl is undefined/api/... (due to missing process.env), fix it
61
+ if (rawUrl.startsWith('undefined/')) {
62
+ rawUrl = rawUrl.replace('undefined/', '/');
63
+ }
64
+
60
65
  const parsedUrl = new URL(rawUrl, window.location.origin);
61
66
 
62
67
  if (parsedUrl.origin === window.location.origin) {
68
+ if (parsedUrl.pathname.startsWith('/api/') && !parsedUrl.pathname.startsWith('/api/proxy') && !parsedUrl.pathname.startsWith('/api/session')) {
69
+ const proxyPath = parsedUrl.pathname.replace(/^\/+/, '');
70
+ return `/api/proxy/${proxyPath}${parsedUrl.search}`;
71
+ }
63
72
  return parsedUrl.toString();
64
73
  }
65
74