@multiplatform.one/keycloak 6.0.4 → 6.1.0
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/cjs/index.cjs +19 -6
- package/dist/cjs/index.native.cjs +717 -0
- package/dist/esm/index.js +18 -5
- package/dist/esm/index.native.js +684 -0
- package/package.json +14 -10
- package/src/Authenticated.tsx +3 -1
- package/src/Loading.tsx +10 -2
- package/src/betterAuth/expoAuthFlow.native.ts +187 -0
- package/src/frappeToken.native.ts +45 -0
- package/src/frappeToken.ts +10 -0
- package/src/index.ts +1 -0
- package/src/provider/KeycloakProvider.tsx +11 -0
- package/src/provider/authProvider/index.native.tsx +72 -64
- package/src/session/index.native.ts +32 -7
package/dist/cjs/index.cjs
CHANGED
|
@@ -40,6 +40,7 @@ __export(index_exports, {
|
|
|
40
40
|
KeycloakProvider: () => KeycloakProvider,
|
|
41
41
|
defaultAuthConfig: () => defaultAuthConfig,
|
|
42
42
|
getAllWalletAddresses: () => getAllWalletAddresses,
|
|
43
|
+
getKeycloakBearerToken: () => getKeycloakBearerToken,
|
|
43
44
|
getWalletAddresses: () => getWalletAddresses,
|
|
44
45
|
getWalletsFromToken: () => getWalletsFromToken,
|
|
45
46
|
hasWallets: () => hasWallets,
|
|
@@ -57,7 +58,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
57
58
|
// src/Authenticated.tsx
|
|
58
59
|
var import_platform6 = require("@multiplatform.one/platform");
|
|
59
60
|
var import_react8 = require("react");
|
|
60
|
-
var
|
|
61
|
+
var import_react_native = require("react-native");
|
|
61
62
|
|
|
62
63
|
// src/hooks/useAuthConfig.ts
|
|
63
64
|
var import_react2 = require("react");
|
|
@@ -434,11 +435,11 @@ function Authenticated({
|
|
|
434
435
|
if (disabled) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
435
436
|
if (typeof keycloak === "undefined") {
|
|
436
437
|
const LoadingComponent = loadingComponent;
|
|
437
|
-
return LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
438
|
+
return LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { children: authConfig.debug ? "loading" : null });
|
|
438
439
|
}
|
|
439
440
|
if (keycloak === null || keycloak.authenticated) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
440
441
|
const LoggedOutComponent = loggedOutComponent;
|
|
441
|
-
return LoggedOutComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoggedOutComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
442
|
+
return LoggedOutComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoggedOutComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { children: authConfig.debug ? "not authenticated" : null });
|
|
442
443
|
}
|
|
443
444
|
function withAuthenticated(Component, options = {}) {
|
|
444
445
|
return (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Authenticated, { ...options, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props }) });
|
|
@@ -506,13 +507,16 @@ var import_logger2 = require("@multiplatform.one/logger");
|
|
|
506
507
|
var import_react10 = require("react");
|
|
507
508
|
|
|
508
509
|
// src/Loading.tsx
|
|
509
|
-
var
|
|
510
|
+
var import_react_native2 = require("react-native");
|
|
510
511
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
511
512
|
function Loading({ loadingComponent }) {
|
|
512
513
|
const { debug } = useAuthConfig();
|
|
513
514
|
const LoadingComponent = loadingComponent;
|
|
514
515
|
if (typeof LoadingComponent === "undefined") {
|
|
515
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native2.View, { style: { flex: 1, alignItems: "center", justifyContent: "center" }, children: [
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native2.ActivityIndicator, {}),
|
|
518
|
+
debug ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native2.Text, { children: "loading" }) : null
|
|
519
|
+
] });
|
|
516
520
|
}
|
|
517
521
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LoadingComponent, {});
|
|
518
522
|
}
|
|
@@ -859,8 +863,10 @@ var import_react11 = require("react");
|
|
|
859
863
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
860
864
|
function KeycloakProvider({
|
|
861
865
|
baseUrl,
|
|
866
|
+
betterAuthBaseUrl,
|
|
862
867
|
children,
|
|
863
868
|
clientId,
|
|
869
|
+
expoScheme,
|
|
864
870
|
loginRedirectUri,
|
|
865
871
|
debug,
|
|
866
872
|
disabled,
|
|
@@ -880,9 +886,16 @@ function KeycloakProvider({
|
|
|
880
886
|
clientId: clientId || "app",
|
|
881
887
|
publicClientId,
|
|
882
888
|
realm: realm || "main",
|
|
883
|
-
url: baseUrl ?? ""
|
|
889
|
+
url: baseUrl ?? "",
|
|
890
|
+
betterAuthBaseUrl,
|
|
891
|
+
expoScheme
|
|
884
892
|
},
|
|
885
893
|
children
|
|
886
894
|
}
|
|
887
895
|
) });
|
|
888
896
|
}
|
|
897
|
+
|
|
898
|
+
// src/frappeToken.ts
|
|
899
|
+
async function getKeycloakBearerToken() {
|
|
900
|
+
return void 0;
|
|
901
|
+
}
|