tenneo-auth-plugin 0.1.9 → 0.1.10
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/README.md +1 -0
- package/dist/index.d.mts +77 -75
- package/dist/index.d.ts +77 -75
- package/dist/index.js +22 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2876,6 +2876,7 @@ function createAuthEngine(config) {
|
|
|
2876
2876
|
function AuthProvider({
|
|
2877
2877
|
children,
|
|
2878
2878
|
autoInit = true,
|
|
2879
|
+
config,
|
|
2879
2880
|
tenantCode,
|
|
2880
2881
|
apiBaseUrl,
|
|
2881
2882
|
authServerUrl,
|
|
@@ -2883,7 +2884,11 @@ function AuthProvider({
|
|
|
2883
2884
|
appId = "",
|
|
2884
2885
|
storageAdapter
|
|
2885
2886
|
}) {
|
|
2886
|
-
const
|
|
2887
|
+
const mergedTenantCode = tenantCode ?? config?.tenantCode;
|
|
2888
|
+
const mergedApiBaseUrl = apiBaseUrl ?? config?.apiBaseUrl;
|
|
2889
|
+
const mergedAuthServerUrl = authServerUrl ?? config?.authServerUrl;
|
|
2890
|
+
const mergedCallbackUrl = callbackUrl ?? config?.callbackUrl;
|
|
2891
|
+
const resolvedTenantKey = mergedTenantCode ?? Config.getClientCode();
|
|
2887
2892
|
const namespace = useMemo(
|
|
2888
2893
|
() => ({ tenantId: resolvedTenantKey ?? "", appId: appId ?? "" }),
|
|
2889
2894
|
[resolvedTenantKey, appId]
|
|
@@ -2892,39 +2897,39 @@ function AuthProvider({
|
|
|
2892
2897
|
const engineRef = useRef(null);
|
|
2893
2898
|
useLayoutEffect(() => {
|
|
2894
2899
|
logger.debug("[AuthProvider] Host config props", {
|
|
2895
|
-
tenantCode:
|
|
2896
|
-
apiBaseUrl:
|
|
2897
|
-
authServerUrl:
|
|
2898
|
-
callbackUrl:
|
|
2900
|
+
tenantCode: mergedTenantCode ?? "(not provided)",
|
|
2901
|
+
apiBaseUrl: mergedApiBaseUrl ? mergedApiBaseUrl : "(empty)",
|
|
2902
|
+
authServerUrl: mergedAuthServerUrl ? mergedAuthServerUrl : "(empty)",
|
|
2903
|
+
callbackUrl: mergedCallbackUrl ? mergedCallbackUrl : "(empty)"
|
|
2899
2904
|
});
|
|
2900
|
-
if (!
|
|
2905
|
+
if (!mergedAuthServerUrl || !mergedAuthServerUrl.trim()) {
|
|
2901
2906
|
logger.warn("[AuthProvider] authServerUrl missing from host props");
|
|
2902
2907
|
}
|
|
2903
|
-
if (!
|
|
2908
|
+
if (!mergedCallbackUrl || !mergedCallbackUrl.trim()) {
|
|
2904
2909
|
logger.warn("[AuthProvider] callbackUrl missing from host props");
|
|
2905
2910
|
}
|
|
2906
2911
|
setConfig({
|
|
2907
|
-
...
|
|
2908
|
-
...
|
|
2909
|
-
...
|
|
2910
|
-
...
|
|
2912
|
+
...mergedTenantCode ? { tenantCode: mergedTenantCode } : {},
|
|
2913
|
+
...mergedApiBaseUrl ? { apiBaseUrl: mergedApiBaseUrl } : {},
|
|
2914
|
+
...mergedAuthServerUrl ? { authServerUrl: mergedAuthServerUrl } : {},
|
|
2915
|
+
...mergedCallbackUrl ? { callbackUrl: mergedCallbackUrl } : {}
|
|
2911
2916
|
});
|
|
2912
2917
|
return () => {
|
|
2913
2918
|
clearConfigOverrides();
|
|
2914
2919
|
};
|
|
2915
|
-
}, [
|
|
2920
|
+
}, [mergedTenantCode, mergedApiBaseUrl, mergedAuthServerUrl, mergedCallbackUrl]);
|
|
2916
2921
|
useEffect(() => {
|
|
2917
2922
|
try {
|
|
2918
2923
|
const payload = {
|
|
2919
|
-
tenantCode:
|
|
2920
|
-
apiBaseUrl:
|
|
2921
|
-
authServerUrl:
|
|
2922
|
-
callbackUrl:
|
|
2924
|
+
tenantCode: mergedTenantCode ?? "",
|
|
2925
|
+
apiBaseUrl: mergedApiBaseUrl ?? "",
|
|
2926
|
+
authServerUrl: mergedAuthServerUrl ?? "",
|
|
2927
|
+
callbackUrl: mergedCallbackUrl ?? ""
|
|
2923
2928
|
};
|
|
2924
2929
|
setStorage(getStorageKey("host_config"), JSON.stringify(payload));
|
|
2925
2930
|
} catch {
|
|
2926
2931
|
}
|
|
2927
|
-
}, [
|
|
2932
|
+
}, [mergedTenantCode, mergedApiBaseUrl, mergedAuthServerUrl, mergedCallbackUrl]);
|
|
2928
2933
|
useLayoutEffect(() => {
|
|
2929
2934
|
setStorageKeyPrefix(resolvedTenantKey ?? "");
|
|
2930
2935
|
const adapter = storageAdapter !== void 0 && storageAdapter !== null ? storageAdapter : createSecureSessionStorageAdapter(namespace);
|