@atlaskit/profilecard 26.19.8 → 26.20.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.
- package/CHANGELOG.md +72 -0
- package/build-agg-user-query/package.json +10 -0
- package/dist/cjs/client/AGGQuery.js +37 -0
- package/dist/cjs/client/AgentForbiddenError.js +28 -0
- package/dist/cjs/client/HeaderProcessor.js +1 -0
- package/dist/cjs/client/ProfileCardClient.js +11 -20
- package/dist/cjs/client/Query.js +1 -0
- package/dist/cjs/client/RovoAgentCardClient.js +38 -50
- package/dist/cjs/client/TeamCentralCardClient.js +5 -12
- package/dist/cjs/client/TeamProfileCardClient.js +2 -2
- package/dist/cjs/client/UserProfileCardClient.js +30 -54
- package/dist/cjs/client/addHeaders.js +16 -0
- package/dist/cjs/client/aggUserQuery.js +11 -0
- package/dist/cjs/client/aggUserQueryString.js +7 -0
- package/dist/cjs/client/ariPrefix.js +7 -0
- package/dist/cjs/client/buildAggUserQuery.js +18 -0
- package/dist/cjs/client/buildGatewayQuery.js +22 -0
- package/dist/cjs/client/buildHeaders.js +11 -0
- package/dist/cjs/client/buildReportingLinesQuery.js +14 -0
- package/dist/cjs/client/convertTeam.js +27 -0
- package/dist/cjs/client/defaultConfig.js +9 -0
- package/dist/cjs/client/directoryGraphqlQuery.js +37 -0
- package/dist/cjs/client/extractIdFromAri.js +14 -0
- package/dist/cjs/client/gatewayQueryV2.js +11 -0
- package/dist/cjs/client/{errorUtils.js → getErrorAttributes.js} +12 -15
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +3 -3
- package/dist/cjs/client/getTeamFromAGG.js +8 -64
- package/dist/cjs/client/graphQLQuery.js +66 -0
- package/dist/cjs/client/graphqlUtils.js +1 -125
- package/dist/cjs/client/handleAGGErrors.js +10 -0
- package/dist/cjs/client/handleDirectoryGraphQLErrors.js +10 -0
- package/dist/cjs/client/id.js +9 -0
- package/dist/cjs/client/idToAri.js +15 -0
- package/dist/cjs/client/idToAriSafe.js +14 -0
- package/dist/cjs/client/index.js +17 -4
- package/dist/cjs/client/maybeCreateTeamCentralClient.js +22 -0
- package/dist/cjs/client/modifyResponse.js +40 -0
- package/dist/cjs/components/Agent/AgentProfileCard.js +4 -4
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +2 -2
- package/dist/cjs/components/Agent/hooks/duplicateFetch.js +2 -169
- package/dist/cjs/components/Agent/hooks/fetchActivationId.js +57 -0
- package/dist/cjs/components/Agent/hooks/fetchDuplicateAgentMutation.js +74 -0
- package/dist/cjs/components/Agent/hooks/fetchHasVersionCapability.js +60 -0
- package/dist/cjs/components/Agent/hooks/firstCharUpper.js +9 -0
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +2 -212
- package/dist/cjs/components/Agent/hooks/useAgentUrlActions.js +219 -0
- package/dist/cjs/components/Agent/utils/getAtlassianStudioAgentDuplicateUrl.js +10 -0
- package/dist/cjs/components/Agent/utils/getAtlassianStudioAgentEditUrl.js +10 -0
- package/dist/cjs/components/Agent/utils/getStudioHost.js +14 -0
- package/dist/cjs/components/Agent/utils/getStudioPath.js +19 -0
- package/dist/cjs/components/Agent/utils/index.js +3 -28
- package/dist/cjs/components/Team/TeamProfileCard.js +2 -2
- package/dist/cjs/components/Team/index.js +5 -0
- package/dist/cjs/components/User/LoadingView.js +31 -0
- package/dist/cjs/components/User/ProfileCard.js +21 -242
- package/dist/cjs/components/User/ProfileCardDetails.js +6 -6
- package/dist/cjs/components/User/ProfileCardResourced.js +2 -2
- package/dist/cjs/components/User/ProfilecardInternal.js +234 -0
- package/dist/cjs/components/User/index.js +7 -0
- package/dist/cjs/components/common/LoadingState.js +2 -1
- package/dist/cjs/components/common/ProfileCardTrigger.js +2 -1
- package/dist/cjs/components/team-profile-card/main.js +9 -3
- package/dist/cjs/components/team-profile-card/team-actions/index.js +2 -2
- package/dist/cjs/index.js +5 -6
- package/dist/cjs/internal/isValidDate.js +12 -0
- package/dist/cjs/internal/relative-date.js +2 -7
- package/dist/cjs/mocks/get-time-string.js +16 -0
- package/dist/cjs/mocks/get-weekday.js +15 -0
- package/dist/cjs/mocks/mock-profile-client.js +7 -5
- package/dist/cjs/mocks/mock-team-client.js +2 -2
- package/dist/cjs/mocks/profile-data.js +32 -31
- package/dist/cjs/mocks/random.js +9 -0
- package/dist/cjs/mocks/simple-mock-clients.js +4 -3
- package/dist/cjs/mocks/static-team-data.js +33 -0
- package/dist/cjs/mocks/team-data.js +8 -33
- package/dist/cjs/styled/Card.js +1 -0
- package/dist/cjs/styled/Error.js +1 -0
- package/dist/cjs/styled/ReportingLines.js +1 -0
- package/dist/cjs/styled/TeamCard.js +1 -0
- package/dist/cjs/styled/TeamTrigger.js +1 -0
- package/dist/cjs/styled/UserTrigger.js +1 -0
- package/dist/cjs/util/AGGError.js +37 -0
- package/dist/cjs/util/AGGErrors.js +34 -0
- package/dist/cjs/util/AnalyticsEventPayload.js +1 -0
- package/dist/cjs/util/DirectoryGraphQLError.js +36 -0
- package/dist/cjs/util/DirectoryGraphQLErrors.js +34 -0
- package/dist/cjs/util/GenericAttributes.js +1 -0
- package/dist/cjs/util/HttpError.js +27 -0
- package/dist/cjs/util/actionClicked.js +15 -0
- package/dist/cjs/util/agentRequestAnalytics.js +15 -0
- package/dist/cjs/util/analytics.js +5 -134
- package/dist/cjs/util/cardTriggered.js +23 -0
- package/dist/cjs/util/createEvent.js +30 -0
- package/dist/cjs/util/errorRetryClicked.js +15 -0
- package/dist/cjs/util/getActionSubject.js +19 -0
- package/dist/cjs/util/moreActionsClicked.js +15 -0
- package/dist/cjs/util/moreMembersClicked.js +15 -0
- package/dist/cjs/util/profileCardRendered.js +15 -0
- package/dist/cjs/util/reportingLinesClicked.js +15 -0
- package/dist/cjs/util/teamAvatarClicked.js +15 -0
- package/dist/cjs/util/teamRequestAnalytics.js +15 -0
- package/dist/cjs/util/userRequestAnalytics.js +15 -0
- package/dist/es2019/client/AGGQuery.js +12 -0
- package/dist/es2019/client/AgentForbiddenError.js +8 -0
- package/dist/es2019/client/HeaderProcessor.js +0 -0
- package/dist/es2019/client/ProfileCardClient.js +10 -19
- package/dist/es2019/client/Query.js +0 -0
- package/dist/es2019/client/RovoAgentCardClient.js +3 -10
- package/dist/es2019/client/TeamCentralCardClient.js +2 -31
- package/dist/es2019/client/TeamProfileCardClient.js +1 -1
- package/dist/es2019/client/UserProfileCardClient.js +15 -102
- package/dist/es2019/client/addHeaders.js +10 -0
- package/dist/es2019/client/aggUserQuery.js +31 -0
- package/dist/es2019/client/aggUserQueryString.js +28 -0
- package/dist/es2019/client/ariPrefix.js +1 -0
- package/dist/es2019/client/buildAggUserQuery.js +10 -0
- package/dist/es2019/client/buildGatewayQuery.js +15 -0
- package/dist/es2019/client/buildHeaders.js +5 -0
- package/dist/es2019/client/buildReportingLinesQuery.js +30 -0
- package/dist/es2019/client/convertTeam.js +21 -0
- package/dist/es2019/client/defaultConfig.js +3 -0
- package/dist/es2019/client/directoryGraphqlQuery.js +12 -0
- package/dist/es2019/client/extractIdFromAri.js +8 -0
- package/dist/es2019/client/gatewayQueryV2.js +30 -0
- package/dist/es2019/client/{errorUtils.js → getErrorAttributes.js} +4 -7
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +2 -2
- package/dist/es2019/client/getTeamFromAGG.js +4 -80
- package/dist/es2019/client/graphQLQuery.js +24 -0
- package/dist/es2019/client/graphqlUtils.js +0 -47
- package/dist/es2019/client/handleAGGErrors.js +4 -0
- package/dist/es2019/client/handleDirectoryGraphQLErrors.js +4 -0
- package/dist/es2019/client/id.js +1 -0
- package/dist/es2019/client/idToAri.js +9 -0
- package/dist/es2019/client/idToAriSafe.js +6 -0
- package/dist/es2019/client/index.js +22 -2
- package/dist/es2019/client/maybeCreateTeamCentralClient.js +14 -0
- package/dist/es2019/client/modifyResponse.js +32 -0
- package/dist/es2019/components/Agent/AgentProfileCard.js +2 -2
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +1 -1
- package/dist/es2019/components/Agent/hooks/duplicateFetch.js +1 -121
- package/dist/es2019/components/Agent/hooks/fetchActivationId.js +35 -0
- package/dist/es2019/components/Agent/hooks/fetchDuplicateAgentMutation.js +49 -0
- package/dist/es2019/components/Agent/hooks/fetchHasVersionCapability.js +39 -0
- package/dist/es2019/components/Agent/hooks/firstCharUpper.js +1 -0
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +1 -182
- package/dist/es2019/components/Agent/hooks/useAgentUrlActions.js +186 -0
- package/dist/es2019/components/Agent/utils/getAtlassianStudioAgentDuplicateUrl.js +2 -0
- package/dist/es2019/components/Agent/utils/getAtlassianStudioAgentEditUrl.js +2 -0
- package/dist/es2019/components/Agent/utils/getStudioHost.js +8 -0
- package/dist/es2019/components/Agent/utils/getStudioPath.js +13 -0
- package/dist/es2019/components/Agent/utils/index.js +2 -23
- package/dist/es2019/components/Team/TeamProfileCard.js +1 -1
- package/dist/es2019/components/Team/index.js +6 -0
- package/dist/es2019/components/User/LoadingView.js +19 -0
- package/dist/es2019/components/User/ProfileCard.js +12 -221
- package/dist/es2019/components/User/ProfileCardDetails.js +1 -1
- package/dist/es2019/components/User/ProfileCardResourced.js +1 -1
- package/dist/es2019/components/User/ProfilecardInternal.js +207 -0
- package/dist/es2019/components/User/index.js +8 -0
- package/dist/es2019/components/common/LoadingState.js +2 -1
- package/dist/es2019/components/common/ProfileCardTrigger.js +2 -1
- package/dist/es2019/components/team-profile-card/main.js +8 -1
- package/dist/es2019/components/team-profile-card/team-actions/index.js +1 -1
- package/dist/es2019/i18n/index.js +91 -0
- package/dist/es2019/index.js +4 -2
- package/dist/es2019/internal/isValidDate.js +4 -0
- package/dist/es2019/internal/relative-date.js +1 -4
- package/dist/es2019/mocks/{util.js → get-time-string.js} +1 -9
- package/dist/es2019/mocks/get-weekday.js +9 -0
- package/dist/es2019/mocks/index.js +13 -0
- package/dist/es2019/mocks/mock-profile-client.js +4 -2
- package/dist/es2019/mocks/mock-team-client.js +1 -1
- package/dist/es2019/mocks/profile-data.js +2 -1
- package/dist/es2019/mocks/random.js +1 -0
- package/dist/es2019/mocks/simple-mock-clients.js +3 -2
- package/dist/es2019/mocks/static-team-data.js +21 -0
- package/dist/es2019/mocks/team-data.js +6 -26
- package/dist/es2019/styled/Card.js +1 -0
- package/dist/es2019/styled/Error.js +1 -0
- package/dist/es2019/styled/ReportingLines.js +1 -0
- package/dist/es2019/styled/TeamCard.js +1 -0
- package/dist/es2019/styled/TeamTrigger.js +1 -0
- package/dist/es2019/styled/UserTrigger.js +1 -0
- package/dist/es2019/util/AGGError.js +16 -0
- package/dist/es2019/util/AGGErrors.js +12 -0
- package/dist/es2019/util/AnalyticsEventPayload.js +0 -0
- package/dist/es2019/util/DirectoryGraphQLError.js +14 -0
- package/dist/es2019/util/DirectoryGraphQLErrors.js +12 -0
- package/dist/es2019/util/GenericAttributes.js +0 -0
- package/dist/es2019/util/HttpError.js +7 -0
- package/dist/es2019/util/actionClicked.js +8 -0
- package/dist/es2019/util/agentRequestAnalytics.js +7 -0
- package/dist/es2019/util/analytics.js +4 -107
- package/dist/es2019/util/cardTriggered.js +15 -0
- package/dist/es2019/util/createEvent.js +18 -0
- package/dist/es2019/util/errorRetryClicked.js +8 -0
- package/dist/es2019/util/getActionSubject.js +13 -0
- package/dist/es2019/util/moreActionsClicked.js +8 -0
- package/dist/es2019/util/moreMembersClicked.js +8 -0
- package/dist/es2019/util/profileCardRendered.js +8 -0
- package/dist/es2019/util/reportingLinesClicked.js +8 -0
- package/dist/es2019/util/teamAvatarClicked.js +8 -0
- package/dist/es2019/util/teamRequestAnalytics.js +7 -0
- package/dist/es2019/util/userRequestAnalytics.js +7 -0
- package/dist/esm/client/AGGQuery.js +31 -0
- package/dist/esm/client/AgentForbiddenError.js +21 -0
- package/dist/esm/client/HeaderProcessor.js +0 -0
- package/dist/esm/client/ProfileCardClient.js +10 -17
- package/dist/esm/client/Query.js +0 -0
- package/dist/esm/client/RovoAgentCardClient.js +27 -39
- package/dist/esm/client/TeamCentralCardClient.js +2 -9
- package/dist/esm/client/TeamProfileCardClient.js +1 -1
- package/dist/esm/client/UserProfileCardClient.js +17 -51
- package/dist/esm/client/addHeaders.js +10 -0
- package/dist/esm/client/aggUserQuery.js +4 -0
- package/dist/esm/client/aggUserQueryString.js +1 -0
- package/dist/esm/client/ariPrefix.js +1 -0
- package/dist/esm/client/buildAggUserQuery.js +12 -0
- package/dist/esm/client/buildGatewayQuery.js +16 -0
- package/dist/esm/client/buildHeaders.js +5 -0
- package/dist/esm/client/buildReportingLinesQuery.js +8 -0
- package/dist/esm/client/convertTeam.js +22 -0
- package/dist/esm/client/defaultConfig.js +3 -0
- package/dist/esm/client/directoryGraphqlQuery.js +31 -0
- package/dist/esm/client/extractIdFromAri.js +8 -0
- package/dist/esm/client/gatewayQueryV2.js +5 -0
- package/dist/esm/client/{errorUtils.js → getErrorAttributes.js} +5 -8
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +2 -2
- package/dist/esm/client/getTeamFromAGG.js +4 -59
- package/dist/esm/client/graphQLQuery.js +59 -0
- package/dist/esm/client/graphqlUtils.js +0 -118
- package/dist/esm/client/handleAGGErrors.js +4 -0
- package/dist/esm/client/handleDirectoryGraphQLErrors.js +4 -0
- package/dist/esm/client/id.js +3 -0
- package/dist/esm/client/idToAri.js +9 -0
- package/dist/esm/client/idToAriSafe.js +8 -0
- package/dist/esm/client/index.js +22 -2
- package/dist/esm/client/maybeCreateTeamCentralClient.js +15 -0
- package/dist/esm/client/modifyResponse.js +33 -0
- package/dist/esm/components/Agent/AgentProfileCard.js +2 -2
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +1 -1
- package/dist/esm/components/Agent/hooks/duplicateFetch.js +1 -167
- package/dist/esm/components/Agent/hooks/fetchActivationId.js +51 -0
- package/dist/esm/components/Agent/hooks/fetchDuplicateAgentMutation.js +68 -0
- package/dist/esm/components/Agent/hooks/fetchHasVersionCapability.js +54 -0
- package/dist/esm/components/Agent/hooks/firstCharUpper.js +3 -0
- package/dist/esm/components/Agent/hooks/useAgentActions.js +1 -210
- package/dist/esm/components/Agent/hooks/useAgentUrlActions.js +212 -0
- package/dist/esm/components/Agent/utils/getAtlassianStudioAgentDuplicateUrl.js +4 -0
- package/dist/esm/components/Agent/utils/getAtlassianStudioAgentEditUrl.js +4 -0
- package/dist/esm/components/Agent/utils/getStudioHost.js +8 -0
- package/dist/esm/components/Agent/utils/getStudioPath.js +13 -0
- package/dist/esm/components/Agent/utils/index.js +2 -27
- package/dist/esm/components/Team/TeamProfileCard.js +1 -1
- package/dist/esm/components/Team/index.js +6 -0
- package/dist/esm/components/User/LoadingView.js +22 -0
- package/dist/esm/components/User/ProfileCard.js +12 -239
- package/dist/esm/components/User/ProfileCardDetails.js +1 -1
- package/dist/esm/components/User/ProfileCardResourced.js +1 -1
- package/dist/esm/components/User/ProfilecardInternal.js +225 -0
- package/dist/esm/components/User/index.js +8 -0
- package/dist/esm/components/common/LoadingState.js +2 -1
- package/dist/esm/components/common/ProfileCardTrigger.js +2 -1
- package/dist/esm/components/team-profile-card/main.js +8 -1
- package/dist/esm/components/team-profile-card/team-actions/index.js +1 -1
- package/dist/esm/i18n/index.js +91 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/internal/isValidDate.js +5 -0
- package/dist/esm/internal/relative-date.js +1 -5
- package/dist/esm/mocks/{util.js → get-time-string.js} +1 -11
- package/dist/esm/mocks/get-weekday.js +9 -0
- package/dist/esm/mocks/index.js +13 -0
- package/dist/esm/mocks/mock-profile-client.js +4 -2
- package/dist/esm/mocks/mock-team-client.js +1 -1
- package/dist/esm/mocks/profile-data.js +2 -1
- package/dist/esm/mocks/random.js +3 -0
- package/dist/esm/mocks/simple-mock-clients.js +3 -2
- package/dist/esm/mocks/static-team-data.js +27 -0
- package/dist/esm/mocks/team-data.js +6 -32
- package/dist/esm/styled/Card.js +1 -0
- package/dist/esm/styled/Error.js +1 -0
- package/dist/esm/styled/ReportingLines.js +1 -0
- package/dist/esm/styled/TeamCard.js +1 -0
- package/dist/esm/styled/TeamTrigger.js +1 -0
- package/dist/esm/styled/UserTrigger.js +1 -0
- package/dist/esm/util/AGGError.js +30 -0
- package/dist/esm/util/AGGErrors.js +27 -0
- package/dist/esm/util/AnalyticsEventPayload.js +0 -0
- package/dist/esm/util/DirectoryGraphQLError.js +29 -0
- package/dist/esm/util/DirectoryGraphQLErrors.js +27 -0
- package/dist/esm/util/GenericAttributes.js +0 -0
- package/dist/esm/util/HttpError.js +20 -0
- package/dist/esm/util/actionClicked.js +10 -0
- package/dist/esm/util/agentRequestAnalytics.js +9 -0
- package/dist/esm/util/analytics.js +4 -132
- package/dist/esm/util/cardTriggered.js +17 -0
- package/dist/esm/util/createEvent.js +24 -0
- package/dist/esm/util/errorRetryClicked.js +10 -0
- package/dist/esm/util/getActionSubject.js +13 -0
- package/dist/esm/util/moreActionsClicked.js +10 -0
- package/dist/esm/util/moreMembersClicked.js +10 -0
- package/dist/esm/util/profileCardRendered.js +10 -0
- package/dist/esm/util/reportingLinesClicked.js +10 -0
- package/dist/esm/util/teamAvatarClicked.js +10 -0
- package/dist/esm/util/teamRequestAnalytics.js +9 -0
- package/dist/esm/util/userRequestAnalytics.js +9 -0
- package/dist/types/client/AGGQuery.d.ts +8 -0
- package/dist/types/client/AgentForbiddenError.d.ts +4 -0
- package/dist/types/client/HeaderProcessor.d.ts +1 -0
- package/dist/types/client/ProfileCardClient.d.ts +8 -3
- package/dist/types/client/Query.d.ts +4 -0
- package/dist/types/client/RovoAgentCardClient.d.ts +0 -4
- package/dist/types/client/TeamCentralCardClient.d.ts +0 -6
- package/dist/types/client/UserProfileCardClient.d.ts +9 -16
- package/dist/types/client/addHeaders.d.ts +1 -0
- package/dist/types/client/aggUserQuery.d.ts +2 -0
- package/dist/types/client/aggUserQueryString.d.ts +1 -0
- package/dist/types/client/ariPrefix.d.ts +1 -0
- package/dist/types/client/buildAggUserQuery.d.ts +6 -0
- package/dist/types/client/buildGatewayQuery.d.ts +12 -0
- package/dist/types/client/buildHeaders.d.ts +1 -0
- package/dist/types/client/buildReportingLinesQuery.d.ts +6 -0
- package/dist/types/client/convertTeam.d.ts +3 -0
- package/dist/types/client/defaultConfig.d.ts +3 -0
- package/dist/types/client/directoryGraphqlQuery.d.ts +8 -0
- package/dist/types/client/extractIdFromAri.d.ts +1 -0
- package/dist/types/client/gatewayQueryV2.d.ts +1 -0
- package/dist/types/client/getErrorAttributes.d.ts +6 -0
- package/dist/types/client/getTeamFromAGG.d.ts +1 -21
- package/dist/types/client/graphQLQuery.d.ts +3 -0
- package/dist/types/client/graphqlUtils.d.ts +0 -18
- package/dist/types/client/handleAGGErrors.d.ts +1 -0
- package/dist/types/client/handleDirectoryGraphQLErrors.d.ts +1 -0
- package/dist/types/client/id.d.ts +2 -0
- package/dist/types/client/idToAri.d.ts +4 -0
- package/dist/types/client/idToAriSafe.d.ts +1 -0
- package/dist/types/client/index.d.ts +18 -2
- package/dist/types/client/maybeCreateTeamCentralClient.d.ts +3 -0
- package/dist/types/client/modifyResponse.d.ts +10 -0
- package/dist/types/components/Agent/hooks/duplicateFetch.d.ts +1 -24
- package/dist/types/components/Agent/hooks/fetchActivationId.d.ts +5 -0
- package/dist/types/components/Agent/hooks/fetchDuplicateAgentMutation.d.ts +11 -0
- package/dist/types/components/Agent/hooks/fetchHasVersionCapability.d.ts +8 -0
- package/dist/types/components/Agent/hooks/firstCharUpper.d.ts +1 -0
- package/dist/types/components/Agent/hooks/useAgentActions.d.ts +1 -16
- package/dist/types/components/Agent/hooks/useAgentUrlActions.d.ts +15 -0
- package/dist/types/components/Agent/utils/getAtlassianStudioAgentDuplicateUrl.d.ts +1 -0
- package/dist/types/components/Agent/utils/getAtlassianStudioAgentEditUrl.d.ts +1 -0
- package/dist/types/components/Agent/utils/getStudioHost.d.ts +1 -0
- package/dist/types/components/Agent/utils/getStudioPath.d.ts +1 -0
- package/dist/types/components/Agent/utils/index.d.ts +2 -4
- package/dist/types/components/Team/index.d.ts +3 -0
- package/dist/types/components/User/LoadingView.d.ts +3 -0
- package/dist/types/components/User/ProfileCard.d.ts +9 -4
- package/dist/types/components/User/ProfilecardInternal.d.ts +3 -0
- package/dist/types/components/User/index.d.ts +6 -0
- package/dist/types/components/team-profile-card/main.d.ts +5 -0
- package/dist/types/i18n/index.d.ts +90 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/internal/isValidDate.d.ts +1 -0
- package/dist/types/internal/relative-date.d.ts +0 -1
- package/dist/types/mocks/get-time-string.d.ts +1 -0
- package/dist/types/mocks/get-weekday.d.ts +4 -0
- package/dist/types/mocks/index.d.ts +12 -0
- package/dist/types/mocks/random.d.ts +1 -0
- package/dist/types/mocks/simple-mock-clients.d.ts +1 -1
- package/dist/types/mocks/static-team-data.d.ts +8 -0
- package/dist/types/mocks/team-data.d.ts +10 -7
- package/dist/types/types.d.ts +1 -1
- package/dist/types/util/AGGError.d.ts +15 -0
- package/dist/types/util/AGGErrors.d.ts +6 -0
- package/dist/types/util/AnalyticsEventPayload.d.ts +1 -0
- package/dist/types/util/DirectoryGraphQLError.d.ts +14 -0
- package/dist/types/util/DirectoryGraphQLErrors.d.ts +6 -0
- package/dist/types/util/GenericAttributes.d.ts +1 -0
- package/dist/types/util/HttpError.d.ts +5 -0
- package/dist/types/util/actionClicked.d.ts +13 -0
- package/dist/types/util/agentRequestAnalytics.d.ts +9 -0
- package/dist/types/util/analytics.d.ts +3 -97
- package/dist/types/util/cardTriggered.d.ts +7 -0
- package/dist/types/util/createEvent.d.ts +7 -0
- package/dist/types/util/errorRetryClicked.d.ts +8 -0
- package/dist/types/util/getActionSubject.d.ts +1 -0
- package/dist/types/util/moreActionsClicked.d.ts +10 -0
- package/dist/types/util/moreMembersClicked.d.ts +9 -0
- package/dist/types/util/profileCardRendered.d.ts +16 -0
- package/dist/types/util/reportingLinesClicked.d.ts +9 -0
- package/dist/types/util/teamAvatarClicked.d.ts +11 -0
- package/dist/types/util/teamRequestAnalytics.d.ts +9 -0
- package/dist/types/util/userRequestAnalytics.d.ts +9 -0
- package/loading-view/package.json +10 -0
- package/main/package.json +4 -4
- package/modify-response/package.json +10 -0
- package/package.json +2 -2
- package/profile-card-client/package.json +4 -4
- package/profile-card-resourced/package.json +10 -0
- package/profilecard-internal/package.json +10 -0
- package/dist/cjs/components/Error/index.js +0 -27
- package/dist/cjs/components/Icon/index.js +0 -13
- package/dist/cjs/components/team-profile-card/index.js +0 -12
- package/dist/cjs/entry-points/ProfileCardClient.js +0 -13
- package/dist/cjs/entry-points/main.js +0 -12
- package/dist/cjs/mocks/util.js +0 -26
- package/dist/cjs/util/errors.js +0 -105
- package/dist/es2019/components/Error/index.js +0 -3
- package/dist/es2019/components/Icon/index.js +0 -1
- package/dist/es2019/components/team-profile-card/index.js +0 -1
- package/dist/es2019/entry-points/ProfileCardClient.js +0 -1
- package/dist/es2019/entry-points/main.js +0 -1
- package/dist/es2019/util/errors.js +0 -59
- package/dist/esm/components/Error/index.js +0 -3
- package/dist/esm/components/Icon/index.js +0 -1
- package/dist/esm/components/team-profile-card/index.js +0 -1
- package/dist/esm/entry-points/ProfileCardClient.js +0 -1
- package/dist/esm/entry-points/main.js +0 -1
- package/dist/esm/util/errors.js +0 -98
- package/dist/types/client/errorUtils.d.ts +0 -5
- package/dist/types/components/Error/index.d.ts +0 -3
- package/dist/types/components/Icon/index.d.ts +0 -1
- package/dist/types/components/team-profile-card/index.d.ts +0 -1
- package/dist/types/entry-points/ProfileCardClient.d.ts +0 -1
- package/dist/types/entry-points/main.d.ts +0 -1
- package/dist/types/mocks/util.d.ts +0 -6
- package/dist/types/util/errors.d.ts +0 -43
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
1
2
|
import CachingClient from './CachingClient';
|
|
2
3
|
import ProfileCardClient from './ProfileCardClient';
|
|
3
4
|
import TeamProfileClient from './TeamProfileCardClient';
|
|
4
|
-
import UserProfileClient
|
|
5
|
-
|
|
5
|
+
import UserProfileClient from './UserProfileCardClient';
|
|
6
|
+
import { modifyResponse } from './modifyResponse';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use `import CachingClient from '@atlaskit/profilecard/caching-client'` instead.
|
|
10
|
+
*/
|
|
11
|
+
export { CachingClient };
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `import { modifyResponse } from '@atlaskit/profilecard/modify-response'` instead.
|
|
14
|
+
*/
|
|
15
|
+
export { modifyResponse };
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use `import TeamProfileClient from '@atlaskit/profilecard/team-profile-card-client'` instead.
|
|
18
|
+
*/
|
|
19
|
+
export { TeamProfileClient };
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `import UserProfileClient from '@atlaskit/profilecard/user-profile-card-client'` instead.
|
|
22
|
+
*/
|
|
23
|
+
export { UserProfileClient };
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-re-exports
|
|
6
26
|
export default ProfileCardClient;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isFedRamp } from '@atlaskit/atlassian-context/is-fedramp';
|
|
2
|
+
import { default as TeamCentralCardClient } from './TeamCentralCardClient';
|
|
3
|
+
export function maybeCreateTeamCentralClient(config, clients) {
|
|
4
|
+
if (isFedRamp()) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
if (clients !== null && clients !== void 0 && clients.teamCentralClient) {
|
|
8
|
+
return clients.teamCentralClient;
|
|
9
|
+
}
|
|
10
|
+
const teamCentralEnabled = config.teamCentralDisabled !== true;
|
|
11
|
+
return teamCentralEnabled ? new TeamCentralCardClient({
|
|
12
|
+
...config
|
|
13
|
+
}) : undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform response from GraphQL
|
|
3
|
+
* - Prefix `timestring` with `remoteWeekdayString` depending on `remoteWeekdayIndex`
|
|
4
|
+
* - Remove properties which will be not used later
|
|
5
|
+
* @ignore
|
|
6
|
+
* @param {object} response
|
|
7
|
+
* @return {object}
|
|
8
|
+
*/
|
|
9
|
+
export const modifyResponse = response => {
|
|
10
|
+
const data = {
|
|
11
|
+
...response.User
|
|
12
|
+
};
|
|
13
|
+
const localWeekdayIndex = new Date().getDay().toString();
|
|
14
|
+
if (data.remoteWeekdayIndex && data.remoteWeekdayIndex !== localWeekdayIndex) {
|
|
15
|
+
data.remoteTimeString = `${data.remoteWeekdayString} ${data.remoteTimeString}`;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
isBot: data.isBot,
|
|
19
|
+
isCurrentUser: data.isCurrentUser,
|
|
20
|
+
status: data.status,
|
|
21
|
+
statusModifiedDate: data.statusModifiedDate || undefined,
|
|
22
|
+
avatarUrl: data.avatarUrl || undefined,
|
|
23
|
+
email: data.email || undefined,
|
|
24
|
+
fullName: data.fullName || undefined,
|
|
25
|
+
location: data.location || undefined,
|
|
26
|
+
meta: data.meta || undefined,
|
|
27
|
+
nickname: data.nickname || undefined,
|
|
28
|
+
companyName: data.companyName || undefined,
|
|
29
|
+
timestring: data.remoteTimeString || undefined,
|
|
30
|
+
accountType: data.accountType || undefined
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -17,12 +17,12 @@ import { TeamsLink } from '@atlaskit/teams-app-internal-navigation/teams-link';
|
|
|
17
17
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
18
|
import { PACKAGE_META_DATA } from '../../util/analytics';
|
|
19
19
|
import { getPageTime } from '../../util/performance';
|
|
20
|
+
import { default as ErrorMessage } from '../Error/ErrorMessage';
|
|
20
21
|
import { LoadingState } from '../common/LoadingState';
|
|
21
|
-
import { ErrorMessage } from '../Error';
|
|
22
22
|
import { AgentActions } from './Actions';
|
|
23
23
|
import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
|
|
24
24
|
import { ConversationStarters } from './ConversationStarters';
|
|
25
|
-
import { useAgentUrlActions } from './hooks/
|
|
25
|
+
import { useAgentUrlActions } from './hooks/useAgentUrlActions';
|
|
26
26
|
import { messages } from './messages';
|
|
27
27
|
const styles = {
|
|
28
28
|
detailWrapper: "_1q511ejb",
|
|
@@ -4,7 +4,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
4
4
|
import { getAgentCreator } from '@atlaskit/rovo-agent-components/ui/AgentProfileInfo';
|
|
5
5
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
6
6
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics/use-analytics-events';
|
|
7
|
-
import { AgentForbiddenError } from '../../client/
|
|
7
|
+
import { AgentForbiddenError } from '../../client/AgentForbiddenError';
|
|
8
8
|
import { getAAIDFromARI } from '../../util/rovoAgentUtils';
|
|
9
9
|
import ErrorMessage from '../Error/ErrorMessage';
|
|
10
10
|
import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
|
|
@@ -1,121 +1 @@
|
|
|
1
|
-
const GRAPHQL_ENDPOINT = '/gateway/api/graphql';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Fetches version capability for a site via raw GraphQL fetch.
|
|
5
|
-
* Returns true only if versioning migration has completed.
|
|
6
|
-
*
|
|
7
|
-
* TODO remove after versioning rollout complete
|
|
8
|
-
* See: https://product-fabric.atlassian.net/browse/RAGE-2822
|
|
9
|
-
*/
|
|
10
|
-
export const fetchHasVersionCapability = async cloudId => {
|
|
11
|
-
try {
|
|
12
|
-
var _json$data;
|
|
13
|
-
const response = await fetch(GRAPHQL_ENDPOINT, {
|
|
14
|
-
method: 'POST',
|
|
15
|
-
credentials: 'include',
|
|
16
|
-
headers: {
|
|
17
|
-
'Content-Type': 'application/json'
|
|
18
|
-
},
|
|
19
|
-
body: JSON.stringify({
|
|
20
|
-
query: `query profilecardHasVersionCapabilityQuery($cloudId: String!) {
|
|
21
|
-
agentStudio_hasVersionCapability(cloudId: $cloudId) @optIn(to: "AgentStudio") {
|
|
22
|
-
__typename
|
|
23
|
-
... on AgentStudioHasVersionCapability {
|
|
24
|
-
hasVersionCapability
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}`,
|
|
28
|
-
variables: {
|
|
29
|
-
cloudId
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
const json = await response.json();
|
|
34
|
-
const result = json === null || json === void 0 ? void 0 : (_json$data = json.data) === null || _json$data === void 0 ? void 0 : _json$data.agentStudio_hasVersionCapability;
|
|
35
|
-
return (result === null || result === void 0 ? void 0 : result.__typename) === 'AgentStudioHasVersionCapability' ? Boolean(result.hasVersionCapability) : false;
|
|
36
|
-
} catch {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Fetches the Rovo activation ID for a given cloud ID.
|
|
43
|
-
* Used to construct the agent ARI when not available.
|
|
44
|
-
*/
|
|
45
|
-
export const fetchActivationId = async cloudId => {
|
|
46
|
-
try {
|
|
47
|
-
var _json$data$tenantCont, _json$data2, _json$data2$tenantCon, _json$data2$tenantCon2, _json$data2$tenantCon3;
|
|
48
|
-
const response = await fetch(GRAPHQL_ENDPOINT, {
|
|
49
|
-
method: 'POST',
|
|
50
|
-
credentials: 'include',
|
|
51
|
-
headers: {
|
|
52
|
-
'Content-Type': 'application/json'
|
|
53
|
-
},
|
|
54
|
-
body: JSON.stringify({
|
|
55
|
-
query: `query profilecardActivationQuery($cloudId: ID!, $product: String!) {
|
|
56
|
-
tenantContexts(cloudIds: [$cloudId]) {
|
|
57
|
-
activationIdByProduct(product: $product) {
|
|
58
|
-
active
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}`,
|
|
62
|
-
variables: {
|
|
63
|
-
cloudId,
|
|
64
|
-
product: 'rovo'
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
});
|
|
68
|
-
const json = await response.json();
|
|
69
|
-
return (_json$data$tenantCont = json === null || json === void 0 ? void 0 : (_json$data2 = json.data) === null || _json$data2 === void 0 ? void 0 : (_json$data2$tenantCon = _json$data2.tenantContexts) === null || _json$data2$tenantCon === void 0 ? void 0 : (_json$data2$tenantCon2 = _json$data2$tenantCon[0]) === null || _json$data2$tenantCon2 === void 0 ? void 0 : (_json$data2$tenantCon3 = _json$data2$tenantCon2.activationIdByProduct) === null || _json$data2$tenantCon3 === void 0 ? void 0 : _json$data2$tenantCon3.active) !== null && _json$data$tenantCont !== void 0 ? _json$data$tenantCont : null;
|
|
70
|
-
} catch {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Calls the agentStudio_duplicateAgent mutation via raw GraphQL fetch.
|
|
77
|
-
*
|
|
78
|
-
* TODO: Add SLO tracking and Sentry error reporting.
|
|
79
|
-
* See: https://product-fabric.atlassian.net/browse/RAGE-2822
|
|
80
|
-
*/
|
|
81
|
-
export const fetchDuplicateAgentMutation = async agentAri => {
|
|
82
|
-
try {
|
|
83
|
-
var _json$data3, _result$agent, _result$errors$0$mess, _result$errors, _result$errors$;
|
|
84
|
-
const response = await fetch(GRAPHQL_ENDPOINT, {
|
|
85
|
-
method: 'POST',
|
|
86
|
-
credentials: 'include',
|
|
87
|
-
headers: {
|
|
88
|
-
'Content-Type': 'application/json'
|
|
89
|
-
},
|
|
90
|
-
body: JSON.stringify({
|
|
91
|
-
query: `mutation profilecardDuplicateAgentMutation($agentId: ID!) {
|
|
92
|
-
agentStudio_duplicateAgent(id: $agentId) @optIn(to: "AgentStudio") {
|
|
93
|
-
agent { id }
|
|
94
|
-
success
|
|
95
|
-
errors { message }
|
|
96
|
-
}
|
|
97
|
-
}`,
|
|
98
|
-
variables: {
|
|
99
|
-
agentId: agentAri
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
});
|
|
103
|
-
const json = await response.json();
|
|
104
|
-
const result = json === null || json === void 0 ? void 0 : (_json$data3 = json.data) === null || _json$data3 === void 0 ? void 0 : _json$data3.agentStudio_duplicateAgent;
|
|
105
|
-
if (result !== null && result !== void 0 && result.success && result !== null && result !== void 0 && (_result$agent = result.agent) !== null && _result$agent !== void 0 && _result$agent.id) {
|
|
106
|
-
return {
|
|
107
|
-
success: true,
|
|
108
|
-
newAgentAri: result.agent.id
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
success: false,
|
|
113
|
-
errorMessage: (_result$errors$0$mess = result === null || result === void 0 ? void 0 : (_result$errors = result.errors) === null || _result$errors === void 0 ? void 0 : (_result$errors$ = _result$errors[0]) === null || _result$errors$ === void 0 ? void 0 : _result$errors$.message) !== null && _result$errors$0$mess !== void 0 ? _result$errors$0$mess : 'Duplicate agent mutation failed'
|
|
114
|
-
};
|
|
115
|
-
} catch (error) {
|
|
116
|
-
return {
|
|
117
|
-
success: false,
|
|
118
|
-
errorMessage: error instanceof Error ? error.message : 'Network error during duplication'
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
};
|
|
1
|
+
export const GRAPHQL_ENDPOINT = '/gateway/api/graphql';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GRAPHQL_ENDPOINT } from './duplicateFetch';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetches the Rovo activation ID for a given cloud ID.
|
|
5
|
+
* Used to construct the agent ARI when not available.
|
|
6
|
+
*/
|
|
7
|
+
export const fetchActivationId = async cloudId => {
|
|
8
|
+
try {
|
|
9
|
+
var _json$data$tenantCont, _json$data, _json$data$tenantCont2, _json$data$tenantCont3, _json$data$tenantCont4;
|
|
10
|
+
const response = await fetch(GRAPHQL_ENDPOINT, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
credentials: 'include',
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: JSON.stringify({
|
|
17
|
+
query: `query profilecardActivationQuery($cloudId: ID!, $product: String!) {
|
|
18
|
+
tenantContexts(cloudIds: [$cloudId]) {
|
|
19
|
+
activationIdByProduct(product: $product) {
|
|
20
|
+
active
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}`,
|
|
24
|
+
variables: {
|
|
25
|
+
cloudId,
|
|
26
|
+
product: 'rovo'
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
const json = await response.json();
|
|
31
|
+
return (_json$data$tenantCont = json === null || json === void 0 ? void 0 : (_json$data = json.data) === null || _json$data === void 0 ? void 0 : (_json$data$tenantCont2 = _json$data.tenantContexts) === null || _json$data$tenantCont2 === void 0 ? void 0 : (_json$data$tenantCont3 = _json$data$tenantCont2[0]) === null || _json$data$tenantCont3 === void 0 ? void 0 : (_json$data$tenantCont4 = _json$data$tenantCont3.activationIdByProduct) === null || _json$data$tenantCont4 === void 0 ? void 0 : _json$data$tenantCont4.active) !== null && _json$data$tenantCont !== void 0 ? _json$data$tenantCont : null;
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { GRAPHQL_ENDPOINT } from './duplicateFetch';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Calls the agentStudio_duplicateAgent mutation via raw GraphQL fetch.
|
|
5
|
+
*
|
|
6
|
+
* TODO: Add SLO tracking and Sentry error reporting.
|
|
7
|
+
* See: https://product-fabric.atlassian.net/browse/RAGE-2822
|
|
8
|
+
*/
|
|
9
|
+
export const fetchDuplicateAgentMutation = async agentAri => {
|
|
10
|
+
try {
|
|
11
|
+
var _json$data, _result$agent, _result$errors$0$mess, _result$errors, _result$errors$;
|
|
12
|
+
const response = await fetch(GRAPHQL_ENDPOINT, {
|
|
13
|
+
method: 'POST',
|
|
14
|
+
credentials: 'include',
|
|
15
|
+
headers: {
|
|
16
|
+
'Content-Type': 'application/json'
|
|
17
|
+
},
|
|
18
|
+
body: JSON.stringify({
|
|
19
|
+
query: `mutation profilecardDuplicateAgentMutation($agentId: ID!) {
|
|
20
|
+
agentStudio_duplicateAgent(id: $agentId) @optIn(to: "AgentStudio") {
|
|
21
|
+
agent { id }
|
|
22
|
+
success
|
|
23
|
+
errors { message }
|
|
24
|
+
}
|
|
25
|
+
}`,
|
|
26
|
+
variables: {
|
|
27
|
+
agentId: agentAri
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
const json = await response.json();
|
|
32
|
+
const result = json === null || json === void 0 ? void 0 : (_json$data = json.data) === null || _json$data === void 0 ? void 0 : _json$data.agentStudio_duplicateAgent;
|
|
33
|
+
if (result !== null && result !== void 0 && result.success && result !== null && result !== void 0 && (_result$agent = result.agent) !== null && _result$agent !== void 0 && _result$agent.id) {
|
|
34
|
+
return {
|
|
35
|
+
success: true,
|
|
36
|
+
newAgentAri: result.agent.id
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
success: false,
|
|
41
|
+
errorMessage: (_result$errors$0$mess = result === null || result === void 0 ? void 0 : (_result$errors = result.errors) === null || _result$errors === void 0 ? void 0 : (_result$errors$ = _result$errors[0]) === null || _result$errors$ === void 0 ? void 0 : _result$errors$.message) !== null && _result$errors$0$mess !== void 0 ? _result$errors$0$mess : 'Duplicate agent mutation failed'
|
|
42
|
+
};
|
|
43
|
+
} catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
success: false,
|
|
46
|
+
errorMessage: error instanceof Error ? error.message : 'Network error during duplication'
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { GRAPHQL_ENDPOINT } from './duplicateFetch';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetches version capability for a site via raw GraphQL fetch.
|
|
5
|
+
* Returns true only if versioning migration has completed.
|
|
6
|
+
*
|
|
7
|
+
* TODO remove after versioning rollout complete
|
|
8
|
+
* See: https://product-fabric.atlassian.net/browse/RAGE-2822
|
|
9
|
+
*/
|
|
10
|
+
export const fetchHasVersionCapability = async cloudId => {
|
|
11
|
+
try {
|
|
12
|
+
var _json$data;
|
|
13
|
+
const response = await fetch(GRAPHQL_ENDPOINT, {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
credentials: 'include',
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json'
|
|
18
|
+
},
|
|
19
|
+
body: JSON.stringify({
|
|
20
|
+
query: `query profilecardHasVersionCapabilityQuery($cloudId: String!) {
|
|
21
|
+
agentStudio_hasVersionCapability(cloudId: $cloudId) @optIn(to: "AgentStudio") {
|
|
22
|
+
__typename
|
|
23
|
+
... on AgentStudioHasVersionCapability {
|
|
24
|
+
hasVersionCapability
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}`,
|
|
28
|
+
variables: {
|
|
29
|
+
cloudId
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
const json = await response.json();
|
|
34
|
+
const result = json === null || json === void 0 ? void 0 : (_json$data = json.data) === null || _json$data === void 0 ? void 0 : _json$data.agentStudio_hasVersionCapability;
|
|
35
|
+
return (result === null || result === void 0 ? void 0 : result.__typename) === 'AgentStudioHasVersionCapability' ? Boolean(result.hasVersionCapability) : false;
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const firstCharUpper = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -1,182 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { getATLContextUrl } from '@atlaskit/atlassian-context/get-atl-context-url';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
|
-
import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers/post-message-to-pubsub';
|
|
5
|
-
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
6
|
-
import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics/use-analytics-events';
|
|
7
|
-
import { encodeParamsToUrl } from '../../../util/url';
|
|
8
|
-
import { getAtlassianStudioAgentDuplicateUrl, getAtlassianStudioAgentEditUrl, getStudioPath } from '../utils';
|
|
9
|
-
import { fetchHasVersionCapability, fetchActivationId, fetchDuplicateAgentMutation } from './duplicateFetch';
|
|
10
|
-
export const firstCharUpper = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
11
|
-
const ROVO_PARAM_PREFIX = 'rovoChat';
|
|
12
|
-
const createRovoParams = params => {
|
|
13
|
-
const rovoParams = {};
|
|
14
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
15
|
-
rovoParams[`${ROVO_PARAM_PREFIX}${firstCharUpper(key)}`] = encodeURIComponent(value);
|
|
16
|
-
});
|
|
17
|
-
return rovoParams;
|
|
18
|
-
};
|
|
19
|
-
export const useAgentUrlActions = ({
|
|
20
|
-
cloudId,
|
|
21
|
-
email,
|
|
22
|
-
source
|
|
23
|
-
}) => {
|
|
24
|
-
const {
|
|
25
|
-
publishWithPostMessage
|
|
26
|
-
} = useRovoPostMessageToPubsub();
|
|
27
|
-
const {
|
|
28
|
-
fireEvent
|
|
29
|
-
} = useAnalyticsEvents();
|
|
30
|
-
const onEditAgent = useCallback(agentId => {
|
|
31
|
-
const url = getAtlassianStudioAgentEditUrl(cloudId, agentId, email);
|
|
32
|
-
window.open(url, '_blank', 'noopener, noreferrer');
|
|
33
|
-
fireEvent('ui.button.clicked.editAgentButton', {
|
|
34
|
-
agentId,
|
|
35
|
-
source
|
|
36
|
-
});
|
|
37
|
-
}, [cloudId, email, fireEvent, source]);
|
|
38
|
-
const onCopyAgent = agentId => {
|
|
39
|
-
const url = `${window.location.origin}/people/agent/${agentId}`;
|
|
40
|
-
const urlWithParams = encodeParamsToUrl(url, {
|
|
41
|
-
cloudId
|
|
42
|
-
});
|
|
43
|
-
navigator.clipboard.writeText(urlWithParams);
|
|
44
|
-
fireEvent('ui.button.clicked.copyAgentLinkButton', {
|
|
45
|
-
agentId,
|
|
46
|
-
source
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
const onDuplicateAgent = useCallback(async agentId => {
|
|
50
|
-
fireEvent('ui.button.clicked.duplicateAgentButton', {
|
|
51
|
-
agentId,
|
|
52
|
-
source
|
|
53
|
-
});
|
|
54
|
-
const legacyDuplicateUrl = getAtlassianStudioAgentDuplicateUrl(cloudId, agentId, email);
|
|
55
|
-
|
|
56
|
-
// When versioning FG is off, use legacy duplicate flow
|
|
57
|
-
if (!fg('rovo_agent_versioning_enabled')) {
|
|
58
|
-
window.open(legacyDuplicateUrl, '_blank', 'noopener, noreferrer');
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Check if versioning migration has completed for this site
|
|
63
|
-
const hasVersionCapability = await fetchHasVersionCapability(cloudId);
|
|
64
|
-
if (!hasVersionCapability) {
|
|
65
|
-
// Opening in same tab because, we cannot open in new tab after async operation, because browsers prevent `.open` after certain duration
|
|
66
|
-
window.location.assign(legacyDuplicateUrl);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Resolve agent ARI (profilecard doesn't have agentAri, so fetch activationId)
|
|
71
|
-
const activationId = await fetchActivationId(cloudId);
|
|
72
|
-
if (!activationId) {
|
|
73
|
-
// Opening in same tab because, we cannot open in new tab after async operation, because browsers prevent `.open` after certain duration
|
|
74
|
-
window.location.assign(legacyDuplicateUrl);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const agentAri = `ari:cloud:rovo::agent/activation/${activationId}/${agentId}`;
|
|
78
|
-
|
|
79
|
-
// Call BE mutation to duplicate the agent
|
|
80
|
-
const result = await fetchDuplicateAgentMutation(agentAri);
|
|
81
|
-
if (result.success && result.newAgentAri) {
|
|
82
|
-
// Opening in same tab because, we cannot open in new tab after async operation, because browsers prevent `.open` after certain duration
|
|
83
|
-
window.location.assign(getStudioPath(`/s/${cloudId}/agents/${encodeURIComponent(result.newAgentAri)}/v/draft/details`));
|
|
84
|
-
} else {
|
|
85
|
-
// Fallback to legacy on error
|
|
86
|
-
// Opening in same tab because, we cannot open in new tab after async operation, because browsers prevent `.open` after certain duration
|
|
87
|
-
window.location.assign(legacyDuplicateUrl);
|
|
88
|
-
}
|
|
89
|
-
}, [cloudId, email, fireEvent, source]);
|
|
90
|
-
const onConversationStarter = ({
|
|
91
|
-
agentId,
|
|
92
|
-
prompt
|
|
93
|
-
}) => {
|
|
94
|
-
const startConversationInNewTab = () => {
|
|
95
|
-
const baseUrl = `${getATLContextUrl('home')}/chat`;
|
|
96
|
-
const urlWithParams = encodeParamsToUrl(baseUrl, {
|
|
97
|
-
cloudId,
|
|
98
|
-
...createRovoParams({
|
|
99
|
-
cloudId,
|
|
100
|
-
agentId,
|
|
101
|
-
prompt,
|
|
102
|
-
pathway: 'chat'
|
|
103
|
-
})
|
|
104
|
-
});
|
|
105
|
-
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
106
|
-
};
|
|
107
|
-
publishWithPostMessage({
|
|
108
|
-
targetWindow: window,
|
|
109
|
-
payload: {
|
|
110
|
-
type: 'chat-new',
|
|
111
|
-
source: 'AgentProfileCard',
|
|
112
|
-
data: {
|
|
113
|
-
name: prompt.slice(0, 50),
|
|
114
|
-
prompt,
|
|
115
|
-
agentId,
|
|
116
|
-
dialogues: []
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
onAcknowledgeTimeout: () => {
|
|
120
|
-
startConversationInNewTab();
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
const onOpenChat = (agentId, agentName) => {
|
|
125
|
-
const openChatInNewTab = () => {
|
|
126
|
-
const baseUrl = `${getATLContextUrl('home')}/chat`;
|
|
127
|
-
const urlWithParams = encodeParamsToUrl(baseUrl, {
|
|
128
|
-
cloudId,
|
|
129
|
-
...createRovoParams({
|
|
130
|
-
cloudId,
|
|
131
|
-
agentId,
|
|
132
|
-
pathway: 'chat'
|
|
133
|
-
})
|
|
134
|
-
});
|
|
135
|
-
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
136
|
-
};
|
|
137
|
-
publishWithPostMessage({
|
|
138
|
-
targetWindow: window,
|
|
139
|
-
payload: {
|
|
140
|
-
type: 'chat-new',
|
|
141
|
-
source: 'AgentProfileCard',
|
|
142
|
-
data: {
|
|
143
|
-
agentId,
|
|
144
|
-
dialogues: [],
|
|
145
|
-
name: `Chat with ${agentName}`
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
onAcknowledgeTimeout: () => {
|
|
149
|
-
openChatInNewTab();
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
const onViewFullProfile = agentId => {
|
|
154
|
-
const {
|
|
155
|
-
onNavigate
|
|
156
|
-
} = navigateToTeamsApp({
|
|
157
|
-
type: 'AGENT',
|
|
158
|
-
payload: {
|
|
159
|
-
agentId
|
|
160
|
-
},
|
|
161
|
-
cloudId,
|
|
162
|
-
shouldOpenInSameTab: false
|
|
163
|
-
});
|
|
164
|
-
if (fg('platform-adopt-teams-nav-config')) {
|
|
165
|
-
onNavigate();
|
|
166
|
-
} else {
|
|
167
|
-
window.open(`${window.location.origin}/people/agent/${agentId}`, '_blank', 'noopener, noreferrer');
|
|
168
|
-
}
|
|
169
|
-
fireEvent('ui.button.clicked.viewAgentFullProfileButton', {
|
|
170
|
-
agentId,
|
|
171
|
-
source
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
return {
|
|
175
|
-
onEditAgent,
|
|
176
|
-
onCopyAgent,
|
|
177
|
-
onDuplicateAgent,
|
|
178
|
-
onOpenChat,
|
|
179
|
-
onConversationStarter,
|
|
180
|
-
onViewFullProfile
|
|
181
|
-
};
|
|
182
|
-
};
|
|
1
|
+
export const ROVO_PARAM_PREFIX = 'rovoChat';
|