@hylid/custom-jsapi 3.3.0-alpha.13 → 3.3.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.
Files changed (37) hide show
  1. package/lib/bridge.d.ts +2 -0
  2. package/lib/bridge.js +23 -0
  3. package/lib/common/alipay/getCallAppLink.d.ts +2 -0
  4. package/lib/common/alipay/getCallAppLink.js +35 -0
  5. package/lib/common/alipay/index.d.ts +1 -0
  6. package/lib/common/alipay/index.js +1 -0
  7. package/lib/common/alipayhk/getCallAppLink.d.ts +2 -0
  8. package/lib/common/alipayhk/getCallAppLink.js +39 -0
  9. package/lib/common/alipayhk/index.d.ts +1 -0
  10. package/lib/common/alipayhk/index.js +1 -0
  11. package/lib/common/dana/getCallAppLink.d.ts +2 -0
  12. package/lib/common/dana/getCallAppLink.js +37 -0
  13. package/lib/common/dana/index.d.ts +1 -0
  14. package/lib/common/dana/index.js +1 -0
  15. package/lib/common/gcash/getCallAppLink.d.ts +2 -0
  16. package/lib/common/gcash/getCallAppLink.js +43 -0
  17. package/lib/common/gcash/index.d.ts +1 -0
  18. package/lib/common/gcash/index.js +1 -0
  19. package/lib/common/tngd/getCallAppLink.d.ts +2 -0
  20. package/lib/common/tngd/getCallAppLink.js +39 -0
  21. package/lib/common/tngd/index.d.ts +1 -0
  22. package/lib/common/tngd/index.js +1 -0
  23. package/lib/common/toss/getCallAppLink.d.ts +2 -0
  24. package/lib/common/toss/getCallAppLink.js +40 -0
  25. package/lib/common/toss/index.d.ts +1 -0
  26. package/lib/common/toss/index.js +1 -0
  27. package/lib/common/truemoney/getCallAppLink.d.ts +2 -0
  28. package/lib/common/truemoney/getCallAppLink.js +43 -0
  29. package/lib/common/truemoney/index.d.ts +1 -0
  30. package/lib/common/truemoney/index.js +1 -0
  31. package/lib/index.d.ts +1 -0
  32. package/lib/index.js +1 -0
  33. package/lib/utils/getCallAppPage.d.ts +2 -0
  34. package/lib/utils/getCallAppPage.js +20 -0
  35. package/lib/utils/index.d.ts +1 -0
  36. package/lib/utils/index.js +1 -0
  37. package/package.json +4 -4
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
package/lib/bridge.js ADDED
@@ -0,0 +1,23 @@
1
+ import { clientEnv } from '@hylid/env';
2
+ import { notFound } from '@hylid/call';
3
+ import { getCallAppLink as alipayGetCallAppLink } from "./common/alipay";
4
+ import { getCallAppLink as alipayhkGetCallAppLink } from "./common/alipayhk";
5
+ import { getCallAppLink as danaGetCallAppLink } from "./common/dana";
6
+ import { getCallAppLink as gcashGetCallAppLink } from "./common/gcash";
7
+ import { getCallAppLink as tngdGetCallAppLink } from "./common/tngd";
8
+ import { getCallAppLink as tossGetCallAppLink } from "./common/toss";
9
+ import { getCallAppLink as truemoneyGetCallAppLink } from "./common/truemoney";
10
+ export var getCallAppLink = function getCallAppLink() {
11
+ var args = [];
12
+ for (var _i = 0; _i < arguments.length; _i++) {
13
+ args[_i] = arguments[_i];
14
+ }
15
+ if (clientEnv.isALIPAY) return alipayGetCallAppLink.apply(void 0, args);
16
+ if (clientEnv.isALIPAYHK) return alipayhkGetCallAppLink.apply(void 0, args);
17
+ if (clientEnv.isDANA) return danaGetCallAppLink.apply(void 0, args);
18
+ if (clientEnv.isGCASH) return gcashGetCallAppLink.apply(void 0, args);
19
+ if (clientEnv.isTNGD) return tngdGetCallAppLink.apply(void 0, args);
20
+ if (clientEnv.isTOSSPAY) return tossGetCallAppLink.apply(void 0, args);
21
+ if (clientEnv.isTRUEMONEY) return truemoneyGetCallAppLink.apply(void 0, args);
22
+ return notFound('getCallAppLink');
23
+ };
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
@@ -0,0 +1,35 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ var __assign = this && this.__assign || function () {
3
+ __assign = Object.assign || function (t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { stringify } from 'qs-es5';
13
+ export var getCallAppLink = function getCallAppLink(opt) {
14
+ // 支付宝 h5 不支持 page, debugConfig
15
+ var _a = opt || {},
16
+ appId = _a.appId,
17
+ url = _a.url,
18
+ query = _a.query;
19
+ var params = {
20
+ appId: appId
21
+ };
22
+ if (url) {
23
+ if (_typeof(url) === 'object') {
24
+ // 支付宝 h5 key 值始终固定为 url
25
+ params.url = url.value;
26
+ } else {
27
+ params.url = url;
28
+ }
29
+ }
30
+ if (query) {
31
+ // 打平参数,来支持高级配置,参考文档:https://yuque.antfin.com/fish-pond/stdlib/vtmwsh#jKA1U
32
+ params = __assign(__assign({}, params), query);
33
+ }
34
+ return 'alipays://platformapi/startapp?' + stringify(params);
35
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppLink';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppLink";
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
@@ -0,0 +1,39 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import { stringify } from 'qs-es5';
12
+ import { getCallAppPage } from "../../utils";
13
+ export var getCallAppLink = function getCallAppLink(opt) {
14
+ var _a = opt || {},
15
+ appId = _a.appId,
16
+ query = _a.query,
17
+ debugConfig = _a.debugConfig;
18
+ var params = {
19
+ appId: appId,
20
+ // griver android 存在多次解码导致参数丢失,这里多进行一次编码,进行兼容处理
21
+ page: getCallAppPage(opt, true)
22
+ };
23
+ if (debugConfig === null || debugConfig === void 0 ? void 0 : debugConfig.version) {
24
+ var token = debugConfig.token,
25
+ version = debugConfig.version;
26
+ params = __assign(__assign({}, params), {
27
+ nbsource: 'debug',
28
+ nbsn: 'INSTALL',
29
+ nbsv: version,
30
+ token: token
31
+ });
32
+ }
33
+ if (query) {
34
+ params = __assign(__assign({}, params), {
35
+ query: stringify(query)
36
+ });
37
+ }
38
+ return 'alipayhk://platformapi/startapp?' + stringify(params);
39
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppLink';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppLink";
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
@@ -0,0 +1,37 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import { stringify } from 'qs-es5';
12
+ export var getCallAppLink = function getCallAppLink(opt) {
13
+ var _a = opt || {},
14
+ appId = _a.appId,
15
+ query = _a.query,
16
+ debugConfig = _a.debugConfig,
17
+ page = _a.page;
18
+ var destinationPath = encodeURIComponent(page);
19
+ var params = {};
20
+ if (debugConfig === null || debugConfig === void 0 ? void 0 : debugConfig.version) {
21
+ var token = debugConfig.token,
22
+ version = debugConfig.version;
23
+ params = __assign(__assign({}, params), {
24
+ nbsource: 'debug',
25
+ nbsn: 'INSTALL',
26
+ nbsv: version,
27
+ token: token
28
+ });
29
+ }
30
+ if (query) {
31
+ params = __assign(__assign({}, params), query);
32
+ }
33
+ var extendedInfo = {
34
+ query: stringify(params)
35
+ };
36
+ return "https://link.dana.id/miniprogram?params=[appId=".concat(appId, "]&destinationPath=").concat(destinationPath, "&extendedInfo=").concat(encodeURIComponent(JSON.stringify(extendedInfo)));
37
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppLink';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppLink";
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
@@ -0,0 +1,43 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import { stringify } from 'query-string';
12
+ import { getCallAppPage } from "../../utils";
13
+ export var getCallAppLink = function getCallAppLink(opt) {
14
+ var _a = opt || {},
15
+ appId = _a.appId,
16
+ query = _a.query,
17
+ debugConfig = _a.debugConfig;
18
+ var params = {
19
+ _ariver_appid: appId,
20
+ _ariver_path: getCallAppPage(opt)
21
+ };
22
+ if (debugConfig === null || debugConfig === void 0 ? void 0 : debugConfig.version) {
23
+ var token = debugConfig.token,
24
+ version = debugConfig.version;
25
+ params = __assign(__assign({}, params), {
26
+ _ariver_source: 'debug',
27
+ _ariver_scene: 'INSTALL',
28
+ _ariver_version: version,
29
+ _ariver_token: token
30
+ });
31
+ }
32
+ if (query) {
33
+ params = __assign(__assign({}, params), {
34
+ query: stringify(query)
35
+ });
36
+ }
37
+ var link = {
38
+ url: 'mini://platformapi/startapp?' + stringify(params, {
39
+ encode: false
40
+ })
41
+ };
42
+ return 'gcash://com.mynt.gcash/app/006300000200?' + stringify(link);
43
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppLink';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppLink";
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
@@ -0,0 +1,39 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import { stringify } from 'qs-es5';
12
+ import { getCallAppPage } from "../../utils";
13
+ export var getCallAppLink = function getCallAppLink(opt) {
14
+ var _a = opt || {},
15
+ appId = _a.appId,
16
+ query = _a.query,
17
+ debugConfig = _a.debugConfig;
18
+ var params = {
19
+ mpid: appId,
20
+ // griver android 存在多次解码导致参数丢失,这里多进行一次编码,进行兼容处理
21
+ path: getCallAppPage(opt, true)
22
+ };
23
+ if (debugConfig === null || debugConfig === void 0 ? void 0 : debugConfig.version) {
24
+ var token = debugConfig.token,
25
+ version = debugConfig.version;
26
+ params = __assign(__assign({}, params), {
27
+ _ariver_source: 'debug',
28
+ _ariver_scene: 'INSTALL',
29
+ _ariver_version: version,
30
+ _ariver_token: token
31
+ });
32
+ }
33
+ if (query) {
34
+ params = __assign(__assign({}, params), {
35
+ query: stringify(query)
36
+ });
37
+ }
38
+ return 'tngdwallet://client/dl/mp?' + stringify(params);
39
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppLink';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppLink";
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
@@ -0,0 +1,40 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import { stringify } from 'qs-es5';
12
+ import { getCallAppPage } from "../../utils";
13
+ export var getCallAppLink = function getCallAppLink(opt) {
14
+ var _a = opt || {},
15
+ appId = _a.appId,
16
+ query = _a.query,
17
+ debugConfig = _a.debugConfig;
18
+ var params = {
19
+ _ariver_appid: appId,
20
+ // griver android 存在多次解码导致参数丢失,这里多进行一次编码,进行兼容处理
21
+ _ariver_path: getCallAppPage(opt, true)
22
+ };
23
+ if (debugConfig === null || debugConfig === void 0 ? void 0 : debugConfig.version) {
24
+ var token = debugConfig.token,
25
+ version = debugConfig.version;
26
+ params = __assign(__assign({}, params), {
27
+ _ariver_source: 'debug',
28
+ _ariver_scene: 'INSTALL',
29
+ _ariver_version: version,
30
+ _ariver_token: token
31
+ });
32
+ }
33
+ if (query) {
34
+ params = __assign(__assign({}, params), {
35
+ query: stringify(query)
36
+ });
37
+ }
38
+ var link = 'mini://platformapi/startapp?' + stringify(params);
39
+ return 'supertoss://alipay/miniprogram/openUrl?url=' + encodeURIComponent(link);
40
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppLink';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppLink";
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppLink: HyCustomJSAPI['getCallAppLink'];
@@ -0,0 +1,43 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import { stringify } from 'qs-es5';
12
+ import { getCallAppPage } from "../../utils";
13
+ export var getCallAppLink = function getCallAppLink(opt) {
14
+ var _a = opt || {},
15
+ appId = _a.appId,
16
+ query = _a.query,
17
+ debugConfig = _a.debugConfig;
18
+ var methodParams = {
19
+ app_id: appId,
20
+ // griver android 存在多次解码导致参数丢失,这里多进行一次编码,进行兼容处理
21
+ page: getCallAppPage(opt, true)
22
+ };
23
+ if (debugConfig === null || debugConfig === void 0 ? void 0 : debugConfig.version) {
24
+ var token = debugConfig.token,
25
+ version = debugConfig.version;
26
+ methodParams = __assign(__assign({}, methodParams), {
27
+ _ariver_source: 'debug',
28
+ _ariver_scene: 'INSTALL',
29
+ _ariver_version: version,
30
+ _ariver_token: token
31
+ });
32
+ }
33
+ if (query) {
34
+ methodParams = __assign(__assign({}, methodParams), {
35
+ query: stringify(query)
36
+ });
37
+ }
38
+ var params = {
39
+ type: 'alipayreward',
40
+ method: JSON.stringify(methodParams)
41
+ };
42
+ return 'https://tmn.app.link/?deeplink=ascendmoney://wallet.truemoney.co.th/app/660000000029?' + encodeURIComponent(stringify(params));
43
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppLink';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppLink";
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './bridge';
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./bridge";
@@ -0,0 +1,2 @@
1
+ import { HyCustomJSAPI } from '@hylid/types';
2
+ export declare const getCallAppPage: (params: Parameters<HyCustomJSAPI['getCallAppLink']>[0], encodeUrl?: boolean) => string | undefined;
@@ -0,0 +1,20 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import { stringify } from 'qs-es5';
3
+ export var getCallAppPage = function getCallAppPage(params, encodeUrl) {
4
+ var _a;
5
+ var _b = params || {},
6
+ url = _b.url,
7
+ page = _b.page;
8
+ if (!url) {
9
+ return page;
10
+ }
11
+ var urlQuery = '';
12
+ if (_typeof(url) === 'object') {
13
+ urlQuery = stringify((_a = {}, _a[url.key] = encodeUrl ? encodeURIComponent(url.value) : url.value, _a));
14
+ } else {
15
+ urlQuery = stringify({
16
+ url: encodeUrl ? encodeURIComponent(url) : url
17
+ });
18
+ }
19
+ return page ? "".concat(page).concat(page.indexOf('?') === -1 ? '?' : '&').concat(urlQuery) : "/pages/index/index?".concat(urlQuery);
20
+ };
@@ -0,0 +1 @@
1
+ export * from './getCallAppPage';
@@ -0,0 +1 @@
1
+ export * from "./getCallAppPage";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hylid/custom-jsapi",
3
- "version": "3.3.0-alpha.13",
3
+ "version": "3.3.0-alpha.19",
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": "^3.3.0-alpha.13",
13
- "@hylid/env": "^3.3.0-alpha.13",
14
- "@hylid/types": "^3.3.0-alpha.13",
12
+ "@hylid/call": "^3.3.0-alpha.19",
13
+ "@hylid/env": "^3.3.0-alpha.19",
14
+ "@hylid/types": "^3.3.0-alpha.19",
15
15
  "qs-es5": "^6.8.4"
16
16
  },
17
17
  "license": "MIT",