@hylid/types 2.12.0-alpha.18

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/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @hylid/env
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ npm i @hylid/env --save
7
+ ```
8
+
9
+ ## API
10
+
11
+ ```ts
12
+ import { getAppEnv, getPlatformEnv, getAppName, getPlatformName, APP, PLATFORM } from '@hylid/env';
13
+ ```
14
+
15
+ ## License
16
+
17
+ MIT
@@ -0,0 +1,5 @@
1
+ export declare type PickAttr<Attr extends keyof T, T = any> = {
2
+ [P in keyof T]: T[Attr];
3
+ }[keyof T];
4
+ export declare type Common = Record<string, any>;
5
+ export declare type Callback<T> = (result?: T) => void;
package/lib/common.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export * from './common';
2
+ export * from './jsapi';
3
+ export * from './mp';
4
+ declare global {
5
+ interface Window {
6
+ my: any;
7
+ AlipayJSBridge: any;
8
+ __hylid_jsapi__: any;
9
+ }
10
+ }
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./common";
2
+ export * from "./jsapi";
3
+ export * from "./mp";
package/lib/jsapi.d.ts ADDED
@@ -0,0 +1,250 @@
1
+ import { Common, PickAttr } from './common';
2
+ export declare namespace AliJsApi {
3
+ type AlertArgs = {
4
+ title?: string;
5
+ message?: string;
6
+ align?: string;
7
+ button?: string;
8
+ };
9
+ type ConfirmArgs = {
10
+ title?: string;
11
+ message?: string;
12
+ align?: string;
13
+ okButton?: string;
14
+ cancelButton?: string;
15
+ };
16
+ type GetAuthCodeArgs = {
17
+ scopes?: string | string[];
18
+ appId: string;
19
+ showErrorTip?: boolean;
20
+ };
21
+ type GetCurrentLocationArgs = {
22
+ bizType: string;
23
+ requestType?: number;
24
+ cacheTimeout?: number;
25
+ timeout?: number;
26
+ };
27
+ type GetCurrentLocationReturns = {
28
+ error: number;
29
+ errorMessage: string;
30
+ latitude: number;
31
+ longitude: number;
32
+ accuracy: number;
33
+ country: string;
34
+ countryCode: string;
35
+ province: string;
36
+ city: string;
37
+ cityAdcode: string;
38
+ district: string;
39
+ districtAdcode: string;
40
+ streetNumber: {
41
+ street: string;
42
+ number: number;
43
+ };
44
+ pois: {
45
+ name: string;
46
+ address: string;
47
+ }[];
48
+ highAccuracyClosed: boolean;
49
+ };
50
+ type GetAPDataStorageArgs = {
51
+ key: string;
52
+ business?: string;
53
+ type?: 'user' | 'common';
54
+ };
55
+ type GetAPDataStorageReturns = {
56
+ data: string;
57
+ errorMessage: string;
58
+ };
59
+ type GetSystemInfoReturns = {
60
+ model: string;
61
+ pixelRatio: number;
62
+ windowWidth: number;
63
+ windowHeight: number;
64
+ language: string;
65
+ version: string;
66
+ };
67
+ type PopToArgs = {
68
+ url?: string;
69
+ urlPattern?: string;
70
+ index?: number;
71
+ data?: Common;
72
+ };
73
+ type PushWindowArgs = {
74
+ url: string;
75
+ data?: Common;
76
+ params?: Common;
77
+ };
78
+ type HttpRequestArgs = {
79
+ url: string;
80
+ headers?: Common;
81
+ method?: 'GET' | 'POST';
82
+ data?: Common | string;
83
+ timeout?: number;
84
+ dataType?: 'json' | 'text' | 'base64' | ({} & string);
85
+ };
86
+ type HttpRequestReturns = {
87
+ data: string;
88
+ status: number;
89
+ headers: Common;
90
+ };
91
+ type SetTitleArgs = {
92
+ title?: string;
93
+ subtitle?: string;
94
+ image?: string;
95
+ };
96
+ type SetBarBottomLineColorArgs = {
97
+ color: number;
98
+ };
99
+ type SetTitleColorArgs = {
100
+ color: number;
101
+ reset?: boolean;
102
+ resetTransparent?: boolean;
103
+ };
104
+ type SetAPDataStorageArgs = GetAPDataStorageArgs & {
105
+ value: string;
106
+ };
107
+ type ShowAuthGuideArgs = {
108
+ bizType: string;
109
+ authType: string;
110
+ issue?: string;
111
+ source?: string;
112
+ option?: string;
113
+ };
114
+ type ShowLoadingArgs = {
115
+ content?: string;
116
+ delay?: number;
117
+ };
118
+ type ToastArgs = {
119
+ content: string;
120
+ type?: 'none' | 'success' | 'fail' | 'exception' | ({} & string);
121
+ duration?: number;
122
+ xOffset?: number;
123
+ yOffset?: number;
124
+ };
125
+ type TradePayArgs = {
126
+ tradeNO?: string;
127
+ partnerID?: string;
128
+ bizType?: string;
129
+ bizSubType?: string;
130
+ bizContext?: string;
131
+ orderStr?: string;
132
+ paymentUrl?: string;
133
+ flowType?: 'a+' | 'local' | '';
134
+ };
135
+ type ActionSheetArgs = {
136
+ title?: string;
137
+ btns: string[];
138
+ cancelBtn?: string;
139
+ destructiveBtnIndex?: number;
140
+ fn?: (v: any) => void;
141
+ };
142
+ type SetTabBarArgs = {
143
+ actionType: string;
144
+ };
145
+ interface Api {
146
+ alert(args?: AlertArgs): any;
147
+ clearTinyLocalStorage(args?: Common): any;
148
+ confirm(args?: ConfirmArgs): any;
149
+ getAuthCode(args?: GetAuthCodeArgs): {
150
+ authCode: string;
151
+ };
152
+ getClipboard(args?: Common): any;
153
+ getCurrentLocation(args?: GetCurrentLocationArgs): GetCurrentLocationReturns;
154
+ getNetworkType(): {
155
+ networkInfo: string;
156
+ };
157
+ getAPDataStorage(args: GetAPDataStorageArgs): GetAPDataStorageReturns;
158
+ getSystemInfo(): GetSystemInfoReturns;
159
+ hideKeyboard(): void;
160
+ hideLoading(args?: {
161
+ page: number;
162
+ }): void;
163
+ hideTitleLoading(): void;
164
+ hideToast(args?: Common): any;
165
+ popTo(args?: PopToArgs): any;
166
+ pushWindow(args?: PushWindowArgs): any;
167
+ removeTinyLocalStorage(args?: {
168
+ key: string;
169
+ }): any;
170
+ httpRequest(args: HttpRequestArgs): HttpRequestReturns;
171
+ setClipboard(args: {
172
+ text: string;
173
+ }): any;
174
+ setTitle(args?: SetTitleArgs): any;
175
+ setBarBottomLineColor(args?: SetBarBottomLineColorArgs): any;
176
+ setTitleColor(args?: SetTitleColorArgs): any;
177
+ setAPDataStorage(args?: SetAPDataStorageArgs): any;
178
+ showAuthGuide(args?: ShowAuthGuideArgs): {
179
+ shown: boolean;
180
+ };
181
+ showLoading(args?: ShowLoadingArgs): any;
182
+ showTitleLoading(): void;
183
+ toast(args: ToastArgs): void;
184
+ tradePay(args: TradePayArgs): {
185
+ resultCode: string;
186
+ };
187
+ getImageInfo(args?: Common): void;
188
+ multiLevelSelect(args?: Common): void;
189
+ navigateBackMiniProgram(args?: Common): void;
190
+ navigateToMiniProgram(args?: Common): void;
191
+ previewImage(args?: Common): void;
192
+ saveImage(args?: Common): void;
193
+ setOptionMenu(args?: Common): void;
194
+ chooseImage(args?: Common): void;
195
+ actionSheet(args?: ActionSheetArgs): void;
196
+ setTabBar(args?: SetTabBarArgs): void;
197
+ switchTab(args?: {
198
+ url: string;
199
+ }): void;
200
+ firePullToRefresh(): void;
201
+ restorePullToRefresh(): void;
202
+ datePicker(args: any): void;
203
+ saveFile(args?: any): void;
204
+ uploadFile(args?: any): void;
205
+ downloadFile(args?: any): void;
206
+ watchShake(args?: any): void;
207
+ connectSocket(args?: any): void;
208
+ onSocketOpen(args?: any): void;
209
+ offSocketOpen(args?: any): void;
210
+ onSocketError(args?: any): void;
211
+ offSocketError(args?: any): void;
212
+ sendSocketMessage(args?: any): void;
213
+ onSocketMessage(args?: any): void;
214
+ offSocketMessage(args?: any): void;
215
+ closeSocket(args?: any): void;
216
+ onSocketClose(args?: any): void;
217
+ offSocketClose(args?: any): void;
218
+ onAccelerometerChange(args?: any): void;
219
+ offAccelerometerChange(args?: any): void;
220
+ onCompassChange(args?: any): void;
221
+ offCompassChange(args?: any): void;
222
+ connectBLEDevice(args?: Common): void;
223
+ disconnectBLEDevice(args?: Common): void;
224
+ getBLEDeviceCharacteristics(args?: Common): void;
225
+ getBLEDeviceServices(args?: Common): void;
226
+ notifyBLECharacteristicValueChange(args?: Common): void;
227
+ offBLECharacteristicValueChange(args?: Common): void;
228
+ offBLEConnectionStateChanged(args?: Common): void;
229
+ onBLECharacteristicValueChange(args?: Common): void;
230
+ onBLEConnectionStateChanged(args?: Common): void;
231
+ readBLECharacteristicValue(args?: Common): void;
232
+ writeBLECharacteristicValue(args?: Common): void;
233
+ openBluetoothAdapter(args?: Common): void;
234
+ closeBluetoothAdapter(args?: Common): void;
235
+ getBluetoothAdapterState(args?: Common): void;
236
+ startBluetoothDevicesDiscovery(args?: Common): void;
237
+ stopBluetoothDevicesDiscovery(args?: Common): void;
238
+ getBluetoothDevices(args?: Common): void;
239
+ getConnectedBluetoothDevices(args?: Common): void;
240
+ onBluetoothDeviceFound(args?: Common): void;
241
+ offBluetoothDeviceFound(args?: Common): void;
242
+ onBluetoothAdapterStateChange(args?: Common): void;
243
+ offBluetoothAdapterStateChange(args?: Common): void;
244
+ getFileInfo(args?: Common): void;
245
+ openDocument(args?: Common): void;
246
+ }
247
+ }
248
+ export declare type PickJSAttr<Attr extends keyof AliJsApi.Api> = PickAttr<Attr, AliJsApi.Api>;
249
+ export declare type PickJSArgs<Attr extends keyof AliJsApi.Api = any> = Parameters<PickJSAttr<Attr>>[0];
250
+ export declare type PickJSReturns<Attr extends keyof AliJsApi.Api> = ReturnType<PickJSAttr<Attr>>;
package/lib/jsapi.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/mp.d.ts ADDED
@@ -0,0 +1,59 @@
1
+ /// <reference types="miniprogram" />
2
+ import { PickAttr, Common } from './common';
3
+ export interface AddFatigueActionArgs extends AsyncCallback<any> {
4
+ deliverId?: string;
5
+ spaceCode?: string;
6
+ action?: string;
7
+ }
8
+ export interface IRPCArgs {
9
+ operationType: string;
10
+ requestData: any[];
11
+ headers?: Record<string, any>;
12
+ gateway?: string;
13
+ compress?: boolean;
14
+ disableLimitView?: boolean;
15
+ timeout?: number;
16
+ getResponse?: boolean;
17
+ }
18
+ export interface MPApi extends MiniprogramApi {
19
+ authorize: (opt: any) => void;
20
+ getAuthUserInfo: (opt: any) => void;
21
+ crossPay(args?: TradePayArgs): void;
22
+ addFatigueAction(args?: AddFatigueActionArgs): void;
23
+ appxrpc(args?: {
24
+ reqeustData: any;
25
+ }): void;
26
+ batchQueryCdpSpaceInfo(args?: any): void;
27
+ exitApp(args?: any): void;
28
+ getAppToken(args?: any): void;
29
+ getComponentAuth(args?: any): void;
30
+ getPaymentCode(args?: any): void;
31
+ getPhoneNumber(args?: any): void;
32
+ inquireQuote(args?: any): void;
33
+ isInstalledApp(args?: any): void;
34
+ navigateToBizScene(args?: any): void;
35
+ paySignCenter(args?: any): void;
36
+ rpc(args: IRPCArgs, callback: (result: any) => void): void;
37
+ APRegionRPC(args?: any): void;
38
+ startApp(args?: any): void;
39
+ startBizService(args?: any): void;
40
+ thirdPartyAuthForAc(args?: any): void;
41
+ openSchemeWithBacking(args?: any): void;
42
+ uploadApdidToken(args?: any): void;
43
+ apDisableJSAPI(args?: any): void;
44
+ regionFetchAllApps(args?: any): void;
45
+ regionSearchAppsByKeywords(args?: any): void;
46
+ setOptionMenu(args?: Common & AsyncCallback<any>): void;
47
+ getLaunchOptionsSync(): any;
48
+ getStorageInfo(args?: any): void;
49
+ getStorageInfoSync(args?: any): void;
50
+ showSharePanel(args?: any): void;
51
+ postMessage(args?: any): void;
52
+ onMessage(args?: any): void;
53
+ canIUse(args: string): boolean;
54
+ SDKVersion: any;
55
+ hideOptionButton(args?: any): void;
56
+ }
57
+ export declare type PickMPAttr<Attr extends keyof MPApi> = PickAttr<Attr, MPApi>;
58
+ export declare type PickMPArgs<Attr extends keyof MPApi> = Parameters<PickMPAttr<Attr>>[0];
59
+ export declare type PickMpReturns<Attr extends keyof MPApi> = ReturnType<PickMPAttr<Attr>>;
package/lib/mp.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@hylid/types",
3
+ "version": "2.12.0-alpha.18",
4
+ "main": "lib/index.js",
5
+ "files": [
6
+ "lib",
7
+ "global.d.ts"
8
+ ],
9
+ "dependencies": {
10
+ "@types/miniprogram": "^1.0.3"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "license": "MIT",
16
+ "sideEffects": false,
17
+ "registry": "https://registry.npmjs.org/",
18
+ "repository": "https://code.alipay.com/ant-ife/hylid-bridge.git"
19
+ }