@kumori/aurora-backend-handler 1.1.102 → 1.1.104

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.102",
3
+ "version": "1.1.104",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "glob": "^11.0.0"
12
12
  },
13
13
  "dependencies": {
14
- "@kumori/aurora-interfaces": "^1.0.27",
14
+ "@kumori/aurora-interfaces": "^1.0.29",
15
15
  "@kumori/kumori-dsl-generator": "1.0.10",
16
16
  "@kumori/kumori-module-generator": "^1.1.6",
17
17
  "ts-node": "^10.9.2",
@@ -1,5 +1,6 @@
1
1
  import { v7 as uuidv7 } from "uuid";
2
2
  import { environment } from "./environment";
3
+ import { AccountStatus } from "@kumori/aurora-interfaces/enums/accountStatusEnum";
3
4
  import {
4
5
  Account,
5
6
  Channel,
@@ -662,6 +663,17 @@ export const closeGlobalWebSocketConnection = () => {
662
663
  });
663
664
  };
664
665
 
666
+ const computePromotionInfo = (
667
+ tenants: Tenant[],
668
+ ): { completedSteps: number; remainingDays: number } => {
669
+ const hasValidCredentialsAccount = tenants.some((tenant) =>
670
+ tenant.accounts?.some((account) => account.status === AccountStatus.ACTIVE),
671
+ );
672
+ const hasDeployedService = tenants.some((tenant) => tenant.services?.length > 0);
673
+ const completedSteps = (hasValidCredentialsAccount ? 1 : 0) + (hasDeployedService ? 1 : 0);
674
+ return { completedSteps, remainingDays: 7 };
675
+ };
676
+
665
677
  const rebuildHierarchy = () => {
666
678
  const preservedUserData = { ...userData };
667
679
 
@@ -716,6 +728,7 @@ const rebuildHierarchy = () => {
716
728
  notifications: preservedUserData.notifications || [],
717
729
  plans: preservedUserData.plans || [],
718
730
  discoveryMethod: preservedUserData.discoveryMethod,
731
+ promotionInfo: computePromotionInfo(Array.from(tenantsMap.values())),
719
732
  };
720
733
  };
721
734
  const handleEvent = async (message: WSMessage) => {
@@ -2151,6 +2164,7 @@ export const updateUserComplete = (updatedUserData: UserData): User => {
2151
2164
  status: updatedUserData.status,
2152
2165
  discoveryMethod:
2153
2166
  updatedUserData.discoveryMethod || userData.discoveryMethod,
2167
+ promotionInfo: computePromotionInfo(updatedUserData.tenants || userData.tenants || []),
2154
2168
  };
2155
2169
  user = new User(
2156
2170
  userData,