synapse-react-client 3.1.24 → 3.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/dist/components/styled/LeftRightPanel.d.ts +10 -0
  2. package/dist/components/styled/LeftRightPanel.js +45 -0
  3. package/dist/components/styled/LeftRightPanel.js.map +1 -0
  4. package/dist/containers/CardContainerLogic.js +4 -3
  5. package/dist/containers/CardContainerLogic.js.map +1 -1
  6. package/dist/containers/SynapseNavDrawer.js +1 -3
  7. package/dist/containers/SynapseNavDrawer.js.map +1 -1
  8. package/dist/containers/TextField.d.ts +8 -0
  9. package/dist/containers/TextField.js +22 -0
  10. package/dist/containers/TextField.js.map +1 -0
  11. package/dist/containers/access_requirement_list/AccessRequirementList.js +15 -12
  12. package/dist/containers/access_requirement_list/AccessRequirementList.js.map +1 -1
  13. package/dist/containers/access_requirement_list/managedACTAccess/CancelRequestDataAccess.d.ts +1 -1
  14. package/dist/containers/access_requirement_list/managedACTAccess/CancelRequestDataAccess.js +21 -16
  15. package/dist/containers/access_requirement_list/managedACTAccess/CancelRequestDataAccess.js.map +1 -1
  16. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccess.js +1 -1
  17. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccess.js.map +1 -1
  18. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep1.js +14 -9
  19. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep1.js.map +1 -1
  20. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep2.js +22 -18
  21. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep2.js.map +1 -1
  22. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessSuccess.js +11 -7
  23. package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessSuccess.js.map +1 -1
  24. package/dist/containers/auth/AuthenticationMethodSelection.d.ts +17 -0
  25. package/dist/containers/auth/AuthenticationMethodSelection.js +49 -0
  26. package/dist/containers/auth/AuthenticationMethodSelection.js.map +1 -0
  27. package/dist/containers/auth/LoginFlowBackButton.d.ts +10 -0
  28. package/dist/containers/auth/LoginFlowBackButton.js +38 -0
  29. package/dist/containers/auth/LoginFlowBackButton.js.map +1 -0
  30. package/dist/containers/auth/LoginForm.d.ts +18 -0
  31. package/dist/containers/auth/LoginForm.js +32 -0
  32. package/dist/containers/auth/LoginForm.js.map +1 -0
  33. package/dist/containers/auth/LoginPage.d.ts +2 -3
  34. package/dist/containers/auth/LoginPage.js +84 -25
  35. package/dist/containers/auth/LoginPage.js.map +1 -1
  36. package/dist/containers/auth/RecoveryCodeForm.d.ts +8 -0
  37. package/dist/containers/auth/RecoveryCodeForm.js +30 -0
  38. package/dist/containers/auth/RecoveryCodeForm.js.map +1 -0
  39. package/dist/containers/auth/StandaloneLoginForm.d.ts +12 -0
  40. package/dist/containers/auth/StandaloneLoginForm.js +24 -0
  41. package/dist/containers/auth/StandaloneLoginForm.js.map +1 -0
  42. package/dist/containers/auth/TOTPForm.d.ts +8 -0
  43. package/dist/containers/auth/TOTPForm.js +38 -0
  44. package/dist/containers/auth/TOTPForm.js.map +1 -0
  45. package/dist/containers/auth/UsernamePasswordForm.d.ts +9 -0
  46. package/dist/containers/auth/UsernamePasswordForm.js +29 -0
  47. package/dist/containers/auth/UsernamePasswordForm.js.map +1 -0
  48. package/dist/containers/home_page/featured-data/QueryPerFacetPlotsCard.js +2 -1
  49. package/dist/containers/home_page/featured-data/QueryPerFacetPlotsCard.js.map +1 -1
  50. package/dist/containers/table/StandaloneQueryWrapper.js +2 -1
  51. package/dist/containers/table/StandaloneQueryWrapper.js.map +1 -1
  52. package/dist/index.d.ts +4 -4
  53. package/dist/index.js +2 -2
  54. package/dist/index.js.map +1 -1
  55. package/dist/style/base/_core.scss +0 -13
  56. package/dist/style/components/_access-requirement-list.scss +0 -7
  57. package/dist/umd/synapse-react-client.development.css +0 -17
  58. package/dist/umd/synapse-react-client.development.css.map +2 -2
  59. package/dist/umd/synapse-react-client.development.js +28424 -27327
  60. package/dist/umd/synapse-react-client.development.js.map +4 -4
  61. package/dist/umd/synapse-react-client.production.min.css +1 -1
  62. package/dist/umd/synapse-react-client.production.min.js +89 -83
  63. package/dist/umd.index.d.ts +8 -6
  64. package/dist/umd.index.js +5 -3
  65. package/dist/umd.index.js.map +1 -1
  66. package/dist/utils/SynapseClient.d.ts +30 -16
  67. package/dist/utils/SynapseClient.js +99 -120
  68. package/dist/utils/SynapseClient.js.map +1 -1
  69. package/dist/utils/SynapseClientError.d.ts +4 -1
  70. package/dist/utils/SynapseClientError.js +2 -5
  71. package/dist/utils/SynapseClientError.js.map +1 -1
  72. package/dist/utils/SynapseConstants.d.ts +1 -0
  73. package/dist/utils/SynapseConstants.js +2 -1
  74. package/dist/utils/SynapseConstants.js.map +1 -1
  75. package/dist/utils/SynapseContext.d.ts +6 -4
  76. package/dist/utils/SynapseContext.js +26 -6
  77. package/dist/utils/SynapseContext.js.map +1 -1
  78. package/dist/utils/functions/ArrayUtils.d.ts +5 -0
  79. package/dist/utils/functions/ArrayUtils.js +25 -0
  80. package/dist/utils/functions/ArrayUtils.js.map +1 -0
  81. package/dist/utils/hooks/SynapseAPI/KeyFactory.d.ts +102 -0
  82. package/dist/utils/hooks/SynapseAPI/KeyFactory.js +308 -0
  83. package/dist/utils/hooks/SynapseAPI/KeyFactory.js.map +1 -0
  84. package/dist/utils/hooks/SynapseAPI/QueryClientUtils.d.ts +9 -0
  85. package/dist/utils/hooks/SynapseAPI/QueryClientUtils.js +18 -0
  86. package/dist/utils/hooks/SynapseAPI/QueryClientUtils.js.map +1 -0
  87. package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessApprovals.js +2 -2
  88. package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessApprovals.js.map +1 -1
  89. package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessRequirements.js +13 -14
  90. package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessRequirements.js.map +1 -1
  91. package/dist/utils/hooks/SynapseAPI/dataaccess/useDataAccessSubmission.js +17 -18
  92. package/dist/utils/hooks/SynapseAPI/dataaccess/useDataAccessSubmission.js.map +1 -1
  93. package/dist/utils/hooks/SynapseAPI/dataaccess/useGetApprovedSubmissionInfo.js +2 -2
  94. package/dist/utils/hooks/SynapseAPI/dataaccess/useGetApprovedSubmissionInfo.js.map +1 -1
  95. package/dist/utils/hooks/SynapseAPI/doi/useDOI.js +2 -2
  96. package/dist/utils/hooks/SynapseAPI/doi/useDOI.js.map +1 -1
  97. package/dist/utils/hooks/SynapseAPI/download/useDownloadList.d.ts +0 -8
  98. package/dist/utils/hooks/SynapseAPI/download/useDownloadList.js +13 -29
  99. package/dist/utils/hooks/SynapseAPI/download/useDownloadList.js.map +1 -1
  100. package/dist/utils/hooks/SynapseAPI/entity/useEntity.js +19 -19
  101. package/dist/utils/hooks/SynapseAPI/entity/useEntity.js.map +1 -1
  102. package/dist/utils/hooks/SynapseAPI/entity/useEntityBoundSchema.js +4 -5
  103. package/dist/utils/hooks/SynapseAPI/entity/useEntityBoundSchema.js.map +1 -1
  104. package/dist/utils/hooks/SynapseAPI/entity/useEntityBundle.js +2 -3
  105. package/dist/utils/hooks/SynapseAPI/entity/useEntityBundle.js.map +1 -1
  106. package/dist/utils/hooks/SynapseAPI/entity/useGetEntityChildren.js +4 -5
  107. package/dist/utils/hooks/SynapseAPI/entity/useGetEntityChildren.js.map +1 -1
  108. package/dist/utils/hooks/SynapseAPI/entity/useGetEntityHeaders.js +4 -4
  109. package/dist/utils/hooks/SynapseAPI/entity/useGetEntityHeaders.js.map +1 -1
  110. package/dist/utils/hooks/SynapseAPI/entity/useGetQueryResultBundle.js +8 -9
  111. package/dist/utils/hooks/SynapseAPI/entity/useGetQueryResultBundle.js.map +1 -1
  112. package/dist/utils/hooks/SynapseAPI/entity/useSchema.js +3 -1
  113. package/dist/utils/hooks/SynapseAPI/entity/useSchema.js.map +1 -1
  114. package/dist/utils/hooks/SynapseAPI/file/useFiles.js +4 -3
  115. package/dist/utils/hooks/SynapseAPI/file/useFiles.js.map +1 -1
  116. package/dist/utils/hooks/SynapseAPI/file/useUploadDestination.js +2 -2
  117. package/dist/utils/hooks/SynapseAPI/file/useUploadDestination.js.map +1 -1
  118. package/dist/utils/hooks/SynapseAPI/index.d.ts +2 -0
  119. package/dist/utils/hooks/SynapseAPI/index.js +2 -0
  120. package/dist/utils/hooks/SynapseAPI/index.js.map +1 -1
  121. package/dist/utils/hooks/SynapseAPI/oauth/useOAuthClient.js +6 -6
  122. package/dist/utils/hooks/SynapseAPI/oauth/useOAuthClient.js.map +1 -1
  123. package/dist/utils/hooks/SynapseAPI/search/useSearch.js +4 -4
  124. package/dist/utils/hooks/SynapseAPI/search/useSearch.js.map +1 -1
  125. package/dist/utils/hooks/SynapseAPI/team/useTeamMembers.js +4 -4
  126. package/dist/utils/hooks/SynapseAPI/team/useTeamMembers.js.map +1 -1
  127. package/dist/utils/hooks/SynapseAPI/trash/useTrashCan.js +6 -6
  128. package/dist/utils/hooks/SynapseAPI/trash/useTrashCan.js.map +1 -1
  129. package/dist/utils/hooks/SynapseAPI/user/useFavorites.js +8 -8
  130. package/dist/utils/hooks/SynapseAPI/user/useFavorites.js.map +1 -1
  131. package/dist/utils/hooks/SynapseAPI/user/useGetUserChallenges.js +2 -2
  132. package/dist/utils/hooks/SynapseAPI/user/useGetUserChallenges.js.map +1 -1
  133. package/dist/utils/hooks/SynapseAPI/user/useGetUserProjects.js +2 -2
  134. package/dist/utils/hooks/SynapseAPI/user/useGetUserProjects.js.map +1 -1
  135. package/dist/utils/hooks/SynapseAPI/user/useGetUserTeams.js +2 -2
  136. package/dist/utils/hooks/SynapseAPI/user/useGetUserTeams.js.map +1 -1
  137. package/dist/utils/hooks/SynapseAPI/user/usePersonalAccessToken.js +2 -2
  138. package/dist/utils/hooks/SynapseAPI/user/usePersonalAccessToken.js.map +1 -1
  139. package/dist/utils/hooks/SynapseAPI/user/useProjects.js +4 -4
  140. package/dist/utils/hooks/SynapseAPI/user/useProjects.js.map +1 -1
  141. package/dist/utils/hooks/SynapseAPI/user/useUserBundle.js +17 -24
  142. package/dist/utils/hooks/SynapseAPI/user/useUserBundle.js.map +1 -1
  143. package/dist/utils/hooks/SynapseAPI/user/useUserGroupHeader.js +6 -4
  144. package/dist/utils/hooks/SynapseAPI/user/useUserGroupHeader.js.map +1 -1
  145. package/dist/utils/hooks/index.d.ts +15 -0
  146. package/dist/utils/hooks/index.js +20 -0
  147. package/dist/utils/hooks/index.js.map +1 -0
  148. package/dist/utils/hooks/useDetectSSOCode.d.ts +8 -0
  149. package/dist/utils/hooks/useDetectSSOCode.js +90 -0
  150. package/dist/utils/hooks/useDetectSSOCode.js.map +1 -0
  151. package/dist/utils/hooks/useFocus.d.ts +15 -0
  152. package/dist/utils/hooks/useFocus.js +25 -0
  153. package/dist/utils/hooks/useFocus.js.map +1 -0
  154. package/dist/utils/hooks/useLogin.d.ts +15 -0
  155. package/dist/utils/hooks/useLogin.js +155 -0
  156. package/dist/utils/hooks/useLogin.js.map +1 -0
  157. package/dist/utils/hooks/useTraceUpdate.d.ts +1 -0
  158. package/dist/utils/hooks/useTraceUpdate.js +22 -0
  159. package/dist/utils/hooks/useTraceUpdate.js.map +1 -0
  160. package/dist/utils/index.d.ts +3 -2
  161. package/dist/utils/index.js +5 -3
  162. package/dist/utils/index.js.map +1 -1
  163. package/dist/utils/synapseTypes/ErrorResponse.d.ts +22 -0
  164. package/dist/utils/synapseTypes/ErrorResponse.js +17 -0
  165. package/dist/utils/synapseTypes/ErrorResponse.js.map +1 -0
  166. package/dist/utils/synapseTypes/LoginResponse.d.ts +0 -1
  167. package/dist/utils/synapseTypes/TwoFactorAuthLoginRequest.d.ts +12 -0
  168. package/dist/utils/synapseTypes/TwoFactorAuthLoginRequest.js +3 -0
  169. package/dist/utils/synapseTypes/TwoFactorAuthLoginRequest.js.map +1 -0
  170. package/package.json +9 -7
  171. package/dist/assets/ButtonWithIcon.d.ts +0 -12
  172. package/dist/assets/ButtonWithIcon.js +0 -17
  173. package/dist/assets/ButtonWithIcon.js.map +0 -1
  174. package/dist/containers/auth/Login.d.ts +0 -24
  175. package/dist/containers/auth/Login.js +0 -125
  176. package/dist/containers/auth/Login.js.map +0 -1
  177. package/dist/utils/hooks/SynapseAPI/entity/queryKeys.d.ts +0 -93
  178. package/dist/utils/hooks/SynapseAPI/entity/queryKeys.js +0 -69
  179. package/dist/utils/hooks/SynapseAPI/entity/queryKeys.js.map +0 -1
@@ -7,8 +7,8 @@ var __1 = require("../../..");
7
7
  var SynapseContext_1 = require("../../../SynapseContext");
8
8
  function useGetUserGroupHeader(principalId, options) {
9
9
  var _this = this;
10
- var accessToken = (0, SynapseContext_1.useSynapseContext)().accessToken;
11
- var queryKey = ['userGroupHeader', principalId];
10
+ var _a = (0, SynapseContext_1.useSynapseContext)(), accessToken = _a.accessToken, keyFactory = _a.keyFactory;
11
+ var queryKey = keyFactory.getUserGroupHeaderQueryKey(principalId);
12
12
  return (0, react_query_1.useQuery)(queryKey, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
13
13
  var responsePage;
14
14
  return tslib_1.__generator(this, function (_a) {
@@ -27,7 +27,8 @@ function useGetUserGroupHeader(principalId, options) {
27
27
  exports.useGetUserGroupHeader = useGetUserGroupHeader;
28
28
  function useSearchUserGroupHeaders(prefix, filter, options) {
29
29
  var _this = this;
30
- var queryKey = ['userGroupHeader', 'search', prefix, filter];
30
+ var keyFactory = (0, SynapseContext_1.useSynapseContext)().keyFactory;
31
+ var queryKey = keyFactory.getUserGroupHeaderSearchQueryKey(prefix, filter);
31
32
  return (0, react_query_1.useQuery)(queryKey, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
32
33
  var responsePage;
33
34
  return tslib_1.__generator(this, function (_a) {
@@ -43,7 +44,8 @@ function useSearchUserGroupHeaders(prefix, filter, options) {
43
44
  exports.useSearchUserGroupHeaders = useSearchUserGroupHeaders;
44
45
  function useGetUserGroupHeaderWithAlias(aliases, options) {
45
46
  var _this = this;
46
- var queryKey = ['userGroupHeader', aliases];
47
+ var keyFactory = (0, SynapseContext_1.useSynapseContext)().keyFactory;
48
+ var queryKey = keyFactory.getUserGroupHeaderWithAliasQueryKey(aliases);
47
49
  return (0, react_query_1.useQuery)(queryKey, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
48
50
  var response;
49
51
  return tslib_1.__generator(this, function (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"useUserGroupHeader.js","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/SynapseAPI/user/useUserGroupHeader.ts"],"names":[],"mappings":";;;;AAAA,2CAAuD;AACvD,8BAAwC;AAExC,0DAA2D;AAG3D,SAAgB,qBAAqB,CACnC,WAAmB,EACnB,OAA8D;IAFhE,iBAuBC;IAnBS,IAAA,WAAW,GAAK,IAAA,kCAAiB,GAAE,YAAxB,CAAwB;IAC3C,IAAM,QAAQ,GAAG,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAA;IAEjD,OAAO,IAAA,sBAAQ,EACb,QAAQ,EACR;;;;wBACuB,qBAAM,iBAAa,CAAC,oBAAoB,CAC3D,CAAC,WAAW,CAAC,EACb,WAAW,CACZ,EAAA;;oBAHK,YAAY,GAAG,SAGpB;oBACD,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;wBACtC,MAAM,IAAI,KAAK,CACb,iEAA0D,WAAW,mBAAS,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAE,CAC7G,CAAA;qBACF;oBACD,sBAAO,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAA;;;SAChC,EACD,OAAO,CACR,CAAA;AACH,CAAC;AAvBD,sDAuBC;AAED,SAAgB,yBAAyB,CACvC,MAAc,EACd,MAAoB,EACpB,OAAgE;IAHlE,iBAkBC;IAbC,IAAM,QAAQ,GAAG,CAAC,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAE9D,OAAO,IAAA,sBAAQ,EACb,QAAQ,EACR;;;;wBACuB,qBAAM,iBAAa,CAAC,mBAAmB,CAC1D,MAAM,EACN,MAAM,CACP,EAAA;;oBAHK,YAAY,GAAG,SAGpB;oBACD,sBAAO,YAAY,CAAC,QAAQ,EAAA;;;SAC7B,EACD,OAAO,CACR,CAAA;AACH,CAAC;AAlBD,8DAkBC;AAED,SAAgB,8BAA8B,CAC5C,OAAiB,EACjB,OAAgE;IAFlE,iBAgBC;IAZC,IAAM,QAAQ,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IAE7C,OAAO,IAAA,sBAAQ,EACb,QAAQ,EACR;;;;wBACmB,qBAAM,iBAAa,CAAC,6BAA6B,CAChE,OAAO,CACR,EAAA;;oBAFK,QAAQ,GAAG,SAEhB;oBACD,sBAAO,QAAQ,CAAC,IAAI,EAAA;;;SACrB,EACD,OAAO,CACR,CAAA;AACH,CAAC;AAhBD,wEAgBC"}
1
+ {"version":3,"file":"useUserGroupHeader.js","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/SynapseAPI/user/useUserGroupHeader.ts"],"names":[],"mappings":";;;;AAAA,2CAAuD;AACvD,8BAAwC;AAExC,0DAA2D;AAG3D,SAAgB,qBAAqB,CACnC,WAAmB,EACnB,OAA8D;IAFhE,iBAuBC;IAnBO,IAAA,KAA8B,IAAA,kCAAiB,GAAE,EAA/C,WAAW,iBAAA,EAAE,UAAU,gBAAwB,CAAA;IACvD,IAAM,QAAQ,GAAG,UAAU,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAA;IAEnE,OAAO,IAAA,sBAAQ,EACb,QAAQ,EACR;;;;wBACuB,qBAAM,iBAAa,CAAC,oBAAoB,CAC3D,CAAC,WAAW,CAAC,EACb,WAAW,CACZ,EAAA;;oBAHK,YAAY,GAAG,SAGpB;oBACD,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;wBACtC,MAAM,IAAI,KAAK,CACb,iEAA0D,WAAW,mBAAS,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAE,CAC7G,CAAA;qBACF;oBACD,sBAAO,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAA;;;SAChC,EACD,OAAO,CACR,CAAA;AACH,CAAC;AAvBD,sDAuBC;AAED,SAAgB,yBAAyB,CACvC,MAAc,EACd,MAAoB,EACpB,OAAgE;IAHlE,iBAmBC;IAdS,IAAA,UAAU,GAAK,IAAA,kCAAiB,GAAE,WAAxB,CAAwB;IAC1C,IAAM,QAAQ,GAAG,UAAU,CAAC,gCAAgC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE5E,OAAO,IAAA,sBAAQ,EACb,QAAQ,EACR;;;;wBACuB,qBAAM,iBAAa,CAAC,mBAAmB,CAC1D,MAAM,EACN,MAAM,CACP,EAAA;;oBAHK,YAAY,GAAG,SAGpB;oBACD,sBAAO,YAAY,CAAC,QAAQ,EAAA;;;SAC7B,EACD,OAAO,CACR,CAAA;AACH,CAAC;AAnBD,8DAmBC;AAED,SAAgB,8BAA8B,CAC5C,OAAiB,EACjB,OAAgE;IAFlE,iBAkBC;IAdS,IAAA,UAAU,GAAK,IAAA,kCAAiB,GAAE,WAAxB,CAAwB;IAE1C,IAAM,QAAQ,GAAG,UAAU,CAAC,mCAAmC,CAAC,OAAO,CAAC,CAAA;IAExE,OAAO,IAAA,sBAAQ,EACb,QAAQ,EACR;;;;wBACmB,qBAAM,iBAAa,CAAC,6BAA6B,CAChE,OAAO,CACR,EAAA;;oBAFK,QAAQ,GAAG,SAEhB;oBACD,sBAAO,QAAQ,CAAC,IAAI,EAAA;;;SACrB,EACD,OAAO,CACR,CAAA;AACH,CAAC;AAlBD,wEAkBC"}
@@ -0,0 +1,15 @@
1
+ export * from './useCompare';
2
+ export * from './useDebouncedEffect';
3
+ export * from './useDetectSSOCode';
4
+ export * from './useFocus';
5
+ export * from './useGetInfoFromIds';
6
+ export * from './useGetIsAllSelectedInfiniteList';
7
+ export * from './useLogin';
8
+ export * from './useListState';
9
+ export * from './useOverlay';
10
+ export * from './usePreFetchResource';
11
+ export * from './usePrevious';
12
+ export * from './useSet';
13
+ export * from './useShowDesktop';
14
+ export * from './useTraceUpdate';
15
+ export * as SynapseQueries from './SynapseAPI';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SynapseQueries = void 0;
4
+ var tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./useCompare"), exports);
6
+ tslib_1.__exportStar(require("./useDebouncedEffect"), exports);
7
+ tslib_1.__exportStar(require("./useDetectSSOCode"), exports);
8
+ tslib_1.__exportStar(require("./useFocus"), exports);
9
+ tslib_1.__exportStar(require("./useGetInfoFromIds"), exports);
10
+ tslib_1.__exportStar(require("./useGetIsAllSelectedInfiniteList"), exports);
11
+ tslib_1.__exportStar(require("./useLogin"), exports);
12
+ tslib_1.__exportStar(require("./useListState"), exports);
13
+ tslib_1.__exportStar(require("./useOverlay"), exports);
14
+ tslib_1.__exportStar(require("./usePreFetchResource"), exports);
15
+ tslib_1.__exportStar(require("./usePrevious"), exports);
16
+ tslib_1.__exportStar(require("./useSet"), exports);
17
+ tslib_1.__exportStar(require("./useShowDesktop"), exports);
18
+ tslib_1.__exportStar(require("./useTraceUpdate"), exports);
19
+ exports.SynapseQueries = tslib_1.__importStar(require("./SynapseAPI"));
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/utils/hooks/index.ts"],"names":[],"mappings":";;;;AAAA,uDAA4B;AAC5B,+DAAoC;AACpC,6DAAkC;AAClC,qDAA0B;AAC1B,8DAAmC;AACnC,4EAAiD;AACjD,qDAA0B;AAC1B,yDAA8B;AAC9B,uDAA4B;AAC5B,gEAAqC;AACrC,wDAA6B;AAC7B,mDAAwB;AACxB,2DAAgC;AAChC,2DAAgC;AAChC,uEAA8C"}
@@ -0,0 +1,8 @@
1
+ import { TwoFactorAuthErrorResponse } from '../synapseTypes/ErrorResponse';
2
+ type UseDetectSSOCodeOptions = {
3
+ registerAccountUrl?: string;
4
+ onError?: (err: unknown) => void;
5
+ onTwoFactorAuthRequired?: (resp: TwoFactorAuthErrorResponse, callback: () => void) => void;
6
+ };
7
+ export default function useDetectSSOCode(opts?: UseDetectSSOCodeOptions): void;
8
+ export {};
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var getEndpoint_1 = require("../functions/getEndpoint");
4
+ var SynapseClient_1 = require("../SynapseClient");
5
+ var react_1 = require("react");
6
+ var AuthenticationMethodSelection_1 = require("../../containers/auth/AuthenticationMethodSelection");
7
+ /*
8
+ * During SSO login, the authorization provider (Google) will send the user back to the portal with an authorization code,
9
+ * which can be exchanged for a Synapse user session. This function should be called whenever the root App is initialized
10
+ * (to look for this code parameter and complete the round-trip). If state is included, then we assume that this is being
11
+ * used for account creation, where we pass the username through the process.
12
+ */
13
+ function useDetectSSOCode(opts) {
14
+ if (opts === void 0) { opts = {}; }
15
+ var _a = opts.registerAccountUrl, registerAccountUrl = _a === void 0 ? "".concat(getEndpoint_1.PRODUCTION_ENDPOINT_CONFIG.PORTAL, "#!RegisterAccount:0") : _a, onError = opts.onError, onTwoFactorAuthRequired = opts.onTwoFactorAuthRequired;
16
+ (0, react_1.useEffect)(function () {
17
+ var redirectURL = (0, SynapseClient_1.getRootURL)();
18
+ // 'code' handling (from SSO) should be preformed on the root page, and then redirect to original route.
19
+ var fullUrl = new URL(window.location.href);
20
+ // in test environment the searchParams isn't defined
21
+ var searchParams = fullUrl.searchParams;
22
+ if (!searchParams) {
23
+ return;
24
+ }
25
+ var code = searchParams.get('code');
26
+ var provider = searchParams.get('provider');
27
+ var state = searchParams.get('state');
28
+ // state is used during OAuth based Synapse account creation (it's the username)
29
+ if (code && provider) {
30
+ var redirectUrl = "".concat(redirectURL, "?provider=").concat(provider);
31
+ var redirectAfterSuccess_1 = function () {
32
+ // go back to original route after successful SSO login
33
+ var originalUrl = localStorage.getItem('after-sso-login-url');
34
+ localStorage.removeItem('after-sso-login-url');
35
+ if (originalUrl) {
36
+ window.location.replace(originalUrl);
37
+ }
38
+ };
39
+ if (AuthenticationMethodSelection_1.PROVIDERS.GOOGLE == provider) {
40
+ var onSuccess = function (response) {
41
+ if ('accessToken' in response) {
42
+ (0, SynapseClient_1.setAccessTokenCookie)(response.accessToken).then(redirectAfterSuccess_1);
43
+ }
44
+ else {
45
+ // The app will redirect or open a modal to handle 2FA
46
+ if (onTwoFactorAuthRequired) {
47
+ onTwoFactorAuthRequired(response, redirectAfterSuccess_1);
48
+ }
49
+ }
50
+ };
51
+ var onFailure = function (err) {
52
+ if (err.status === 404) {
53
+ // Synapse account not found, send to registration page
54
+ window.location.replace(registerAccountUrl);
55
+ }
56
+ console.error('Error with Google account association: ', err);
57
+ if (onError) {
58
+ onError(err.reason);
59
+ }
60
+ };
61
+ if (state) {
62
+ (0, SynapseClient_1.oAuthRegisterAccountStep2)(state, provider, code, redirectUrl, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT)
63
+ .then(onSuccess)
64
+ .catch(onFailure);
65
+ }
66
+ else {
67
+ (0, SynapseClient_1.oAuthSessionRequest)(provider, code, redirectUrl, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT)
68
+ .then(onSuccess)
69
+ .catch(onFailure);
70
+ }
71
+ }
72
+ else if (AuthenticationMethodSelection_1.PROVIDERS.ORCID == provider) {
73
+ // now bind this to the user account
74
+ var onFailure = function (err) {
75
+ console.error('Error binding ORCiD to account: ', err);
76
+ if (onError) {
77
+ onError(err.reason);
78
+ }
79
+ };
80
+ (0, SynapseClient_1.bindOAuthProviderToAccount)(provider, code, redirectUrl, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT)
81
+ .then(redirectAfterSuccess_1)
82
+ .catch(onFailure);
83
+ }
84
+ }
85
+ // Intentionally have an empty dep array -- this should only run once per mount since it's checking for params that come from a redirect
86
+ // eslint-disable-next-line react-hooks/exhaustive-deps
87
+ }, []);
88
+ }
89
+ exports.default = useDetectSSOCode;
90
+ //# sourceMappingURL=useDetectSSOCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDetectSSOCode.js","sourceRoot":"","sources":["../../../src/lib/utils/hooks/useDetectSSOCode.ts"],"names":[],"mappings":";;AAAA,wDAGiC;AAGjC,kDAMyB;AACzB,+BAAiC;AAEjC,qGAA+E;AAW/E;;;;;GAKG;AACH,SAAwB,gBAAgB,CACtC,IAAkC;IAAlC,qBAAA,EAAA,SAAkC;IAGhC,IAAA,KAGE,IAAI,mBAHwE,EAA9E,kBAAkB,mBAAG,UAAG,wCAA0B,CAAC,MAAM,wBAAqB,KAAA,EAC9E,OAAO,GAEL,IAAI,QAFC,EACP,uBAAuB,GACrB,IAAI,wBADiB,CACjB;IACR,IAAA,iBAAS,EAAC;QACR,IAAM,WAAW,GAAG,IAAA,0BAAU,GAAE,CAAA;QAChC,wGAAwG;QACxG,IAAM,OAAO,GAAQ,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAClD,qDAAqD;QAC7C,IAAA,YAAY,GAAK,OAAO,aAAZ,CAAY;QAChC,IAAI,CAAC,YAAY,EAAE;YACjB,OAAM;SACP;QACD,IAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACrC,IAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QAC7C,IAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACvC,gFAAgF;QAChF,IAAI,IAAI,IAAI,QAAQ,EAAE;YACpB,IAAM,WAAW,GAAG,UAAG,WAAW,uBAAa,QAAQ,CAAE,CAAA;YACzD,IAAM,sBAAoB,GAAG;gBAC3B,uDAAuD;gBACvD,IAAM,WAAW,GAAG,YAAY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f,KAAK,CAAC,SAAS,CAAC,CAAA;iBACpB;aACF;iBAAM,IAAI,yCAAS,CAAC,KAAK,IAAI,QAAQ,EAAE;gBACtC,oCAAoC;gBACpC,IAAM,SAAS,GAAG,UAAC,GAAuB;oBACxC,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAA;oBACtD,IAAI,OAAO,EAAE;wBACX,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;qBACpB;gBACH,CAAC,CAAA;gBACD,IAAA,0CAA0B,EACxB,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,oCAAsB,CAAC,aAAa,CACrC;qBACE,IAAI,CAAC,sBAAoB,CAAC;qBAC1B,KAAK,CAAC,SAAS,CAAC,CAAA;aACpB;SACF;QACD,wIAAwI;QACxI,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC;AAlGD,mCAkGC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * How to use:
3
+ const [inputRef, setInputFocus] = useFocus()
4
+ return (
5
+ <>
6
+ <button onClick={setInputFocus} >
7
+ Click to ask input to request focus
8
+ </button>
9
+ <input ref={inputRef} />
10
+ </>
11
+ )
12
+ */
13
+ /// <reference types="react" />
14
+ declare const useFocus: () => (import("react").MutableRefObject<HTMLInputElement | undefined> | (() => void))[];
15
+ export default useFocus;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * How to use:
4
+ const [inputRef, setInputFocus] = useFocus()
5
+ return (
6
+ <>
7
+ <button onClick={setInputFocus} >
8
+ Click to ask input to request focus
9
+ </button>
10
+ <input ref={inputRef} />
11
+ </>
12
+ )
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ var react_1 = require("react");
16
+ var useFocus = function () {
17
+ var ref = (0, react_1.useRef)();
18
+ var setFocus = function () {
19
+ var _a;
20
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
21
+ };
22
+ return [ref, setFocus];
23
+ };
24
+ exports.default = useFocus;
25
+ //# sourceMappingURL=useFocus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocus.js","sourceRoot":"","sources":["../../../src/lib/utils/hooks/useFocus.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAEH,+BAA8B;AAE9B,IAAM,QAAQ,GAAG;IACf,IAAM,GAAG,GAAG,IAAA,cAAM,GAAoB,CAAA;IACtC,IAAM,QAAQ,GAAG;;QACf,MAAA,GAAG,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA;IACtB,CAAC,CAAA;IACD,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AACxB,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { TwoFactorAuthOtpType } from '../synapseTypes/TwoFactorAuthLoginRequest';
3
+ import { TwoFactorAuthErrorResponse } from '../synapseTypes/ErrorResponse';
4
+ export type UseLoginReturn = {
5
+ step: 'CHOOSE_AUTH_METHOD' | 'USERNAME_PASSWORD' | 'VERIFICATION_CODE' | 'RECOVERY_CODE' | 'LOGGED_IN';
6
+ onStepChange: Dispatch<SetStateAction<UseLoginReturn['step']>>;
7
+ submitUsernameAndPassword: (username: string, password: string) => void;
8
+ submitOneTimePassword: (code: string, otpType?: TwoFactorAuthOtpType) => void;
9
+ errorMessage: string | undefined;
10
+ isLoading: boolean;
11
+ };
12
+ /**
13
+ * Stateful hook that manages logging into Synapse
14
+ */
15
+ export default function useLogin(sessionCallback?: () => void, twoFaErrorResponse?: TwoFactorAuthErrorResponse): UseLoginReturn;
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var react_1 = require("react");
5
+ var index_1 = require("../index");
6
+ var SynapseConstants_1 = require("../SynapseConstants");
7
+ var react_query_1 = require("react-query");
8
+ /**
9
+ * Stateful hook that manages logging into Synapse
10
+ */
11
+ function useLogin(sessionCallback, twoFaErrorResponse) {
12
+ var _this = this;
13
+ var _a = (0, react_1.useState)('CHOOSE_AUTH_METHOD'), step = _a[0], setStep = _a[1];
14
+ var _b = (0, react_1.useState)(), errorMessage = _b[0], setErrorMessage = _b[1];
15
+ var _c = (0, react_1.useState)(), userId = _c[0], setUserId = _c[1];
16
+ var _d = (0, react_1.useState)(), twoFaToken = _d[0], setTwoFaToken = _d[1];
17
+ /*
18
+ * In SWC, if logging in with OAuth, the servlet will call POST /oauth2/session2 to get the access token.
19
+ *
20
+ * If the user has 2FA enabled, the servlet will receive a 401 with the userId and twoFaToken in the response.
21
+ * The servlet will then redirect the user to the login page with the userId and twoFaToken in the searchParams.
22
+ *
23
+ * This effect will check if the search params are present, and change the step to 'VERIFICATION_CODE' if they are.
24
+ */
25
+ (0, react_1.useEffect)(function () {
26
+ // Replace the hash with a slash to handle SWC, which uses a hash in the URL. Otherwise, the searchParams aren't found
27
+ var fullUrl = new URL(window.location.href.replaceAll('#', '/'));
28
+ var searchParams = fullUrl.searchParams;
29
+ if (searchParams) {
30
+ var userId_1 = searchParams.get('userId');
31
+ var twoFaToken_1 = searchParams.get('twoFaToken');
32
+ if (userId_1 && twoFaToken_1) {
33
+ setUserId(parseInt(userId_1, 10));
34
+ setTwoFaToken(twoFaToken_1);
35
+ if (!['VERIFICATION_CODE', 'RECOVERY_CODE', 'LOGGED_IN'].includes(step)) {
36
+ setStep('VERIFICATION_CODE');
37
+ }
38
+ }
39
+ }
40
+ }, [step]);
41
+ /*
42
+ * In client-only apps (like Portals), if logging in with OAuth, the client app will call POST /oauth2/session2 to get the access token.
43
+ *
44
+ * If the user has 2FA enabled, the client app will receive a 401 with the userId and twoFaToken in the response.
45
+ *
46
+ * The app can pass the error response as a prop/argument, and we'll use it here to jump straight to the VERIFICATION_CODE step.
47
+ */
48
+ (0, react_1.useEffect)(function () {
49
+ if (twoFaErrorResponse) {
50
+ setTwoFaToken(twoFaErrorResponse.twoFaToken);
51
+ setUserId(twoFaErrorResponse.userId);
52
+ if (!['VERIFICATION_CODE', 'RECOVERY_CODE', 'LOGGED_IN'].includes(step)) {
53
+ setStep('VERIFICATION_CODE');
54
+ }
55
+ }
56
+ }, [twoFaErrorResponse]);
57
+ function finishLogin(loginResponse) {
58
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
59
+ return tslib_1.__generator(this, function (_a) {
60
+ switch (_a.label) {
61
+ case 0: return [4 /*yield*/, index_1.SynapseClient.setAccessTokenCookie(loginResponse.accessToken)];
62
+ case 1:
63
+ _a.sent();
64
+ localStorage.setItem(SynapseConstants_1.AUTHENTICATION_RECEIPT_LOCALSTORAGE_KEY, loginResponse.authenticationReceipt);
65
+ setStep('LOGGED_IN');
66
+ if (sessionCallback) {
67
+ sessionCallback();
68
+ }
69
+ return [2 /*return*/];
70
+ }
71
+ });
72
+ });
73
+ }
74
+ var _e = (0, react_query_1.useMutation)(function (_a) {
75
+ var username = _a.username, password = _a.password, authenticationReceipt = _a.authenticationReceipt;
76
+ return index_1.SynapseClient.login(username, password, authenticationReceipt);
77
+ }, {
78
+ onError: function (error) {
79
+ setErrorMessage(error.reason);
80
+ },
81
+ onSuccess: function (loginResponse) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
82
+ return tslib_1.__generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0:
85
+ if (!('errorCode' in loginResponse)) return [3 /*break*/, 1];
86
+ setStep('VERIFICATION_CODE');
87
+ setTwoFaToken(loginResponse.twoFaToken);
88
+ setUserId(loginResponse.userId);
89
+ return [3 /*break*/, 3];
90
+ case 1: return [4 /*yield*/, finishLogin(loginResponse)];
91
+ case 2:
92
+ _a.sent();
93
+ _a.label = 3;
94
+ case 3: return [2 /*return*/];
95
+ }
96
+ });
97
+ }); },
98
+ }), mutateLoginWithUsernameAndPassword = _e.mutate, isLoadingLoginWithUsernameAndPassword = _e.isLoading;
99
+ var _f = (0, react_query_1.useMutation)(index_1.SynapseClient.loginWith2fa, {
100
+ onError: function (e) {
101
+ setErrorMessage(e.reason);
102
+ if (
103
+ // The twoFaToken wasn't transmitted correctly
104
+ e.reason.includes('The provided twoFaToken is invalid') ||
105
+ // The user waited too long to enter the code.
106
+ e.reason.includes('Token has expired')) {
107
+ console.warn(e);
108
+ // Instruct the user refresh to start over.
109
+ setErrorMessage('Something went wrong. Refresh the page and try again.');
110
+ // If the 2FA token is in the search parameters, remove it so the user doesn't just get the same error again.
111
+ if (window.location.href.includes('twoFaToken')) {
112
+ window.history.replaceState({}, document.title,
113
+ // using regex because SWC hashbang doesn't work with URLSearchParams
114
+ window.location.href.replaceAll(/(twoFaToken|userId)=[^&]*&?/g, ''));
115
+ }
116
+ }
117
+ },
118
+ onSuccess: finishLogin,
119
+ }), mutateLoginWith2FACode = _f.mutate, isLoadingLoginWith2FACode = _f.isLoading;
120
+ var submitUsernameAndPassword = function (username, password) {
121
+ setErrorMessage(undefined);
122
+ var authenticationReceipt = localStorage.getItem(SynapseConstants_1.AUTHENTICATION_RECEIPT_LOCALSTORAGE_KEY);
123
+ mutateLoginWithUsernameAndPassword({
124
+ username: username,
125
+ password: password,
126
+ authenticationReceipt: authenticationReceipt,
127
+ });
128
+ };
129
+ var submitOneTimePassword = function (code, otpType) {
130
+ if (otpType === void 0) { otpType = step === 'RECOVERY_CODE' ? 'RECOVERY_CODE' : 'TOTP'; }
131
+ setErrorMessage(undefined);
132
+ if (twoFaToken == null || userId == null) {
133
+ // This could happen if the 2FA component exists on its own route, and the user directly navigates to it without first logging in with credentials/OAuth
134
+ setErrorMessage('You did not first log in with your password or a third-party identity provider.');
135
+ return;
136
+ }
137
+ var request = {
138
+ userId: userId,
139
+ twoFaToken: twoFaToken,
140
+ otpCode: code,
141
+ otpType: otpType,
142
+ };
143
+ mutateLoginWith2FACode(request);
144
+ };
145
+ return {
146
+ step: step,
147
+ onStepChange: setStep,
148
+ submitUsernameAndPassword: submitUsernameAndPassword,
149
+ submitOneTimePassword: submitOneTimePassword,
150
+ errorMessage: errorMessage,
151
+ isLoading: isLoadingLoginWithUsernameAndPassword || isLoadingLoginWith2FACode,
152
+ };
153
+ }
154
+ exports.default = useLogin;
155
+ //# sourceMappingURL=useLogin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../../src/lib/utils/hooks/useLogin.ts"],"names":[],"mappings":";;;AAAA,+BAAqE;AACrE,kCAAwC;AAOxC,wDAA6E;AAC7E,2CAAyC;AAqBzC;;GAEG;AACH,SAAwB,QAAQ,CAC9B,eAA4B,EAC5B,kBAA+C;IAFjD,iBA6KC;IAzKO,IAAA,KAAkB,IAAA,gBAAQ,EAAyB,oBAAoB,CAAC,EAAvE,IAAI,QAAA,EAAE,OAAO,QAA0D,CAAA;IACxE,IAAA,KAAkC,IAAA,gBAAQ,GAAU,EAAnD,YAAY,QAAA,EAAE,eAAe,QAAsB,CAAA;IACpD,IAAA,KAAsB,IAAA,gBAAQ,GAAU,EAAvC,MAAM,QAAA,EAAE,SAAS,QAAsB,CAAA;IACxC,IAAA,KAA8B,IAAA,gBAAQ,GAAU,EAA/C,UAAU,QAAA,EAAE,aAAa,QAAsB,CAAA;IAEtD;;;;;;;OAOG;IACH,IAAA,iBAAS,EAAC;QACR,sHAAsH;QACtH,IAAM,OAAO,GAAQ,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;QAE/D,IAAA,YAAY,GAAK,OAAO,aAAZ,CAAY;QAChC,IAAI,YAAY,EAAE;YAChB,IAAM,QAAM,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACzC,IAAM,YAAU,GAAG,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;YACjD,IAAI,QAAM,IAAI,YAAU,EAAE;gBACxB,SAAS,CAAC,QAAQ,CAAC,QAAM,EAAE,EAAE,CAAC,CAAC,CAAA;gB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,CAAA;QAC1B,IAAM,qBAAqB,GAAG,YAAY,CAAC,OAAO,CAChD,0DAAuC,CACxC,CAAA;QACD,kCAAkC,CAAC;YACjC,QAAQ,UAAA;YACR,QAAQ,UAAA;YACR,qBAAqB,uBAAA;SACtB,CAAC,CAAA;IACJ,CAAC,CAAA;IAEH,IAAM,qBAAqB,GAA4C,UACrE,IAAI,EACJ,OAA6D;QAA7D,wBAAA,EAAA,UAAU,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM;QAE7D,eAAe,CAAC,SAAS,CAAC,CAAA;QAC1B,IAAI,UAAU,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE;YACxC,wJAAwJ;YACxJ,eAAe,CACb,iFAAiF,CAClF,CAAA;YACD,OAAM;SACP;QACD,IAAM,OAAO,GAA8B;YACzC,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,OAAO;SACjB,CAAA;QACD,sBAAsB,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC,CAAA;IAED,OAAO;QACL,IAAI,MAAA;QACJ,YAAY,EAAE,OAAO;QACrB,yBAAyB,2BAAA;QACzB,qBAAqB,EAAE,qBAAqB;QAC5C,YAAY,cAAA;QACZ,SAAS,EACP,qCAAqC,IAAI,yBAAyB;KACrE,CAAA;AACH,CAAC;AA7KD,2BA6KC"}
@@ -0,0 +1 @@
1
+ export default function useTraceUpdate(props: any): void;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var react_1 = require("react");
4
+ // https://stackoverflow.com/questions/41004631/trace-why-a-react-component-is-re-rendering
5
+ function useTraceUpdate(props) {
6
+ var prev = (0, react_1.useRef)(props);
7
+ (0, react_1.useEffect)(function () {
8
+ var changedProps = Object.entries(props).reduce(function (ps, _a) {
9
+ var k = _a[0], v = _a[1];
10
+ if (prev.current[k] !== v) {
11
+ ps[k] = [prev.current[k], v];
12
+ }
13
+ return ps;
14
+ }, {});
15
+ if (Object.keys(changedProps).length > 0) {
16
+ console.log('Changed props:', changedProps);
17
+ }
18
+ prev.current = props;
19
+ });
20
+ }
21
+ exports.default = useTraceUpdate;
22
+ //# sourceMappingURL=useTraceUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTraceUpdate.js","sourceRoot":"","sources":["../../../src/lib/utils/hooks/useTraceUpdate.ts"],"names":[],"mappings":";;AAAA,+BAAyC;AAEzC,2FAA2F;AAC3F,SAAwB,cAAc,CAAC,KAAU;IAC/C,IAAM,IAAI,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAA;IAC1B,IAAA,iBAAS,EAAC;QACR,IAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAC,EAAE,EAAE,EAAM;gBAAL,CAAC,QAAA,EAAE,CAAC,QAAA;YAC1D,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBACzB,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;aAC7B;YACD,OAAO,EAAE,CAAA;QACX,CAAC,EAAE,EAAE,CAAC,CAAA;QACN,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACxC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAA;SAC5C;QACD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC,CAAC,CAAA;AACJ,CAAC;AAdD,iCAcC"}
@@ -1,6 +1,7 @@
1
1
  import * as SynapseConstants from './SynapseConstants';
2
2
  import * as SynapseClient from './SynapseClient';
3
- import * as SynapseQueries from './hooks/SynapseAPI';
3
+ import * as SynapseHookUtils from './hooks';
4
+ import { SynapseQueries } from './hooks';
4
5
  import { RequiredProperties } from './types/RequiredProperties';
5
- export { SynapseConstants, SynapseClient, SynapseQueries };
6
+ export { SynapseConstants, SynapseClient, SynapseHookUtils, SynapseQueries };
6
7
  export type { RequiredProperties };
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SynapseQueries = exports.SynapseClient = exports.SynapseConstants = void 0;
3
+ exports.SynapseQueries = exports.SynapseHookUtils = exports.SynapseClient = exports.SynapseConstants = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var SynapseConstants = tslib_1.__importStar(require("./SynapseConstants"));
6
6
  exports.SynapseConstants = SynapseConstants;
7
7
  var SynapseClient = tslib_1.__importStar(require("./SynapseClient"));
8
8
  exports.SynapseClient = SynapseClient;
9
- var SynapseQueries = tslib_1.__importStar(require("./hooks/SynapseAPI"));
10
- exports.SynapseQueries = SynapseQueries;
9
+ var SynapseHookUtils = tslib_1.__importStar(require("./hooks"));
10
+ exports.SynapseHookUtils = SynapseHookUtils;
11
+ var hooks_1 = require("./hooks");
12
+ Object.defineProperty(exports, "SynapseQueries", { enumerable: true, get: function () { return hooks_1.SynapseQueries; } });
11
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/utils/index.tsx"],"names":[],"mappings":";;;;AAAA,2EAAsD;AAK7C,4CAAgB;AAJzB,qEAAgD;AAIrB,sCAAa;AAHxC,yEAAoD;AAGV,wCAAc"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/utils/index.tsx"],"names":[],"mappings":";;;;AAAA,2EAAsD;AAM7C,4CAAgB;AALzB,qEAAgD;AAKrB,sCAAa;AAJxC,gEAA2C;AAID,4CAAgB;AAH1D,iCAAwC;AAGoB,+FAHnD,sBAAc,OAGmD"}
@@ -0,0 +1,22 @@
1
+ export declare enum ErrorResponseCode {
2
+ PASSWORD_RESET_VIA_EMAIL_REQUIRED = "PASSWORD_RESET_VIA_EMAIL_REQUIRED",
3
+ USER_CERTIFICATION_REQUIRED = "USER_CERTIFICATION_REQUIRED",
4
+ INVALID_TABLE_QUERY_FACET_COLUMN_REQUEST = "INVALID_TABLE_QUERY_FACET_COLUMN_REQUEST",
5
+ OAUTH_CLIENT_NOT_VERIFIED = "OAUTH_CLIENT_NOT_VERIFIED",
6
+ TWO_FA_REQUIRED = "TWO_FA_REQUIRED"
7
+ }
8
+ /**
9
+ * https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/ErrorResponse.html
10
+ */
11
+ export type ErrorResponse = {
12
+ concreteType: 'org.sagebionetworks.repo.model.ErrorResponse';
13
+ reason: string;
14
+ errorCode?: ErrorResponseCode;
15
+ };
16
+ export type TwoFactorAuthErrorResponse = {
17
+ concreteType: 'org.sagebionetworks.repo.model.auth.TwoFactorAuthErrorResponse';
18
+ userId: number;
19
+ twoFaToken: string;
20
+ reason: string;
21
+ errorCode: ErrorResponseCode.TWO_FA_REQUIRED;
22
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorResponseCode = void 0;
4
+ var ErrorResponseCode;
5
+ (function (ErrorResponseCode) {
6
+ /* The user's password must be reset via email. */
7
+ ErrorResponseCode["PASSWORD_RESET_VIA_EMAIL_REQUIRED"] = "PASSWORD_RESET_VIA_EMAIL_REQUIRED";
8
+ /* The user has not passed the certification process. */
9
+ ErrorResponseCode["USER_CERTIFICATION_REQUIRED"] = "USER_CERTIFICATION_REQUIRED";
10
+ /* At least one of the columns listed in a FacetColumnRequest is not facet-able according to the table's schema. */
11
+ ErrorResponseCode["INVALID_TABLE_QUERY_FACET_COLUMN_REQUEST"] = "INVALID_TABLE_QUERY_FACET_COLUMN_REQUEST";
12
+ /* The OAuth Client is not verified. */
13
+ ErrorResponseCode["OAUTH_CLIENT_NOT_VERIFIED"] = "OAUTH_CLIENT_NOT_VERIFIED";
14
+ /* Two-factor authentication is required. */
15
+ ErrorResponseCode["TWO_FA_REQUIRED"] = "TWO_FA_REQUIRED";
16
+ })(ErrorResponseCode = exports.ErrorResponseCode || (exports.ErrorResponseCode = {}));
17
+ //# sourceMappingURL=ErrorResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorResponse.js","sourceRoot":"","sources":["../../../src/lib/utils/synapseTypes/ErrorResponse.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,kDAAkD;IAClD,4FAAuE,CAAA;IACvE,wDAAwD;IACxD,gFAA2D,CAAA;IAC3D,mHAAmH;IACnH,0GAAqF,CAAA;IACrF,uCAAuC;IACvC,4EAAuD,CAAA;IACvD,4CAA4C;IAC5C,wDAAmC,CAAA;AACrC,CAAC,EAXW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAW5B"}
@@ -1,6 +1,5 @@
1
1
  export type LoginResponse = {
2
2
  accessToken: string;
3
- sessionToken: string;
4
3
  acceptsTermsOfUse: boolean;
5
4
  authenticationReceipt: string;
6
5
  };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Used to log in when two-factor authentication is enabled.
3
+ *
4
+ * https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/auth/TwoFactorAuthLoginRequest.html
5
+ */
6
+ export type TwoFactorAuthLoginRequest = {
7
+ userId: number;
8
+ twoFaToken: string;
9
+ otpCode: string;
10
+ otpType: TwoFactorAuthOtpType;
11
+ };
12
+ export type TwoFactorAuthOtpType = 'TOTP' | 'RECOVERY_CODE';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TwoFactorAuthLoginRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TwoFactorAuthLoginRequest.js","sourceRoot":"","sources":["../../../src/lib/utils/synapseTypes/TwoFactorAuthLoginRequest.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synapse-react-client",
3
- "version": "3.1.24",
3
+ "version": "3.1.26",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,7 +20,8 @@
20
20
  "@emotion/react": "^11.10.5",
21
21
  "@emotion/styled": "^11.10.5",
22
22
  "@mui/icons-material": "^5.11.0",
23
- "@mui/material": "^5.11.6",
23
+ "@mui/material": "^5.11.8",
24
+ "@mui/system": "^5.11.9",
24
25
  "@mui/x-date-pickers": "^5.0.15",
25
26
  "@popperjs/core": "^2.10.2",
26
27
  "@react-google-maps/api": "^2.13.1",
@@ -57,6 +58,7 @@
57
58
  "markdown-it-synapse-heading": "^1.0.1",
58
59
  "markdown-it-synapse-math": "^3.0.4",
59
60
  "markdown-it-synapse-table": "^1.0.6",
61
+ "mui-one-time-password-input": "^1.0.4",
60
62
  "plotly.js-basic-dist": "^2.11.1",
61
63
  "pluralize": "^8.0.0",
62
64
  "raf": "^3.4.1",
@@ -132,7 +134,7 @@
132
134
  "@types/brainhubeu__react-carousel": "1.15.0",
133
135
  "@types/dagre": "^0.7.47",
134
136
  "@types/google.maps": "^3.50.2",
135
- "@types/jest": "^28.1.5",
137
+ "@types/jest": "^29.4.0",
136
138
  "@types/jest-when": "^3.5.0",
137
139
  "@types/jquery": "^3.5.14",
138
140
  "@types/json-schema": "^7.0.11",
@@ -162,7 +164,7 @@
162
164
  "@vitejs/plugin-legacy": "^3.0.2",
163
165
  "@vitejs/plugin-react": "^3.0.1",
164
166
  "@welldone-software/why-did-you-render": "^7.0.1",
165
- "babel-jest": "^28.1.1",
167
+ "babel-jest": "^29.4.3",
166
168
  "babel-loader": "^8.2.5",
167
169
  "buffer": "^6.0.3",
168
170
  "copyfiles": "^2.4.1",
@@ -181,8 +183,8 @@
181
183
  "eslint-plugin-testing-library": "^5.0.6",
182
184
  "https-browserify": "^1.0.0",
183
185
  "identity-obj-proxy": "^3.0.0",
184
- "jest": "^29.4.1",
185
- "jest-environment-jsdom": "^29.4.1",
186
+ "jest": "^29.4.3",
187
+ "jest-environment-jsdom": "^29.4.3",
186
188
  "jest-fail-on-console": "^3.0.2",
187
189
  "jest-html-reporter": "^3.7.0",
188
190
  "jest-mock-promise": "^1.1.10",
@@ -252,7 +254,7 @@
252
254
  "test:coverage": "jest --coverage --runInBand",
253
255
  "build": "rimraf dist && pnpm build:js && pnpm build:copy-assets && pnpm build:esbuild",
254
256
  "build:js": "tsc --p tsconfig.build.json",
255
- "build:copy-assets": "copyfiles -u 2 src/lib/**/*.{css,scss,svg} dist",
257
+ "build:copy-assets": "copyfiles -u 2 \"src/lib/**/*.{css,scss,svg}\" dist",
256
258
  "build:esbuild": "node esbuild.config.mjs",
257
259
  "serve:docs": "pnpm storybook",
258
260
  "build:docs": "pnpm build:storybook",