@os-team/profile 1.1.13 → 1.1.15

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 (226) hide show
  1. package/dist/cjs/components/profile/ProfileButton.js +4 -6
  2. package/dist/cjs/components/profile/ProfileButton.js.map +1 -1
  3. package/dist/cjs/components/profile/ProfileConfigContext.js +5 -7
  4. package/dist/cjs/components/profile/ProfileConfigContext.js.map +1 -1
  5. package/dist/cjs/components/profile/ProfileContext.js +5 -7
  6. package/dist/cjs/components/profile/ProfileContext.js.map +1 -1
  7. package/dist/cjs/components/profile/ProfileDrawer.js +10 -16
  8. package/dist/cjs/components/profile/ProfileDrawer.js.map +1 -1
  9. package/dist/cjs/components/profile/ProfileDrawerContent.js +73 -103
  10. package/dist/cjs/components/profile/ProfileDrawerContent.js.map +1 -1
  11. package/dist/cjs/components/profile/ProfileNavigationItem.js +10 -11
  12. package/dist/cjs/components/profile/ProfileNavigationItem.js.map +1 -1
  13. package/dist/cjs/components/profile/ProfileUpdateNameModal.js +43 -54
  14. package/dist/cjs/components/profile/ProfileUpdateNameModal.js.map +1 -1
  15. package/dist/cjs/components/profile/ProfileUpdatePasswordModal.js +42 -52
  16. package/dist/cjs/components/profile/ProfileUpdatePasswordModal.js.map +1 -1
  17. package/dist/cjs/components/profile/ProtectedWrapper.js +27 -27
  18. package/dist/cjs/components/profile/ProtectedWrapper.js.map +1 -1
  19. package/dist/cjs/components/profile/UserAvatar.js +16 -15
  20. package/dist/cjs/components/profile/UserAvatar.js.map +1 -1
  21. package/dist/cjs/components/profile/UserAvatarAddon.js +13 -23
  22. package/dist/cjs/components/profile/UserAvatarAddon.js.map +1 -1
  23. package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js +1 -2
  24. package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +1 -1
  25. package/dist/cjs/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js +1 -2
  26. package/dist/cjs/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +1 -1
  27. package/dist/cjs/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js +1 -2
  28. package/dist/cjs/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js.map +1 -1
  29. package/dist/cjs/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js +1 -2
  30. package/dist/cjs/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js.map +1 -1
  31. package/dist/cjs/components/profile/__generated__/ProtectedWrapperQuery.graphql.js +1 -2
  32. package/dist/cjs/components/profile/__generated__/ProtectedWrapperQuery.graphql.js.map +1 -1
  33. package/dist/cjs/components/session/SessionDrawer.js +11 -15
  34. package/dist/cjs/components/session/SessionDrawer.js.map +1 -1
  35. package/dist/cjs/components/session/SessionDrawerContent.js +13 -14
  36. package/dist/cjs/components/session/SessionDrawerContent.js.map +1 -1
  37. package/dist/cjs/components/session/SessionList.js +31 -55
  38. package/dist/cjs/components/session/SessionList.js.map +1 -1
  39. package/dist/cjs/components/session/SessionListItem.js +59 -106
  40. package/dist/cjs/components/session/SessionListItem.js.map +1 -1
  41. package/dist/cjs/components/session/SessionListSkeleton.js +8 -9
  42. package/dist/cjs/components/session/SessionListSkeleton.js.map +1 -1
  43. package/dist/cjs/components/session/__generated__/SessionDrawerContentQuery.graphql.js +1 -1
  44. package/dist/cjs/components/session/__generated__/SessionDrawerContentQuery.graphql.js.map +1 -1
  45. package/dist/cjs/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js +1 -2
  46. package/dist/cjs/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js.map +1 -1
  47. package/dist/cjs/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js +1 -2
  48. package/dist/cjs/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js.map +1 -1
  49. package/dist/cjs/components/session/__generated__/SessionListItem_session.graphql.js +1 -1
  50. package/dist/cjs/components/session/__generated__/SessionListItem_session.graphql.js.map +1 -1
  51. package/dist/cjs/components/session/__generated__/SessionListRefetchQuery.graphql.js +1 -1
  52. package/dist/cjs/components/session/__generated__/SessionListRefetchQuery.graphql.js.map +1 -1
  53. package/dist/cjs/components/session/__generated__/SessionList_sessions.graphql.js +1 -1
  54. package/dist/cjs/components/session/__generated__/SessionList_sessions.graphql.js.map +1 -1
  55. package/dist/cjs/components/session/formatDate.js +6 -6
  56. package/dist/cjs/components/session/formatDate.js.map +1 -1
  57. package/dist/cjs/components/session/getLastSeen.js +6 -6
  58. package/dist/cjs/components/session/getLastSeen.js.map +1 -1
  59. package/dist/cjs/components/shared/ButtonUpdate.js +4 -3
  60. package/dist/cjs/components/shared/ButtonUpdate.js.map +1 -1
  61. package/dist/cjs/components/shared/ErrorResult.js +8 -5
  62. package/dist/cjs/components/shared/ErrorResult.js.map +1 -1
  63. package/dist/cjs/components/shared/FormError.js +5 -4
  64. package/dist/cjs/components/shared/FormError.js.map +1 -1
  65. package/dist/cjs/components/shared/MainLoader.js +2 -6
  66. package/dist/cjs/components/shared/MainLoader.js.map +1 -1
  67. package/dist/cjs/components/shared/icons/AndroidIcon.js +5 -7
  68. package/dist/cjs/components/shared/icons/AndroidIcon.js.map +1 -1
  69. package/dist/cjs/components/shared/icons/AppleIcon.js +5 -7
  70. package/dist/cjs/components/shared/icons/AppleIcon.js.map +1 -1
  71. package/dist/cjs/components/shared/icons/BrowserIcon.js +5 -7
  72. package/dist/cjs/components/shared/icons/BrowserIcon.js.map +1 -1
  73. package/dist/cjs/components/shared/icons/ProfileIcon.js +5 -7
  74. package/dist/cjs/components/shared/icons/ProfileIcon.js.map +1 -1
  75. package/dist/cjs/components/shared/icons/UnknownDeviceIcon.js +5 -7
  76. package/dist/cjs/components/shared/icons/UnknownDeviceIcon.js.map +1 -1
  77. package/dist/cjs/index.js +16 -17
  78. package/dist/cjs/index.js.map +1 -1
  79. package/dist/cjs/utils/getErrorMessage.js +13 -13
  80. package/dist/cjs/utils/getErrorMessage.js.map +1 -1
  81. package/dist/cjs/utils/getUserFullName.js +7 -5
  82. package/dist/cjs/utils/getUserFullName.js.map +1 -1
  83. package/dist/cjs/utils/handleFormErrors.js +11 -16
  84. package/dist/cjs/utils/handleFormErrors.js.map +1 -1
  85. package/dist/esm/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js +0 -1
  86. package/dist/esm/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +1 -1
  87. package/dist/esm/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js +0 -1
  88. package/dist/esm/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +1 -1
  89. package/dist/esm/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js +0 -1
  90. package/dist/esm/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js.map +1 -1
  91. package/dist/esm/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js +0 -1
  92. package/dist/esm/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js.map +1 -1
  93. package/dist/esm/components/profile/__generated__/ProtectedWrapperQuery.graphql.js +0 -1
  94. package/dist/esm/components/profile/__generated__/ProtectedWrapperQuery.graphql.js.map +1 -1
  95. package/dist/esm/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js +0 -1
  96. package/dist/esm/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js.map +1 -1
  97. package/dist/esm/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js +0 -1
  98. package/dist/esm/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js.map +1 -1
  99. package/dist/esm/utils/getUserFullName.js.map +1 -1
  100. package/dist/types/components/profile/ProfileButton.d.ts.map +1 -0
  101. package/dist/types/components/profile/ProfileConfigContext.d.ts.map +1 -0
  102. package/dist/types/components/profile/ProfileContext.d.ts.map +1 -0
  103. package/dist/types/components/profile/ProfileDrawer.d.ts.map +1 -0
  104. package/dist/types/components/profile/ProfileDrawerContent.d.ts.map +1 -0
  105. package/dist/types/components/profile/ProfileNavigationItem.d.ts.map +1 -0
  106. package/dist/types/components/profile/ProfileUpdateNameModal.d.ts.map +1 -0
  107. package/dist/types/components/profile/ProfileUpdatePasswordModal.d.ts.map +1 -0
  108. package/dist/types/components/profile/ProtectedWrapper.d.ts.map +1 -0
  109. package/dist/types/components/profile/UserAvatar.d.ts.map +1 -0
  110. package/dist/types/components/profile/UserAvatarAddon.d.ts.map +1 -0
  111. package/dist/types/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts.map +1 -0
  112. package/dist/types/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts.map +1 -0
  113. package/dist/types/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts.map +1 -0
  114. package/dist/types/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts.map +1 -0
  115. package/dist/types/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts.map +1 -0
  116. package/dist/types/components/session/SessionDrawer.d.ts.map +1 -0
  117. package/dist/types/components/session/SessionDrawerContent.d.ts.map +1 -0
  118. package/dist/types/{src/lib/components → components}/session/SessionList.d.ts +2 -2
  119. package/dist/types/components/session/SessionList.d.ts.map +1 -0
  120. package/dist/types/{src/lib/components → components}/session/SessionListItem.d.ts +4 -4
  121. package/dist/types/components/session/SessionListItem.d.ts.map +1 -0
  122. package/dist/types/components/session/SessionListSkeleton.d.ts.map +1 -0
  123. package/dist/types/components/session/__generated__/SessionDrawerContentQuery.graphql.d.ts.map +1 -0
  124. package/dist/types/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts.map +1 -0
  125. package/dist/types/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts.map +1 -0
  126. package/dist/types/components/session/__generated__/SessionListItem_session.graphql.d.ts.map +1 -0
  127. package/dist/types/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts.map +1 -0
  128. package/dist/types/components/session/__generated__/SessionList_sessions.graphql.d.ts.map +1 -0
  129. package/dist/types/components/session/formatDate.d.ts.map +1 -0
  130. package/dist/types/components/session/getLastSeen.d.ts.map +1 -0
  131. package/dist/types/components/shared/ButtonUpdate.d.ts.map +1 -0
  132. package/dist/types/components/shared/ErrorResult.d.ts.map +1 -0
  133. package/dist/types/components/shared/FormError.d.ts.map +1 -0
  134. package/dist/types/components/shared/MainLoader.d.ts.map +1 -0
  135. package/dist/types/components/shared/icons/AndroidIcon.d.ts.map +1 -0
  136. package/dist/types/components/shared/icons/AppleIcon.d.ts.map +1 -0
  137. package/dist/types/components/shared/icons/BrowserIcon.d.ts.map +1 -0
  138. package/dist/types/components/shared/icons/ProfileIcon.d.ts.map +1 -0
  139. package/dist/types/components/shared/icons/UnknownDeviceIcon.d.ts.map +1 -0
  140. package/dist/types/index.d.ts.map +1 -0
  141. package/dist/types/utils/getErrorMessage.d.ts.map +1 -0
  142. package/dist/types/{src/lib/utils → utils}/getUserFullName.d.ts +2 -2
  143. package/dist/types/utils/getUserFullName.d.ts.map +1 -0
  144. package/dist/types/utils/handleFormErrors.d.ts.map +1 -0
  145. package/package.json +41 -41
  146. package/dist/types/src/lib/components/profile/ProfileButton.d.ts.map +0 -1
  147. package/dist/types/src/lib/components/profile/ProfileConfigContext.d.ts.map +0 -1
  148. package/dist/types/src/lib/components/profile/ProfileContext.d.ts.map +0 -1
  149. package/dist/types/src/lib/components/profile/ProfileDrawer.d.ts.map +0 -1
  150. package/dist/types/src/lib/components/profile/ProfileDrawerContent.d.ts.map +0 -1
  151. package/dist/types/src/lib/components/profile/ProfileNavigationItem.d.ts.map +0 -1
  152. package/dist/types/src/lib/components/profile/ProfileUpdateNameModal.d.ts.map +0 -1
  153. package/dist/types/src/lib/components/profile/ProfileUpdatePasswordModal.d.ts.map +0 -1
  154. package/dist/types/src/lib/components/profile/ProtectedWrapper.d.ts.map +0 -1
  155. package/dist/types/src/lib/components/profile/UserAvatar.d.ts.map +0 -1
  156. package/dist/types/src/lib/components/profile/UserAvatarAddon.d.ts.map +0 -1
  157. package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts.map +0 -1
  158. package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts.map +0 -1
  159. package/dist/types/src/lib/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts.map +0 -1
  160. package/dist/types/src/lib/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts.map +0 -1
  161. package/dist/types/src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts.map +0 -1
  162. package/dist/types/src/lib/components/session/SessionDrawer.d.ts.map +0 -1
  163. package/dist/types/src/lib/components/session/SessionDrawerContent.d.ts.map +0 -1
  164. package/dist/types/src/lib/components/session/SessionList.d.ts.map +0 -1
  165. package/dist/types/src/lib/components/session/SessionListItem.d.ts.map +0 -1
  166. package/dist/types/src/lib/components/session/SessionListSkeleton.d.ts.map +0 -1
  167. package/dist/types/src/lib/components/session/__generated__/SessionDrawerContentQuery.graphql.d.ts.map +0 -1
  168. package/dist/types/src/lib/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts.map +0 -1
  169. package/dist/types/src/lib/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts.map +0 -1
  170. package/dist/types/src/lib/components/session/__generated__/SessionListItem_session.graphql.d.ts.map +0 -1
  171. package/dist/types/src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts.map +0 -1
  172. package/dist/types/src/lib/components/session/__generated__/SessionList_sessions.graphql.d.ts.map +0 -1
  173. package/dist/types/src/lib/components/session/formatDate.d.ts.map +0 -1
  174. package/dist/types/src/lib/components/session/getLastSeen.d.ts.map +0 -1
  175. package/dist/types/src/lib/components/shared/ButtonUpdate.d.ts.map +0 -1
  176. package/dist/types/src/lib/components/shared/ErrorResult.d.ts.map +0 -1
  177. package/dist/types/src/lib/components/shared/FormError.d.ts.map +0 -1
  178. package/dist/types/src/lib/components/shared/MainLoader.d.ts.map +0 -1
  179. package/dist/types/src/lib/components/shared/icons/AndroidIcon.d.ts.map +0 -1
  180. package/dist/types/src/lib/components/shared/icons/AppleIcon.d.ts.map +0 -1
  181. package/dist/types/src/lib/components/shared/icons/BrowserIcon.d.ts.map +0 -1
  182. package/dist/types/src/lib/components/shared/icons/ProfileIcon.d.ts.map +0 -1
  183. package/dist/types/src/lib/components/shared/icons/UnknownDeviceIcon.d.ts.map +0 -1
  184. package/dist/types/src/lib/index.d.ts.map +0 -1
  185. package/dist/types/src/lib/utils/getErrorMessage.d.ts.map +0 -1
  186. package/dist/types/src/lib/utils/getUserFullName.d.ts.map +0 -1
  187. package/dist/types/src/lib/utils/handleFormErrors.d.ts.map +0 -1
  188. /package/dist/types/{src/lib/components → components}/profile/ProfileButton.d.ts +0 -0
  189. /package/dist/types/{src/lib/components → components}/profile/ProfileConfigContext.d.ts +0 -0
  190. /package/dist/types/{src/lib/components → components}/profile/ProfileContext.d.ts +0 -0
  191. /package/dist/types/{src/lib/components → components}/profile/ProfileDrawer.d.ts +0 -0
  192. /package/dist/types/{src/lib/components → components}/profile/ProfileDrawerContent.d.ts +0 -0
  193. /package/dist/types/{src/lib/components → components}/profile/ProfileNavigationItem.d.ts +0 -0
  194. /package/dist/types/{src/lib/components → components}/profile/ProfileUpdateNameModal.d.ts +0 -0
  195. /package/dist/types/{src/lib/components → components}/profile/ProfileUpdatePasswordModal.d.ts +0 -0
  196. /package/dist/types/{src/lib/components → components}/profile/ProtectedWrapper.d.ts +0 -0
  197. /package/dist/types/{src/lib/components → components}/profile/UserAvatar.d.ts +0 -0
  198. /package/dist/types/{src/lib/components → components}/profile/UserAvatarAddon.d.ts +0 -0
  199. /package/dist/types/{src/lib/components → components}/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts +0 -0
  200. /package/dist/types/{src/lib/components → components}/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts +0 -0
  201. /package/dist/types/{src/lib/components → components}/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts +0 -0
  202. /package/dist/types/{src/lib/components → components}/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts +0 -0
  203. /package/dist/types/{src/lib/components → components}/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts +0 -0
  204. /package/dist/types/{src/lib/components → components}/session/SessionDrawer.d.ts +0 -0
  205. /package/dist/types/{src/lib/components → components}/session/SessionDrawerContent.d.ts +0 -0
  206. /package/dist/types/{src/lib/components → components}/session/SessionListSkeleton.d.ts +0 -0
  207. /package/dist/types/{src/lib/components → components}/session/__generated__/SessionDrawerContentQuery.graphql.d.ts +0 -0
  208. /package/dist/types/{src/lib/components → components}/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts +0 -0
  209. /package/dist/types/{src/lib/components → components}/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts +0 -0
  210. /package/dist/types/{src/lib/components → components}/session/__generated__/SessionListItem_session.graphql.d.ts +0 -0
  211. /package/dist/types/{src/lib/components → components}/session/__generated__/SessionListRefetchQuery.graphql.d.ts +0 -0
  212. /package/dist/types/{src/lib/components → components}/session/__generated__/SessionList_sessions.graphql.d.ts +0 -0
  213. /package/dist/types/{src/lib/components → components}/session/formatDate.d.ts +0 -0
  214. /package/dist/types/{src/lib/components → components}/session/getLastSeen.d.ts +0 -0
  215. /package/dist/types/{src/lib/components → components}/shared/ButtonUpdate.d.ts +0 -0
  216. /package/dist/types/{src/lib/components → components}/shared/ErrorResult.d.ts +0 -0
  217. /package/dist/types/{src/lib/components → components}/shared/FormError.d.ts +0 -0
  218. /package/dist/types/{src/lib/components → components}/shared/MainLoader.d.ts +0 -0
  219. /package/dist/types/{src/lib/components → components}/shared/icons/AndroidIcon.d.ts +0 -0
  220. /package/dist/types/{src/lib/components → components}/shared/icons/AppleIcon.d.ts +0 -0
  221. /package/dist/types/{src/lib/components → components}/shared/icons/BrowserIcon.d.ts +0 -0
  222. /package/dist/types/{src/lib/components → components}/shared/icons/ProfileIcon.d.ts +0 -0
  223. /package/dist/types/{src/lib/components → components}/shared/icons/UnknownDeviceIcon.d.ts +0 -0
  224. /package/dist/types/{src/lib/index.d.ts → index.d.ts} +0 -0
  225. /package/dist/types/{src/lib/utils → utils}/getErrorMessage.d.ts +0 -0
  226. /package/dist/types/{src/lib/utils → utils}/handleFormErrors.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileNavigationItem.js","names":["_react","_interopRequireDefault","require","_media","_core","_reactI18next","_ProfileIcon","_excluded","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","ProfileNavigationItem","_ref","_ref$onClick","onClick","rest","_useTranslation","useTranslation","t","isMinMd","useIsMinWidth","createElement","NavigationItem","href","icon","onKeyDown","e","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileNavigationItem.tsx"],"sourcesContent":["import React from 'react';\nimport { useIsMinWidth } from '@os-design/media';\nimport { NavigationItem, NavigationItemProps } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\nimport ProfileIcon from '../shared/icons/ProfileIcon';\n\nexport interface ProfileNavigationItemProps\n extends Partial<NavigationItemProps> {\n onClick?: () => void;\n}\n\nconst ProfileNavigationItem: React.FC<ProfileNavigationItemProps> = ({\n onClick = () => {},\n ...rest\n}) => {\n const { t } = useTranslation(['profile']);\n const isMinMd = useIsMinWidth('md');\n\n if (isMinMd) return null;\n\n return (\n <NavigationItem\n href='#' // To make focusable\n icon={<ProfileIcon />}\n onClick={onClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onClick();\n }}\n {...rest}\n >\n {t('profile:menu')}\n </NavigationItem>\n );\n};\n\nexport default ProfileNavigationItem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ClC;EAAE,GACEC,IAAI,GAEPG,CAAC,CAAC,cAAc,CACH,CAAC;AAErB,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAzC,OAAA,GAEawB,qBAAqB"}
1
+ {"version":3,"file":"ProfileNavigationItem.js","names":["_react","_interopRequireDefault","require","_media","_core","_reactI18next","_ProfileIcon","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","ProfileNavigationItem","_ref","onClick","rest","t","useTranslation","isMinMd","useIsMinWidth","createElement","NavigationItem","href","icon","onKeyDown","e","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileNavigationItem.tsx"],"sourcesContent":["import React from 'react';\nimport { useIsMinWidth } from '@os-design/media';\nimport { NavigationItem, NavigationItemProps } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\nimport ProfileIcon from '../shared/icons/ProfileIcon';\n\nexport interface ProfileNavigationItemProps\n extends Partial<NavigationItemProps> {\n onClick?: () => void;\n}\n\nconst ProfileNavigationItem: React.FC<ProfileNavigationItemProps> = ({\n onClick = () => {},\n ...rest\n}) => {\n const { t } = useTranslation(['profile']);\n const isMinMd = useIsMinWidth('md');\n\n if (isMinMd) return null;\n\n return (\n <NavigationItem\n href='#' // To make focusable\n icon={<ProfileIcon />}\n onClick={onClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onClick();\n }}\n {...rest}\n >\n {t('profile:menu')}\n </NavigationItem>\n );\n};\n\nexport default ProfileNavigationItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAsD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAA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AEae,qBAAqB"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -15,69 +14,55 @@ var _FormError = _interopRequireDefault(require("../shared/FormError"));
15
14
  var _ProfileContext = require("./ProfileContext");
16
15
  var _ProfileUpdateNameModalMutation;
17
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
19
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
22
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
24
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
25
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
26
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
- var ProfileUpdateNameModal = function ProfileUpdateNameModal(_ref) {
28
- var visible = _ref.visible,
29
- onClose = _ref.onClose;
30
- var _useTranslation = (0, _reactI18next.useTranslation)(['profile']),
31
- t = _useTranslation.t;
32
- var _useProfile = (0, _ProfileContext.useProfile)(),
33
- _useProfile$firstName = _useProfile.firstName,
34
- firstName = _useProfile$firstName === void 0 ? '' : _useProfile$firstName,
35
- _useProfile$lastName = _useProfile.lastName,
36
- lastName = _useProfile$lastName === void 0 ? '' : _useProfile$lastName;
37
- var initValues = (0, _react.useMemo)(function () {
38
- return {
39
- firstName: firstName,
40
- lastName: lastName
41
- };
42
- }, [firstName, lastName]);
43
- var _useForm = (0, _form.useForm)(initValues),
44
- form = _useForm.form,
45
- Field = _useForm.Field;
46
- var _useMutation = (0, _hooks.useMutation)(_ProfileUpdateNameModalMutation !== void 0 ? _ProfileUpdateNameModalMutation : (_ProfileUpdateNameModalMutation = require("./__generated__/ProfileUpdateNameModalMutation.graphql"), _ProfileUpdateNameModalMutation.hash && _ProfileUpdateNameModalMutation.hash !== "7264a05b6738d5417df9f1dc462486aa" && console.error("The definition of 'ProfileUpdateNameModalMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileUpdateNameModalMutation)),
47
- _useMutation2 = _slicedToArray(_useMutation, 2),
48
- commit = _useMutation2[0],
49
- loading = _useMutation2[1];
20
+ const ProfileUpdateNameModal = _ref => {
21
+ let {
22
+ visible,
23
+ onClose
24
+ } = _ref;
25
+ const {
26
+ t
27
+ } = (0, _reactI18next.useTranslation)(['profile']);
28
+ const {
29
+ firstName = '',
30
+ lastName = ''
31
+ } = (0, _ProfileContext.useProfile)();
32
+ const initValues = (0, _react.useMemo)(() => ({
33
+ firstName,
34
+ lastName
35
+ }), [firstName, lastName]);
36
+ const {
37
+ form,
38
+ Field
39
+ } = (0, _form.useForm)(initValues);
40
+ const [commit, loading] = (0, _hooks.useMutation)(_ProfileUpdateNameModalMutation !== void 0 ? _ProfileUpdateNameModalMutation : (_ProfileUpdateNameModalMutation = require("./__generated__/ProfileUpdateNameModalMutation.graphql"), _ProfileUpdateNameModalMutation.hash && _ProfileUpdateNameModalMutation.hash !== "7264a05b6738d5417df9f1dc462486aa" && console.error("The definition of 'ProfileUpdateNameModalMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileUpdateNameModalMutation));
50
41
 
51
42
  // Reset the form when the modal is opened
52
- (0, _react.useEffect)(function () {
43
+ (0, _react.useEffect)(() => {
53
44
  if (visible) form.reset();
54
45
  }, [form, visible]);
55
- var onSubmit = (0, _react.useCallback)(function () {
46
+ const onSubmit = (0, _react.useCallback)(() => {
56
47
  commit({
57
48
  variables: {
58
49
  input: form.values.getAll()
59
50
  },
60
- onError: function onError(error) {
61
- return (0, _handleFormErrors.default)(form, error);
62
- },
63
- onCompleted: function onCompleted() {
51
+ onError: error => (0, _handleFormErrors.default)(form, error),
52
+ onCompleted: () => {
64
53
  _core.message.success(t('profile:updated'));
65
54
  onClose();
66
55
  }
67
56
  });
68
57
  }, [commit, form, onClose, t]);
69
- var firstNameData = (0, _react.useMemo)(function () {
70
- return {
71
- label: t('profile:updateNameModal.firstName.label'),
72
- placeholder: t('profile:updateNameModal.firstName.placeholder')
73
- };
74
- }, [t]);
75
- var lastNameData = (0, _react.useMemo)(function () {
76
- return {
77
- label: t('profile:updateNameModal.lastName.label'),
78
- placeholder: t('profile:updateNameModal.lastName.placeholder')
79
- };
80
- }, [t]);
58
+ const firstNameData = (0, _react.useMemo)(() => ({
59
+ label: t('profile:updateNameModal.firstName.label'),
60
+ placeholder: t('profile:updateNameModal.firstName.placeholder')
61
+ }), [t]);
62
+ const lastNameData = (0, _react.useMemo)(() => ({
63
+ label: t('profile:updateNameModal.lastName.label'),
64
+ placeholder: t('profile:updateNameModal.lastName.placeholder')
65
+ }), [t]);
81
66
  return /*#__PURE__*/_react.default.createElement(_core.Modal, {
82
67
  title: t('profile:updateNameModal.title'),
83
68
  visible: visible,
@@ -90,8 +75,10 @@ var ProfileUpdateNameModal = function ProfileUpdateNameModal(_ref) {
90
75
  }, /*#__PURE__*/_react.default.createElement(_core.Form, null, /*#__PURE__*/_react.default.createElement(Field, {
91
76
  name: "firstName",
92
77
  data: firstNameData,
93
- render: function render(props, _ref2, data) {
94
- var error = _ref2.error;
78
+ render: (props, _ref2, data) => {
79
+ let {
80
+ error
81
+ } = _ref2;
95
82
  return /*#__PURE__*/_react.default.createElement(_core.FormItem, {
96
83
  label: data.label,
97
84
  error: error
@@ -102,8 +89,10 @@ var ProfileUpdateNameModal = function ProfileUpdateNameModal(_ref) {
102
89
  }), /*#__PURE__*/_react.default.createElement(Field, {
103
90
  name: "lastName",
104
91
  data: lastNameData,
105
- render: function render(props, _ref3, data) {
106
- var error = _ref3.error;
92
+ render: (props, _ref3, data) => {
93
+ let {
94
+ error
95
+ } = _ref3;
107
96
  return /*#__PURE__*/_react.default.createElement(_core.FormItem, {
108
97
  label: data.label,
109
98
  error: error
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileUpdateNameModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileContext","_ProfileUpdateNameModalMutation","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","toString","slice","constructor","name","Array","from","test","len","arr2","l","Symbol","iterator","f","next","done","push","value","return","isArray","ProfileUpdateNameModal","_ref","visible","onClose","_useTranslation","useTranslation","_useProfile","useProfile","_useProfile$firstName","firstName","_useProfile$lastName","lastName","initValues","useMemo","_useForm","useForm","form","Field","_useMutation","useMutation","hash","console","error","_useMutation2","commit","loading","useEffect","reset","onSubmit","useCallback","variables","input","values","getAll","onError","handleFormErrors","onCompleted","message","success","firstNameData","label","placeholder","lastNameData","createElement","Modal","title","okText","okLoading","onOk","FormProvider","Form","data","render","props","_ref2","FormItem","Input","_ref3","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileUpdateNameModal.tsx"],"sourcesContent":["import { Form, FormItem, Input, message, Modal } from '@os-design/core';\nimport { FormProvider, useForm } from '@os-design/form';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport handleFormErrors from '../../utils/handleFormErrors';\nimport FormError from '../shared/FormError';\nimport { ProfileUpdateNameModalMutation } from './__generated__/ProfileUpdateNameModalMutation.graphql';\nimport { useProfile } from './ProfileContext';\n\ninterface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameModalProps {\n visible: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdateNameModal: React.FC<ProfileUpdateNameModalProps> = ({\n visible,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n const { firstName = '', lastName = '' } = useProfile();\n\n const initValues = useMemo<ProfileUpdateNameFormData>(\n () => ({ firstName, lastName }),\n [firstName, lastName]\n );\n\n const { form, Field } = useForm(initValues);\n\n const [commit, loading] = useMutation<ProfileUpdateNameModalMutation>(graphql`\n mutation ProfileUpdateNameModalMutation($input: UpdateProfileInput!) {\n updateProfile(input: $input) {\n firstName\n lastName\n }\n }\n `);\n\n // Reset the form when the modal is opened\n useEffect(() => {\n if (visible) form.reset();\n }, [form, visible]);\n\n const onSubmit = useCallback(() => {\n commit({\n variables: {\n input: form.values.getAll(),\n },\n onError: (error) => handleFormErrors(form, error),\n onCompleted: () => {\n message.success(t('profile:updated'));\n onClose();\n },\n });\n }, [commit, form, onClose, t]);\n\n const firstNameData = useMemo(\n () => ({\n label: t('profile:updateNameModal.firstName.label'),\n placeholder: t('profile:updateNameModal.firstName.placeholder'),\n }),\n [t]\n );\n\n const lastNameData = useMemo(\n () => ({\n label: t('profile:updateNameModal.lastName.label'),\n placeholder: t('profile:updateNameModal.lastName.placeholder'),\n }),\n [t]\n );\n\n return (\n <Modal\n title={t('profile:updateNameModal.title')}\n visible={visible}\n okText={t('profile:update')}\n okLoading={loading}\n onOk={onSubmit}\n onClose={onClose}\n >\n <FormProvider form={form}>\n <Form>\n <Field\n name='firstName'\n data={firstNameData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <Input placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <Field\n name='lastName'\n data={lastNameData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <Input placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <FormError />\n </Form>\n </FormProvider>\n </Modal>\n );\n};\n\nexport default ProfileUpdateNameModal;\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAD,sBAAA,CAAAP,OAAA;AAEA,IAAAS,eAAA,GAAAT,OAAA;AAA8C,IAAAU,+BAAA;AAAA,SAAAH,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,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AM,gBACxC5F,MAAA,CAAAW,OAAA,CAAAsG,aAAA,CAACpH,KAAA,CAAAiI,KAAK,EAAA9F,QAAA;QAAC+E,WAAW,EAAEU,IAAI,CAACV;MAAY,GAAKY,KAAK,CAAG,CAC1C,CAAC;IAAA;EACX,CACH,CAAC,eAEF3H,MAAA,CAAAW,OAAA,CAAAsG,aAAA,CAAC1B,KAAK;IACJjC,IAAI,EAAC,UAAU;IACfmE,IAAI,EAAET,YAAa;IACnBU,MAAM,EAAE,SAAAA,OAACC,KAAK,EAAAI,KAAA,EAAaN,IAAI;MAAA,IAAb7B,KAAK,GAAAmC,KAAA,CAALnC,KAAK;MAAA,oBACrB5F,MAAA,CAAAW,OAAA,CAAAsG,aAAA,CAACpH,KAAA,CAAAgI,QAAQ;QAACf,KAAK,EAAEW,IAAI,CAACX,KAAM;QAAClB,KAAK,EAAEA;MAAM,gBACxC5F,MAAA,CAAAW,OAAA,CAAAsG,aAAA,CAACpH,KAAA,CAAAiI,KAAK,EAAA9F,QAAA;QAAC+E,WAAW,EAAEU,IAAI,CAACV;MAAY,GAAKY,KAAK,CAAG,CAC1C,CAAC;IAAA;EACX,CACH,CAAC,eAEF3H,MAAA,CAAAW,OAAA,CAAAsG,aAAA,CAAC3G,UAAA,CAAAK,OAAS,MAAE,CACR,CACM,CACT,CAAC;AAEZ,CAAC;AAAC,IAAAqH,QAAA,GAAAC,OAAA,CAAAtH,OAAA,GAEa2D,sBAAsB"}
1
+ {"version":3,"file":"ProfileUpdateNameModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileContext","_ProfileUpdateNameModalMutation","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","ProfileUpdateNameModal","_ref","visible","onClose","useTranslation","firstName","lastName","useProfile","initValues","useMemo","form","Field","useForm","commit","loading","useMutation","hash","console","error","useEffect","reset","onSubmit","useCallback","variables","input","values","getAll","onError","handleFormErrors","onCompleted","message","success","firstNameData","label","placeholder","lastNameData","createElement","Modal","title","okText","okLoading","onOk","FormProvider","Form","name","data","render","props","_ref2","FormItem","Input","_ref3","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileUpdateNameModal.tsx"],"sourcesContent":["import { Form, FormItem, Input, message, Modal } from '@os-design/core';\nimport { FormProvider, useForm } from '@os-design/form';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport handleFormErrors from '../../utils/handleFormErrors';\nimport FormError from '../shared/FormError';\nimport { ProfileUpdateNameModalMutation } from './__generated__/ProfileUpdateNameModalMutation.graphql';\nimport { useProfile } from './ProfileContext';\n\ninterface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameModalProps {\n visible: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdateNameModal: React.FC<ProfileUpdateNameModalProps> = ({\n visible,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n const { firstName = '', lastName = '' } = useProfile();\n\n const initValues = useMemo<ProfileUpdateNameFormData>(\n () => ({ firstName, lastName }),\n [firstName, lastName]\n );\n\n const { form, Field } = useForm(initValues);\n\n const [commit, loading] = useMutation<ProfileUpdateNameModalMutation>(graphql`\n mutation ProfileUpdateNameModalMutation($input: UpdateProfileInput!) {\n updateProfile(input: $input) {\n firstName\n lastName\n }\n }\n `);\n\n // Reset the form when the modal is opened\n useEffect(() => {\n if (visible) form.reset();\n }, [form, visible]);\n\n const onSubmit = useCallback(() => {\n commit({\n variables: {\n input: form.values.getAll(),\n },\n onError: (error) => handleFormErrors(form, error),\n onCompleted: () => {\n message.success(t('profile:updated'));\n onClose();\n },\n });\n }, [commit, form, onClose, t]);\n\n const firstNameData = useMemo(\n () => ({\n label: t('profile:updateNameModal.firstName.label'),\n placeholder: t('profile:updateNameModal.firstName.placeholder'),\n }),\n [t]\n );\n\n const lastNameData = useMemo(\n () => ({\n label: t('profile:updateNameModal.lastName.label'),\n placeholder: t('profile:updateNameModal.lastName.placeholder'),\n }),\n [t]\n );\n\n return (\n <Modal\n title={t('profile:updateNameModal.title')}\n visible={visible}\n okText={t('profile:update')}\n okLoading={loading}\n onOk={onSubmit}\n onClose={onClose}\n >\n <FormProvider form={form}>\n <Form>\n <Field\n name='firstName'\n data={firstNameData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <Input placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <Field\n name='lastName'\n data={lastNameData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <Input placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <FormError />\n </Form>\n </FormProvider>\n </Modal>\n );\n};\n\nexport default ProfileUpdateNameModal;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAD,sBAAA,CAAAP,OAAA;AAEA,IAAAS,eAAA,GAAAT,OAAA;AAA8C,IAAAU,+BAAA;AAAA,SAAAH,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CA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"symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -14,67 +13,54 @@ var _handleFormErrors = _interopRequireDefault(require("../../utils/handleFormEr
14
13
  var _FormError = _interopRequireDefault(require("../shared/FormError"));
15
14
  var _ProfileUpdatePasswordModalMutation;
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
18
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
24
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
25
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
- var ProfileUpdatePasswordModal = function ProfileUpdatePasswordModal(_ref) {
27
- var visible = _ref.visible,
28
- onClose = _ref.onClose;
29
- var _useTranslation = (0, _reactI18next.useTranslation)(['profile']),
30
- t = _useTranslation.t;
31
- var initValues = (0, _react.useMemo)(function () {
32
- return {
33
- currentPassword: '',
34
- password: ''
35
- };
36
- }, []);
37
- var _useForm = (0, _form.useForm)(initValues),
38
- form = _useForm.form,
39
- Field = _useForm.Field;
40
- var _useMutation = (0, _hooks.useMutation)(_ProfileUpdatePasswordModalMutation !== void 0 ? _ProfileUpdatePasswordModalMutation : (_ProfileUpdatePasswordModalMutation = require("./__generated__/ProfileUpdatePasswordModalMutation.graphql"), _ProfileUpdatePasswordModalMutation.hash && _ProfileUpdatePasswordModalMutation.hash !== "efa37ccbe82fbace709f7e3992643c05" && console.error("The definition of 'ProfileUpdatePasswordModalMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileUpdatePasswordModalMutation)),
41
- _useMutation2 = _slicedToArray(_useMutation, 2),
42
- commit = _useMutation2[0],
43
- loading = _useMutation2[1];
19
+ const ProfileUpdatePasswordModal = _ref => {
20
+ let {
21
+ visible,
22
+ onClose
23
+ } = _ref;
24
+ const {
25
+ t
26
+ } = (0, _reactI18next.useTranslation)(['profile']);
27
+ const initValues = (0, _react.useMemo)(() => ({
28
+ currentPassword: '',
29
+ password: ''
30
+ }), []);
31
+ const {
32
+ form,
33
+ Field
34
+ } = (0, _form.useForm)(initValues);
35
+ const [commit, loading] = (0, _hooks.useMutation)(_ProfileUpdatePasswordModalMutation !== void 0 ? _ProfileUpdatePasswordModalMutation : (_ProfileUpdatePasswordModalMutation = require("./__generated__/ProfileUpdatePasswordModalMutation.graphql"), _ProfileUpdatePasswordModalMutation.hash && _ProfileUpdatePasswordModalMutation.hash !== "efa37ccbe82fbace709f7e3992643c05" && console.error("The definition of 'ProfileUpdatePasswordModalMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileUpdatePasswordModalMutation));
44
36
 
45
37
  // Reset the form when the modal is opened
46
- (0, _react.useEffect)(function () {
38
+ (0, _react.useEffect)(() => {
47
39
  if (visible) form.reset();
48
40
  }, [form, visible]);
49
- var onSubmit = (0, _react.useCallback)(function () {
41
+ const onSubmit = (0, _react.useCallback)(() => {
50
42
  commit({
51
43
  variables: {
52
44
  input: form.values.getAll()
53
45
  },
54
- onError: function onError(error) {
55
- return (0, _handleFormErrors.default)(form, error);
56
- },
57
- onCompleted: function onCompleted() {
46
+ onError: error => (0, _handleFormErrors.default)(form, error),
47
+ onCompleted: () => {
58
48
  _core.message.success(t('profile:updatePasswordModal.success'));
59
49
  onClose();
60
50
  }
61
51
  });
62
52
  }, [commit, form, onClose, t]);
63
- var currentPasswordData = (0, _react.useMemo)(function () {
64
- return {
65
- label: t('profile:updatePasswordModal.currentPassword.label'),
66
- placeholder: t('profile:updatePasswordModal.currentPassword.placeholder')
67
- };
68
- }, [t]);
69
- var passwordData = (0, _react.useMemo)(function () {
70
- return {
71
- label: t('profile:updatePasswordModal.newPassword.label'),
72
- placeholder: t('profile:updatePasswordModal.newPassword.placeholder'),
73
- strengthNames: t('profile:updatePasswordModal.passwordStrengthNames', {
74
- returnObjects: true
75
- })
76
- };
77
- }, [t]);
53
+ const currentPasswordData = (0, _react.useMemo)(() => ({
54
+ label: t('profile:updatePasswordModal.currentPassword.label'),
55
+ placeholder: t('profile:updatePasswordModal.currentPassword.placeholder')
56
+ }), [t]);
57
+ const passwordData = (0, _react.useMemo)(() => ({
58
+ label: t('profile:updatePasswordModal.newPassword.label'),
59
+ placeholder: t('profile:updatePasswordModal.newPassword.placeholder'),
60
+ strengthNames: t('profile:updatePasswordModal.passwordStrengthNames', {
61
+ returnObjects: true
62
+ })
63
+ }), [t]);
78
64
  return /*#__PURE__*/_react.default.createElement(_core.Modal, {
79
65
  title: t('profile:updatePasswordModal.title'),
80
66
  visible: visible,
@@ -87,8 +73,10 @@ var ProfileUpdatePasswordModal = function ProfileUpdatePasswordModal(_ref) {
87
73
  }, /*#__PURE__*/_react.default.createElement(_core.Form, null, /*#__PURE__*/_react.default.createElement(Field, {
88
74
  name: "currentPassword",
89
75
  data: currentPasswordData,
90
- render: function render(props, _ref2, data) {
91
- var error = _ref2.error;
76
+ render: (props, _ref2, data) => {
77
+ let {
78
+ error
79
+ } = _ref2;
92
80
  return /*#__PURE__*/_react.default.createElement(_core.FormItem, {
93
81
  label: data.label,
94
82
  error: error
@@ -99,8 +87,10 @@ var ProfileUpdatePasswordModal = function ProfileUpdatePasswordModal(_ref) {
99
87
  }), /*#__PURE__*/_react.default.createElement(Field, {
100
88
  name: "password",
101
89
  data: passwordData,
102
- render: function render(props, _ref3, data) {
103
- var error = _ref3.error;
90
+ render: (props, _ref3, data) => {
91
+ let {
92
+ error
93
+ } = _ref3;
104
94
  return /*#__PURE__*/_react.default.createElement(_core.FormItem, {
105
95
  label: data.label,
106
96
  error: error
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileUpdatePasswordModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileUpdatePasswordModalMutation","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","toString","slice","constructor","name","Array","from","test","len","arr2","l","Symbol","iterator","f","next","done","push","value","return","isArray","ProfileUpdatePasswordModal","_ref","visible","onClose","_useTranslation","useTranslation","initValues","useMemo","currentPassword","password","_useForm","useForm","form","Field","_useMutation","useMutation","hash","console","error","_useMutation2","commit","loading","useEffect","reset","onSubmit","useCallback","variables","input","values","getAll","onError","handleFormErrors","onCompleted","message","success","currentPasswordData","label","placeholder","passwordData","strengthNames","returnObjects","createElement","Modal","title","okText","okLoading","onOk","FormProvider","Form","data","render","props","_ref2","FormItem","InputPassword","_ref3","showStrengthMeter","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordModal.tsx"],"sourcesContent":["import { Form, FormItem, InputPassword, message, Modal } from '@os-design/core';\nimport { FormProvider, useForm } from '@os-design/form';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport handleFormErrors from '../../utils/handleFormErrors';\nimport FormError from '../shared/FormError';\nimport { ProfileUpdatePasswordModalMutation } from './__generated__/ProfileUpdatePasswordModalMutation.graphql';\n\ninterface ProfileUpdatePasswordFormData {\n currentPassword: string;\n password: string;\n}\n\ninterface ProfileUpdatePasswordModalProps {\n visible: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdatePasswordModal: React.FC<ProfileUpdatePasswordModalProps> = ({\n visible,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n\n const initValues = useMemo<ProfileUpdatePasswordFormData>(\n () => ({\n currentPassword: '',\n password: '',\n }),\n []\n );\n\n const { form, Field } = useForm(initValues);\n\n const [commit, loading] = useMutation<ProfileUpdatePasswordModalMutation>(\n graphql`\n mutation ProfileUpdatePasswordModalMutation(\n $input: UpdatePasswordInput!\n ) {\n updatePassword(input: $input) {\n id\n }\n }\n `\n );\n\n // Reset the form when the modal is opened\n useEffect(() => {\n if (visible) form.reset();\n }, [form, visible]);\n\n const onSubmit = useCallback(() => {\n commit({\n variables: {\n input: form.values.getAll(),\n },\n onError: (error) => handleFormErrors(form, error),\n onCompleted: () => {\n message.success(t('profile:updatePasswordModal.success'));\n onClose();\n },\n });\n }, [commit, form, onClose, t]);\n\n const currentPasswordData = useMemo(\n () => ({\n label: t('profile:updatePasswordModal.currentPassword.label'),\n placeholder: t('profile:updatePasswordModal.currentPassword.placeholder'),\n }),\n [t]\n );\n\n const passwordData = useMemo(\n () => ({\n label: t('profile:updatePasswordModal.newPassword.label'),\n placeholder: t('profile:updatePasswordModal.newPassword.placeholder'),\n strengthNames: t('profile:updatePasswordModal.passwordStrengthNames', {\n returnObjects: true,\n }),\n }),\n [t]\n );\n\n return (\n <Modal\n title={t('profile:updatePasswordModal.title')}\n visible={visible}\n okText={t('profile:updatePasswordModal.button')}\n okLoading={loading}\n onOk={onSubmit}\n onClose={onClose}\n >\n <FormProvider form={form}>\n <Form>\n <Field\n name='currentPassword'\n data={currentPasswordData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <InputPassword placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <Field\n name='password'\n data={passwordData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <InputPassword\n placeholder={data.placeholder}\n showStrengthMeter\n strengthNames={data.strengthNames}\n {...props}\n />\n </FormItem>\n )}\n />\n\n <FormError />\n </Form>\n </FormProvider>\n </Modal>\n );\n};\n\nexport default ProfileUpdatePasswordModal;\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAD,sBAAA,CAAAP,OAAA;AAA4C,IAAAS,mCAAA;AAAA,SAAAF,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,gBAAAI,OAAA,CA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AAAoG,aAAA,CAAC5B,KAAK;IACJ7B,IAAI,EAAC,UAAU;IACfiE,IAAI,EAAEX,YAAa;IACnBY,MAAM,EAAE,SAAAA,OAACC,KAAK,EAAAI,KAAA,EAAaN,IAAI;MAAA,IAAb/B,KAAK,GAAAqC,KAAA,CAALrC,KAAK;MAAA,oBACrBvF,MAAA,CAAAU,OAAA,CAAAoG,aAAA,CAACjH,KAAA,CAAA6H,QAAQ;QAACjB,KAAK,EAAEa,IAAI,CAACb,KAAM;QAAClB,KAAK,EAAEA;MAAM,gBACxCvF,MAAA,CAAAU,OAAA,CAAAoG,aAAA,CAACjH,KAAA,CAAA8H,aAAa,EAAA5F,QAAA;QACZ2E,WAAW,EAAEY,IAAI,CAACZ,WAAY;QAC9BmB,iBAAiB;QACjBjB,aAAa,EAAEU,IAAI,CAACV;MAAc,GAC9BY,KAAK,CACV,CACO,CAAC;IAAA;EACX,CACH,CAAC,eAEFxH,MAAA,CAAAU,OAAA,CAAAoG,aAAA,CAACxG,UAAA,CAAAI,OAAS,MAAE,CACR,CACM,CACT,CAAC;AAEZ,CAAC;AAAC,IAAAoH,QAAA,GAAAC,OAAA,CAAArH,OAAA,GAEa2D,0BAA0B"}
1
+ {"version":3,"file":"ProfileUpdatePasswordModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileUpdatePasswordModalMutation","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","ProfileUpdatePasswordModal","_ref","visible","onClose","useTranslation","initValues","useMemo","currentPassword","password","form","Field","useForm","commit","loading","useMutation","hash","console","error","useEffect","reset","onSubmit","useCallback","variables","input","values","getAll","onError","handleFormErrors","onCompleted","message","success","currentPasswordData","label","placeholder","passwordData","strengthNames","returnObjects","createElement","Modal","title","okText","okLoading","onOk","FormProvider","Form","name","data","render","props","_ref2","FormItem","InputPassword","_ref3","showStrengthMeter","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordModal.tsx"],"sourcesContent":["import { Form, FormItem, InputPassword, message, Modal } from '@os-design/core';\nimport { FormProvider, useForm } from '@os-design/form';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport handleFormErrors from '../../utils/handleFormErrors';\nimport FormError from '../shared/FormError';\nimport { ProfileUpdatePasswordModalMutation } from './__generated__/ProfileUpdatePasswordModalMutation.graphql';\n\ninterface ProfileUpdatePasswordFormData {\n currentPassword: string;\n password: string;\n}\n\ninterface ProfileUpdatePasswordModalProps {\n visible: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdatePasswordModal: React.FC<ProfileUpdatePasswordModalProps> = ({\n visible,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n\n const initValues = useMemo<ProfileUpdatePasswordFormData>(\n () => ({\n currentPassword: '',\n password: '',\n }),\n []\n );\n\n const { form, Field } = useForm(initValues);\n\n const [commit, loading] = useMutation<ProfileUpdatePasswordModalMutation>(\n graphql`\n mutation ProfileUpdatePasswordModalMutation(\n $input: UpdatePasswordInput!\n ) {\n updatePassword(input: $input) {\n id\n }\n }\n `\n );\n\n // Reset the form when the modal is opened\n useEffect(() => {\n if (visible) form.reset();\n }, [form, visible]);\n\n const onSubmit = useCallback(() => {\n commit({\n variables: {\n input: form.values.getAll(),\n },\n onError: (error) => handleFormErrors(form, error),\n onCompleted: () => {\n message.success(t('profile:updatePasswordModal.success'));\n onClose();\n },\n });\n }, [commit, form, onClose, t]);\n\n const currentPasswordData = useMemo(\n () => ({\n label: t('profile:updatePasswordModal.currentPassword.label'),\n placeholder: t('profile:updatePasswordModal.currentPassword.placeholder'),\n }),\n [t]\n );\n\n const passwordData = useMemo(\n () => ({\n label: t('profile:updatePasswordModal.newPassword.label'),\n placeholder: t('profile:updatePasswordModal.newPassword.placeholder'),\n strengthNames: t('profile:updatePasswordModal.passwordStrengthNames', {\n returnObjects: true,\n }),\n }),\n [t]\n );\n\n return (\n <Modal\n title={t('profile:updatePasswordModal.title')}\n visible={visible}\n okText={t('profile:updatePasswordModal.button')}\n okLoading={loading}\n onOk={onSubmit}\n onClose={onClose}\n >\n <FormProvider form={form}>\n <Form>\n <Field\n name='currentPassword'\n data={currentPasswordData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <InputPassword placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <Field\n name='password'\n data={passwordData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <InputPassword\n placeholder={data.placeholder}\n showStrengthMeter\n strengthNames={data.strengthNames}\n {...props}\n />\n </FormItem>\n )}\n />\n\n <FormError />\n </Form>\n </FormProvider>\n </Modal>\n );\n};\n\nexport default ProfileUpdatePasswordModal;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAD,sBAAA,CAAAP,OAAA;AAA4C,IAAAS,mCAAA;AAAA,SAAAF,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBA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symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -12,39 +11,40 @@ var _ProfileConfigContext = _interopRequireDefault(require("./ProfileConfigConte
12
11
  var _ProfileContext = _interopRequireDefault(require("./ProfileContext"));
13
12
  var _ProtectedWrapperQuery;
14
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- var ProtectedWrapperLoader = function ProtectedWrapperLoader(_ref) {
18
- var children = _ref.children;
19
- var _useLazyLoadQuery = (0, _hooks.useLazyLoadQuery)(_ProtectedWrapperQuery !== void 0 ? _ProtectedWrapperQuery : (_ProtectedWrapperQuery = require("./__generated__/ProtectedWrapperQuery.graphql"), _ProtectedWrapperQuery.hash && _ProtectedWrapperQuery.hash !== "903b234e48f53b4a44dc0b4974ebc521" && console.error("The definition of 'ProtectedWrapperQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProtectedWrapperQuery), {}, {
20
- fetchPolicy: 'store-or-network'
21
- }),
22
- profile = _useLazyLoadQuery.profile;
23
- var profileContext = (0, _react.useMemo)(function () {
24
- return {
25
- id: profile.id,
26
- email: profile.email,
27
- firstName: profile.firstName || undefined,
28
- lastName: profile.lastName || undefined,
29
- avatar: profile.avatar || undefined
30
- };
31
- }, [profile.avatar, profile.email, profile.firstName, profile.id, profile.lastName]);
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ const ProtectedWrapperLoader = _ref => {
17
+ let {
18
+ children
19
+ } = _ref;
20
+ const {
21
+ profile
22
+ } = (0, _hooks.useLazyLoadQuery)(_ProtectedWrapperQuery !== void 0 ? _ProtectedWrapperQuery : (_ProtectedWrapperQuery = require("./__generated__/ProtectedWrapperQuery.graphql"), _ProtectedWrapperQuery.hash && _ProtectedWrapperQuery.hash !== "903b234e48f53b4a44dc0b4974ebc521" && console.error("The definition of 'ProtectedWrapperQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProtectedWrapperQuery), {}, {
23
+ fetchPolicy: 'store-or-network'
24
+ });
25
+ const profileContext = (0, _react.useMemo)(() => ({
26
+ id: profile.id,
27
+ email: profile.email,
28
+ firstName: profile.firstName || undefined,
29
+ lastName: profile.lastName || undefined,
30
+ avatar: profile.avatar || undefined
31
+ }), [profile.avatar, profile.email, profile.firstName, profile.id, profile.lastName]);
32
32
  return /*#__PURE__*/_react.default.createElement(_ProfileContext.default.Provider, {
33
33
  value: profileContext
34
34
  }, children);
35
35
  };
36
- var ProtectedWrapper = function ProtectedWrapper(_ref2) {
37
- var bucketId = _ref2.bucketId,
38
- children = _ref2.children;
39
- var profileConfigContext = (0, _react.useMemo)(function () {
40
- return {
41
- bucketId: bucketId
42
- };
43
- }, [bucketId]);
36
+ const ProtectedWrapper = _ref2 => {
37
+ let {
38
+ bucketId,
39
+ children
40
+ } = _ref2;
41
+ const profileConfigContext = (0, _react.useMemo)(() => ({
42
+ bucketId
43
+ }), [bucketId]);
44
44
  return /*#__PURE__*/_react.default.createElement(_ProfileConfigContext.default.Provider, {
45
45
  value: profileConfigContext
46
46
  }, /*#__PURE__*/_react.default.createElement(_utils.ErrorBoundary, {
47
- fallback: function fallback() {
47
+ fallback: () => {
48
48
  window.location.href = '/auth/';
49
49
  return null;
50
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ProtectedWrapper.js","names":["_react","_interopRequireWildcard","require","_hooks","_utils","_ProfileConfigContext","_interopRequireDefault","_ProfileContext","_ProtectedWrapperQuery","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ProtectedWrapperLoader","_ref","children","_useLazyLoadQuery","useLazyLoadQuery","hash","console","error","fetchPolicy","profile","profileContext","useMemo","id","email","firstName","undefined","lastName","avatar","createElement","Provider","value","ProtectedWrapper","_ref2","bucketId","profileConfigContext","ErrorBoundary","fallback","window","location","href","_default","exports"],"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useLazyLoadQuery } from 'react-relay/hooks';\nimport { ErrorBoundary } from '@os-design/utils';\nimport ProfileConfigContext from './ProfileConfigContext';\nimport ProfileContext from './ProfileContext';\nimport { ProtectedWrapperQuery } from './__generated__/ProtectedWrapperQuery.graphql';\n\ninterface ProtectedWrapperLoaderProps {\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapperLoader: React.FC<ProtectedWrapperLoaderProps> = ({\n children,\n}) => {\n const { profile } = useLazyLoadQuery<ProtectedWrapperQuery>(\n graphql`\n query ProtectedWrapperQuery {\n profile {\n id\n email\n firstName\n lastName\n avatar\n }\n }\n `,\n {},\n { fetchPolicy: 'store-or-network' }\n );\n\n const profileContext = useMemo(\n () => ({\n id: profile.id,\n email: profile.email,\n firstName: profile.firstName || undefined,\n lastName: profile.lastName || undefined,\n avatar: profile.avatar || undefined,\n }),\n [\n profile.avatar,\n profile.email,\n profile.firstName,\n profile.id,\n profile.lastName,\n ]\n );\n\n return (\n <ProfileContext.Provider value={profileContext}>\n {children}\n </ProfileContext.Provider>\n );\n};\n\nexport interface ProtectedWrapperProps {\n bucketId: string;\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapper: React.FC<ProtectedWrapperProps> = ({\n bucketId,\n children,\n}) => {\n const profileConfigContext = useMemo(() => ({ bucketId }), [bucketId]);\n\n return (\n <ProfileConfigContext.Provider value={profileConfigContext}>\n <ErrorBoundary\n fallback={() => {\n window.location.href = '/auth/';\n return null;\n }}\n >\n <ProtectedWrapperLoader>{children}</ProtectedWrapperLoader>\n </ErrorBoundary>\n </ProfileConfigContext.Provider>\n );\n};\n\nexport default ProtectedWrapper;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAA8C,IAAAM,sBAAA;AAAA,SAAAF,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAA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ACwC,QAAQ;IAACC,KAAK,EAAEI;EAAqB,gBACzDxD,MAAA,CAAAW,OAAA,CAAAuC,aAAA,CAAC9C,MAAA,CAAAqD,aAAa;IACZC,QAAQ,EAAE,SAAAA,SAAA,EAAM;MACdC,MAAM,CAACC,QAAQ,CAACC,IAAI,GAAG,QAAQ;MAC/B,OAAO,IAAI;IACb;EAAE,gBAEF7D,MAAA,CAAAW,OAAA,CAAAuC,aAAA,CAAClB,sBAAsB,QAAEE,QAAiC,CAC7C,CACc,CAAC;AAEpC,CAAC;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAApD,OAAA,GAEa0C,gBAAgB"}
1
+ {"version":3,"file":"ProtectedWrapper.js","names":["_react","_interopRequireWildcard","require","_hooks","_utils","_ProfileConfigContext","_interopRequireDefault","_ProfileContext","_ProtectedWrapperQuery","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ProtectedWrapperLoader","_ref","children","profile","useLazyLoadQuery","hash","console","error","fetchPolicy","profileContext","useMemo","id","email","firstName","undefined","lastName","avatar","createElement","Provider","value","ProtectedWrapper","_ref2","bucketId","profileConfigContext","ErrorBoundary","fallback","window","location","href","_default","exports"],"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useLazyLoadQuery } from 'react-relay/hooks';\nimport { ErrorBoundary } from '@os-design/utils';\nimport ProfileConfigContext from './ProfileConfigContext';\nimport ProfileContext from './ProfileContext';\nimport { ProtectedWrapperQuery } from './__generated__/ProtectedWrapperQuery.graphql';\n\ninterface ProtectedWrapperLoaderProps {\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapperLoader: React.FC<ProtectedWrapperLoaderProps> = ({\n children,\n}) => {\n const { profile } = useLazyLoadQuery<ProtectedWrapperQuery>(\n graphql`\n query ProtectedWrapperQuery {\n profile {\n id\n email\n firstName\n lastName\n avatar\n }\n }\n `,\n {},\n { fetchPolicy: 'store-or-network' }\n );\n\n const profileContext = useMemo(\n () => ({\n id: profile.id,\n email: profile.email,\n firstName: profile.firstName || undefined,\n lastName: profile.lastName || undefined,\n avatar: profile.avatar || undefined,\n }),\n [\n profile.avatar,\n profile.email,\n profile.firstName,\n profile.id,\n profile.lastName,\n ]\n );\n\n return (\n <ProfileContext.Provider value={profileContext}>\n {children}\n </ProfileContext.Provider>\n );\n};\n\nexport interface ProtectedWrapperProps {\n bucketId: string;\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapper: React.FC<ProtectedWrapperProps> = ({\n bucketId,\n children,\n}) => {\n const profileConfigContext = useMemo(() => ({ bucketId }), [bucketId]);\n\n return (\n <ProfileConfigContext.Provider value={profileConfigContext}>\n <ErrorBoundary\n fallback={() => {\n window.location.href = '/auth/';\n return null;\n }}\n >\n <ProtectedWrapperLoader>{children}</ProtectedWrapperLoader>\n </ErrorBoundary>\n </ProfileConfigContext.Provider>\n );\n};\n\nexport default ProtectedWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAA8C,IAAAM,sBAAA;AAAA,SAAAF,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY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;AAAC,IAAA2B,QAAA,GAAAC,OAAA,CAAAlD,OAAA,GAEawC,gBAAgB"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -9,27 +8,29 @@ var _react = _interopRequireWildcard(require("react"));
9
8
  var _core = require("@os-design/core");
10
9
  var _ProfileContext = require("./ProfileContext");
11
10
  var _ProfileConfigContext = require("./ProfileConfigContext");
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
13
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
- var UserAvatar = function UserAvatar(props) {
16
- var _useProfile = (0, _ProfileContext.useProfile)(),
17
- email = _useProfile.email,
18
- firstName = _useProfile.firstName,
19
- lastName = _useProfile.lastName,
20
- avatar = _useProfile.avatar;
21
- var _useProfileConfig = (0, _ProfileConfigContext.useProfileConfig)(),
22
- bucketId = _useProfileConfig.bucketId;
23
- var avatarProps = (0, _react.useMemo)(function () {
14
+ const UserAvatar = props => {
15
+ const {
16
+ email,
17
+ firstName,
18
+ lastName,
19
+ avatar
20
+ } = (0, _ProfileContext.useProfile)();
21
+ const {
22
+ bucketId
23
+ } = (0, _ProfileConfigContext.useProfileConfig)();
24
+ const avatarProps = (0, _react.useMemo)(() => {
24
25
  if (firstName || lastName) return {
25
- firstName: firstName,
26
- lastName: lastName
26
+ firstName,
27
+ lastName
27
28
  };
28
29
  return {
29
30
  firstName: email
30
31
  };
31
32
  }, [email, firstName, lastName]);
32
- var image = (0, _react.useMemo)(function () {
33
+ const image = (0, _react.useMemo)(() => {
33
34
  if (!avatar) return undefined;
34
35
  return "https://storage.yandexcloud.net/".concat(bucketId, "/users/").concat(avatar);
35
36
  }, [avatar, bucketId]);