@hylid/custom-jsapi 4.0.0-alpha.2 → 4.0.0-alpha.20
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/bridge.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { HyCustomJSAPI, GetGeneralAppInfo } from '@hylid/types';
|
|
2
|
+
export declare const bySpecificClient: <T extends unknown>(map: Record<string, T>, defaultValue: T) => (clientName: string) => T;
|
|
2
3
|
export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
|
|
4
|
+
export declare const getCallAppLinkCreator: (clientName: string) => (params: import("@hylid/types/lib/custom/appLink").AppLinkParams) => string;
|
|
3
5
|
export declare const getAppScanLink: HyCustomJSAPI['getAppScanLink'];
|
|
6
|
+
export declare const getAppScanLinkCreator: (clientName: string) => (params: import("@hylid/types/lib/custom/appLink").AppLinkParams) => string;
|
|
4
7
|
export declare const getGeneralAppInfo: GetGeneralAppInfo;
|
|
8
|
+
export declare const getGeneralAppInfoCreator: (clientName: string) => GetGeneralAppInfo;
|
package/lib/bridge.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
var _a, _b, _c;
|
|
2
|
+
import { clientEnv, CLIENT } from '@hylid/env';
|
|
2
3
|
import { notFound } from '@hylid/call';
|
|
3
4
|
import { getCallAppLink as alipayGetCallAppLink } from "./common/alipay";
|
|
4
5
|
import { getCallAppLink as alipayhkGetCallAppLink } from "./common/alipayhk";
|
|
@@ -19,6 +20,11 @@ import { getGeneralAppInfo as mpayGetGeneralAppInfo } from "./common/mpay/getGen
|
|
|
19
20
|
import { getGeneralAppInfo as tngdGetGeneralAppInfo } from "./common/tngd/getGeneralAppInfo";
|
|
20
21
|
import { getGeneralAppInfo as tossGetGeneralAppInfo } from "./common/toss/getGeneralAppInfo";
|
|
21
22
|
import { getGeneralAppInfo as truemoneyGetGeneralAppInfo } from "./common/truemoney/getGeneralAppInfo";
|
|
23
|
+
export var bySpecificClient = function bySpecificClient(map, defaultValue) {
|
|
24
|
+
return function (clientName) {
|
|
25
|
+
return map[clientName] || defaultValue;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
22
28
|
export var getCallAppLink = function getCallAppLink() {
|
|
23
29
|
var args = [];
|
|
24
30
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -34,6 +40,9 @@ export var getCallAppLink = function getCallAppLink() {
|
|
|
34
40
|
if (clientEnv.isTRUEMONEY) return truemoneyGetCallAppLink.apply(void 0, args);
|
|
35
41
|
return notFound('getCallAppLink');
|
|
36
42
|
};
|
|
43
|
+
export var getCallAppLinkCreator = bySpecificClient((_a = {}, _a[CLIENT.ALIPAY] = alipayGetCallAppLink, _a[CLIENT.ALIPAYHK] = alipayhkGetCallAppLink, _a[CLIENT.DANA] = danaGetCallAppLink, _a[CLIENT.GCASH] = gcashGetCallAppLink, _a[CLIENT.MPAY] = mpayGetCallAppLink, _a[CLIENT.TNGD] = tngdGetCallAppLink, _a[CLIENT.TOSSPAY] = tossGetCallAppLink, _a[CLIENT.TRUEMONEY] = truemoneyGetCallAppLink, _a), function () {
|
|
44
|
+
return notFound('getCallAppLink');
|
|
45
|
+
});
|
|
37
46
|
export var getAppScanLink = function getAppScanLink() {
|
|
38
47
|
var args = [];
|
|
39
48
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -44,6 +53,9 @@ export var getAppScanLink = function getAppScanLink() {
|
|
|
44
53
|
if (clientEnv.isMPAY) return mpayGetAppScanLink.apply(void 0, args);
|
|
45
54
|
return notFound('getAppScanLink');
|
|
46
55
|
};
|
|
56
|
+
export var getAppScanLinkCreator = bySpecificClient((_b = {}, _b[CLIENT.ALIPAY] = alipayGetAppScanLink, _b[CLIENT.ALIPAYHK] = alipayhkGetAppScanLink, _b[CLIENT.MPAY] = mpayGetAppScanLink, _b), function () {
|
|
57
|
+
return notFound('getAppScanLink');
|
|
58
|
+
});
|
|
47
59
|
export var getGeneralAppInfo = function getGeneralAppInfo() {
|
|
48
60
|
if (clientEnv.isALIPAY) return alipayGetGeneralAppInfo();
|
|
49
61
|
if (clientEnv.isALIPAYHK) return alipayhkGetGeneralAppInfo();
|
|
@@ -54,4 +66,7 @@ export var getGeneralAppInfo = function getGeneralAppInfo() {
|
|
|
54
66
|
if (clientEnv.isTOSSPAY) return tossGetGeneralAppInfo();
|
|
55
67
|
if (clientEnv.isTRUEMONEY) return truemoneyGetGeneralAppInfo();
|
|
56
68
|
return notFound('getGeneralAppInfo');
|
|
57
|
-
};
|
|
69
|
+
};
|
|
70
|
+
export var getGeneralAppInfoCreator = bySpecificClient((_c = {}, _c[CLIENT.ALIPAY] = alipayGetGeneralAppInfo, _c[CLIENT.ALIPAYHK] = alipayhkGetGeneralAppInfo, _c[CLIENT.DANA] = danaGetGeneralAppInfo, _c[CLIENT.GCASH] = gcashGetGeneralAppInfo, _c[CLIENT.MPAY] = mpayGetGeneralAppInfo, _c[CLIENT.TNGD] = tngdGetGeneralAppInfo, _c[CLIENT.TOSSPAY] = tossGetGeneralAppInfo, _c[CLIENT.TRUEMONEY] = truemoneyGetGeneralAppInfo, _c), function () {
|
|
71
|
+
return notFound('getGeneralAppInfo');
|
|
72
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hylid/custom-jsapi",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.20",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@hylid/call": "^4.0.0-alpha.
|
|
13
|
-
"@hylid/env": "^4.0.0-alpha.
|
|
14
|
-
"@hylid/types": "^4.0.0-alpha.
|
|
12
|
+
"@hylid/call": "^4.0.0-alpha.20",
|
|
13
|
+
"@hylid/env": "^4.0.0-alpha.20",
|
|
14
|
+
"@hylid/types": "^4.0.0-alpha.20",
|
|
15
15
|
"qs-es5": "^6.8.4"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|