@propknot/shared-ui 1.0.16 → 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 +17 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -293,7 +293,8 @@ var AuthProvider = ({ children }) => {
|
|
|
293
293
|
};
|
|
294
294
|
setUser(normalizedUser);
|
|
295
295
|
const isOwnerRole = normalizedUser.role === "owner";
|
|
296
|
-
const hasNoCompany = !normalizedUser.company;
|
|
296
|
+
const hasNoCompany = !normalizedUser.company || normalizedUser.company === null || normalizedUser.company === void 0;
|
|
297
|
+
console.log("Onboarding check:", { isOwnerRole, hasNoCompany, company: normalizedUser.company });
|
|
297
298
|
setNeedsOnboarding(isOwnerRole && hasNoCompany);
|
|
298
299
|
if (normalizedUser.role === "property_manager" || normalizedUser.role === "maintenance") {
|
|
299
300
|
try {
|
|
@@ -323,7 +324,21 @@ var AuthProvider = ({ children }) => {
|
|
|
323
324
|
const { token, user: user2 } = response.data;
|
|
324
325
|
localStorage.setItem("token", token);
|
|
325
326
|
api_default.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
326
|
-
|
|
327
|
+
const normalizedUser = {
|
|
328
|
+
...user2,
|
|
329
|
+
id: user2._id || user2.id,
|
|
330
|
+
enabledFeatures: user2.enabledFeatures || {
|
|
331
|
+
workersModule: true,
|
|
332
|
+
inventoryModule: true,
|
|
333
|
+
advancedAnalytics: false,
|
|
334
|
+
aiAssistant: true
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
setUser(normalizedUser);
|
|
338
|
+
const isOwnerRole = normalizedUser.role === "owner";
|
|
339
|
+
const hasNoCompany = !normalizedUser.company || normalizedUser.company === null || normalizedUser.company === void 0;
|
|
340
|
+
console.log("Login onboarding check:", { isOwnerRole, hasNoCompany, company: normalizedUser.company });
|
|
341
|
+
setNeedsOnboarding(isOwnerRole && hasNoCompany);
|
|
327
342
|
return { success: true };
|
|
328
343
|
} catch (error) {
|
|
329
344
|
console.error("Login failed:", error);
|