@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,19 +1,12 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import FeatureGates from '@atlaskit/feature-gate-js-client/feature-gates';
|
|
3
2
|
import { PACKAGE_META_DATA } from '../util/analytics';
|
|
4
3
|
import { getPageTime } from '../util/performance';
|
|
5
4
|
import { USER_ARI_PREFIX } from '../util/rovoAgentUtils';
|
|
5
|
+
import { AGGQuery } from './AGGQuery';
|
|
6
|
+
import { AgentForbiddenError } from './AgentForbiddenError';
|
|
6
7
|
import CachingClient from './CachingClient';
|
|
7
|
-
import { getErrorAttributes } from './
|
|
8
|
-
import { AGGQuery } from './graphqlUtils';
|
|
8
|
+
import { getErrorAttributes } from './getErrorAttributes';
|
|
9
9
|
import { SHARED_CACHE_MAX_AGE, sharedAgentProfileCache } from './sharedAgentProfileCache';
|
|
10
|
-
export class AgentForbiddenError extends Error {
|
|
11
|
-
constructor() {
|
|
12
|
-
super('Agent access forbidden');
|
|
13
|
-
_defineProperty(this, "status", 403);
|
|
14
|
-
this.name = 'AgentForbiddenError';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
10
|
const buildActivationIdQuery = (cloudId, product) => ({
|
|
18
11
|
query: `
|
|
19
12
|
query RovoAgentProfileCard_ActivationQuery($cloudId: ID!, $product: String!) {
|
|
@@ -1,38 +1,9 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
2
|
import CachingClient from './CachingClient';
|
|
3
|
+
import { buildReportingLinesQuery } from './buildReportingLinesQuery';
|
|
4
|
+
import { directoryGraphqlQuery } from './directoryGraphqlQuery';
|
|
3
5
|
import { getOrgIdForCloudIdFromAGG } from './getOrgIdForCloudIdFromAGG';
|
|
4
|
-
import { directoryGraphqlQuery } from './graphqlUtils';
|
|
5
6
|
const UNSHARDED_PREFIX = '/gateway/api/watermelon';
|
|
6
|
-
export const buildReportingLinesQuery = aaid => ({
|
|
7
|
-
query: `
|
|
8
|
-
fragment ReportingLinesUserPII on UserPII {
|
|
9
|
-
name
|
|
10
|
-
picture
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
fragment ReportingLinesUserFragment on ReportingLinesUser {
|
|
14
|
-
accountIdentifier
|
|
15
|
-
identifierType
|
|
16
|
-
pii {
|
|
17
|
-
...ReportingLinesUserPII
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
query ReportingLines($aaid: String) {
|
|
22
|
-
reportingLines(aaidOrHash: $aaid) {
|
|
23
|
-
managers {
|
|
24
|
-
...ReportingLinesUserFragment
|
|
25
|
-
}
|
|
26
|
-
reports {
|
|
27
|
-
...ReportingLinesUserFragment
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`,
|
|
32
|
-
variables: {
|
|
33
|
-
aaid
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
7
|
const orgContainsAnyWorkspacePromiseCache = new Map();
|
|
37
8
|
const orgIdPromiseCache = new Map();
|
|
38
9
|
const workspaceExistsWithTypePromiseCache = new Map();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PACKAGE_META_DATA } from '../util/analytics';
|
|
2
2
|
import { getPageTime } from '../util/performance';
|
|
3
3
|
import CachingClient from './CachingClient';
|
|
4
|
-
import { getErrorAttributes } from './
|
|
4
|
+
import { getErrorAttributes } from './getErrorAttributes';
|
|
5
5
|
import { getTeamFromAGG } from './getTeamFromAGG';
|
|
6
6
|
export default class TeamProfileCardClient extends CachingClient {
|
|
7
7
|
constructor(options) {
|
|
@@ -1,109 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { PACKAGE_META_DATA } from '../util/analytics';
|
|
5
5
|
import { localTime } from '../util/date';
|
|
6
6
|
import { getPageTime } from '../util/performance';
|
|
7
|
+
import { AGGQuery } from './AGGQuery';
|
|
7
8
|
import CachingClient from './CachingClient';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Transform response from GraphQL
|
|
13
|
-
* - Prefix `timestring` with `remoteWeekdayString` depending on `remoteWeekdayIndex`
|
|
14
|
-
* - Remove properties which will be not used later
|
|
15
|
-
* @ignore
|
|
16
|
-
* @param {object} response
|
|
17
|
-
* @return {object}
|
|
18
|
-
*/
|
|
19
|
-
export const modifyResponse = response => {
|
|
20
|
-
const data = {
|
|
21
|
-
...response.User
|
|
22
|
-
};
|
|
23
|
-
const localWeekdayIndex = new Date().getDay().toString();
|
|
24
|
-
if (data.remoteWeekdayIndex && data.remoteWeekdayIndex !== localWeekdayIndex) {
|
|
25
|
-
data.remoteTimeString = `${data.remoteWeekdayString} ${data.remoteTimeString}`;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
isBot: data.isBot,
|
|
29
|
-
isCurrentUser: data.isCurrentUser,
|
|
30
|
-
status: data.status,
|
|
31
|
-
statusModifiedDate: data.statusModifiedDate || undefined,
|
|
32
|
-
avatarUrl: data.avatarUrl || undefined,
|
|
33
|
-
email: data.email || undefined,
|
|
34
|
-
fullName: data.fullName || undefined,
|
|
35
|
-
location: data.location || undefined,
|
|
36
|
-
meta: data.meta || undefined,
|
|
37
|
-
nickname: data.nickname || undefined,
|
|
38
|
-
companyName: data.companyName || undefined,
|
|
39
|
-
timestring: data.remoteTimeString || undefined,
|
|
40
|
-
accountType: data.accountType || undefined
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const aggUserQuery = gql`
|
|
44
|
-
query user($userId: ID!) {
|
|
45
|
-
user(accountId: $userId) {
|
|
46
|
-
id
|
|
47
|
-
name
|
|
48
|
-
picture
|
|
49
|
-
accountStatus
|
|
50
|
-
__typename
|
|
51
|
-
... on AtlassianAccountUser {
|
|
52
|
-
email
|
|
53
|
-
nickname
|
|
54
|
-
zoneinfo
|
|
55
|
-
extendedProfile {
|
|
56
|
-
jobTitle
|
|
57
|
-
organization
|
|
58
|
-
location
|
|
59
|
-
closedDate
|
|
60
|
-
inactiveDate
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
... on CustomerUser {
|
|
64
|
-
email
|
|
65
|
-
zoneinfo
|
|
66
|
-
}
|
|
67
|
-
... on AppUser {
|
|
68
|
-
appType
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
const aggUserQueryString = `query user($userId: ID!) {
|
|
74
|
-
user(accountId: $userId) {
|
|
75
|
-
id
|
|
76
|
-
name
|
|
77
|
-
picture
|
|
78
|
-
accountStatus
|
|
79
|
-
__typename
|
|
80
|
-
... on AtlassianAccountUser {
|
|
81
|
-
email
|
|
82
|
-
nickname
|
|
83
|
-
zoneinfo
|
|
84
|
-
extendedProfile {
|
|
85
|
-
jobTitle
|
|
86
|
-
organization
|
|
87
|
-
location
|
|
88
|
-
closedDate
|
|
89
|
-
inactiveDate
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
... on CustomerUser {
|
|
93
|
-
email
|
|
94
|
-
zoneinfo
|
|
95
|
-
}
|
|
96
|
-
... on AppUser {
|
|
97
|
-
appType
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}`;
|
|
101
|
-
export const buildAggUserQuery = userId => ({
|
|
102
|
-
query: fg('platform_agg_user_query_doc_change') ? print(aggUserQuery) : aggUserQueryString,
|
|
103
|
-
variables: {
|
|
104
|
-
userId
|
|
105
|
-
}
|
|
106
|
-
});
|
|
9
|
+
import { buildAggUserQuery } from './buildAggUserQuery';
|
|
10
|
+
import { getErrorAttributes } from './getErrorAttributes';
|
|
107
11
|
const buildScopedProfileAtlAttributionHeader = cloudId => JSON.stringify({
|
|
108
12
|
tenantId: `ari:cloud:townsquare::site/${cloudId}`,
|
|
109
13
|
product: 'Atlassian Home',
|
|
@@ -201,4 +105,13 @@ export default class UserProfileCardClient extends CachingClient {
|
|
|
201
105
|
});
|
|
202
106
|
});
|
|
203
107
|
}
|
|
204
|
-
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated Use `import { modifyResponse } from '@atlaskit/profilecard/modify-response'` instead.
|
|
112
|
+
*/
|
|
113
|
+
export { modifyResponse } from './modifyResponse';
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated Use `import { buildAggUserQuery } from '@atlaskit/profilecard/build-agg-user-query'` instead.
|
|
116
|
+
*/
|
|
117
|
+
export { buildAggUserQuery } from './buildAggUserQuery';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
// for typing `process`
|
|
3
|
+
|
|
4
|
+
export const addHeaders = headers => {
|
|
5
|
+
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
6
|
+
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
7
|
+
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
8
|
+
headers.append('atl-client-version', "26.19.9");
|
|
9
|
+
return headers;
|
|
10
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import gql from 'graphql-tag';
|
|
2
|
+
export const aggUserQuery = gql`
|
|
3
|
+
query user($userId: ID!) {
|
|
4
|
+
user(accountId: $userId) {
|
|
5
|
+
id
|
|
6
|
+
name
|
|
7
|
+
picture
|
|
8
|
+
accountStatus
|
|
9
|
+
__typename
|
|
10
|
+
... on AtlassianAccountUser {
|
|
11
|
+
email
|
|
12
|
+
nickname
|
|
13
|
+
zoneinfo
|
|
14
|
+
extendedProfile {
|
|
15
|
+
jobTitle
|
|
16
|
+
organization
|
|
17
|
+
location
|
|
18
|
+
closedDate
|
|
19
|
+
inactiveDate
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
... on CustomerUser {
|
|
23
|
+
email
|
|
24
|
+
zoneinfo
|
|
25
|
+
}
|
|
26
|
+
... on AppUser {
|
|
27
|
+
appType
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const aggUserQueryString = `query user($userId: ID!) {
|
|
2
|
+
user(accountId: $userId) {
|
|
3
|
+
id
|
|
4
|
+
name
|
|
5
|
+
picture
|
|
6
|
+
accountStatus
|
|
7
|
+
__typename
|
|
8
|
+
... on AtlassianAccountUser {
|
|
9
|
+
email
|
|
10
|
+
nickname
|
|
11
|
+
zoneinfo
|
|
12
|
+
extendedProfile {
|
|
13
|
+
jobTitle
|
|
14
|
+
organization
|
|
15
|
+
location
|
|
16
|
+
closedDate
|
|
17
|
+
inactiveDate
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
... on CustomerUser {
|
|
21
|
+
email
|
|
22
|
+
zoneinfo
|
|
23
|
+
}
|
|
24
|
+
... on AppUser {
|
|
25
|
+
appType
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ARI_PREFIX = 'ari:cloud:identity::team/';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { print } from 'graphql';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
|
+
import { aggUserQuery } from './aggUserQuery';
|
|
4
|
+
import { aggUserQueryString } from './aggUserQueryString';
|
|
5
|
+
export const buildAggUserQuery = userId => ({
|
|
6
|
+
query: fg('platform_agg_user_query_doc_change') ? print(aggUserQuery) : aggUserQueryString,
|
|
7
|
+
variables: {
|
|
8
|
+
userId
|
|
9
|
+
}
|
|
10
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
// for typing `process`
|
|
3
|
+
|
|
4
|
+
import { GATEWAY_QUERY_V2 } from './gatewayQueryV2';
|
|
5
|
+
import { idToAriSafe } from './idToAriSafe';
|
|
6
|
+
export const buildGatewayQuery = ({
|
|
7
|
+
teamId,
|
|
8
|
+
siteId
|
|
9
|
+
}) => ({
|
|
10
|
+
query: GATEWAY_QUERY_V2,
|
|
11
|
+
variables: {
|
|
12
|
+
teamId: idToAriSafe(teamId),
|
|
13
|
+
siteId: siteId || 'None'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const buildReportingLinesQuery = aaid => ({
|
|
2
|
+
query: `
|
|
3
|
+
fragment ReportingLinesUserPII on UserPII {
|
|
4
|
+
name
|
|
5
|
+
picture
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
fragment ReportingLinesUserFragment on ReportingLinesUser {
|
|
9
|
+
accountIdentifier
|
|
10
|
+
identifierType
|
|
11
|
+
pii {
|
|
12
|
+
...ReportingLinesUserPII
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
query ReportingLines($aaid: String) {
|
|
17
|
+
reportingLines(aaidOrHash: $aaid) {
|
|
18
|
+
managers {
|
|
19
|
+
...ReportingLinesUserFragment
|
|
20
|
+
}
|
|
21
|
+
reports {
|
|
22
|
+
...ReportingLinesUserFragment
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
variables: {
|
|
28
|
+
aaid
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
// for typing `process`
|
|
3
|
+
|
|
4
|
+
import { extractIdFromAri } from './extractIdFromAri';
|
|
5
|
+
export const convertTeam = result => {
|
|
6
|
+
var _team$members;
|
|
7
|
+
const {
|
|
8
|
+
team
|
|
9
|
+
} = result;
|
|
10
|
+
return {
|
|
11
|
+
...team,
|
|
12
|
+
id: extractIdFromAri(team.id),
|
|
13
|
+
members: (_team$members = team.members) === null || _team$members === void 0 ? void 0 : _team$members.nodes.map(({
|
|
14
|
+
member
|
|
15
|
+
}) => ({
|
|
16
|
+
id: member.accountId,
|
|
17
|
+
fullName: member.name,
|
|
18
|
+
avatarUrl: member.picture
|
|
19
|
+
}))
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { graphQLQuery } from './graphQLQuery';
|
|
2
|
+
import { handleDirectoryGraphQLErrors } from './handleDirectoryGraphQLErrors';
|
|
3
|
+
import { id } from './id';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} serviceUrl - GraphQL service endpoint
|
|
7
|
+
* @param {Query} query - GraphQL query
|
|
8
|
+
* @param {HeaderProcessor} processHeaders - a function to add extra headers to the request
|
|
9
|
+
*/
|
|
10
|
+
export async function directoryGraphqlQuery(serviceUrl, query, processHeaders = id) {
|
|
11
|
+
return graphQLQuery(serviceUrl, query, processHeaders, handleDirectoryGraphQLErrors);
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// indented so it's
|
|
2
|
+
const TEAM_FRAGMENT = `
|
|
3
|
+
id
|
|
4
|
+
displayName
|
|
5
|
+
description
|
|
6
|
+
smallHeaderImageUrl
|
|
7
|
+
largeHeaderImageUrl
|
|
8
|
+
smallAvatarImageUrl
|
|
9
|
+
largeAvatarImageUrl
|
|
10
|
+
isVerified
|
|
11
|
+
state
|
|
12
|
+
members {
|
|
13
|
+
nodes {
|
|
14
|
+
member {
|
|
15
|
+
accountId
|
|
16
|
+
name
|
|
17
|
+
picture
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
// We alias the team node to always be team
|
|
24
|
+
export const GATEWAY_QUERY_V2 = `query TeamCard($teamId: ID!, $siteId: String!) {
|
|
25
|
+
Team: team {
|
|
26
|
+
team: teamV2(id: $teamId, siteId: $siteId) @optIn(to: "Team-v2") {
|
|
27
|
+
${TEAM_FRAGMENT}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}`;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { AGGError
|
|
1
|
+
import { AGGError } from '../util/AGGError';
|
|
2
|
+
import { AGGErrors } from '../util/AGGErrors';
|
|
3
|
+
import { DirectoryGraphQLError } from '../util/DirectoryGraphQLError';
|
|
4
|
+
import { DirectoryGraphQLErrors } from '../util/DirectoryGraphQLErrors';
|
|
2
5
|
const IGNORED_ERROR_REASONS_DIRECTORY = [
|
|
3
6
|
// Error categories from pf-directory
|
|
4
7
|
'NotPermitted', 'Gone', 'IdentityUserNotFoundError'];
|
|
@@ -96,10 +99,4 @@ export const getErrorAttributes = error => {
|
|
|
96
99
|
errorMessage: 'Unknown error',
|
|
97
100
|
isSLOFailure: true
|
|
98
101
|
};
|
|
99
|
-
};
|
|
100
|
-
export const handleDirectoryGraphQLErrors = (errors, traceId) => {
|
|
101
|
-
throw new DirectoryGraphQLErrors(errors, traceId);
|
|
102
|
-
};
|
|
103
|
-
export const handleAGGErrors = (errors, traceId) => {
|
|
104
|
-
throw new AGGErrors(errors, traceId);
|
|
105
102
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AGGQuery } from './
|
|
1
|
+
import { AGGQuery } from './AGGQuery';
|
|
2
2
|
const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
|
|
3
3
|
tenantContexts(cloudIds: [$cloudId]) {
|
|
4
4
|
orgId
|
|
@@ -6,7 +6,7 @@ const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
|
|
|
6
6
|
}`;
|
|
7
7
|
const addHeaders = headers => {
|
|
8
8
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
9
|
-
headers.append('atl-client-version', "26.19.
|
|
9
|
+
headers.append('atl-client-version', "26.19.9");
|
|
10
10
|
return headers;
|
|
11
11
|
};
|
|
12
12
|
export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
|
|
@@ -1,86 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
// for typing `process`
|
|
3
3
|
|
|
4
|
-
import { AGGQuery } from './
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const id = ari.slice(slashPos + 1);
|
|
9
|
-
return id;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use idToAriSafe instead
|
|
14
|
-
*/
|
|
15
|
-
export const idToAri = teamId => {
|
|
16
|
-
return `ari:cloud:identity::team/${teamId}`;
|
|
17
|
-
};
|
|
18
|
-
export const idToAriSafe = teamIdOrTeamAri => teamIdOrTeamAri.startsWith(ARI_PREFIX) ? teamIdOrTeamAri : idToAri(teamIdOrTeamAri);
|
|
19
|
-
export const convertTeam = result => {
|
|
20
|
-
var _team$members;
|
|
21
|
-
const {
|
|
22
|
-
team
|
|
23
|
-
} = result;
|
|
24
|
-
return {
|
|
25
|
-
...team,
|
|
26
|
-
id: extractIdFromAri(team.id),
|
|
27
|
-
members: (_team$members = team.members) === null || _team$members === void 0 ? void 0 : _team$members.nodes.map(({
|
|
28
|
-
member
|
|
29
|
-
}) => ({
|
|
30
|
-
id: member.accountId,
|
|
31
|
-
fullName: member.name,
|
|
32
|
-
avatarUrl: member.picture
|
|
33
|
-
}))
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// indented so it's
|
|
38
|
-
const TEAM_FRAGMENT = `
|
|
39
|
-
id
|
|
40
|
-
displayName
|
|
41
|
-
description
|
|
42
|
-
smallHeaderImageUrl
|
|
43
|
-
largeHeaderImageUrl
|
|
44
|
-
smallAvatarImageUrl
|
|
45
|
-
largeAvatarImageUrl
|
|
46
|
-
isVerified
|
|
47
|
-
state
|
|
48
|
-
members {
|
|
49
|
-
nodes {
|
|
50
|
-
member {
|
|
51
|
-
accountId
|
|
52
|
-
name
|
|
53
|
-
picture
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
// We alias the team node to always be team
|
|
60
|
-
export const GATEWAY_QUERY_V2 = `query TeamCard($teamId: ID!, $siteId: String!) {
|
|
61
|
-
Team: team {
|
|
62
|
-
team: teamV2(id: $teamId, siteId: $siteId) @optIn(to: "Team-v2") {
|
|
63
|
-
${TEAM_FRAGMENT}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}`;
|
|
67
|
-
export const buildGatewayQuery = ({
|
|
68
|
-
teamId,
|
|
69
|
-
siteId
|
|
70
|
-
}) => ({
|
|
71
|
-
query: GATEWAY_QUERY_V2,
|
|
72
|
-
variables: {
|
|
73
|
-
teamId: idToAriSafe(teamId),
|
|
74
|
-
siteId: siteId || 'None'
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
export const addHeaders = headers => {
|
|
78
|
-
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
79
|
-
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
80
|
-
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
81
|
-
headers.append('atl-client-version', "26.19.7");
|
|
82
|
-
return headers;
|
|
83
|
-
};
|
|
4
|
+
import { AGGQuery } from './AGGQuery';
|
|
5
|
+
import { addHeaders } from './addHeaders';
|
|
6
|
+
import { buildGatewayQuery } from './buildGatewayQuery';
|
|
7
|
+
import { convertTeam } from './convertTeam';
|
|
84
8
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
85
9
|
const query = buildGatewayQuery({
|
|
86
10
|
teamId,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpError } from '../util/HttpError';
|
|
2
|
+
import { buildHeaders } from './buildHeaders';
|
|
3
|
+
import { id } from './id';
|
|
4
|
+
export async function graphQLQuery(serviceUrl, query, processHeaders = id, handleErrors) {
|
|
5
|
+
var _response$headers;
|
|
6
|
+
const headers = processHeaders(buildHeaders());
|
|
7
|
+
const response = await fetch(new Request(serviceUrl, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
credentials: 'include',
|
|
10
|
+
mode: 'cors',
|
|
11
|
+
headers,
|
|
12
|
+
body: JSON.stringify(query)
|
|
13
|
+
}));
|
|
14
|
+
const traceIdFromHeaders = response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('atl-traceid');
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
throw new HttpError(response.status, response.statusText, traceIdFromHeaders);
|
|
17
|
+
}
|
|
18
|
+
const json = await response.json();
|
|
19
|
+
if (json.errors) {
|
|
20
|
+
var _json$extensions$gate, _json$extensions, _json$extensions$gate2;
|
|
21
|
+
handleErrors(json.errors, (_json$extensions$gate = (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate2 = _json$extensions.gateway) === null || _json$extensions$gate2 === void 0 ? void 0 : _json$extensions$gate2.request_id) !== null && _json$extensions$gate !== void 0 ? _json$extensions$gate : traceIdFromHeaders);
|
|
22
|
+
}
|
|
23
|
+
return json.data;
|
|
24
|
+
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { HttpError } from '../util/errors';
|
|
2
|
-
import { handleAGGErrors, handleDirectoryGraphQLErrors } from './errorUtils';
|
|
3
|
-
const buildHeaders = () => {
|
|
4
|
-
const headers = new Headers();
|
|
5
|
-
headers.append('Content-Type', 'application/json');
|
|
6
|
-
return headers;
|
|
7
|
-
};
|
|
8
|
-
const id = headers => headers;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @param {string} serviceUrl - GraphQL service endpoint
|
|
12
|
-
* @param {Query} query - GraphQL query
|
|
13
|
-
* @param {HeaderProcessor} processHeaders - a function to add extra headers to the request
|
|
14
|
-
*/
|
|
15
|
-
export async function directoryGraphqlQuery(serviceUrl, query, processHeaders = id) {
|
|
16
|
-
return graphQLQuery(serviceUrl, query, processHeaders, handleDirectoryGraphQLErrors);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @param {string} serviceUrl - GraphQL service endpoint
|
|
21
|
-
* @param {Query} query - GraphQL query
|
|
22
|
-
* @param {HeaderProcessor} processHeaders - a function to add extra headers to the request
|
|
23
|
-
*/
|
|
24
|
-
export async function AGGQuery(serviceUrl, query, processHeaders = id) {
|
|
25
|
-
return graphQLQuery(serviceUrl, query, processHeaders, handleAGGErrors);
|
|
26
|
-
}
|
|
27
|
-
async function graphQLQuery(serviceUrl, query, processHeaders = id, handleErrors) {
|
|
28
|
-
var _response$headers;
|
|
29
|
-
const headers = processHeaders(buildHeaders());
|
|
30
|
-
const response = await fetch(new Request(serviceUrl, {
|
|
31
|
-
method: 'POST',
|
|
32
|
-
credentials: 'include',
|
|
33
|
-
mode: 'cors',
|
|
34
|
-
headers,
|
|
35
|
-
body: JSON.stringify(query)
|
|
36
|
-
}));
|
|
37
|
-
const traceIdFromHeaders = response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('atl-traceid');
|
|
38
|
-
if (!response.ok) {
|
|
39
|
-
throw new HttpError(response.status, response.statusText, traceIdFromHeaders);
|
|
40
|
-
}
|
|
41
|
-
const json = await response.json();
|
|
42
|
-
if (json.errors) {
|
|
43
|
-
var _json$extensions$gate, _json$extensions, _json$extensions$gate2;
|
|
44
|
-
handleErrors(json.errors, (_json$extensions$gate = (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate2 = _json$extensions.gateway) === null || _json$extensions$gate2 === void 0 ? void 0 : _json$extensions$gate2.request_id) !== null && _json$extensions$gate !== void 0 ? _json$extensions$gate : traceIdFromHeaders);
|
|
45
|
-
}
|
|
46
|
-
return json.data;
|
|
47
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const id = headers => headers;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
// for typing `process`
|
|
3
|
+
|
|
4
|
+
import { ARI_PREFIX } from './ariPrefix';
|
|
5
|
+
import { idToAri } from './idToAri';
|
|
6
|
+
export const idToAriSafe = teamIdOrTeamAri => teamIdOrTeamAri.startsWith(ARI_PREFIX) ? teamIdOrTeamAri : idToAri(teamIdOrTeamAri);
|