@blocklet/ui-react 2.10.1 → 2.10.3

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 (31) hide show
  1. package/lib/BlockletStudio/index.d.ts +0 -1
  2. package/lib/ComponentManager/components/resource-dialog.d.ts +6 -7
  3. package/lib/UserCenter/components/config-profile.d.ts +0 -1
  4. package/lib/UserCenter/components/notification.d.ts +0 -1
  5. package/lib/UserCenter/components/notification.js +1 -1
  6. package/lib/UserCenter/components/passport.d.ts +0 -1
  7. package/lib/UserCenter/components/privacy.d.ts +0 -1
  8. package/lib/UserCenter/components/storage/connect-to.d.ts +0 -1
  9. package/lib/UserCenter/components/storage/connected.d.ts +0 -1
  10. package/lib/UserCenter/components/storage/delete.d.ts +0 -1
  11. package/lib/UserCenter/components/storage/disconnect.d.ts +0 -1
  12. package/lib/UserCenter/components/storage/index.d.ts +0 -1
  13. package/lib/UserCenter/components/storage/item.d.ts +0 -1
  14. package/lib/UserCenter/components/storage/preview-nft.d.ts +0 -1
  15. package/lib/UserCenter/components/third-party-login/index.d.ts +0 -1
  16. package/lib/UserCenter/components/third-party-login/third-party-item.d.ts +0 -1
  17. package/lib/UserCenter/components/user-center.d.ts +0 -1
  18. package/lib/UserCenter/components/user-center.js +8 -1
  19. package/lib/UserCenter/components/user-info/user-basic-info.d.ts +0 -1
  20. package/lib/UserCenter/components/user-info/user-info-item.d.ts +0 -1
  21. package/lib/UserCenter/components/user-info/user-info.d.ts +0 -1
  22. package/lib/UserCenter/components/webhook-item.d.ts +0 -1
  23. package/lib/UserCenter/libs/utils.d.ts +1 -1
  24. package/lib/UserSessions/components/user-session-info.d.ts +0 -1
  25. package/lib/UserSessions/components/user-sessions.d.ts +0 -1
  26. package/lib/UserSessions/components/user-sessions.js +7 -4
  27. package/lib/contexts/config-user-space.d.ts +0 -1
  28. package/package.json +4 -4
  29. package/src/UserCenter/components/notification.tsx +1 -1
  30. package/src/UserCenter/components/user-center.tsx +8 -1
  31. package/src/UserSessions/components/user-sessions.tsx +9 -6
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface BlockletStudioProps {
3
2
  open: boolean;
4
3
  setOpen: (open: boolean) => void;
@@ -1,13 +1,12 @@
1
- /// <reference types="react" />
2
1
  declare const _default: import("react").ForwardRefExoticComponent<{
3
2
  src: string;
4
3
  componentDid: string;
5
- open?: boolean | undefined;
6
- loading?: boolean | undefined;
7
- storeUrl?: string | undefined;
8
- onLoad?: (() => void) | undefined;
9
- onClose?: (() => void) | undefined;
10
- onComplete?: (() => void) | undefined;
4
+ open?: boolean;
5
+ loading?: boolean;
6
+ storeUrl?: string;
7
+ onLoad?: () => void;
8
+ onClose?: () => void;
9
+ onComplete?: () => void;
11
10
  } & import("react").RefAttributes<{
12
11
  selectBlocklet: (blockletMeta: any) => void;
13
12
  }>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { User } from '../../@types';
3
2
  export default function ConfigProfile({ user }: {
4
3
  user: User;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { User } from '../../@types';
3
2
  export default function Notification({ user }: {
4
3
  user: User;
@@ -71,7 +71,7 @@ export default function Notification({ user }) {
71
71
  wallet: true,
72
72
  email: true,
73
73
  phone: false,
74
- push: false,
74
+ push: true,
75
75
  ...notificationConfigState?.data?.notifications || {}
76
76
  };
77
77
  }, [notificationConfigState?.data?.notifications]);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { BoxProps } from '@mui/material';
3
2
  import type { User } from '../../@types';
4
3
  export default function Passport({ user, ...rest }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type PrivacyConfig = {
3
2
  key: string;
4
3
  name: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SpaceGateway } from '../../../contexts/config-user-space';
3
2
  declare function ConnectTo({ onConnect, storageEndpoint, }: {
4
3
  onConnect: (spaceGateway: SpaceGateway) => Promise<void>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SettingStorageEndpoint, SpaceGateway } from '../../../contexts/config-user-space';
3
2
  declare function Connected({ spaceGateway, settingStorageEndpoint, }: {
4
3
  spaceGateway: SpaceGateway | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SpaceGateway } from '../../../contexts/config-user-space';
3
2
  declare function SpaceDelete({ spaceGateway, onDeleteSpace, }: {
4
3
  spaceGateway: SpaceGateway;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare function Disconnect(): import("react").JSX.Element;
3
2
  export default Disconnect;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare function DidSpace(): import("react").JSX.Element;
3
2
  export default DidSpace;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BoxProps } from '@mui/material';
3
2
  import { SpaceGateway } from '../../../contexts/config-user-space';
4
3
  declare function SpaceItem({ spaceGateway, connected, onDisconnect, ...rest }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare function PreviewSpaceNft({ src, alt }: {
3
2
  src: string;
4
3
  alt: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { User } from '../../../@types';
3
2
  export default function ThirdPartyLogin({ user }: {
4
3
  user: User;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { OAuthAccount } from '../../../@types';
3
2
  export default function ThirdPartyItem({ item, }: {
4
3
  item: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { BoxProps } from '@mui/material';
3
2
  export default function UserCenter({ children, notLoginContent, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, userDid, stickySidebar, }: {
4
3
  readonly children: any;
@@ -370,7 +370,14 @@ export default function UserCenter({
370
370
  ] });
371
371
  }, [userState, userCenterTabs, isMyself, currentActiveTab, privacyState, currentTab, stickySidebar]);
372
372
  if (!disableAutoRedirect && !currentTab && formattedBlocklet?.navigation?.userCenter?.length > 0) {
373
- window.location.replace(formattedBlocklet?.navigation?.userCenter[0]?.link);
373
+ const firstUserCenterUrl = formattedBlocklet?.navigation?.userCenter[0]?.link;
374
+ if (firstUserCenterUrl) {
375
+ window.location.replace(
376
+ withQuery(firstUserCenterUrl, {
377
+ did: isMyself ? void 0 : currentDid
378
+ })
379
+ );
380
+ }
374
381
  return null;
375
382
  }
376
383
  return /* @__PURE__ */ jsxs(
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { BoxProps } from '@mui/material';
3
2
  import type { User } from '../../../@types';
4
3
  export default function UserBasicInfo({ user, isMyself, showFullDid, switchPassport, switchProfile, openSettings, ...rest }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BoxProps } from '@mui/material';
3
2
  type TUserInfoItemProps = {
4
3
  data: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { BoxProps } from '@mui/material';
3
2
  import type { User } from '../../../@types';
4
3
  export default function UserInfo({ user, ...rest }: {
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { WebhookItemProps } from '../../@types';
3
2
  export default function WebhookItem({ onTest, onDelete, onSave, onCancel, type, url, edit, }: WebhookItemProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import type { AxiosError } from 'axios';
2
2
  import { CreatePassportProps } from '../../@types';
3
3
  export declare const formatAxiosError: (err: AxiosError) => string;
4
- export declare const createPassportSvg: (props: CreatePassportProps) => any;
4
+ export declare const createPassportSvg: (props: CreatePassportProps) => string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { User } from '../../@types';
3
2
  export default function UserSessionInfo({ user, sessionUser }: {
4
3
  readonly user: User;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { User } from '../../@types';
3
2
  export default function UserSessions({ user, showAction, showUser, }: {
4
3
  readonly user: User & {
@@ -65,10 +65,13 @@ export default function UserSessions({
65
65
  return pageState.data || [];
66
66
  }, [pageState.data]);
67
67
  const ipRegionMap = useCreation(() => {
68
- return safeData.reduce((acc, x) => {
69
- acc[x.lastLoginIp] = x.ipRegion;
70
- return acc;
71
- }, {});
68
+ return safeData.reduce(
69
+ (acc, x) => {
70
+ acc[x.lastLoginIp] = x.ipRegion;
71
+ return acc;
72
+ },
73
+ {}
74
+ );
72
75
  }, [safeData]);
73
76
  const logout = useMemoizedFn(({ visitorId }) => {
74
77
  confirmApi.open({
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface SpaceGateway {
3
2
  did: string;
4
3
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -32,8 +32,8 @@
32
32
  "url": "https://github.com/ArcBlock/ux/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/bridge": "^2.10.1",
36
- "@arcblock/react-hooks": "^2.10.1",
35
+ "@arcblock/bridge": "^2.10.3",
36
+ "@arcblock/react-hooks": "^2.10.3",
37
37
  "@iconify-icons/logos": "^1.2.36",
38
38
  "@iconify-icons/material-symbols": "^1.2.58",
39
39
  "@iconify/react": "^4.1.1",
@@ -78,5 +78,5 @@
78
78
  "jest": "^28.1.3",
79
79
  "unbuild": "^2.0.0"
80
80
  },
81
- "gitHead": "703447a831eaf4118ad467e83b07d23920e9221c"
81
+ "gitHead": "bd12e5b7417376a7a2be74354a070f04a997efac"
82
82
  }
@@ -78,7 +78,7 @@ export default function Notification({ user }: { user: User }) {
78
78
  wallet: true,
79
79
  email: true,
80
80
  phone: false,
81
- push: false,
81
+ push: true,
82
82
  ...(notificationConfigState?.data?.notifications || {}),
83
83
  };
84
84
  }, [notificationConfigState?.data?.notifications]);
@@ -402,7 +402,14 @@ export default function UserCenter({
402
402
  }, [userState, userCenterTabs, isMyself, currentActiveTab, privacyState, currentTab, stickySidebar]);
403
403
 
404
404
  if (!disableAutoRedirect && !currentTab && formattedBlocklet?.navigation?.userCenter?.length > 0) {
405
- window.location.replace(formattedBlocklet?.navigation?.userCenter[0]?.link);
405
+ const firstUserCenterUrl = formattedBlocklet?.navigation?.userCenter[0]?.link;
406
+ if (firstUserCenterUrl) {
407
+ window.location.replace(
408
+ withQuery(firstUserCenterUrl, {
409
+ did: isMyself ? undefined : currentDid,
410
+ })
411
+ );
412
+ }
406
413
  return null;
407
414
  }
408
415
 
@@ -82,10 +82,13 @@ export default function UserSessions({
82
82
  }, [pageState.data]);
83
83
 
84
84
  const ipRegionMap = useCreation(() => {
85
- return safeData.reduce((acc, x) => {
86
- acc[x.lastLoginIp] = x.ipRegion;
87
- return acc;
88
- }, {} as { [key: string]: string | undefined });
85
+ return safeData.reduce(
86
+ (acc, x) => {
87
+ acc[x.lastLoginIp] = x.ipRegion;
88
+ return acc;
89
+ },
90
+ {} as { [key: string]: string | undefined }
91
+ );
89
92
  }, [safeData]);
90
93
 
91
94
  const logout = useMemoizedFn(({ visitorId }) => {
@@ -273,8 +276,8 @@ export default function UserSessions({
273
276
  {x.status === 'expired'
274
277
  ? t('remove')
275
278
  : currentVisitorId === x.visitorId
276
- ? t('currentSession')
277
- : t('logout')}
279
+ ? t('currentSession')
280
+ : t('logout')}
278
281
  </Button>
279
282
  </Box>
280
283
  );