@ews-admin/global-design-system 1.1.22 → 1.1.24

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/index.js CHANGED
@@ -5,6 +5,61 @@ var React = require('react');
5
5
 
6
6
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
7
7
 
8
+ const LOCAL_PORTS = {
9
+ bff: 8082,
10
+ loginBff: 8080,
11
+ app: 3000,
12
+ login: 3001,
13
+ dashboard: 3002,
14
+ admin: 3008,
15
+ };
16
+ function buildUrls(environment) {
17
+ if (environment === "local") {
18
+ const domain = "medecine360local.com";
19
+ // APIs run at api.medecine360local.com (no "local." prefix)
20
+ // Frontend apps run at local.{app}.medecine360local.com
21
+ return {
22
+ bffUrl: `http://api.${domain}:${LOCAL_PORTS.bff}/bff/api/v1`,
23
+ loginBffUrl: `http://api.${domain}:${LOCAL_PORTS.loginBff}/login-bff/api/v1`,
24
+ appUrl: `http://local.app.${domain}:${LOCAL_PORTS.app}`,
25
+ loginUrl: `http://local.login.${domain}:${LOCAL_PORTS.login}`,
26
+ dashboardUrl: `http://local.dashboard.${domain}:${LOCAL_PORTS.dashboard}`,
27
+ adminUrl: `http://local.admin.${domain}:${LOCAL_PORTS.admin}`,
28
+ };
29
+ }
30
+ const prefix = environment === "prod" ? "" : `${environment}.`;
31
+ const domain = "medecine360.com";
32
+ return {
33
+ bffUrl: `https://${prefix}api.${domain}/bff/api/v1`,
34
+ loginBffUrl: `https://${prefix}api.${domain}/login-bff/api/v1`,
35
+ appUrl: `https://${prefix}app.${domain}`,
36
+ loginUrl: `https://${prefix}login.${domain}`,
37
+ dashboardUrl: `https://${prefix}dashboard.${domain}`,
38
+ adminUrl: `https://${prefix}admin.${domain}`,
39
+ };
40
+ }
41
+ /**
42
+ * Creates an environment configuration with all derived URLs.
43
+ *
44
+ * For deployed environments (dev, qa, prod), only the environment name is needed
45
+ * — all URLs follow a predictable convention.
46
+ *
47
+ * For local development, sensible defaults are provided but can be overridden
48
+ * (e.g. to point BFF URL at a mock server).
49
+ *
50
+ * @param env - The environment name (VITE_ENV value)
51
+ * @param overrides - Optional URL overrides (e.g. for local mock servers)
52
+ */
53
+ function createEnvConfig(env, overrides) {
54
+ const environment = (env || "local");
55
+ const derived = buildUrls(environment);
56
+ return {
57
+ env: environment,
58
+ ...derived,
59
+ ...overrides,
60
+ };
61
+ }
62
+
8
63
  /**
9
64
  * Default currency for price formatting
10
65
  */
@@ -2144,6 +2199,7 @@ exports.ThemeProvider = ThemeProvider;
2144
2199
  exports.ThemeToggle = ThemeToggle;
2145
2200
  exports.UserIcon = UserIcon;
2146
2201
  exports.cn = cn;
2202
+ exports.createEnvConfig = createEnvConfig;
2147
2203
  exports.debounce = debounce;
2148
2204
  exports.formatCurrency = formatCurrency;
2149
2205
  exports.formatDate = formatDate;