@blocklet/ui-react 3.0.6 → 3.0.8
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/@types/index.d.ts +204 -3
- package/lib/BlockletStudio/index.d.ts +27 -26
- package/lib/BlockletStudio/index.js +66 -66
- package/lib/ComponentInstaller/index.d.ts +15 -15
- package/lib/ComponentInstaller/installer-item.d.ts +10 -10
- package/lib/ComponentInstaller/locales.d.ts +2 -2
- package/lib/ComponentInstaller/use-component-installed.d.ts +2 -2
- package/lib/ComponentManager/components/add-component.d.ts +16 -13
- package/lib/ComponentManager/components/add-component.js +29 -29
- package/lib/ComponentManager/components/check-component.d.ts +2 -2
- package/lib/ComponentManager/components/publish-component.d.ts +10 -7
- package/lib/ComponentManager/components/publish-component.js +19 -19
- package/lib/ComponentManager/components/resource-dialog.d.ts +13 -11
- package/lib/ComponentManager/components/resource-dialog.js +1 -1
- package/lib/ComponentManager/index.d.ts +3 -4
- package/lib/ComponentManager/libs/locales.d.ts +14 -19
- package/lib/Dashboard/index.d.ts +16 -13
- package/lib/Footer/brand.d.ts +8 -8
- package/lib/Footer/copyright.d.ts +7 -7
- package/lib/Footer/index.d.ts +2 -2
- package/lib/Footer/internal-footer.d.ts +26 -21
- package/lib/Footer/internal-footer.js +1 -1
- package/lib/Footer/layout/plain.d.ts +15 -12
- package/lib/Footer/layout/row.d.ts +7 -7
- package/lib/Footer/layout/standard.d.ts +17 -14
- package/lib/Footer/layout/standard.js +1 -1
- package/lib/Footer/links.d.ts +15 -12
- package/lib/Footer/links.js +3 -3
- package/lib/Footer/social-media.d.ts +8 -8
- package/lib/Header/index.d.ts +23 -13
- package/lib/Header/index.js +17 -17
- package/lib/Icon/index.d.ts +9 -7
- package/lib/Icon/index.js +6 -6
- package/lib/Notifications/Snackbar.d.ts +16 -8
- package/lib/Notifications/Snackbar.js +1 -1
- package/lib/Notifications/hooks/use-title.d.ts +48 -9
- package/lib/Notifications/hooks/use-title.js +9 -9
- package/lib/Notifications/hooks/use-width.d.ts +2 -2
- package/lib/Notifications/utils.d.ts +69 -9
- package/lib/UserCenter/components/config-inviter.d.ts +4 -4
- package/lib/UserCenter/components/config-profile.d.ts +5 -5
- package/lib/UserCenter/components/danger-zone.d.ts +1 -2
- package/lib/UserCenter/components/editable-field.d.ts +34 -30
- package/lib/UserCenter/components/editable-field.js +12 -12
- package/lib/UserCenter/components/nft.d.ts +4 -4
- package/lib/UserCenter/components/notification.d.ts +5 -5
- package/lib/UserCenter/components/notification.js +5 -5
- package/lib/UserCenter/components/passport.d.ts +5 -5
- package/lib/UserCenter/components/privacy.d.ts +11 -5
- package/lib/UserCenter/components/settings.d.ts +10 -8
- package/lib/UserCenter/components/status-dialog/date-picker.d.ts +10 -9
- package/lib/UserCenter/components/status-dialog/date-picker.js +17 -10
- package/lib/UserCenter/components/status-dialog/index.d.ts +12 -9
- package/lib/UserCenter/components/status-dialog/index.js +8 -1
- package/lib/UserCenter/components/status-selector/duration-menu.d.ts +7 -7
- package/lib/UserCenter/components/status-selector/index.d.ts +9 -8
- package/lib/UserCenter/components/status-selector/index.js +5 -5
- package/lib/UserCenter/components/status-selector/menu-item.d.ts +24 -9
- package/lib/UserCenter/components/status-selector/menu-item.js +11 -6
- package/lib/UserCenter/components/storage/action.d.ts +9 -7
- package/lib/UserCenter/components/storage/connected.d.ts +5 -4
- package/lib/UserCenter/components/storage/delete.d.ts +6 -5
- package/lib/UserCenter/components/storage/disconnect.d.ts +2 -2
- package/lib/UserCenter/components/storage/index.d.ts +2 -2
- package/lib/UserCenter/components/storage/preview-nft.d.ts +5 -5
- package/lib/UserCenter/components/third-party-login/index.d.ts +4 -4
- package/lib/UserCenter/components/third-party-login/index.js +23 -29
- package/lib/UserCenter/components/third-party-login/third-party-item.d.ts +13 -4
- package/lib/UserCenter/components/user-center.d.ts +16 -15
- package/lib/UserCenter/components/user-info/address.d.ts +16 -7
- package/lib/UserCenter/components/user-info/index.d.ts +4 -5
- package/lib/UserCenter/components/user-info/link-preview-input.d.ts +5 -6
- package/lib/UserCenter/components/user-info/metadata.d.ts +10 -7
- package/lib/UserCenter/components/user-info/switch-role.d.ts +7 -6
- package/lib/UserCenter/components/user-info/timezone-select.d.ts +8 -7
- package/lib/UserCenter/components/user-info/user-basic-info.d.ts +13 -12
- package/lib/UserCenter/components/user-info/user-info-item.d.ts +11 -6
- package/lib/UserCenter/components/user-info/user-info-item.js +1 -1
- package/lib/UserCenter/components/user-info/user-info.d.ts +6 -6
- package/lib/UserCenter/components/user-info/user-status.d.ts +9 -9
- package/lib/UserCenter/components/user-info/user-status.js +17 -17
- package/lib/UserCenter/components/user-info/utils.d.ts +33 -15
- package/lib/UserCenter/components/webhook-item.d.ts +2 -10
- package/lib/UserCenter/index.d.ts +1 -2
- package/lib/UserCenter/libs/locales.d.ts +345 -513
- package/lib/UserCenter/libs/utils.d.ts +4 -3
- package/lib/UserSessions/components/user-session-info.d.ts +5 -5
- package/lib/UserSessions/components/user-sessions.d.ts +20 -8
- package/lib/UserSessions/index.d.ts +1 -2
- package/lib/UserSessions/libs/locales.d.ts +60 -88
- package/lib/UserSessions/libs/utils.d.ts +2 -3
- package/lib/blocklets.d.ts +9 -10
- package/lib/common/domain-warning.d.ts +7 -7
- package/lib/common/header-addons.d.ts +9 -9
- package/lib/common/link-blocker.d.ts +6 -3
- package/lib/common/notification-addon.d.ts +6 -6
- package/lib/common/overridable-theme-provider.d.ts +10 -7
- package/lib/common/wallet-hidden-topbar.d.ts +1 -2
- package/lib/common/ws.d.ts +3 -4
- package/lib/contexts/config-user-space.d.ts +27 -7
- package/lib/hooks/use-mobile.d.ts +3 -3
- package/lib/index.d.ts +10 -12
- package/lib/libs/client.d.ts +2 -3
- package/lib/libs/constant.d.ts +1 -2
- package/lib/libs/spaces.d.ts +2 -3
- package/lib/libs/with-hide-when-embed.d.ts +2 -3
- package/lib/types.d.ts +31 -32
- package/lib/utils.d.ts +10 -11
- package/package.json +8 -6
- package/src/BlockletStudio/index.tsx +13 -13
- package/src/ComponentManager/components/add-component.tsx +6 -6
- package/src/ComponentManager/components/publish-component.tsx +2 -2
- package/src/ComponentManager/components/resource-dialog.tsx +1 -1
- package/src/Footer/internal-footer.jsx +1 -1
- package/src/Footer/layout/standard.jsx +1 -1
- package/src/Footer/links.jsx +1 -1
- package/src/Header/index.tsx +2 -2
- package/src/Icon/index.tsx +2 -2
- package/src/Notifications/Snackbar.tsx +2 -2
- package/src/Notifications/hooks/use-title.tsx +1 -1
- package/src/UserCenter/components/editable-field.tsx +6 -6
- package/src/UserCenter/components/notification.tsx +2 -2
- package/src/UserCenter/components/status-dialog/date-picker.tsx +8 -1
- package/src/UserCenter/components/status-dialog/index.tsx +8 -1
- package/src/UserCenter/components/status-selector/index.tsx +1 -1
- package/src/UserCenter/components/status-selector/menu-item.tsx +6 -1
- package/src/UserCenter/components/third-party-login/index.tsx +0 -2
- package/src/UserCenter/components/user-center.tsx +1 -1
- package/src/UserCenter/components/user-info/link-preview-input.tsx +2 -2
- package/src/UserCenter/components/user-info/user-info-item.tsx +1 -1
- package/src/UserCenter/components/user-info/user-info.tsx +1 -1
- package/src/UserCenter/components/user-info/user-status.tsx +2 -2
- package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.d.ts +0 -3
package/lib/@types/index.d.ts
CHANGED
|
@@ -1,3 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
import { UserPublicInfo } from '@blocklet/js-sdk';
|
|
3
|
+
import { OAUTH_PROVIDER } from '@arcblock/ux/lib/Util/constant';
|
|
4
|
+
import { CloseConnect, OpenConnect } from '@arcblock/did-connect/lib/types';
|
|
5
|
+
export type SessionContext = {
|
|
6
|
+
session: Session;
|
|
7
|
+
api: Axios;
|
|
8
|
+
connectApi: {
|
|
9
|
+
open: OpenConnect;
|
|
10
|
+
close: CloseConnect;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type OAuthAccount = {
|
|
14
|
+
provider: keyof typeof OAUTH_PROVIDER;
|
|
15
|
+
id: string;
|
|
16
|
+
did: string;
|
|
17
|
+
pk: string;
|
|
18
|
+
lastLoginAt: string;
|
|
19
|
+
firstLoginAt: string;
|
|
20
|
+
order?: number;
|
|
21
|
+
userInfo?: {
|
|
22
|
+
email: string;
|
|
23
|
+
emailVerified: boolean;
|
|
24
|
+
name: string;
|
|
25
|
+
picture: string;
|
|
26
|
+
sub: string;
|
|
27
|
+
extraData: Object;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type WalletAccount = {
|
|
31
|
+
provider: 'wallet';
|
|
32
|
+
did: string;
|
|
33
|
+
pk: string;
|
|
34
|
+
lastLoginAt: string;
|
|
35
|
+
firstLoginAt: string;
|
|
36
|
+
};
|
|
37
|
+
export type NFTAccount = {
|
|
38
|
+
provider: 'nft';
|
|
39
|
+
did: string;
|
|
40
|
+
pk: string;
|
|
41
|
+
owner: string;
|
|
42
|
+
lastLoginAt: string;
|
|
43
|
+
firstLoginAt: string;
|
|
44
|
+
};
|
|
45
|
+
export type ConnectedAccount = OAuthAccount | WalletAccount | NFTAccount;
|
|
46
|
+
export type UserMetadataLink = {
|
|
47
|
+
url: string;
|
|
48
|
+
favicon?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare enum DurationEnum {
|
|
51
|
+
NoClear = "no_clear",
|
|
52
|
+
ThirtyMinutes = "30_minutes",
|
|
53
|
+
OneHour = "1_hour",
|
|
54
|
+
FourHours = "4_hours",
|
|
55
|
+
Today = "today",
|
|
56
|
+
ThisWeek = "this_week",
|
|
57
|
+
Custom = "custom"
|
|
58
|
+
}
|
|
59
|
+
export declare enum StatusEnum {
|
|
60
|
+
Meeting = "meeting",
|
|
61
|
+
Community = "community",
|
|
62
|
+
Holiday = "holiday",
|
|
63
|
+
OffSick = "off_sick",
|
|
64
|
+
WorkingRemotely = "working_remotely"
|
|
65
|
+
}
|
|
66
|
+
export type UserPhoneProps = {
|
|
67
|
+
country: string;
|
|
68
|
+
phoneNumber?: string;
|
|
69
|
+
};
|
|
70
|
+
export type UserMetadata = {
|
|
71
|
+
bio?: string;
|
|
72
|
+
location?: string;
|
|
73
|
+
timezone?: string;
|
|
74
|
+
joinedAt?: string;
|
|
75
|
+
status?: {
|
|
76
|
+
value: string;
|
|
77
|
+
duration?: DurationEnum;
|
|
78
|
+
dateRange?: Date[];
|
|
79
|
+
};
|
|
80
|
+
links?: UserMetadataLink[];
|
|
81
|
+
cover?: string;
|
|
82
|
+
email?: string;
|
|
83
|
+
phone?: UserPhoneProps;
|
|
84
|
+
};
|
|
85
|
+
export type UserAddress = {
|
|
86
|
+
country?: string;
|
|
87
|
+
province?: string;
|
|
88
|
+
city?: string;
|
|
89
|
+
line1?: string;
|
|
90
|
+
line2?: string;
|
|
91
|
+
postalCode?: string;
|
|
92
|
+
};
|
|
93
|
+
export type User = UserPublicInfo & {
|
|
94
|
+
role: string;
|
|
95
|
+
email?: string;
|
|
96
|
+
phone?: string;
|
|
97
|
+
sourceProvider?: string;
|
|
98
|
+
sourceAppPid?: string;
|
|
99
|
+
lastLoginAt?: string;
|
|
100
|
+
lastLoginIp?: string;
|
|
101
|
+
createdAt?: string;
|
|
102
|
+
passports?: any[];
|
|
103
|
+
didSpace?: Record<string, any>;
|
|
104
|
+
connectedAccounts?: any[];
|
|
105
|
+
locale?: string;
|
|
106
|
+
url: string;
|
|
107
|
+
inviter?: string;
|
|
108
|
+
emailVerified?: boolean;
|
|
109
|
+
phoneVerified?: boolean;
|
|
110
|
+
metadata?: UserMetadata;
|
|
111
|
+
address?: UserAddress;
|
|
112
|
+
};
|
|
113
|
+
export type UserCenterTab = {
|
|
114
|
+
value: string;
|
|
115
|
+
label: string;
|
|
116
|
+
url: string;
|
|
117
|
+
protected: boolean;
|
|
118
|
+
icon?: string;
|
|
119
|
+
isPrivate?: boolean;
|
|
120
|
+
};
|
|
121
|
+
export type Session = {
|
|
122
|
+
loading: boolean;
|
|
123
|
+
initialized: boolean;
|
|
124
|
+
user?: User;
|
|
125
|
+
login: any;
|
|
126
|
+
logout: any;
|
|
127
|
+
switch: any;
|
|
128
|
+
switchDid: any;
|
|
129
|
+
refreshProfile: () => Promise<void>;
|
|
130
|
+
switchProfile: any;
|
|
131
|
+
switchPassport: any;
|
|
132
|
+
refresh: Function;
|
|
133
|
+
useOAuth: Function;
|
|
134
|
+
usePasskey: Function;
|
|
135
|
+
};
|
|
136
|
+
export type WebhookType = 'slack' | 'api';
|
|
137
|
+
export type WebhookItemData = {
|
|
138
|
+
type: WebhookType;
|
|
139
|
+
url: string;
|
|
140
|
+
};
|
|
141
|
+
export type WebhookItemProps = {
|
|
142
|
+
onTest: (params: WebhookItemData) => void;
|
|
143
|
+
onSave: (params: WebhookItemData) => void;
|
|
144
|
+
onDelete?: (params: WebhookItemData) => void;
|
|
145
|
+
onCancel?: () => void;
|
|
146
|
+
edit: boolean;
|
|
147
|
+
type?: WebhookType;
|
|
148
|
+
url?: string;
|
|
149
|
+
};
|
|
150
|
+
export type CreatePassportProps = {
|
|
151
|
+
issuer: string;
|
|
152
|
+
title: string;
|
|
153
|
+
issuerDid: string;
|
|
154
|
+
issuerAvatarUrl: string;
|
|
155
|
+
ownerDid: string;
|
|
156
|
+
ownerName?: string;
|
|
157
|
+
ownerAvatarUrl: string;
|
|
158
|
+
preferredColor?: string;
|
|
159
|
+
revoked?: boolean;
|
|
160
|
+
isDataUrl?: boolean;
|
|
161
|
+
width?: string;
|
|
162
|
+
height?: string;
|
|
163
|
+
scope?: string;
|
|
164
|
+
role?: string;
|
|
165
|
+
display?: {
|
|
166
|
+
type: string;
|
|
167
|
+
content: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
export type BlockletMetaProps = {
|
|
171
|
+
appLogo?: React.ReactNode;
|
|
172
|
+
appName?: string;
|
|
173
|
+
theme?: {
|
|
174
|
+
background?: string;
|
|
175
|
+
};
|
|
176
|
+
enableConnect?: boolean;
|
|
177
|
+
enableLocale?: boolean;
|
|
178
|
+
navigation?: Array<{
|
|
179
|
+
title?: string | object;
|
|
180
|
+
link?: string | object;
|
|
181
|
+
icon?: string;
|
|
182
|
+
items?: Array<{
|
|
183
|
+
title?: string | object;
|
|
184
|
+
link?: string | object;
|
|
185
|
+
}>;
|
|
186
|
+
}>;
|
|
187
|
+
};
|
|
188
|
+
export type SessionManagerProps = {
|
|
189
|
+
showText?: boolean;
|
|
190
|
+
showRole?: boolean;
|
|
191
|
+
switchDid?: boolean;
|
|
192
|
+
switchProfile?: boolean;
|
|
193
|
+
switchPassport?: boolean;
|
|
194
|
+
disableLogout?: boolean;
|
|
195
|
+
onLogin?: () => void;
|
|
196
|
+
onLogout?: () => void;
|
|
197
|
+
onSwitchDid?: () => void;
|
|
198
|
+
onSwitchProfile?: () => void;
|
|
199
|
+
onSwitchPassport?: () => void;
|
|
200
|
+
menu?: any[];
|
|
201
|
+
menuRender?: () => void;
|
|
202
|
+
dark?: boolean;
|
|
203
|
+
size?: number;
|
|
204
|
+
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
interface BlockletStudioProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
setOpen: (open: boolean) => void;
|
|
4
|
+
onOpened?: () => void;
|
|
5
|
+
componentDid: string;
|
|
6
|
+
tenantScope?: string;
|
|
7
|
+
resourcesParams?: Record<string, any>;
|
|
8
|
+
mode?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
logo?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
introduction?: string;
|
|
13
|
+
note?: string;
|
|
14
|
+
onUploaded?: (data: unknown) => void;
|
|
15
|
+
onReleased?: (data: unknown) => void;
|
|
16
|
+
onConnected?: (data: unknown) => void;
|
|
17
|
+
components?: Record<string, unknown>[];
|
|
18
|
+
resources?: Record<string, unknown>;
|
|
19
|
+
componentsTitle?: string;
|
|
20
|
+
resourcesTitle?: string;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
zIndex?: number;
|
|
23
|
+
dependentComponentsMode?: 'auto' | 'readonly';
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
declare function BlockletStudio({ open, setOpen, onOpened, componentDid, tenantScope, resourcesParams, mode, title, logo, description, introduction, note, componentsTitle, resourcesTitle, onUploaded, onReleased, onConnected, components, resources, style, zIndex, dependentComponentsMode, ...rest }: BlockletStudioProps): import("react/jsx-runtime").JSX.Element | null;
|
|
27
|
+
export default BlockletStudio;
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { BLOCKLET_SERVICE_PATH_PREFIX as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { joinURL as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return Object.keys(s).forEach((
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
}),
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import { BLOCKLET_SERVICE_PATH_PREFIX as T } from "@arcblock/ux/lib/Util/constant";
|
|
3
|
+
import { useState as V, useRef as p, useEffect as A } from "react";
|
|
4
|
+
import { joinURL as H } from "ufo";
|
|
5
|
+
function J(d, s) {
|
|
6
|
+
const i = new URL(d);
|
|
7
|
+
return Object.keys(s).forEach((e) => {
|
|
8
|
+
const r = s[e];
|
|
9
|
+
r !== void 0 && i.searchParams.set(e, typeof r == "string" ? r : JSON.stringify(r));
|
|
10
|
+
}), i.pathname + i.search;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
open:
|
|
12
|
+
function z({
|
|
13
|
+
open: d,
|
|
14
14
|
setOpen: s,
|
|
15
|
-
onOpened:
|
|
16
|
-
componentDid:
|
|
17
|
-
tenantScope:
|
|
15
|
+
onOpened: i = void 0,
|
|
16
|
+
componentDid: e,
|
|
17
|
+
tenantScope: r = void 0,
|
|
18
18
|
resourcesParams: h = {},
|
|
19
19
|
mode: w = "dialog",
|
|
20
|
-
title: E,
|
|
21
|
-
logo:
|
|
22
|
-
description:
|
|
23
|
-
introduction:
|
|
24
|
-
note:
|
|
25
|
-
componentsTitle:
|
|
26
|
-
resourcesTitle:
|
|
27
|
-
onUploaded:
|
|
28
|
-
onReleased:
|
|
29
|
-
onConnected:
|
|
30
|
-
components:
|
|
31
|
-
resources:
|
|
32
|
-
style:
|
|
33
|
-
zIndex:
|
|
34
|
-
dependentComponentsMode:
|
|
35
|
-
...
|
|
20
|
+
title: E = void 0,
|
|
21
|
+
logo: v = void 0,
|
|
22
|
+
description: R = void 0,
|
|
23
|
+
introduction: L = void 0,
|
|
24
|
+
note: y = void 0,
|
|
25
|
+
componentsTitle: D = void 0,
|
|
26
|
+
resourcesTitle: S = void 0,
|
|
27
|
+
onUploaded: b = void 0,
|
|
28
|
+
onReleased: j = void 0,
|
|
29
|
+
onConnected: x = void 0,
|
|
30
|
+
components: B = [],
|
|
31
|
+
resources: P = {},
|
|
32
|
+
style: U = {},
|
|
33
|
+
zIndex: _ = 9999,
|
|
34
|
+
dependentComponentsMode: k = void 0,
|
|
35
|
+
...C
|
|
36
36
|
}) {
|
|
37
|
-
const [
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
const
|
|
37
|
+
const [a, n] = V(!1), c = p("");
|
|
38
|
+
c.current = e;
|
|
39
|
+
const t = p({});
|
|
40
|
+
if (t.current["resourceDialog.close"] = () => {
|
|
41
|
+
n(!1), s(!1);
|
|
42
|
+
}, t.current["resourceDialog.loaded"] = () => {
|
|
43
|
+
n(!0), i == null || i();
|
|
44
|
+
}, t.current["studioDialog.uploaded"] = b, t.current["studioDialog.connected"] = x, t.current["studioDialog.released"] = j, A(() => {
|
|
45
|
+
const u = (o) => {
|
|
46
46
|
var f, m, g;
|
|
47
|
-
if (((f =
|
|
47
|
+
if (((f = o == null ? void 0 : o.data) == null ? void 0 : f.componentDid) !== c.current)
|
|
48
48
|
return;
|
|
49
|
-
const
|
|
50
|
-
typeof
|
|
49
|
+
const l = t.current[(m = o == null ? void 0 : o.data) == null ? void 0 : m.event];
|
|
50
|
+
typeof l == "function" && l((g = o == null ? void 0 : o.data) == null ? void 0 : g.data);
|
|
51
51
|
};
|
|
52
|
-
return window.addEventListener("message",
|
|
53
|
-
window.removeEventListener("message",
|
|
52
|
+
return window.addEventListener("message", u), () => {
|
|
53
|
+
window.removeEventListener("message", u);
|
|
54
54
|
};
|
|
55
|
-
}, []), !
|
|
55
|
+
}, []), !d)
|
|
56
56
|
return null;
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const F = J(
|
|
58
|
+
H(window.location.origin, T, "/embed/resources", e, "/publish"),
|
|
59
59
|
{
|
|
60
60
|
title: E,
|
|
61
|
-
logo:
|
|
62
|
-
description:
|
|
63
|
-
introduction:
|
|
64
|
-
note:
|
|
65
|
-
tenantScope:
|
|
61
|
+
logo: v,
|
|
62
|
+
description: R,
|
|
63
|
+
introduction: L,
|
|
64
|
+
note: y,
|
|
65
|
+
tenantScope: r,
|
|
66
66
|
mode: w,
|
|
67
67
|
resourcesParams: h,
|
|
68
|
-
resources:
|
|
69
|
-
components:
|
|
70
|
-
resourcesTitle:
|
|
71
|
-
componentsTitle:
|
|
72
|
-
dependentComponentsMode:
|
|
68
|
+
resources: P,
|
|
69
|
+
components: B,
|
|
70
|
+
resourcesTitle: S,
|
|
71
|
+
componentsTitle: D,
|
|
72
|
+
dependentComponentsMode: k
|
|
73
73
|
}
|
|
74
74
|
);
|
|
75
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ I(
|
|
76
76
|
"iframe",
|
|
77
77
|
{
|
|
78
|
-
src:
|
|
78
|
+
src: F,
|
|
79
79
|
title: "Blocklet Studio",
|
|
80
80
|
style: {
|
|
81
81
|
position: "fixed",
|
|
@@ -83,18 +83,18 @@ function G({
|
|
|
83
83
|
left: 0,
|
|
84
84
|
width: "100vw",
|
|
85
85
|
height: "100vh",
|
|
86
|
-
zIndex:
|
|
86
|
+
zIndex: _,
|
|
87
87
|
border: 0,
|
|
88
88
|
padding: 0,
|
|
89
89
|
margin: 0,
|
|
90
|
-
pointerEvents:
|
|
91
|
-
opacity:
|
|
92
|
-
...
|
|
90
|
+
pointerEvents: a ? "auto" : "none",
|
|
91
|
+
opacity: a ? 1 : 0,
|
|
92
|
+
...U
|
|
93
93
|
},
|
|
94
|
-
...
|
|
94
|
+
...C
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
export {
|
|
99
|
-
|
|
99
|
+
z as default
|
|
100
100
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
|
|
3
|
-
declare
|
|
4
|
-
declare namespace G {
|
|
1
|
+
import { default as PropTypes } from 'prop-types';
|
|
2
|
+
declare function WrapComponentInstaller(props: any): any;
|
|
3
|
+
declare namespace WrapComponentInstaller {
|
|
5
4
|
namespace propTypes {
|
|
6
|
-
let children:
|
|
7
|
-
let disabled:
|
|
8
|
-
let warnIcon:
|
|
9
|
-
let did:
|
|
10
|
-
let noPermissionMute:
|
|
11
|
-
let onInstalled:
|
|
12
|
-
let onError:
|
|
13
|
-
let closeByOutSize:
|
|
14
|
-
let onClose:
|
|
15
|
-
let fallback:
|
|
16
|
-
let roles:
|
|
5
|
+
let children: PropTypes.Validator<any>;
|
|
6
|
+
let disabled: PropTypes.Requireable<boolean>;
|
|
7
|
+
let warnIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
8
|
+
let did: PropTypes.Validator<NonNullable<NonNullable<string | (string | null | undefined)[] | null | undefined>>>;
|
|
9
|
+
let noPermissionMute: PropTypes.Requireable<boolean>;
|
|
10
|
+
let onInstalled: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
let onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
let closeByOutSize: PropTypes.Requireable<boolean>;
|
|
13
|
+
let onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
+
let fallback: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
15
|
+
let roles: PropTypes.Requireable<any[]>;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
18
|
+
export default WrapComponentInstaller;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
|
|
3
|
-
declare function I({ optionalComponent: e, index: h, installStatus: l, hasPermission: f, t: c }: {
|
|
1
|
+
import { default as PropTypes } from 'prop-types';
|
|
2
|
+
declare function InstallerItem({ optionalComponent, index, installStatus, hasPermission, t }: {
|
|
4
3
|
optionalComponent: any;
|
|
5
4
|
index: any;
|
|
6
5
|
installStatus?: string | undefined;
|
|
7
6
|
hasPermission: any;
|
|
8
7
|
t: any;
|
|
9
|
-
}): import(
|
|
10
|
-
declare namespace
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare namespace InstallerItem {
|
|
11
10
|
namespace propTypes {
|
|
12
|
-
let t:
|
|
13
|
-
let optionalComponent:
|
|
14
|
-
let index:
|
|
15
|
-
let installStatus:
|
|
16
|
-
let hasPermission:
|
|
11
|
+
let t: PropTypes.Validator<(...args: any[]) => any>;
|
|
12
|
+
let optionalComponent: PropTypes.Validator<object>;
|
|
13
|
+
let index: PropTypes.Validator<number>;
|
|
14
|
+
let installStatus: PropTypes.Requireable<string>;
|
|
15
|
+
let hasPermission: PropTypes.Validator<boolean>;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
18
|
+
export default InstallerItem;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
componentDid:
|
|
4
|
-
resourceType
|
|
5
|
-
resourceDid
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onComplete:
|
|
11
|
-
onClose:
|
|
12
|
-
render:
|
|
13
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export default function AddComponent({ componentDid, resourceType, resourceDid, grantedRoles, autoClose, selectedMeta, storeUrl, onComplete, onClose, render, }: {
|
|
3
|
+
componentDid: string;
|
|
4
|
+
resourceType?: string;
|
|
5
|
+
resourceDid?: string;
|
|
6
|
+
autoClose?: boolean;
|
|
7
|
+
selectedMeta?: any;
|
|
8
|
+
storeUrl?: string;
|
|
9
|
+
grantedRoles?: string[];
|
|
10
|
+
onComplete: () => void;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
render?: ({ onClick, loading }: {
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
}) => ReactElement<any>;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { use as
|
|
3
|
-
import
|
|
4
|
-
import { useLocaleContext as
|
|
5
|
-
import { BLOCKLET_SERVICE_PATH_PREFIX as
|
|
6
|
-
import { useMemoizedFn as r, useReactive as
|
|
7
|
-
import { translate as
|
|
8
|
-
import { withQuery as
|
|
9
|
-
import { SessionContext as
|
|
1
|
+
import { jsxs as y, Fragment as B, jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { use as C, useRef as F, useEffect as I } from "react";
|
|
3
|
+
import S from "@arcblock/ux/lib/Button";
|
|
4
|
+
import { useLocaleContext as j } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
+
import { BLOCKLET_SERVICE_PATH_PREFIX as P } from "@arcblock/ux/lib/Util/constant";
|
|
6
|
+
import { useMemoizedFn as r, useReactive as T } from "ahooks";
|
|
7
|
+
import { translate as U } from "@arcblock/ux/lib/Locale/util";
|
|
8
|
+
import { withQuery as _, joinURL as A } from "ufo";
|
|
9
|
+
import { SessionContext as M } from "@arcblock/did-connect/lib/Session";
|
|
10
10
|
import h from "@arcblock/ux/lib/Toast";
|
|
11
|
-
import
|
|
12
|
-
import { translations as
|
|
11
|
+
import O from "./resource-dialog.js";
|
|
12
|
+
import { translations as z } from "../libs/locales.js";
|
|
13
13
|
function $({
|
|
14
14
|
componentDid: a,
|
|
15
|
-
resourceType: w,
|
|
16
|
-
resourceDid: p,
|
|
15
|
+
resourceType: w = void 0,
|
|
16
|
+
resourceDid: p = void 0,
|
|
17
17
|
grantedRoles: L = ["admin", "owner"],
|
|
18
18
|
autoClose: R = !0,
|
|
19
|
-
selectedMeta: D,
|
|
20
|
-
storeUrl: E,
|
|
19
|
+
selectedMeta: D = void 0,
|
|
20
|
+
storeUrl: E = void 0,
|
|
21
21
|
onComplete: n,
|
|
22
22
|
onClose: t,
|
|
23
|
-
render:
|
|
23
|
+
render: d = void 0
|
|
24
24
|
}) {
|
|
25
|
-
const { session:
|
|
25
|
+
const { session: m } = C(M), { locale: x } = j(), i = r((o, s = {}) => U(z, o, x, "en", s)), l = F(null), e = T({
|
|
26
26
|
loading: !1,
|
|
27
27
|
showDialog: !1
|
|
28
|
-
}), b = A(
|
|
28
|
+
}), b = _(A(P, "embed/resources", a, "add"), {
|
|
29
29
|
resourceDid: p,
|
|
30
30
|
resourceType: w,
|
|
31
31
|
mode: "dialog",
|
|
@@ -33,33 +33,33 @@ function $({
|
|
|
33
33
|
showResourcesSwitch: "false",
|
|
34
34
|
enableRunBackground: "false",
|
|
35
35
|
showCategory: "false"
|
|
36
|
-
}),
|
|
36
|
+
}), v = r(() => {
|
|
37
37
|
e.showDialog = !1, t == null || t();
|
|
38
38
|
}), c = r(() => {
|
|
39
39
|
e.showDialog = !1, n == null || n();
|
|
40
40
|
}), f = r(() => {
|
|
41
41
|
var o;
|
|
42
|
-
if (!
|
|
42
|
+
if (!m.user) {
|
|
43
43
|
h.warning(i("needLogin"));
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (!L.includes((o =
|
|
46
|
+
if (!L.includes((o = m.user) == null ? void 0 : o.role)) {
|
|
47
47
|
h.warning(i("noPermission"));
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
e.loading = !0, e.showDialog = !0;
|
|
51
|
-
}),
|
|
51
|
+
}), k = r(() => {
|
|
52
52
|
var o;
|
|
53
53
|
e.loading = !1, l.current && ((o = l.current) == null || o.selectBlocklet(D));
|
|
54
54
|
}), u = r((o) => {
|
|
55
55
|
var s;
|
|
56
56
|
((s = o == null ? void 0 : o.data) == null ? void 0 : s.event) === "component.installed" && o.data.componentDid === a && (R || o.data.manual) && c();
|
|
57
57
|
});
|
|
58
|
-
return
|
|
58
|
+
return I(() => {
|
|
59
59
|
e.showDialog ? window.addEventListener("message", u) : window.removeEventListener("message", u);
|
|
60
|
-
}, [e.showDialog]), /* @__PURE__ */ B
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
}, [e.showDialog]), /* @__PURE__ */ y(B, { children: [
|
|
61
|
+
d ? d({ onClick: f, loading: e.loading }) : /* @__PURE__ */ g(
|
|
62
|
+
S,
|
|
63
63
|
{
|
|
64
64
|
variant: "outlined",
|
|
65
65
|
color: "secondary",
|
|
@@ -73,7 +73,7 @@ function $({
|
|
|
73
73
|
"button"
|
|
74
74
|
),
|
|
75
75
|
e.showDialog && /* @__PURE__ */ g(
|
|
76
|
-
|
|
76
|
+
O,
|
|
77
77
|
{
|
|
78
78
|
ref: l,
|
|
79
79
|
src: b,
|
|
@@ -81,9 +81,9 @@ function $({
|
|
|
81
81
|
open: !0,
|
|
82
82
|
componentDid: a,
|
|
83
83
|
loading: e.loading,
|
|
84
|
-
onClose:
|
|
84
|
+
onClose: v,
|
|
85
85
|
onComplete: c,
|
|
86
|
-
onLoad:
|
|
86
|
+
onLoad: k
|
|
87
87
|
}
|
|
88
88
|
)
|
|
89
89
|
] });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
export
|
|
1
|
+
import { default as CheckComponent } from '../../ComponentInstaller';
|
|
2
|
+
export default CheckComponent;
|