hylid-bridge 4.0.0-alpha.17 → 4.0.0-alpha.19
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/bridges.d.ts +7 -2
- package/lib/clients/web/alipay/index.d.ts +2 -2
- package/lib/clients/web/h5/index.d.ts +2 -2
- package/lib/common/apis/custom/web/h5/clearStorage.d.ts +2 -2
- package/lib/common/apis/custom/web/h5/clearStorage.js +10 -8
- package/lib/common/apis/custom/web/h5/clearStorageSync.d.ts +2 -1
- package/lib/common/apis/custom/web/h5/clearStorageSync.js +3 -4
- package/lib/common/apis/custom/web/h5/getStorage.js +2 -5
- package/lib/common/apis/custom/web/h5/getStorageSync.js +2 -5
- package/lib/common/apis/custom/web/h5/setStorage.js +3 -2
- package/lib/common/apis/custom/web/h5/setStorageSync.js +3 -2
- package/lib/common/apis/generated/web/postNotification.d.ts +5 -2
- package/lib/internal/apis/custom/web/removeNotifyListener.d.ts +1 -1
- package/lib/internal/utils/network/index.js +6 -3
- package/lib/umd/index.js +1 -1
- package/lib/umd/mp_web_mpay.js +1 -1
- package/lib/umd/mp_web_toss.js +1 -1
- package/lib/umd/web_alipay.js +1 -1
- package/lib/umd/web_h5.js +1 -1
- package/package.json +6 -6
package/lib/bridges.d.ts
CHANGED
|
@@ -3000,7 +3000,10 @@ export declare const postNotification: PickMPAttr<'postNotification'>;
|
|
|
3000
3000
|
* | mp_web | |
|
|
3001
3001
|
* | web | alipay |
|
|
3002
3002
|
*/
|
|
3003
|
-
export declare const postNotificationAsync: (args?:
|
|
3003
|
+
export declare const postNotificationAsync: (args?: ({
|
|
3004
|
+
name: string;
|
|
3005
|
+
data: object;
|
|
3006
|
+
} & import("@hylid/types").AsyncCallback<void>) | undefined) => Promise<void>;
|
|
3004
3007
|
/**
|
|
3005
3008
|
* @support
|
|
3006
3009
|
* | Platform | Apps |
|
|
@@ -3040,7 +3043,9 @@ export declare const removeNotifyListener: PickMPAttr<'removeNotifyListener'>;
|
|
|
3040
3043
|
* | mp_web | |
|
|
3041
3044
|
* | web | alipay |
|
|
3042
3045
|
*/
|
|
3043
|
-
export declare const removeNotifyListenerAsync: (args?:
|
|
3046
|
+
export declare const removeNotifyListenerAsync: (args?: ({
|
|
3047
|
+
name: string;
|
|
3048
|
+
} & import("@hylid/types").AsyncCallback<void>) | undefined) => Promise<void>;
|
|
3044
3049
|
/**
|
|
3045
3050
|
* @support
|
|
3046
3051
|
* | Platform | Apps |
|
|
@@ -177,7 +177,7 @@ declare const _default: {
|
|
|
177
177
|
postNotification: (args: {
|
|
178
178
|
name: string;
|
|
179
179
|
data: object;
|
|
180
|
-
}) => void;
|
|
180
|
+
} & import("@hylid/types").AsyncCallback<void>) => void;
|
|
181
181
|
getMainSelectedCity: (args: import("@hylid/types").AsyncCallback<{
|
|
182
182
|
fullName: string;
|
|
183
183
|
enName: string;
|
|
@@ -311,7 +311,7 @@ declare const _default: {
|
|
|
311
311
|
} & import("@hylid/types").AsyncCallback<any>) => void;
|
|
312
312
|
removeNotifyListener: (args: {
|
|
313
313
|
name: string;
|
|
314
|
-
}) => void;
|
|
314
|
+
} & import("@hylid/types").AsyncCallback<void>) => void;
|
|
315
315
|
popWindow: () => void;
|
|
316
316
|
};
|
|
317
317
|
export default _default;
|
|
@@ -42,8 +42,8 @@ declare const _default: {
|
|
|
42
42
|
navigateToBizScene: (args?: any) => void;
|
|
43
43
|
navigateToMiniProgram: (args: NavigateToMiniProgramArgs) => void;
|
|
44
44
|
alert: typeof alert;
|
|
45
|
-
clearStorage:
|
|
46
|
-
clearStorageSync:
|
|
45
|
+
clearStorage: (args?: AsyncCallback<any> | undefined) => void;
|
|
46
|
+
clearStorageSync: () => void;
|
|
47
47
|
confirm: typeof confirm;
|
|
48
48
|
exitApp: typeof exitApp;
|
|
49
49
|
getClipboard: typeof getClipboard;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
1
|
+
declare const _default: (args?: AsyncCallback<any> | undefined) => void;
|
|
2
|
+
export default _default;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default (function (opt) {
|
|
2
|
+
var _a = opt || {},
|
|
3
|
+
success = _a.success,
|
|
4
|
+
fail = _a.fail,
|
|
5
|
+
complete = _a.complete;
|
|
4
6
|
try {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
localStorage.clear();
|
|
8
|
+
success === null || success === void 0 ? void 0 : success(undefined);
|
|
7
9
|
} catch (e) {
|
|
8
|
-
|
|
10
|
+
fail === null || fail === void 0 ? void 0 : fail(e);
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
|
13
|
+
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: () => void;
|
|
2
|
+
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
export default (function () {
|
|
2
|
+
localStorage.clear();
|
|
3
|
+
});
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import StorageImpl from "../../../../utils/storage";
|
|
2
1
|
export default (function (opt) {
|
|
3
2
|
var key = opt.key,
|
|
4
3
|
success = opt.success,
|
|
5
4
|
fail = opt.fail,
|
|
6
5
|
complete = opt.complete;
|
|
7
6
|
try {
|
|
8
|
-
var value =
|
|
9
|
-
success === null || success === void 0 ? void 0 : success(
|
|
10
|
-
data: value
|
|
11
|
-
});
|
|
7
|
+
var value = localStorage.getItem(key);
|
|
8
|
+
success === null || success === void 0 ? void 0 : success(value ? JSON.parse(value) : value);
|
|
12
9
|
} catch (e) {
|
|
13
10
|
fail === null || fail === void 0 ? void 0 : fail(e);
|
|
14
11
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import StorageImpl from "../../../../utils/storage";
|
|
2
1
|
export default (function (opt) {
|
|
3
2
|
var key = opt.key;
|
|
4
|
-
var value =
|
|
5
|
-
return
|
|
6
|
-
data: value
|
|
7
|
-
};
|
|
3
|
+
var value = localStorage.getItem(key);
|
|
4
|
+
return value ? JSON.parse(value) : value;
|
|
8
5
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import StorageImpl from "../../../../utils/storage";
|
|
2
1
|
export default (function (opt) {
|
|
3
2
|
var key = opt.key,
|
|
4
3
|
data = opt.data,
|
|
@@ -6,7 +5,9 @@ export default (function (opt) {
|
|
|
6
5
|
fail = opt.fail,
|
|
7
6
|
complete = opt.complete;
|
|
8
7
|
try {
|
|
9
|
-
|
|
8
|
+
localStorage.setItem(key, JSON.stringify({
|
|
9
|
+
data: data
|
|
10
|
+
}));
|
|
10
11
|
success === null || success === void 0 ? void 0 : success();
|
|
11
12
|
} catch (e) {
|
|
12
13
|
fail === null || fail === void 0 ? void 0 : fail(e);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare const postNotification: (args: {
|
|
2
2
|
name: string;
|
|
3
3
|
data: object;
|
|
4
|
-
}) => void;
|
|
4
|
+
} & import("@hylid/types").AsyncCallback<void>) => void;
|
|
5
5
|
export default postNotification;
|
|
6
|
-
export declare const postNotificationAsync: (args?:
|
|
6
|
+
export declare const postNotificationAsync: (args?: ({
|
|
7
|
+
name: string;
|
|
8
|
+
data: object;
|
|
9
|
+
} & import("@hylid/types").AsyncCallback<void>) | undefined) => Promise<void>;
|
|
@@ -156,11 +156,11 @@ export var implRpcWithAuth = function implRpcWithAuth(siteName, getStorage, setS
|
|
|
156
156
|
};
|
|
157
157
|
var rpcWithAuthMiniRequest = implAsyncBridge(function (args, resolve, reject) {
|
|
158
158
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
-
var oldHeader, otherArgs, httpRequest, error_1, signData, headers;
|
|
159
|
+
var oldHeader, workspaceId, otherArgs, httpRequest, error_1, signData, headers;
|
|
160
160
|
return __generator(this, function (_a) {
|
|
161
161
|
switch (_a.label) {
|
|
162
162
|
case 0:
|
|
163
|
-
oldHeader = args.headers, otherArgs = __rest(args, ["headers"]);
|
|
163
|
+
oldHeader = args.headers, workspaceId = args.workspaceId, otherArgs = __rest(args, ["headers", "workspaceId"]);
|
|
164
164
|
// 强制把 requestData 设置为 string 类型,确保加签JSON序列化的格式一致
|
|
165
165
|
if (typeof otherArgs.requestData !== 'string') {
|
|
166
166
|
otherArgs.requestData = JSON.stringify(otherArgs.requestData);
|
|
@@ -168,10 +168,12 @@ export var implRpcWithAuth = function implRpcWithAuth(siteName, getStorage, setS
|
|
|
168
168
|
httpRequest = function httpRequest(_a) {
|
|
169
169
|
var httpRequestHeaders = _a.headers,
|
|
170
170
|
operationType = _a.operationType,
|
|
171
|
-
requestData = _a.requestData
|
|
171
|
+
requestData = _a.requestData,
|
|
172
|
+
workspaceId = _a.workspaceId;
|
|
172
173
|
return new Promise(function (httpRequestResolve, httpRequestReject) {
|
|
173
174
|
nonLoginRpc(__assign(__assign({}, otherArgs), {
|
|
174
175
|
requestData: requestData,
|
|
176
|
+
workspaceId: workspaceId,
|
|
175
177
|
headers: __assign(__assign(__assign({}, oldHeader), httpRequestHeaders), {
|
|
176
178
|
'Operation-Type': operationType
|
|
177
179
|
}),
|
|
@@ -209,6 +211,7 @@ export var implRpcWithAuth = function implRpcWithAuth(siteName, getStorage, setS
|
|
|
209
211
|
headers = __assign(__assign({}, oldHeader), signData);
|
|
210
212
|
nonLoginRpc(__assign(__assign({}, otherArgs), {
|
|
211
213
|
headers: headers,
|
|
214
|
+
workspaceId: workspaceId,
|
|
212
215
|
success: function success(response) {
|
|
213
216
|
var _a, _b;
|
|
214
217
|
var resultStatus = (_b = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['result-status']) === null || _b === void 0 ? void 0 : _b.toString();
|