@ollaid/native-sso 2.7.9 → 2.8.1
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/components/AvatarCropModal.d.ts +1 -1
- package/dist/components/DebugPanel.d.ts +1 -1
- package/dist/components/LoginModal.d.ts +2 -2
- package/dist/components/NativeSSOPage.d.ts +1 -1
- package/dist/components/OnboardingModal.d.ts +1 -1
- package/dist/components/PasswordRecoveryModal.d.ts +1 -1
- package/dist/components/SignupModal.d.ts +2 -2
- package/dist/components/ui.d.ts +1 -1
- package/dist/hooks/useLogout.d.ts +1 -1
- package/dist/hooks/useMobilePassword.d.ts +1 -1
- package/dist/hooks/useMobileRegistration.d.ts +1 -1
- package/dist/hooks/useNativeAuth.d.ts +3 -3
- package/dist/hooks/useTokenHealthCheck.d.ts +2 -2
- package/dist/index.cjs +33 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -22
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/services/api.d.ts +5 -5
- package/dist/services/debugLogger.d.ts +1 -1
- package/dist/services/iamAccount.d.ts +1 -1
- package/dist/services/mobilePassword.d.ts +1 -1
- package/dist/services/mobileRegistration.d.ts +1 -1
- package/dist/services/nativeAuth.d.ts +1 -1
- package/dist/services/profile.d.ts +1 -1
- package/dist/services/profileChange.d.ts +1 -1
- package/dist/services/profileMedia.d.ts +1 -1
- package/dist/types/mobile.d.ts +1 -1
- package/dist/types/native.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8888,6 +8888,25 @@ function useTokenHealthCheck(options) {
|
|
|
8888
8888
|
};
|
|
8889
8889
|
}, [enabled, saasApiUrl, performCheck, debug]);
|
|
8890
8890
|
}
|
|
8891
|
+
function normalizeNativeUser(user) {
|
|
8892
|
+
if (!user) return null;
|
|
8893
|
+
const input = user;
|
|
8894
|
+
return {
|
|
8895
|
+
reference: input.reference ?? input.iam_reference ?? input.alias_reference ?? "",
|
|
8896
|
+
name: input.name ?? "",
|
|
8897
|
+
email: input.email ?? void 0,
|
|
8898
|
+
phone: input.phone,
|
|
8899
|
+
ccphone: input.ccphone,
|
|
8900
|
+
image_url: input.image_url ?? input.image,
|
|
8901
|
+
account_type: input.account_type,
|
|
8902
|
+
town: input.town,
|
|
8903
|
+
country: input.country,
|
|
8904
|
+
address: input.address,
|
|
8905
|
+
auth_2fa: input.auth_2fa,
|
|
8906
|
+
alias_reference: input.alias_reference,
|
|
8907
|
+
iam_reference: input.iam_reference
|
|
8908
|
+
};
|
|
8909
|
+
}
|
|
8891
8910
|
function saveSession(exchangeResult, accountType) {
|
|
8892
8911
|
var _a, _b;
|
|
8893
8912
|
const storage = getNativeStorage();
|
|
@@ -9004,7 +9023,8 @@ function useNativeAuth(options) {
|
|
|
9004
9023
|
if (storedRaw) {
|
|
9005
9024
|
try {
|
|
9006
9025
|
const stored = JSON.parse(storedRaw);
|
|
9007
|
-
const merged = { ...stored, ...userInfos };
|
|
9026
|
+
const merged = normalizeNativeUser({ ...stored, ...userInfos });
|
|
9027
|
+
if (!merged) return;
|
|
9008
9028
|
getNativeStorage().setItem(STORAGE.USER, JSON.stringify(merged));
|
|
9009
9029
|
setState((prev) => ({ ...prev, user: merged }));
|
|
9010
9030
|
} catch {
|
|
@@ -9027,13 +9047,10 @@ function useNativeAuth(options) {
|
|
|
9027
9047
|
}
|
|
9028
9048
|
const res = await nativeAuthService.refresh();
|
|
9029
9049
|
if (res.success) {
|
|
9030
|
-
const
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
setState((prev) => ({ ...prev, user, status: "completed" }));
|
|
9035
|
-
} catch {
|
|
9036
|
-
}
|
|
9050
|
+
const snapshot = getSsoSessionSnapshot();
|
|
9051
|
+
const user = normalizeNativeUser(snapshot.user);
|
|
9052
|
+
if (user) {
|
|
9053
|
+
setState((prev) => ({ ...prev, user, status: "completed" }));
|
|
9037
9054
|
}
|
|
9038
9055
|
return "recovered";
|
|
9039
9056
|
}
|
|
@@ -9072,16 +9089,10 @@ function useNativeAuth(options) {
|
|
|
9072
9089
|
return () => clearTimeout(t);
|
|
9073
9090
|
}, [state.status, state.user, tryRefreshSession]);
|
|
9074
9091
|
useEffect(() => {
|
|
9075
|
-
const
|
|
9076
|
-
const
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
try {
|
|
9080
|
-
const user = JSON.parse(storedUser);
|
|
9081
|
-
setState((prev) => ({ ...prev, user, status: "completed" }));
|
|
9082
|
-
} catch {
|
|
9083
|
-
clearSession();
|
|
9084
|
-
}
|
|
9092
|
+
const snapshot = getSsoSessionSnapshot();
|
|
9093
|
+
const user = normalizeNativeUser(snapshot.user);
|
|
9094
|
+
if (snapshot.authToken && user) {
|
|
9095
|
+
setState((prev) => ({ ...prev, user, status: "completed" }));
|
|
9085
9096
|
}
|
|
9086
9097
|
}, []);
|
|
9087
9098
|
useEffect(() => {
|
|
@@ -13494,8 +13505,8 @@ const PasswordRedirectModal = ({ open, onOpenChange, saasApiUrl, iamApiUrl }) =>
|
|
|
13494
13505
|
/* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { style: { maxWidth: "28rem", borderRadius: "16px", background: "#fff" }, children: [
|
|
13495
13506
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
13496
13507
|
/* @__PURE__ */ jsx("div", { style: { margin: "0 auto 12px", width: 56, height: 56, borderRadius: "50%", background: "rgba(232, 67, 10, 0.1)", display: "flex", alignItems: "center", justifyContent: "center", color: "#e8430a" }, children: /* @__PURE__ */ jsx(LockKeyhole, { size: 28 }) }),
|
|
13497
|
-
/* @__PURE__ */ jsx(DialogTitle, {
|
|
13498
|
-
/* @__PURE__ */ jsx(DialogDescription, {
|
|
13508
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-center", children: "Mot de passe géré par OLLAID SSO" }),
|
|
13509
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-center", children: "Ce bouton sert à tester la redirection vers IAM et l'ouverture du modal de changement de mot de passe." })
|
|
13499
13510
|
] }),
|
|
13500
13511
|
/* @__PURE__ */ jsxs("div", { style: { border: "1px solid #e5e7eb", borderRadius: 12, padding: 16, background: "#f8fafc", color: "#475569", fontSize: 13, display: "grid", gap: 8 }, children: [
|
|
13501
13512
|
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8, alignItems: "flex-start" }, children: [
|
|
@@ -13521,8 +13532,8 @@ const PasswordRedirectModal = ({ open, onOpenChange, saasApiUrl, iamApiUrl }) =>
|
|
|
13521
13532
|
}
|
|
13522
13533
|
}, children: /* @__PURE__ */ jsxs(DialogContent, { style: { maxWidth: "26rem", borderRadius: "16px", background: "#fff" }, children: [
|
|
13523
13534
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
13524
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Êtes-vous sûr de rediriger vers le SSO ?" }),
|
|
13525
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "Cette action ouvre IAM dans un nouvel onglet et prépare l'auto-connexion pour tester le changement de mot de passe." })
|
|
13535
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-center", children: "Êtes-vous sûr de rediriger vers le SSO ?" }),
|
|
13536
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-center", children: "Cette action ouvre IAM dans un nouvel onglet et prépare l'auto-connexion pour tester le changement de mot de passe." })
|
|
13526
13537
|
] }),
|
|
13527
13538
|
errorMessage && /* @__PURE__ */ jsx("div", { style: { border: "1px solid #fecaca", background: "#fef2f2", color: "#b91c1c", borderRadius: 12, padding: 12, fontSize: 13 }, children: errorMessage }),
|
|
13528
13539
|
loading && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 10, padding: "8px 0 4px" }, children: [
|