@twentyhq/teams 1.1.2 → 1.2.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.
Files changed (50) hide show
  1. package/dependencies/yarn.lock +723 -3
  2. package/manifest.json +46 -29
  3. package/package.json +4 -2
  4. package/src/features/chat/logic-functions/teams-activities-enqueue.mjs +366 -152
  5. package/src/features/chat/logic-functions/teams-activities-enqueue.mjs.map +4 -4
  6. package/src/features/chat/logic-functions/teams-activities-enqueue.ts +1 -1
  7. package/src/features/chat/logic-functions/teams-activities-resolver.mjs +500 -40
  8. package/src/features/chat/logic-functions/teams-activities-resolver.mjs.map +4 -4
  9. package/src/features/chat/logic-functions/teams-activities-resolver.ts +13 -2
  10. package/src/features/chat/logic-functions/teams-list-unlinked-users.mjs +95 -61
  11. package/src/features/chat/logic-functions/teams-list-unlinked-users.mjs.map +4 -4
  12. package/src/features/chat/logic-functions/teams-match-user-links.mjs +105 -86
  13. package/src/features/chat/logic-functions/teams-match-user-links.mjs.map +4 -4
  14. package/src/features/chat/logic-functions/teams-register-connection.mjs +119 -101
  15. package/src/features/chat/logic-functions/teams-register-connection.mjs.map +4 -4
  16. package/src/features/chat/logic-functions/teams-register-connection.ts +1 -1
  17. package/src/features/chat/logic-functions/teams-search-users.mjs +96 -62
  18. package/src/features/chat/logic-functions/teams-search-users.mjs.map +4 -4
  19. package/src/features/chat/logic-functions/teams-set-user-link.mjs +88 -54
  20. package/src/features/chat/logic-functions/teams-set-user-link.mjs.map +4 -4
  21. package/src/features/chat/logic-functions/teams-tenant-release.mjs +72 -41
  22. package/src/features/chat/logic-functions/teams-tenant-release.mjs.map +4 -4
  23. package/src/features/transcripts/logic-functions/teams-count-transcript-history.mjs +99 -68
  24. package/src/features/transcripts/logic-functions/teams-count-transcript-history.mjs.map +4 -4
  25. package/src/features/transcripts/logic-functions/teams-import-transcript-history.mjs +99 -68
  26. package/src/features/transcripts/logic-functions/teams-import-transcript-history.mjs.map +4 -4
  27. package/src/features/transcripts/logic-functions/teams-import-transcript.mjs +96 -65
  28. package/src/features/transcripts/logic-functions/teams-import-transcript.mjs.map +4 -4
  29. package/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.mjs +89 -58
  30. package/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.mjs.map +4 -4
  31. package/src/features/transcripts/logic-functions/teams-sync-transcript.mjs +96 -65
  32. package/src/features/transcripts/logic-functions/teams-sync-transcript.mjs.map +4 -4
  33. package/src/features/transcripts/logic-functions/teams-transcript-history-count.mjs +0 -1
  34. package/src/features/transcripts/logic-functions/teams-transcript-history-count.mjs.map +2 -2
  35. package/src/features/transcripts/logic-functions/teams-transcript-history-import.mjs +0 -1
  36. package/src/features/transcripts/logic-functions/teams-transcript-history-import.mjs.map +2 -2
  37. package/src/features/transcripts/logic-functions/teams-transcript-history-status.mjs +0 -1
  38. package/src/features/transcripts/logic-functions/teams-transcript-history-status.mjs.map +2 -2
  39. package/src/features/transcripts/logic-functions/teams-transcripts-webhook.mjs +104 -73
  40. package/src/features/transcripts/logic-functions/teams-transcripts-webhook.mjs.map +4 -4
  41. package/src/features/transcripts/logic-functions/teams-uninstall.mjs +72 -41
  42. package/src/features/transcripts/logic-functions/teams-uninstall.mjs.map +4 -4
  43. package/src/front-components/settings.front-component.mjs +113 -113
  44. package/src/front-components/settings.front-component.mjs.map +4 -4
  45. package/src/logic-functions/teams-health-check.mjs +46 -25
  46. package/src/logic-functions/teams-health-check.mjs.map +4 -4
  47. package/src/logic-functions/teams-health-check.ts +21 -6
  48. package/src/logic-functions/teams-post-install.mjs +1270 -0
  49. package/src/logic-functions/teams-post-install.mjs.map +7 -0
  50. package/src/logic-functions/teams-post-install.ts +15 -0
@@ -7,7 +7,9 @@ import { isDefined } from 'twenty-sdk/utils';
7
7
 
8
8
  import { HEALTH_CHECK_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
9
9
  import { findTeamsTenantClaimConflicts } from 'src/features/chat/logic-functions/utils/find-teams-tenant-claim-conflicts';
10
+ import { findTeamsUnclaimedConnectedAccountIds } from 'src/features/chat/logic-functions/utils/find-teams-unclaimed-connected-account-ids';
10
11
  import { isTeamsChatEnabled } from 'src/features/chat/logic-functions/utils/is-teams-chat-enabled';
12
+ import { isWorkingTeamsWorkspaceConnection } from 'src/features/chat/logic-functions/utils/is-working-teams-workspace-connection';
11
13
  import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
12
14
  import { listTeamsConnections } from 'src/features/transcripts/logic-functions/utils/list-teams-connections';
13
15
 
@@ -47,8 +49,7 @@ export const teamsHealthCheckHandler =
47
49
  }
48
50
 
49
51
  const workingWorkspaceConnections = connections.filter(
50
- (connection) =>
51
- connection.scope === 'WORKSPACE' && !isDefined(connection.authFailedAt),
52
+ isWorkingTeamsWorkspaceConnection,
52
53
  );
53
54
 
54
55
  if (!isNonEmptyArray(workingWorkspaceConnections)) {
@@ -61,10 +62,11 @@ export const teamsHealthCheckHandler =
61
62
  };
62
63
  }
63
64
 
65
+ const connectedAccountIds = workingWorkspaceConnections.map(
66
+ (connection) => connection.id,
67
+ );
64
68
  const claimConflicts = await findTeamsTenantClaimConflicts({
65
- connectedAccountIds: workingWorkspaceConnections.map(
66
- (connection) => connection.id,
67
- ),
69
+ connectedAccountIds,
68
70
  });
69
71
 
70
72
  if (isNonEmptyArray(claimConflicts)) {
@@ -80,6 +82,19 @@ export const teamsHealthCheckHandler =
80
82
  };
81
83
  }
82
84
 
85
+ const unclaimedConnectedAccountIds =
86
+ await findTeamsUnclaimedConnectedAccountIds({ connectedAccountIds });
87
+
88
+ if (isNonEmptyArray(unclaimedConnectedAccountIds)) {
89
+ return {
90
+ status: 'WARNING',
91
+ title: 'Microsoft Teams chat is not active',
92
+ description:
93
+ 'Chat is enabled, but this workspace has not registered its Microsoft organization, so the bot cannot answer Teams messages. Remove the workspace connection and add it again.',
94
+ action: { label: 'Open connections', location: '#general/connections' },
95
+ };
96
+ }
97
+
83
98
  return { status: 'OK' };
84
99
  };
85
100
 
@@ -87,7 +102,7 @@ export default defineHealthCheck({
87
102
  universalIdentifier: HEALTH_CHECK_UNIVERSAL_IDENTIFIER,
88
103
  name: 'teams-health-check',
89
104
  description:
90
- 'Warns on the app settings page when no Microsoft Teams account is connected, every connection needs to be reconnected, or another workspace already holds the Microsoft organization chat needs, since transcripts and chat both rely on a connection.',
105
+ 'Warns on the app settings page when no Microsoft Teams account is connected, every connection needs to be reconnected, another workspace already holds the Microsoft organization chat needs, or chat is enabled while a working workspace connection has not claimed its Microsoft organization, since transcripts and chat both rely on a connection.',
91
106
  timeoutSeconds: 30,
92
107
  handler: teamsHealthCheckHandler,
93
108
  });