@aakash58/chatbot 1.1.10 → 1.1.12
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.
|
@@ -4305,46 +4305,28 @@ class LicenseService {
|
|
|
4305
4305
|
* Returns the key for 'doohbot' or null if not found.
|
|
4306
4306
|
*/
|
|
4307
4307
|
resolveTenantLicenseKey(appBaseUrl) {
|
|
4308
|
-
//
|
|
4309
|
-
const hostname = window.location.hostname;
|
|
4310
|
-
const protocol = window.location.protocol;
|
|
4311
|
-
const port = window.location.port ? `:${window.location.port}` : '';
|
|
4312
|
-
const currentUrl = `${protocol}//${hostname}${port}`;
|
|
4313
|
-
// Use provided appBaseUrl or fallback to AppConst
|
|
4314
|
-
const finalAppBaseUrl = appBaseUrl || AppConst.data?.appBaseUrl;
|
|
4315
|
-
// Resolve tenancy name
|
|
4308
|
+
// Attempt to resolve tenancy name using ABP utility
|
|
4316
4309
|
let tenancyName = null;
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
const match = currentUrl.match(regex);
|
|
4322
|
-
tenancyName = match?.[1] ?? null;
|
|
4310
|
+
try {
|
|
4311
|
+
tenancyName =
|
|
4312
|
+
window.AppPreBootstrap?.resolveTenancyName(window.AppConsts?.appBaseUrl || appBaseUrl) ||
|
|
4313
|
+
null;
|
|
4323
4314
|
}
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
const parts = hostname.split('.');
|
|
4327
|
-
if (parts.length > 2)
|
|
4328
|
-
tenancyName = parts[0];
|
|
4315
|
+
catch (e) {
|
|
4316
|
+
Logger.error('[LicenseService] Error resolving tenancy name:', e);
|
|
4329
4317
|
}
|
|
4330
|
-
|
|
4318
|
+
Logger.info('[LicenseService] Detected tenancy name:', tenancyName);
|
|
4331
4319
|
if (!tenancyName) {
|
|
4332
4320
|
Logger.log('[LicenseService] Could not resolve tenancy name.');
|
|
4333
4321
|
return null;
|
|
4334
4322
|
}
|
|
4335
|
-
Logger.
|
|
4336
|
-
// Lookup license key in registry
|
|
4337
|
-
const
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
// Return the 'doohbot' license if it exists
|
|
4343
|
-
if (tenantLicenses?.['doohbot']) {
|
|
4344
|
-
Logger.log(`[LicenseService] Found key for tenant: ${tenancyName}`);
|
|
4345
|
-
return tenantLicenses['doohbot'];
|
|
4346
|
-
}
|
|
4347
|
-
return null;
|
|
4323
|
+
Logger.info(`[LicenseService] Detected tenant: ${tenancyName}`);
|
|
4324
|
+
// Lookup license key in registry
|
|
4325
|
+
const tenantLicenses = this.registry()?.subjectLicenses.get(`tenant:${tenancyName}`);
|
|
4326
|
+
const licenseKey = tenantLicenses?.['doohbot'] || null;
|
|
4327
|
+
if (licenseKey)
|
|
4328
|
+
Logger.log(`[LicenseService] Found Doohbot license for tenant: ${tenancyName}`);
|
|
4329
|
+
return licenseKey;
|
|
4348
4330
|
}
|
|
4349
4331
|
/**
|
|
4350
4332
|
* Check if a registry is currently loaded
|