@laiye_packages/uci 1.0.4 → 1.0.5
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/app/base/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export declare class LYBaseApp extends LYObject {
|
|
|
71
71
|
protected _createHttpClient(): LYAppHttpClient;
|
|
72
72
|
load(): Promise<void>;
|
|
73
73
|
protected doLoad(): Promise<void>;
|
|
74
|
+
protected getBaseUrl(): string;
|
|
74
75
|
private initI18n;
|
|
75
76
|
getI18nResourceUrl(relativeUrl: string, lang?: LYKeyofLang): string;
|
|
76
77
|
getComponent<T>(componentName: string): Promise<T>;
|
|
@@ -26,6 +26,5 @@ declare class LYOrganizationApp extends LYBaseApp {
|
|
|
26
26
|
protected doLoad(): Promise<void>;
|
|
27
27
|
private mergeOEM;
|
|
28
28
|
getAuthorizer<T extends LYBaseAuthorizer = LYBaseAuthorizer>(name?: string): T;
|
|
29
|
-
private getBaseUrl;
|
|
30
29
|
}
|
|
31
30
|
export { LYOrganizationApp, SSOConfig };
|
|
@@ -12,6 +12,7 @@ declare class LYTenantApp extends LYBaseApp {
|
|
|
12
12
|
private _authorizer;
|
|
13
13
|
constructor(name: string, version: string, description: string);
|
|
14
14
|
_createHttpClient(): LYAppHttpClient;
|
|
15
|
+
getBaseUrl(): string;
|
|
15
16
|
static get instance(): LYTenantApp;
|
|
16
17
|
get tenantApi(): LYTenantApi;
|
|
17
18
|
get userApi(): LYUserApi;
|
package/dist/index.js
CHANGED
|
@@ -10671,6 +10671,7 @@ class base_LYBaseApp extends LYObject {
|
|
|
10671
10671
|
this._sessionStore = new LYSessionStorage(prefix);
|
|
10672
10672
|
this._cloudStore = new LYCloudStorage(prefix);
|
|
10673
10673
|
this._env = new LYEnv(this._name);
|
|
10674
|
+
this.env.baseUrl = this.getBaseUrl();
|
|
10674
10675
|
this._httpClient = this._createHttpClient();
|
|
10675
10676
|
}
|
|
10676
10677
|
get location() {
|
|
@@ -10737,6 +10738,50 @@ class base_LYBaseApp extends LYObject {
|
|
|
10737
10738
|
async doLoad() {
|
|
10738
10739
|
await this.initI18n();
|
|
10739
10740
|
}
|
|
10741
|
+
getBaseUrl() {
|
|
10742
|
+
const config = LYConfig.get();
|
|
10743
|
+
const url = new URL(window.location.href);
|
|
10744
|
+
let baseUrl = "";
|
|
10745
|
+
for (const pattern of config.host_patterns){
|
|
10746
|
+
if (!pattern.includes("{tenant_name}") && pattern.startsWith(url.origin)) {
|
|
10747
|
+
const parts = url.pathname.split('/');
|
|
10748
|
+
const index = parts.findIndex((part)=>'view' === part);
|
|
10749
|
+
let tenantName = parts[index + 2];
|
|
10750
|
+
if (!tenantName) throw new Error('tenantName not found');
|
|
10751
|
+
baseUrl = `${pattern}/view/${this.name}/${tenantName}`;
|
|
10752
|
+
this._tenantName = tenantName;
|
|
10753
|
+
return baseUrl;
|
|
10754
|
+
}
|
|
10755
|
+
let filterhost = pattern.replace(/\./g, "\\.").replace("{tenant_name}", "([a-zA-Z0-9_\\-]+)");
|
|
10756
|
+
const reg = new RegExp(`^${filterhost}(?::\\d+)?(?:/.*)?$`);
|
|
10757
|
+
const matched = url.toString().match(reg);
|
|
10758
|
+
if (matched && matched[1]) {
|
|
10759
|
+
const tenantName = matched[1];
|
|
10760
|
+
const host = pattern.replace("{tenant_name}", tenantName);
|
|
10761
|
+
baseUrl = `${host}/view/${this.name}`;
|
|
10762
|
+
this._tenantName = tenantName;
|
|
10763
|
+
return baseUrl;
|
|
10764
|
+
}
|
|
10765
|
+
}
|
|
10766
|
+
try {
|
|
10767
|
+
if ('development' === process.env.NODE_ENV) {
|
|
10768
|
+
baseUrl = `${window.origin}/view/${this.name}/laiye`;
|
|
10769
|
+
this._tenantName = "laiye";
|
|
10770
|
+
return baseUrl;
|
|
10771
|
+
}
|
|
10772
|
+
const parts = url.pathname.split('/');
|
|
10773
|
+
const index = parts.findIndex((part)=>'view' === part);
|
|
10774
|
+
if (-1 === index) throw new Error('view not found in URL');
|
|
10775
|
+
let tenantName = parts[index + 2];
|
|
10776
|
+
if (!tenantName) throw new Error('tenantName not found');
|
|
10777
|
+
baseUrl = `${window.origin}/view/${this.name}/${tenantName}`;
|
|
10778
|
+
this._tenantName = tenantName;
|
|
10779
|
+
return baseUrl;
|
|
10780
|
+
} catch (error) {
|
|
10781
|
+
console.error('Error getting base URL:', error);
|
|
10782
|
+
}
|
|
10783
|
+
return window.origin;
|
|
10784
|
+
}
|
|
10740
10785
|
async initI18n() {
|
|
10741
10786
|
try {
|
|
10742
10787
|
const resources = await this.provider.provideI18nResource(this);
|
|
@@ -11250,7 +11295,6 @@ function app_ts_metadata(k, v) {
|
|
|
11250
11295
|
class LYOrganizationApp extends base_LYBaseApp {
|
|
11251
11296
|
constructor(name1, version, description){
|
|
11252
11297
|
super(name1, version, description);
|
|
11253
|
-
this.env.baseUrl = this.getBaseUrl();
|
|
11254
11298
|
LYOrganizationApp._instance = this;
|
|
11255
11299
|
this._sessionApi = new session_LYSessionApi(this.httpClient);
|
|
11256
11300
|
this._userApi = new LYUserApi(this.httpClient);
|
|
@@ -11315,50 +11359,6 @@ class LYOrganizationApp extends base_LYBaseApp {
|
|
|
11315
11359
|
if (!this._authorizers[type]) throw new Error(`Authorizer ${type} not found`);
|
|
11316
11360
|
return this._authorizers[type];
|
|
11317
11361
|
}
|
|
11318
|
-
getBaseUrl() {
|
|
11319
|
-
const config = LYConfig.get();
|
|
11320
|
-
const url = new URL(window.location.href);
|
|
11321
|
-
let baseUrl = "";
|
|
11322
|
-
for (const pattern of config.host_patterns){
|
|
11323
|
-
if (!pattern.includes("{tenant_name}") && pattern.startsWith(url.origin)) {
|
|
11324
|
-
const parts = url.pathname.split('/');
|
|
11325
|
-
const index = parts.findIndex((part)=>'view' === part);
|
|
11326
|
-
let tenantName = parts[index + 2];
|
|
11327
|
-
if (!tenantName) throw new Error('tenantName not found');
|
|
11328
|
-
baseUrl = `${pattern}/view/${this.name}/${tenantName}`;
|
|
11329
|
-
this._tenantName = tenantName;
|
|
11330
|
-
return baseUrl;
|
|
11331
|
-
}
|
|
11332
|
-
let filterhost = pattern.replace(/\./g, "\\.").replace("{tenant_name}", "([a-zA-Z0-9_\\-]+)");
|
|
11333
|
-
const reg = new RegExp(`^${filterhost}(?::\\d+)?(?:/.*)?$`);
|
|
11334
|
-
const matched = url.toString().match(reg);
|
|
11335
|
-
if (matched && matched[1]) {
|
|
11336
|
-
const tenantName = matched[1];
|
|
11337
|
-
const host = pattern.replace("{tenant_name}", tenantName);
|
|
11338
|
-
baseUrl = `${host}/view/${this.name}`;
|
|
11339
|
-
this._tenantName = tenantName;
|
|
11340
|
-
return baseUrl;
|
|
11341
|
-
}
|
|
11342
|
-
}
|
|
11343
|
-
try {
|
|
11344
|
-
if ('development' === process.env.NODE_ENV) {
|
|
11345
|
-
baseUrl = `${window.origin}/view/${this.name}/laiye`;
|
|
11346
|
-
this._tenantName = "laiye";
|
|
11347
|
-
return baseUrl;
|
|
11348
|
-
}
|
|
11349
|
-
const parts = url.pathname.split('/');
|
|
11350
|
-
const index = parts.findIndex((part)=>'view' === part);
|
|
11351
|
-
if (-1 === index) throw new Error('view not found in URL');
|
|
11352
|
-
let tenantName = parts[index + 2];
|
|
11353
|
-
if (!tenantName) throw new Error('tenantName not found');
|
|
11354
|
-
baseUrl = `${window.origin}/view/${this.name}/${tenantName}`;
|
|
11355
|
-
this._tenantName = tenantName;
|
|
11356
|
-
return baseUrl;
|
|
11357
|
-
} catch (error) {
|
|
11358
|
-
console.error('Error getting base URL:', error);
|
|
11359
|
-
}
|
|
11360
|
-
return window.origin;
|
|
11361
|
-
}
|
|
11362
11362
|
}
|
|
11363
11363
|
LYOrganizationApp = app_ts_decorate([
|
|
11364
11364
|
register('LYOrganizationApp'),
|
|
@@ -11734,6 +11734,9 @@ class LYTenantApp extends base_LYBaseApp {
|
|
|
11734
11734
|
}
|
|
11735
11735
|
});
|
|
11736
11736
|
}
|
|
11737
|
+
getBaseUrl() {
|
|
11738
|
+
return window.origin;
|
|
11739
|
+
}
|
|
11737
11740
|
static get instance() {
|
|
11738
11741
|
if (!LYTenantApp._instance) throw new Error('LYTenantApp not initialized');
|
|
11739
11742
|
return LYTenantApp._instance;
|