@propknot/shared-ui 1.0.17 → 1.0.18
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/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -389,7 +389,21 @@ var AuthProvider = ({ children }) => {
|
|
|
389
389
|
const { token, user: user2 } = response.data;
|
|
390
390
|
localStorage.setItem("token", token);
|
|
391
391
|
api_default.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
392
|
-
|
|
392
|
+
const normalizedUser = {
|
|
393
|
+
...user2,
|
|
394
|
+
id: user2._id || user2.id,
|
|
395
|
+
enabledFeatures: user2.enabledFeatures || {
|
|
396
|
+
workersModule: true,
|
|
397
|
+
inventoryModule: true,
|
|
398
|
+
advancedAnalytics: false,
|
|
399
|
+
aiAssistant: true
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
setUser(normalizedUser);
|
|
403
|
+
const isOwnerRole = normalizedUser.role === "owner";
|
|
404
|
+
const hasNoCompany = !normalizedUser.company || normalizedUser.company === null || normalizedUser.company === void 0;
|
|
405
|
+
console.log("Login onboarding check:", { isOwnerRole, hasNoCompany, company: normalizedUser.company });
|
|
406
|
+
setNeedsOnboarding(isOwnerRole && hasNoCompany);
|
|
393
407
|
return { success: true };
|
|
394
408
|
} catch (error) {
|
|
395
409
|
console.error("Login failed:", error);
|