@blocklet/ui-react 3.4.14 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/org-switch/use-org.d.ts +4 -4
- package/lib/common/ws.d.ts +22 -1
- package/package.json +10 -7
- package/.aigne/doc-smith/.local/afs-storage.sqlite3 +0 -0
- package/.aigne/doc-smith/config.yaml +0 -78
- package/.aigne/doc-smith/history.yaml +0 -14
- package/.aigne/doc-smith/media-description.yaml +0 -11
- package/.aigne/doc-smith/output/structure-plan.json +0 -255
- package/.aigne/doc-smith/translation-cache.yaml +0 -11
- package/.aigne/doc-smith/upload-cache.yaml +0 -528
- package/build.config.ts +0 -24
- package/docs/_sidebar.md +0 -19
- package/docs/assets/diagram/component-installer-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh.jpg +0 -0
- package/docs/components-component-management-blocklet-studio.ja.md +0 -194
- package/docs/components-component-management-blocklet-studio.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh-TW.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh.md +0 -194
- package/docs/components-component-management-component-installer.ja.md +0 -182
- package/docs/components-component-management-component-installer.md +0 -182
- package/docs/components-component-management-component-installer.zh-TW.md +0 -182
- package/docs/components-component-management-component-installer.zh.md +0 -182
- package/docs/components-component-management.ja.md +0 -30
- package/docs/components-component-management.md +0 -30
- package/docs/components-component-management.zh-TW.md +0 -30
- package/docs/components-component-management.zh.md +0 -30
- package/docs/components-layout-dashboard.ja.md +0 -185
- package/docs/components-layout-dashboard.md +0 -187
- package/docs/components-layout-dashboard.zh-TW.md +0 -185
- package/docs/components-layout-dashboard.zh.md +0 -185
- package/docs/components-layout-footer.ja.md +0 -165
- package/docs/components-layout-footer.md +0 -165
- package/docs/components-layout-footer.zh-TW.md +0 -165
- package/docs/components-layout-footer.zh.md +0 -165
- package/docs/components-layout-header.ja.md +0 -183
- package/docs/components-layout-header.md +0 -183
- package/docs/components-layout-header.zh-TW.md +0 -183
- package/docs/components-layout-header.zh.md +0 -183
- package/docs/components-layout.ja.md +0 -31
- package/docs/components-layout.md +0 -31
- package/docs/components-layout.zh-TW.md +0 -31
- package/docs/components-layout.zh.md +0 -31
- package/docs/components-notifications.ja.md +0 -125
- package/docs/components-notifications.md +0 -125
- package/docs/components-notifications.zh-TW.md +0 -125
- package/docs/components-notifications.zh.md +0 -125
- package/docs/components-user-management-user-center.ja.md +0 -148
- package/docs/components-user-management-user-center.md +0 -147
- package/docs/components-user-management-user-center.zh-TW.md +0 -148
- package/docs/components-user-management-user-center.zh.md +0 -148
- package/docs/components-user-management-user-sessions.ja.md +0 -121
- package/docs/components-user-management-user-sessions.md +0 -123
- package/docs/components-user-management-user-sessions.zh-TW.md +0 -121
- package/docs/components-user-management-user-sessions.zh.md +0 -121
- package/docs/components-user-management.ja.md +0 -49
- package/docs/components-user-management.md +0 -51
- package/docs/components-user-management.zh-TW.md +0 -49
- package/docs/components-user-management.zh.md +0 -49
- package/docs/components-utilities-icon.ja.md +0 -106
- package/docs/components-utilities-icon.md +0 -106
- package/docs/components-utilities-icon.zh-TW.md +0 -106
- package/docs/components-utilities-icon.zh.md +0 -106
- package/docs/components-utilities.ja.md +0 -136
- package/docs/components-utilities.md +0 -136
- package/docs/components-utilities.zh-TW.md +0 -136
- package/docs/components-utilities.zh.md +0 -136
- package/docs/components.ja.md +0 -27
- package/docs/components.md +0 -27
- package/docs/components.zh-TW.md +0 -27
- package/docs/components.zh.md +0 -27
- package/docs/core-concepts.ja.md +0 -134
- package/docs/core-concepts.md +0 -135
- package/docs/core-concepts.zh-TW.md +0 -134
- package/docs/core-concepts.zh.md +0 -134
- package/docs/getting-started.ja.md +0 -132
- package/docs/getting-started.md +0 -132
- package/docs/getting-started.zh-TW.md +0 -132
- package/docs/getting-started.zh.md +0 -132
- package/docs/hooks-api.ja.md +0 -214
- package/docs/hooks-api.md +0 -214
- package/docs/hooks-api.zh-TW.md +0 -214
- package/docs/hooks-api.zh.md +0 -214
- package/docs/how-to-guides.ja.md +0 -413
- package/docs/how-to-guides.md +0 -413
- package/docs/how-to-guides.zh-TW.md +0 -413
- package/docs/how-to-guides.zh.md +0 -413
- package/docs/overview.ja.md +0 -51
- package/docs/overview.md +0 -51
- package/docs/overview.zh-TW.md +0 -51
- package/docs/overview.zh.md +0 -51
- package/glossary.md +0 -12
- package/src/@types/index.ts +0 -230
- package/src/@types/shims.d.ts +0 -18
- package/src/BlockletStudio/README.md +0 -116
- package/src/BlockletStudio/index.tsx +0 -145
- package/src/ComponentInstaller/ComponentInstaller.stories.jsx +0 -16
- package/src/ComponentInstaller/index.jsx +0 -207
- package/src/ComponentInstaller/installer-item.jsx +0 -129
- package/src/ComponentInstaller/locales.js +0 -22
- package/src/ComponentInstaller/use-component-installed.js +0 -88
- package/src/ComponentManager/components/add-component.tsx +0 -136
- package/src/ComponentManager/components/check-component.tsx +0 -3
- package/src/ComponentManager/components/publish-component.tsx +0 -90
- package/src/ComponentManager/components/resource-dialog.tsx +0 -91
- package/src/ComponentManager/index.tsx +0 -3
- package/src/ComponentManager/libs/locales.ts +0 -15
- package/src/Dashboard/Dashboard.stories.jsx +0 -20
- package/src/Dashboard/app-shell/app-badge.stories.tsx +0 -64
- package/src/Dashboard/app-shell/app-badge.tsx +0 -94
- package/src/Dashboard/app-shell/app-header.tsx +0 -104
- package/src/Dashboard/app-shell/app-info-context.tsx +0 -182
- package/src/Dashboard/app-shell/badges/app-badge-default.tsx +0 -130
- package/src/Dashboard/app-shell/badges/app-badge-did.tsx +0 -28
- package/src/Dashboard/app-shell/badges/app-badge-state.tsx +0 -40
- package/src/Dashboard/app-shell/badges/app-badge-switch.tsx +0 -72
- package/src/Dashboard/app-shell/badges/app-badge-version.tsx +0 -60
- package/src/Dashboard/app-shell/index.ts +0 -5
- package/src/Dashboard/index.jsx +0 -184
- package/src/Footer/Footer.stories.jsx +0 -33
- package/src/Footer/brand.jsx +0 -81
- package/src/Footer/copyright.jsx +0 -22
- package/src/Footer/index.jsx +0 -111
- package/src/Footer/internal-footer.jsx +0 -139
- package/src/Footer/layout/plain.jsx +0 -55
- package/src/Footer/layout/row.jsx +0 -43
- package/src/Footer/layout/standard.jsx +0 -114
- package/src/Footer/links.jsx +0 -321
- package/src/Footer/social-media.jsx +0 -55
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/index.tsx +0 -259
- package/src/Icon/Icon.stories.jsx +0 -12
- package/src/Icon/index.tsx +0 -87
- package/src/Notifications/Snackbar.tsx +0 -261
- package/src/Notifications/hooks/use-title.tsx +0 -254
- package/src/Notifications/hooks/use-width.tsx +0 -16
- package/src/Notifications/utils.ts +0 -246
- package/src/UserCenter/assets/banner.png +0 -0
- package/src/UserCenter/components/config-inviter.tsx +0 -48
- package/src/UserCenter/components/config-profile.tsx +0 -99
- package/src/UserCenter/components/danger-zone.tsx +0 -82
- package/src/UserCenter/components/editable-field.tsx +0 -273
- package/src/UserCenter/components/fallback.tsx +0 -57
- package/src/UserCenter/components/nft-preview.tsx +0 -84
- package/src/UserCenter/components/nft.tsx +0 -279
- package/src/UserCenter/components/notification.tsx +0 -319
- package/src/UserCenter/components/passport.tsx +0 -107
- package/src/UserCenter/components/privacy.tsx +0 -120
- package/src/UserCenter/components/settings.tsx +0 -170
- package/src/UserCenter/components/status-dialog/date-picker.tsx +0 -77
- package/src/UserCenter/components/status-dialog/index.tsx +0 -293
- package/src/UserCenter/components/status-selector/duration-menu.tsx +0 -90
- package/src/UserCenter/components/status-selector/index.tsx +0 -58
- package/src/UserCenter/components/status-selector/menu-item.tsx +0 -56
- package/src/UserCenter/components/storage/action.tsx +0 -49
- package/src/UserCenter/components/storage/connected.tsx +0 -61
- package/src/UserCenter/components/storage/delete.tsx +0 -72
- package/src/UserCenter/components/storage/disconnect.tsx +0 -40
- package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -1
- package/src/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/src/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/src/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/src/UserCenter/components/storage/index.tsx +0 -41
- package/src/UserCenter/components/storage/preview-nft.tsx +0 -72
- package/src/UserCenter/components/third-party-login/index.tsx +0 -199
- package/src/UserCenter/components/third-party-login/third-party-item.tsx +0 -296
- package/src/UserCenter/components/user-center.tsx +0 -787
- package/src/UserCenter/components/user-info/address.tsx +0 -143
- package/src/UserCenter/components/user-info/index.tsx +0 -4
- package/src/UserCenter/components/user-info/link-preview-input.tsx +0 -274
- package/src/UserCenter/components/user-info/metadata.tsx +0 -658
- package/src/UserCenter/components/user-info/social-actions/chat.tsx +0 -43
- package/src/UserCenter/components/user-info/social-actions/follow.tsx +0 -23
- package/src/UserCenter/components/user-info/social-actions/index.tsx +0 -17
- package/src/UserCenter/components/user-info/switch-role.tsx +0 -42
- package/src/UserCenter/components/user-info/timezone-select.tsx +0 -119
- package/src/UserCenter/components/user-info/user-basic-info.tsx +0 -292
- package/src/UserCenter/components/user-info/user-info-item.tsx +0 -54
- package/src/UserCenter/components/user-info/user-info.tsx +0 -91
- package/src/UserCenter/components/user-info/user-status.tsx +0 -234
- package/src/UserCenter/components/user-info/utils.ts +0 -320
- package/src/UserCenter/components/webhook-item.tsx +0 -248
- package/src/UserCenter/index.tsx +0 -1
- package/src/UserCenter/libs/locales.ts +0 -378
- package/src/UserCenter/libs/utils.ts +0 -30
- package/src/UserSessions/components/user-session-info.tsx +0 -78
- package/src/UserSessions/components/user-sessions.tsx +0 -545
- package/src/UserSessions/index.tsx +0 -1
- package/src/UserSessions/libs/locales.ts +0 -60
- package/src/UserSessions/libs/utils.ts +0 -82
- package/src/blocklets.js +0 -195
- package/src/common/domain-warning.jsx +0 -178
- package/src/common/header-addons.jsx +0 -119
- package/src/common/link-blocker.jsx +0 -20
- package/src/common/notification-addon.jsx +0 -135
- package/src/common/org-switch/avatar-uploader.jsx +0 -271
- package/src/common/org-switch/create.jsx +0 -267
- package/src/common/org-switch/index.jsx +0 -407
- package/src/common/org-switch/locales.js +0 -52
- package/src/common/org-switch/use-org.jsx +0 -79
- package/src/common/overridable-theme-provider.jsx +0 -17
- package/src/common/wallet-hidden-topbar.js +0 -14
- package/src/common/wizard-modal.jsx +0 -200
- package/src/common/ws.js +0 -68
- package/src/contexts/config-user-space.tsx +0 -88
- package/src/contexts/user-followers.tsx +0 -54
- package/src/hooks/use-follow.tsx +0 -75
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -16
- package/src/libs/constant.ts +0 -1
- package/src/libs/spaces.tsx +0 -18
- package/src/libs/with-hide-when-embed.tsx +0 -24
- package/src/types.js +0 -45
- package/src/utils.js +0 -161
- package/vite.config.mjs +0 -34
package/src/@types/index.ts
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import type { Axios } from 'axios';
|
|
2
|
-
import type { UserPublicInfo } from '@blocklet/js-sdk';
|
|
3
|
-
import { OAUTH_PROVIDER } from '@arcblock/ux/lib/Util/constant';
|
|
4
|
-
import type { CloseConnect, OpenConnect } from '@arcblock/did-connect-react/lib/types';
|
|
5
|
-
|
|
6
|
-
export type SessionContext = {
|
|
7
|
-
session: Session;
|
|
8
|
-
api: Axios;
|
|
9
|
-
connectApi: {
|
|
10
|
-
open: OpenConnect;
|
|
11
|
-
close: CloseConnect;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type OAuthAccount = {
|
|
16
|
-
provider: keyof typeof OAUTH_PROVIDER;
|
|
17
|
-
id: string;
|
|
18
|
-
did: string;
|
|
19
|
-
pk: string;
|
|
20
|
-
lastLoginAt: string;
|
|
21
|
-
firstLoginAt: string;
|
|
22
|
-
order?: number;
|
|
23
|
-
userInfo?: {
|
|
24
|
-
email: string;
|
|
25
|
-
emailVerified: boolean;
|
|
26
|
-
name: string;
|
|
27
|
-
picture: string;
|
|
28
|
-
sub: string;
|
|
29
|
-
extraData: Object;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type WalletAccount = {
|
|
34
|
-
provider: 'wallet';
|
|
35
|
-
did: string;
|
|
36
|
-
pk: string;
|
|
37
|
-
lastLoginAt: string;
|
|
38
|
-
firstLoginAt: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type NFTAccount = {
|
|
42
|
-
provider: 'nft';
|
|
43
|
-
did: string;
|
|
44
|
-
pk: string;
|
|
45
|
-
owner: string;
|
|
46
|
-
lastLoginAt: string;
|
|
47
|
-
firstLoginAt: string;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export type ConnectedAccount = OAuthAccount | WalletAccount | NFTAccount;
|
|
51
|
-
|
|
52
|
-
export type UserMetadataLink = {
|
|
53
|
-
url: string;
|
|
54
|
-
favicon?: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export enum DurationEnum {
|
|
58
|
-
NoClear = 'no_clear',
|
|
59
|
-
ThirtyMinutes = '30_minutes',
|
|
60
|
-
OneHour = '1_hour',
|
|
61
|
-
FourHours = '4_hours',
|
|
62
|
-
Today = 'today',
|
|
63
|
-
ThisWeek = 'this_week',
|
|
64
|
-
Custom = 'custom',
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export enum StatusEnum {
|
|
68
|
-
Meeting = 'meeting',
|
|
69
|
-
Community = 'community',
|
|
70
|
-
Holiday = 'holiday',
|
|
71
|
-
OffSick = 'off_sick',
|
|
72
|
-
WorkingRemotely = 'working_remotely',
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export type UserPhoneProps = {
|
|
76
|
-
country: string;
|
|
77
|
-
phoneNumber?: string;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export type UserMetadata = {
|
|
81
|
-
bio?: string;
|
|
82
|
-
location?: string;
|
|
83
|
-
timezone?: string;
|
|
84
|
-
joinedAt?: string;
|
|
85
|
-
status?: {
|
|
86
|
-
value: string;
|
|
87
|
-
duration?: DurationEnum;
|
|
88
|
-
dateRange?: Date[];
|
|
89
|
-
};
|
|
90
|
-
links?: UserMetadataLink[];
|
|
91
|
-
cover?: string;
|
|
92
|
-
// 这两个字段是 User, 方便数据更新,在保存时同步
|
|
93
|
-
email?: string;
|
|
94
|
-
phone?: UserPhoneProps;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export type UserAddress = {
|
|
98
|
-
country?: string;
|
|
99
|
-
province?: string;
|
|
100
|
-
city?: string;
|
|
101
|
-
line1?: string;
|
|
102
|
-
line2?: string;
|
|
103
|
-
postalCode?: string;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export type User = UserPublicInfo & {
|
|
107
|
-
role: string;
|
|
108
|
-
email?: string;
|
|
109
|
-
phone?: string;
|
|
110
|
-
sourceProvider?: string;
|
|
111
|
-
sourceAppPid?: string;
|
|
112
|
-
lastLoginAt?: string;
|
|
113
|
-
lastLoginIp?: string;
|
|
114
|
-
createdAt?: string;
|
|
115
|
-
passports?: any[];
|
|
116
|
-
didSpace?: Record<string, any>;
|
|
117
|
-
connectedAccounts?: any[];
|
|
118
|
-
locale?: string;
|
|
119
|
-
url: string;
|
|
120
|
-
inviter?: string;
|
|
121
|
-
emailVerified?: boolean;
|
|
122
|
-
phoneVerified?: boolean;
|
|
123
|
-
// 1.16.40 新增
|
|
124
|
-
metadata?: UserMetadata;
|
|
125
|
-
// 1.16.41 新增
|
|
126
|
-
address?: UserAddress;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export type UserCenterTab = {
|
|
130
|
-
value: string;
|
|
131
|
-
label: string;
|
|
132
|
-
url: string;
|
|
133
|
-
protected: boolean | string;
|
|
134
|
-
icon?: string;
|
|
135
|
-
isPrivate?: boolean; // 如果为 true 则不应该出现在隐私设置中
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export type Session = {
|
|
139
|
-
loading: boolean;
|
|
140
|
-
initialized: boolean;
|
|
141
|
-
user?: User;
|
|
142
|
-
login: any;
|
|
143
|
-
logout: any;
|
|
144
|
-
switch: any;
|
|
145
|
-
switchDid: any;
|
|
146
|
-
|
|
147
|
-
refreshProfile: () => Promise<void>;
|
|
148
|
-
switchProfile: any;
|
|
149
|
-
switchPassport: any;
|
|
150
|
-
|
|
151
|
-
refresh: Function;
|
|
152
|
-
useOAuth: Function;
|
|
153
|
-
usePasskey: Function;
|
|
154
|
-
withSecondaryAuth: Function;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
export type WebhookType = 'slack' | 'api';
|
|
158
|
-
export type WebhookItemData = {
|
|
159
|
-
type: WebhookType;
|
|
160
|
-
url: string;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export type WebhookItemProps = {
|
|
164
|
-
onTest: (params: WebhookItemData) => void;
|
|
165
|
-
onSave: (params: WebhookItemData) => void;
|
|
166
|
-
onDelete?: (params: WebhookItemData) => void;
|
|
167
|
-
onCancel?: () => void;
|
|
168
|
-
edit: boolean;
|
|
169
|
-
type?: WebhookType;
|
|
170
|
-
url?: string;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
export type CreatePassportProps = {
|
|
174
|
-
issuer: string;
|
|
175
|
-
title: string;
|
|
176
|
-
issuerDid: string;
|
|
177
|
-
issuerAvatarUrl: string;
|
|
178
|
-
ownerDid: string;
|
|
179
|
-
ownerName?: string;
|
|
180
|
-
ownerAvatarUrl: string;
|
|
181
|
-
preferredColor?: string;
|
|
182
|
-
revoked?: boolean;
|
|
183
|
-
isDataUrl?: boolean;
|
|
184
|
-
width?: string;
|
|
185
|
-
height?: string;
|
|
186
|
-
scope?: string;
|
|
187
|
-
role?: string;
|
|
188
|
-
display?: {
|
|
189
|
-
type: string;
|
|
190
|
-
content: string;
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
export type BlockletMetaProps = {
|
|
195
|
-
appLogo?: React.ReactNode;
|
|
196
|
-
appName?: string;
|
|
197
|
-
theme?: {
|
|
198
|
-
background?: string;
|
|
199
|
-
};
|
|
200
|
-
enableConnect?: boolean;
|
|
201
|
-
enableLocale?: boolean;
|
|
202
|
-
navigation?: Array<{
|
|
203
|
-
title?: string | object;
|
|
204
|
-
link?: string | object;
|
|
205
|
-
icon?: string;
|
|
206
|
-
items?: Array<{
|
|
207
|
-
title?: string | object;
|
|
208
|
-
link?: string | object;
|
|
209
|
-
}>;
|
|
210
|
-
}>;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export type SessionManagerProps = {
|
|
214
|
-
showText?: boolean;
|
|
215
|
-
showRole?: boolean;
|
|
216
|
-
switchDid?: boolean;
|
|
217
|
-
switchProfile?: boolean;
|
|
218
|
-
switchPassport?: boolean;
|
|
219
|
-
disableLogout?: boolean;
|
|
220
|
-
onLogin?: () => void;
|
|
221
|
-
onLogout?: () => void;
|
|
222
|
-
onSwitchDid?: () => void;
|
|
223
|
-
onSwitchProfile?: () => void;
|
|
224
|
-
onSwitchPassport?: () => void;
|
|
225
|
-
menu?: any[];
|
|
226
|
-
menuRender?: () => void;
|
|
227
|
-
dark?: boolean;
|
|
228
|
-
size?: number;
|
|
229
|
-
profileUrl?: string;
|
|
230
|
-
};
|
package/src/@types/shims.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare module '@arcblock/ux/*';
|
|
2
|
-
declare module '@arcblock/ux/lib/DID';
|
|
3
|
-
declare module '@arcblock/ux/lib/Tabs';
|
|
4
|
-
declare module '@arcblock/ux/lib/Switch';
|
|
5
|
-
declare module '@arcblock/ux/lib/ErrorBoundary';
|
|
6
|
-
|
|
7
|
-
declare module '@arcblock/did-connect-react/*';
|
|
8
|
-
declare module '@arcblock/did-connect-react/lib/Session';
|
|
9
|
-
declare module '@abtnode/constant';
|
|
10
|
-
declare module '@abtnode/util/lib/notification-preview/*';
|
|
11
|
-
|
|
12
|
-
declare module 'is-url';
|
|
13
|
-
|
|
14
|
-
declare module '*.png';
|
|
15
|
-
|
|
16
|
-
declare interface Window {
|
|
17
|
-
blocklet: any;
|
|
18
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
## Blocklet export api 改动
|
|
2
|
-
|
|
3
|
-
新约定, 如果 blocklet 的 export api 返回数据中,包含了 `dependentComponents`, 在用户选中了这个资源时, 会自动选中这些依赖的组件。
|
|
4
|
-
|
|
5
|
-
example:
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
res.json({
|
|
9
|
-
resources: [
|
|
10
|
-
...list.map((x) => ({
|
|
11
|
-
...x,
|
|
12
|
-
id: `application-${x._id}`,
|
|
13
|
-
name: `${x.name} (as Application)`,
|
|
14
|
-
dependentComponents: [
|
|
15
|
-
'error-did',
|
|
16
|
-
'z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9',
|
|
17
|
-
'z2qZyjnsRffFtn2PDnDwDHTRbAu53RpKqDtFZ',
|
|
18
|
-
'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk',
|
|
19
|
-
],
|
|
20
|
-
})),
|
|
21
|
-
...list.map((x) => ({
|
|
22
|
-
...x,
|
|
23
|
-
id: `tool-${x._id}`,
|
|
24
|
-
name: `${x.name} (as Tool)`,
|
|
25
|
-
dependentComponents: ['error-did', 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk'],
|
|
26
|
-
})),
|
|
27
|
-
...list.map((x) => ({
|
|
28
|
-
...x,
|
|
29
|
-
id: `template-${x._id}`,
|
|
30
|
-
name: `${x.name} (as Template)`,
|
|
31
|
-
})),
|
|
32
|
-
...list.map((x) => ({
|
|
33
|
-
...x,
|
|
34
|
-
id: `example-${x._id}`,
|
|
35
|
-
name: `${x.name} (as Example)`,
|
|
36
|
-
})),
|
|
37
|
-
],
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## BlockletStudio Component example
|
|
43
|
-
|
|
44
|
-
因为 iframe 的加载会有过程, 推荐在点击按钮让渲染 loading, 在 onOpened 取消 loading:
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import { Icon } from '@iconify-icon/react';
|
|
48
|
-
import ArrowUp from '@iconify-icons/tabler/arrow-big-up-line';
|
|
49
|
-
import { Box, IconButton, CircularProgress as Spinner, svgIconClasses } from '@mui/material';
|
|
50
|
-
import { useState } from 'react';
|
|
51
|
-
|
|
52
|
-
import { AI_STUDIO_COMPONENT_DID } from '../../libs/constants';
|
|
53
|
-
import { BlockletStudio } from './blocklet-studio';
|
|
54
|
-
|
|
55
|
-
export default function Exporter() {
|
|
56
|
-
const [showCreateResource, setShowCreateResource] = useState(false);
|
|
57
|
-
const [opening, setOpening] = useState(false);
|
|
58
|
-
const handleShowDialog = () => {
|
|
59
|
-
setOpening(true);
|
|
60
|
-
setShowCreateResource(true);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<>
|
|
65
|
-
<IconButton
|
|
66
|
-
sx={{
|
|
67
|
-
position: 'relative',
|
|
68
|
-
minWidth: 40,
|
|
69
|
-
minHeight: 40,
|
|
70
|
-
borderRadius: '100%',
|
|
71
|
-
[`.${svgIconClasses.root}`]: {
|
|
72
|
-
color: 'text.secondary',
|
|
73
|
-
},
|
|
74
|
-
}}
|
|
75
|
-
onClick={handleShowDialog}>
|
|
76
|
-
{opening ? <Spinner size={16} /> : <Box component={Icon} icon={ArrowUp} style={{ fontSize: 24 }} />}
|
|
77
|
-
</IconButton>
|
|
78
|
-
<BlockletStudio
|
|
79
|
-
mode="dialog"
|
|
80
|
-
tenantScope="test-tenant-scope-id-2"
|
|
81
|
-
title="demo aigne project"
|
|
82
|
-
description={'This is a demo project for "aigne" blocklet.'}
|
|
83
|
-
note='This is a demo project for "aigne" blocklet.'
|
|
84
|
-
introduction="the introduction."
|
|
85
|
-
componentDid={AI_STUDIO_COMPONENT_DID}
|
|
86
|
-
// 新增的参数,用于禁用选择组件
|
|
87
|
-
dependentComponentsMode="readonly"
|
|
88
|
-
componentsTitle="Components"
|
|
89
|
-
resourcesTitle="Add Files"
|
|
90
|
-
// 透传到 get blocklet resource 的参数
|
|
91
|
-
resourcesParams={{ name: 'test-project', ok: true }}
|
|
92
|
-
open={showCreateResource}
|
|
93
|
-
setOpen={setShowCreateResource}
|
|
94
|
-
onConnected={() => alert('connected')}
|
|
95
|
-
onUploaded={() => alert('uploaded')}
|
|
96
|
-
onReleased={() => alert('released')}
|
|
97
|
-
onOpened={() => setOpening(false)}
|
|
98
|
-
// 默认选中的组件
|
|
99
|
-
components={[
|
|
100
|
-
{ did: 'z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ', included: true, required: true },
|
|
101
|
-
{ did: 'z2qZyjnsRffFtn2PDnDwDHTRbAu53RpKqDtFZ', included: true, required: false },
|
|
102
|
-
]}
|
|
103
|
-
// 默认选中的资源
|
|
104
|
-
resources={{
|
|
105
|
-
z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB: [
|
|
106
|
-
'template-448698592710885376',
|
|
107
|
-
'template-448696391418511360',
|
|
108
|
-
'template',
|
|
109
|
-
'example-448698592710885376',
|
|
110
|
-
],
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
</>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
```
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { BLOCKLET_SERVICE_PATH_PREFIX } from '@arcblock/ux/lib/Util/constant';
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { joinURL } from 'ufo';
|
|
4
|
-
|
|
5
|
-
function parseUrl(uri: string, params: Record<string, any>): string {
|
|
6
|
-
const url = new URL(uri);
|
|
7
|
-
Object.keys(params).forEach((key) => {
|
|
8
|
-
const value = params[key];
|
|
9
|
-
if (value !== undefined) {
|
|
10
|
-
url.searchParams.set(key, typeof value === 'string' ? value : JSON.stringify(value));
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
return url.pathname + url.search;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface BlockletStudioProps {
|
|
17
|
-
open: boolean;
|
|
18
|
-
setOpen: (open: boolean) => void;
|
|
19
|
-
onOpened?: () => void;
|
|
20
|
-
componentDid: string;
|
|
21
|
-
tenantScope?: string;
|
|
22
|
-
resourcesParams?: Record<string, any>;
|
|
23
|
-
mode?: string;
|
|
24
|
-
title?: string;
|
|
25
|
-
logo?: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
introduction?: string;
|
|
28
|
-
note?: string;
|
|
29
|
-
onUploaded?: (data: unknown) => void; // 上传后的回调函数
|
|
30
|
-
onReleased?: (data: unknown) => void; // 发布一个新 release 后的回调函数
|
|
31
|
-
onConnected?: (data: unknown) => void; // 连接后的回调函数
|
|
32
|
-
components?: Record<string, unknown>[]; // 默认组件列表
|
|
33
|
-
resources?: Record<string, unknown>; // 默认资源
|
|
34
|
-
componentsTitle?: string;
|
|
35
|
-
resourcesTitle?: string;
|
|
36
|
-
style?: React.CSSProperties;
|
|
37
|
-
zIndex?: number;
|
|
38
|
-
dependentComponentsMode?: 'auto' | 'readonly'; // 禁用选择组件
|
|
39
|
-
[key: string]: any;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function BlockletStudio({
|
|
43
|
-
open,
|
|
44
|
-
setOpen,
|
|
45
|
-
onOpened = undefined,
|
|
46
|
-
componentDid,
|
|
47
|
-
tenantScope = undefined,
|
|
48
|
-
resourcesParams = {},
|
|
49
|
-
mode = 'dialog',
|
|
50
|
-
title = undefined,
|
|
51
|
-
logo = undefined,
|
|
52
|
-
description = undefined,
|
|
53
|
-
introduction = undefined,
|
|
54
|
-
note = undefined,
|
|
55
|
-
componentsTitle = undefined,
|
|
56
|
-
resourcesTitle = undefined,
|
|
57
|
-
onUploaded = undefined,
|
|
58
|
-
onReleased = undefined,
|
|
59
|
-
onConnected = undefined,
|
|
60
|
-
components = [],
|
|
61
|
-
resources = {},
|
|
62
|
-
style = {},
|
|
63
|
-
zIndex = 9999,
|
|
64
|
-
dependentComponentsMode = undefined,
|
|
65
|
-
...rest
|
|
66
|
-
}: BlockletStudioProps) {
|
|
67
|
-
const [opened, setOpened] = useState(false);
|
|
68
|
-
const didRef = useRef('');
|
|
69
|
-
didRef.current = componentDid;
|
|
70
|
-
const latestFunctionVersionRef = useRef<{ [key: string]: undefined | ((data: unknown) => void) }>({});
|
|
71
|
-
latestFunctionVersionRef.current['resourceDialog.close'] = () => {
|
|
72
|
-
setOpened(false);
|
|
73
|
-
setOpen(false);
|
|
74
|
-
};
|
|
75
|
-
latestFunctionVersionRef.current['resourceDialog.loaded'] = () => {
|
|
76
|
-
setOpened(true);
|
|
77
|
-
onOpened?.();
|
|
78
|
-
};
|
|
79
|
-
latestFunctionVersionRef.current['studioDialog.uploaded'] = onUploaded;
|
|
80
|
-
latestFunctionVersionRef.current['studioDialog.connected'] = onConnected;
|
|
81
|
-
latestFunctionVersionRef.current['studioDialog.released'] = onReleased;
|
|
82
|
-
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
const listener = (event: MessageEvent) => {
|
|
85
|
-
if (event?.data?.componentDid !== didRef.current) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
const fn = latestFunctionVersionRef.current[event?.data?.event];
|
|
89
|
-
if (typeof fn === 'function') {
|
|
90
|
-
fn(event?.data?.data);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
window.addEventListener('message', listener);
|
|
94
|
-
return () => {
|
|
95
|
-
window.removeEventListener('message', listener);
|
|
96
|
-
};
|
|
97
|
-
}, []);
|
|
98
|
-
|
|
99
|
-
if (!open) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const src = parseUrl(
|
|
104
|
-
joinURL(window.location.origin, BLOCKLET_SERVICE_PATH_PREFIX, '/embed/resources', componentDid, '/publish'),
|
|
105
|
-
{
|
|
106
|
-
title,
|
|
107
|
-
logo,
|
|
108
|
-
description,
|
|
109
|
-
introduction,
|
|
110
|
-
note,
|
|
111
|
-
tenantScope,
|
|
112
|
-
mode,
|
|
113
|
-
resourcesParams,
|
|
114
|
-
resources,
|
|
115
|
-
components,
|
|
116
|
-
resourcesTitle,
|
|
117
|
-
componentsTitle,
|
|
118
|
-
dependentComponentsMode,
|
|
119
|
-
}
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<iframe
|
|
124
|
-
src={src}
|
|
125
|
-
title="Blocklet Studio"
|
|
126
|
-
style={{
|
|
127
|
-
position: 'fixed',
|
|
128
|
-
top: 0,
|
|
129
|
-
left: 0,
|
|
130
|
-
width: '100vw',
|
|
131
|
-
height: '100vh',
|
|
132
|
-
zIndex,
|
|
133
|
-
border: 0,
|
|
134
|
-
padding: 0,
|
|
135
|
-
margin: 0,
|
|
136
|
-
pointerEvents: opened ? 'auto' : 'none',
|
|
137
|
-
opacity: opened ? 1 : 0,
|
|
138
|
-
...style,
|
|
139
|
-
}}
|
|
140
|
-
{...rest}
|
|
141
|
-
/>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export default BlockletStudio;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Basic from './demo/basic';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Blocklet-UI-React/ComponentInstaller',
|
|
5
|
-
|
|
6
|
-
parameters: {
|
|
7
|
-
layout: 'fullscreen',
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
Basic.argTypes = {
|
|
12
|
-
userRole: { control: 'select', options: [null, 'owner', 'developer'] },
|
|
13
|
-
};
|
|
14
|
-
Basic.storyName = 'ComponentInstaller';
|
|
15
|
-
|
|
16
|
-
export { Basic };
|