@blocklet/js-sdk 1.16.30-beta-cd65989e → 1.16.30
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/dist/index.d.mts +81 -7
- package/dist/index.d.ts +81 -7
- package/dist/index.mjs +6 -0
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
2
|
import { Axios, AxiosRequestConfig } from 'axios';
|
|
3
|
+
import { TTheme, TNavigationItem } from '@blocklet/meta/lib/types';
|
|
4
|
+
import * as _blocklet_meta_lib_blocklet from '@blocklet/meta/lib/blocklet';
|
|
5
|
+
import { TComponentInternalInfo } from '@blocklet/meta/lib/blocklet';
|
|
3
6
|
|
|
4
7
|
type UserPublicInfo = {
|
|
5
8
|
avatar: string;
|
|
@@ -107,16 +110,87 @@ declare class UserSessionService {
|
|
|
107
110
|
}): Promise<UserSession[]>;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
declare class BlockletService {
|
|
111
|
-
getBlocklet(baseUrl: string, force?: boolean): Promise<any>;
|
|
112
|
-
loadBlocklet(): Promise<void>;
|
|
113
|
-
getPrefix(blocklet?: any): any;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
113
|
type RequestParams = {
|
|
117
114
|
lazy?: boolean;
|
|
118
115
|
lazyTime?: number;
|
|
119
116
|
};
|
|
117
|
+
type BlockletComponent = TComponentInternalInfo;
|
|
118
|
+
type BlockletSettings = {
|
|
119
|
+
session: {
|
|
120
|
+
ttl: number;
|
|
121
|
+
cacheTtl: number;
|
|
122
|
+
};
|
|
123
|
+
federated: {
|
|
124
|
+
master: {
|
|
125
|
+
appId: string;
|
|
126
|
+
appPid: string;
|
|
127
|
+
appName: string;
|
|
128
|
+
appDescription: string;
|
|
129
|
+
appUrl: string;
|
|
130
|
+
appLogo: string;
|
|
131
|
+
version: string;
|
|
132
|
+
};
|
|
133
|
+
config: Record<string, any>;
|
|
134
|
+
};
|
|
135
|
+
oauth: Record<string, {
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
[x: string]: any;
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
type Blocklet = {
|
|
141
|
+
[x: string]: any;
|
|
142
|
+
did: string;
|
|
143
|
+
appId: string;
|
|
144
|
+
appPk: string;
|
|
145
|
+
appIds?: string[];
|
|
146
|
+
appPid: string;
|
|
147
|
+
appName: string;
|
|
148
|
+
appDescription: string;
|
|
149
|
+
appLogo: string;
|
|
150
|
+
appLogoRect: string;
|
|
151
|
+
appUrl: string;
|
|
152
|
+
isComponent: boolean;
|
|
153
|
+
prefix: string;
|
|
154
|
+
groupPrefix: string;
|
|
155
|
+
pageGroup: string;
|
|
156
|
+
version: string;
|
|
157
|
+
mode: string;
|
|
158
|
+
tenantMode: 'single' | 'multiple';
|
|
159
|
+
theme: TTheme;
|
|
160
|
+
navigation: TNavigationItem[];
|
|
161
|
+
preferences: Record<string, any>;
|
|
162
|
+
languages: {
|
|
163
|
+
code: string;
|
|
164
|
+
name: string;
|
|
165
|
+
}[];
|
|
166
|
+
passportColor: string;
|
|
167
|
+
componentMountPoints: BlockletComponent[];
|
|
168
|
+
alsoKnownAs: string[];
|
|
169
|
+
trustedFactories: string[];
|
|
170
|
+
status: string;
|
|
171
|
+
serverDid: string;
|
|
172
|
+
serverVersion: string;
|
|
173
|
+
componentId: string;
|
|
174
|
+
webWalletUrl: string;
|
|
175
|
+
updatedAt: number;
|
|
176
|
+
settings: BlockletSettings;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
declare class BlockletService {
|
|
180
|
+
getBlocklet(baseUrl?: string, force?: boolean): Promise<Blocklet>;
|
|
181
|
+
loadBlocklet(): Promise<void>;
|
|
182
|
+
getPrefix(blocklet?: Blocklet): string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare class ComponentService {
|
|
186
|
+
private blocklet;
|
|
187
|
+
constructor({ blocklet }: {
|
|
188
|
+
blocklet: Blocklet;
|
|
189
|
+
});
|
|
190
|
+
getComponent(name: string): _blocklet_meta_lib_blocklet.TComponentInternalInfo;
|
|
191
|
+
getComponentMountPoint(name?: string): string;
|
|
192
|
+
getUrl(name: string, ...parts: string[]): string;
|
|
193
|
+
}
|
|
120
194
|
|
|
121
195
|
declare class BlockletSDK {
|
|
122
196
|
api: Axios;
|
|
@@ -129,4 +203,4 @@ declare class BlockletSDK {
|
|
|
129
203
|
declare function createAxios(config?: AxiosRequestConfig, requestParams?: RequestParams): axios.AxiosInstance;
|
|
130
204
|
declare function createFetch(options?: RequestInit, requestParams?: RequestParams): (input: string | Request | URL, options?: RequestInit) => Promise<Response>;
|
|
131
205
|
|
|
132
|
-
export { AuthService, BlockletSDK, BlockletService, type NotificationConfig, type PrivacyConfig, TokenService, type UserPublicInfo, type UserSession, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch };
|
|
206
|
+
export { AuthService, BlockletSDK, BlockletService, ComponentService, type NotificationConfig, type PrivacyConfig, TokenService, type UserPublicInfo, type UserSession, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
2
|
import { Axios, AxiosRequestConfig } from 'axios';
|
|
3
|
+
import { TTheme, TNavigationItem } from '@blocklet/meta/lib/types';
|
|
4
|
+
import * as _blocklet_meta_lib_blocklet from '@blocklet/meta/lib/blocklet';
|
|
5
|
+
import { TComponentInternalInfo } from '@blocklet/meta/lib/blocklet';
|
|
3
6
|
|
|
4
7
|
type UserPublicInfo = {
|
|
5
8
|
avatar: string;
|
|
@@ -107,16 +110,87 @@ declare class UserSessionService {
|
|
|
107
110
|
}): Promise<UserSession[]>;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
declare class BlockletService {
|
|
111
|
-
getBlocklet(baseUrl: string, force?: boolean): Promise<any>;
|
|
112
|
-
loadBlocklet(): Promise<void>;
|
|
113
|
-
getPrefix(blocklet?: any): any;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
113
|
type RequestParams = {
|
|
117
114
|
lazy?: boolean;
|
|
118
115
|
lazyTime?: number;
|
|
119
116
|
};
|
|
117
|
+
type BlockletComponent = TComponentInternalInfo;
|
|
118
|
+
type BlockletSettings = {
|
|
119
|
+
session: {
|
|
120
|
+
ttl: number;
|
|
121
|
+
cacheTtl: number;
|
|
122
|
+
};
|
|
123
|
+
federated: {
|
|
124
|
+
master: {
|
|
125
|
+
appId: string;
|
|
126
|
+
appPid: string;
|
|
127
|
+
appName: string;
|
|
128
|
+
appDescription: string;
|
|
129
|
+
appUrl: string;
|
|
130
|
+
appLogo: string;
|
|
131
|
+
version: string;
|
|
132
|
+
};
|
|
133
|
+
config: Record<string, any>;
|
|
134
|
+
};
|
|
135
|
+
oauth: Record<string, {
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
[x: string]: any;
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
type Blocklet = {
|
|
141
|
+
[x: string]: any;
|
|
142
|
+
did: string;
|
|
143
|
+
appId: string;
|
|
144
|
+
appPk: string;
|
|
145
|
+
appIds?: string[];
|
|
146
|
+
appPid: string;
|
|
147
|
+
appName: string;
|
|
148
|
+
appDescription: string;
|
|
149
|
+
appLogo: string;
|
|
150
|
+
appLogoRect: string;
|
|
151
|
+
appUrl: string;
|
|
152
|
+
isComponent: boolean;
|
|
153
|
+
prefix: string;
|
|
154
|
+
groupPrefix: string;
|
|
155
|
+
pageGroup: string;
|
|
156
|
+
version: string;
|
|
157
|
+
mode: string;
|
|
158
|
+
tenantMode: 'single' | 'multiple';
|
|
159
|
+
theme: TTheme;
|
|
160
|
+
navigation: TNavigationItem[];
|
|
161
|
+
preferences: Record<string, any>;
|
|
162
|
+
languages: {
|
|
163
|
+
code: string;
|
|
164
|
+
name: string;
|
|
165
|
+
}[];
|
|
166
|
+
passportColor: string;
|
|
167
|
+
componentMountPoints: BlockletComponent[];
|
|
168
|
+
alsoKnownAs: string[];
|
|
169
|
+
trustedFactories: string[];
|
|
170
|
+
status: string;
|
|
171
|
+
serverDid: string;
|
|
172
|
+
serverVersion: string;
|
|
173
|
+
componentId: string;
|
|
174
|
+
webWalletUrl: string;
|
|
175
|
+
updatedAt: number;
|
|
176
|
+
settings: BlockletSettings;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
declare class BlockletService {
|
|
180
|
+
getBlocklet(baseUrl?: string, force?: boolean): Promise<Blocklet>;
|
|
181
|
+
loadBlocklet(): Promise<void>;
|
|
182
|
+
getPrefix(blocklet?: Blocklet): string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare class ComponentService {
|
|
186
|
+
private blocklet;
|
|
187
|
+
constructor({ blocklet }: {
|
|
188
|
+
blocklet: Blocklet;
|
|
189
|
+
});
|
|
190
|
+
getComponent(name: string): _blocklet_meta_lib_blocklet.TComponentInternalInfo;
|
|
191
|
+
getComponentMountPoint(name?: string): string;
|
|
192
|
+
getUrl(name: string, ...parts: string[]): string;
|
|
193
|
+
}
|
|
120
194
|
|
|
121
195
|
declare class BlockletSDK {
|
|
122
196
|
api: Axios;
|
|
@@ -129,4 +203,4 @@ declare class BlockletSDK {
|
|
|
129
203
|
declare function createAxios(config?: AxiosRequestConfig, requestParams?: RequestParams): axios.AxiosInstance;
|
|
130
204
|
declare function createFetch(options?: RequestInit, requestParams?: RequestParams): (input: string | Request | URL, options?: RequestInit) => Promise<Response>;
|
|
131
205
|
|
|
132
|
-
export { AuthService, BlockletSDK, BlockletService, type NotificationConfig, type PrivacyConfig, TokenService, type UserPublicInfo, type UserSession, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch };
|
|
206
|
+
export { AuthService, BlockletSDK, BlockletService, ComponentService, type NotificationConfig, type PrivacyConfig, TokenService, type UserPublicInfo, type UserSession, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch };
|
package/dist/index.mjs
CHANGED
|
@@ -122,6 +122,12 @@ class UserSessionService {
|
|
|
122
122
|
const blockletCache = new QuickLRU({ maxSize: 30, maxAge: 60 * 1e3 });
|
|
123
123
|
class BlockletService {
|
|
124
124
|
async getBlocklet(baseUrl, force = false) {
|
|
125
|
+
if (!baseUrl) {
|
|
126
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
127
|
+
throw new Error("Cannot get blocklet in server side without baseUrl");
|
|
128
|
+
}
|
|
129
|
+
return window.blocklet;
|
|
130
|
+
}
|
|
125
131
|
if (!force && blockletCache.has(baseUrl)) {
|
|
126
132
|
return blockletCache.get(baseUrl);
|
|
127
133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/js-sdk",
|
|
3
|
-
"version": "1.16.30
|
|
3
|
+
"version": "1.16.30",
|
|
4
4
|
"main": "dist/index.mjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"build": "unbuild"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@abtnode/constant": "1.16.30
|
|
34
|
+
"@abtnode/constant": "1.16.30",
|
|
35
|
+
"@blocklet/meta": "1.16.30",
|
|
35
36
|
"axios": "^1.7.2",
|
|
36
37
|
"js-cookie": "^3.0.5",
|
|
37
38
|
"quick-lru": "^7.0.0",
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"unbuild": "^2.0.0"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "18420639259c736016b19152229183d9fc1c1656"
|
|
44
45
|
}
|