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

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,60 @@ 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 base = "http://local";
19
+ const domain = "medecine360local.com";
20
+ return {
21
+ bffUrl: `${base}.api.${domain}:${LOCAL_PORTS.bff}/bff/api/v1`,
22
+ loginBffUrl: `${base}.api.${domain}:${LOCAL_PORTS.loginBff}/login-bff/api/v1`,
23
+ appUrl: `${base}.app.${domain}:${LOCAL_PORTS.app}`,
24
+ loginUrl: `${base}.login.${domain}:${LOCAL_PORTS.login}`,
25
+ dashboardUrl: `${base}.dashboard.${domain}:${LOCAL_PORTS.dashboard}`,
26
+ adminUrl: `${base}.admin.${domain}:${LOCAL_PORTS.admin}`,
27
+ };
28
+ }
29
+ const prefix = environment === "prod" ? "" : `${environment}.`;
30
+ const domain = "medecine360.com";
31
+ return {
32
+ bffUrl: `https://${prefix}api.${domain}/bff/api/v1`,
33
+ loginBffUrl: `https://${prefix}api.${domain}/login-bff/api/v1`,
34
+ appUrl: `https://${prefix}app.${domain}`,
35
+ loginUrl: `https://${prefix}login.${domain}`,
36
+ dashboardUrl: `https://${prefix}dashboard.${domain}`,
37
+ adminUrl: `https://${prefix}admin.${domain}`,
38
+ };
39
+ }
40
+ /**
41
+ * Creates an environment configuration with all derived URLs.
42
+ *
43
+ * For deployed environments (dev, qa, prod), only the environment name is needed
44
+ * — all URLs follow a predictable convention.
45
+ *
46
+ * For local development, sensible defaults are provided but can be overridden
47
+ * (e.g. to point BFF URL at a mock server).
48
+ *
49
+ * @param env - The environment name (VITE_ENV value)
50
+ * @param overrides - Optional URL overrides (e.g. for local mock servers)
51
+ */
52
+ function createEnvConfig(env, overrides) {
53
+ const environment = (env || "local");
54
+ const derived = buildUrls(environment);
55
+ return {
56
+ env: environment,
57
+ ...derived,
58
+ ...overrides,
59
+ };
60
+ }
61
+
8
62
  /**
9
63
  * Default currency for price formatting
10
64
  */
@@ -2144,6 +2198,7 @@ exports.ThemeProvider = ThemeProvider;
2144
2198
  exports.ThemeToggle = ThemeToggle;
2145
2199
  exports.UserIcon = UserIcon;
2146
2200
  exports.cn = cn;
2201
+ exports.createEnvConfig = createEnvConfig;
2147
2202
  exports.debounce = debounce;
2148
2203
  exports.formatCurrency = formatCurrency;
2149
2204
  exports.formatDate = formatDate;