@alipay/ams-checkout 1.3.1-dev → 1.3.1
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/umd/ams-checkout.min.js +1 -1
- package/package.json +1 -54
- package/dist/esm/config/index.d.ts +0 -22
- package/dist/esm/config/index.js +0 -69
- package/dist/esm/constant/index.d.ts +0 -135
- package/dist/esm/constant/index.js +0 -135
- package/dist/esm/core/component/index.d.ts +0 -17
- package/dist/esm/core/component/index.js +0 -127
- package/dist/esm/core/drop-in/index.d.ts +0 -29
- package/dist/esm/core/drop-in/index.js +0 -104
- package/dist/esm/core/instance/index.d.ts +0 -67
- package/dist/esm/core/instance/index.js +0 -276
- package/dist/esm/image/cta.svg +0 -9
- package/dist/esm/index.d.ts +0 -22
- package/dist/esm/plugin/component/cashierApp.d.ts +0 -24
- package/dist/esm/plugin/component/cashierApp.js +0 -140
- package/dist/esm/plugin/component/component.style.d.ts +0 -8
- package/dist/esm/plugin/component/component.style.js +0 -15
- package/dist/esm/plugin/component/index.d.ts +0 -101
- package/dist/esm/plugin/component/index.js +0 -875
- package/dist/esm/plugin/drop-in/index.d.ts +0 -73
- package/dist/esm/plugin/drop-in/index.js +0 -323
- package/dist/esm/request/index.d.ts +0 -15
- package/dist/esm/request/index.js +0 -145
- package/dist/esm/request/utils.d.ts +0 -28
- package/dist/esm/request/utils.js +0 -59
- package/dist/esm/service/index.d.ts +0 -2
- package/dist/esm/service/index.js +0 -40
- package/dist/esm/types/index.d.ts +0 -194
- package/dist/esm/types/index.js +0 -94
- package/dist/esm/util/createIframeNode.d.ts +0 -5
- package/dist/esm/util/createIframeNode.js +0 -35
- package/dist/esm/util/get.d.ts +0 -25
- package/dist/esm/util/get.js +0 -145
- package/dist/esm/util/index.d.ts +0 -53
- package/dist/esm/util/index.js +0 -235
- package/dist/esm/util/intl-callapp/es/browser.d.ts +0 -21
- package/dist/esm/util/intl-callapp/es/browser.js +0 -42
- package/dist/esm/util/intl-callapp/es/evoke.d.ts +0 -13
- package/dist/esm/util/intl-callapp/es/evoke.js +0 -39
- package/dist/esm/util/intl-callapp/es/generate.d.ts +0 -29
- package/dist/esm/util/intl-callapp/es/generate.js +0 -44
- package/dist/esm/util/intl-callapp/es/index.d.ts +0 -43
- package/dist/esm/util/intl-callapp/es/index.js +0 -298
- package/dist/esm/util/intl-callapp/es/main.d.ts +0 -41
- package/dist/esm/util/intl-callapp/es/main.js +0 -305
- package/dist/esm/util/intl-callapp/es/openWallet.d.ts +0 -15
- package/dist/esm/util/intl-callapp/es/openWallet.js +0 -197
- package/dist/esm/util/intl-callapp/es/types.d.ts +0 -46
- package/dist/esm/util/intl-callapp/es/types.js +0 -1
- package/dist/esm/util/intl-callapp/es/utils/config.d.ts +0 -24
- package/dist/esm/util/intl-callapp/es/utils/config.js +0 -57
- package/dist/esm/util/intl-callapp/es/utils/index.d.ts +0 -15
- package/dist/esm/util/intl-callapp/es/utils/index.js +0 -98
- package/dist/esm/util/mock.d.ts +0 -1
- package/dist/esm/util/mock.js +0 -4
- /package/{dist/esm → esm}/index.js +0 -0
@@ -1,197 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
-
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
5
|
-
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
6
|
-
*/
|
7
|
-
function _typeof(obj) {
|
8
|
-
'@babel/helpers - typeof';
|
9
|
-
|
10
|
-
return _typeof = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (obj) {
|
11
|
-
return typeof obj;
|
12
|
-
} : function (obj) {
|
13
|
-
return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
|
14
|
-
}, _typeof(obj);
|
15
|
-
}
|
16
|
-
function ownKeys(object, enumerableOnly) {
|
17
|
-
var keys = Object.keys(object);
|
18
|
-
if (Object.getOwnPropertySymbols) {
|
19
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
20
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
21
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
22
|
-
})), keys.push.apply(keys, symbols);
|
23
|
-
}
|
24
|
-
return keys;
|
25
|
-
}
|
26
|
-
function _objectSpread(target) {
|
27
|
-
for (var i = 1; i < arguments.length; i++) {
|
28
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
29
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
30
|
-
_defineProperty(target, key, source[key]);
|
31
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
32
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
33
|
-
});
|
34
|
-
}
|
35
|
-
return target;
|
36
|
-
}
|
37
|
-
function _defineProperty(obj, key, value) {
|
38
|
-
key = _toPropertyKey(key);
|
39
|
-
if (key in obj) {
|
40
|
-
Object.defineProperty(obj, key, {
|
41
|
-
value: value,
|
42
|
-
enumerable: true,
|
43
|
-
configurable: true,
|
44
|
-
writable: true
|
45
|
-
});
|
46
|
-
} else {
|
47
|
-
obj[key] = value;
|
48
|
-
}
|
49
|
-
return obj;
|
50
|
-
}
|
51
|
-
function _classCallCheck(instance, Constructor) {
|
52
|
-
if (!(instance instanceof Constructor)) {
|
53
|
-
throw new TypeError('Cannot call a class as a function');
|
54
|
-
}
|
55
|
-
}
|
56
|
-
function _defineProperties(target, props) {
|
57
|
-
for (var i = 0; i < props.length; i++) {
|
58
|
-
var descriptor = props[i];
|
59
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
60
|
-
descriptor.configurable = true;
|
61
|
-
if ('value' in descriptor) descriptor.writable = true;
|
62
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
63
|
-
}
|
64
|
-
}
|
65
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
66
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
67
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
68
|
-
Object.defineProperty(Constructor, 'prototype', {
|
69
|
-
writable: false
|
70
|
-
});
|
71
|
-
return Constructor;
|
72
|
-
}
|
73
|
-
function _toPropertyKey(arg) {
|
74
|
-
var key = _toPrimitive(arg, 'string');
|
75
|
-
return _typeof(key) === 'symbol' ? key : String(key);
|
76
|
-
}
|
77
|
-
function _toPrimitive(input, hint) {
|
78
|
-
if (_typeof(input) !== 'object' || input === null) return input;
|
79
|
-
var prim = input[Symbol.toPrimitive];
|
80
|
-
if (prim !== undefined) {
|
81
|
-
var res = prim.call(input, hint || 'default');
|
82
|
-
if (_typeof(res) !== 'object') return res;
|
83
|
-
throw new TypeError('@@toPrimitive must return a primitive value.');
|
84
|
-
}
|
85
|
-
return (hint === 'string' ? String : Number)(input);
|
86
|
-
}
|
87
|
-
function _inherits(subClass, superClass) {
|
88
|
-
if (typeof superClass !== 'function' && superClass !== null) {
|
89
|
-
throw new TypeError('Super expression must either be null or a function');
|
90
|
-
}
|
91
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
92
|
-
constructor: {
|
93
|
-
value: subClass,
|
94
|
-
writable: true,
|
95
|
-
configurable: true
|
96
|
-
}
|
97
|
-
});
|
98
|
-
Object.defineProperty(subClass, 'prototype', {
|
99
|
-
writable: false
|
100
|
-
});
|
101
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
102
|
-
}
|
103
|
-
function _setPrototypeOf(o, p) {
|
104
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
105
|
-
o.__proto__ = p;
|
106
|
-
return o;
|
107
|
-
};
|
108
|
-
return _setPrototypeOf(o, p);
|
109
|
-
}
|
110
|
-
function _createSuper(Derived) {
|
111
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
112
|
-
return function _createSuperInternal() {
|
113
|
-
var Super = _getPrototypeOf(Derived),
|
114
|
-
result;
|
115
|
-
if (hasNativeReflectConstruct) {
|
116
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
117
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
118
|
-
} else {
|
119
|
-
result = Super.apply(this, arguments);
|
120
|
-
}
|
121
|
-
return _possibleConstructorReturn(this, result);
|
122
|
-
};
|
123
|
-
}
|
124
|
-
function _possibleConstructorReturn(self, call) {
|
125
|
-
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
|
126
|
-
return call;
|
127
|
-
} else if (call !== void 0) {
|
128
|
-
throw new TypeError('Derived constructors may only return object or undefined');
|
129
|
-
}
|
130
|
-
return _assertThisInitialized(self);
|
131
|
-
}
|
132
|
-
function _assertThisInitialized(self) {
|
133
|
-
if (self === void 0) {
|
134
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
135
|
-
}
|
136
|
-
return self;
|
137
|
-
}
|
138
|
-
function _isNativeReflectConstruct() {
|
139
|
-
if (typeof Reflect === 'undefined' || !Reflect.construct) return false;
|
140
|
-
if (Reflect.construct.sham) return false;
|
141
|
-
if (typeof Proxy === 'function') return true;
|
142
|
-
try {
|
143
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
144
|
-
return true;
|
145
|
-
} catch (e) {
|
146
|
-
return false;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
function _getPrototypeOf(o) {
|
150
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
151
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
152
|
-
};
|
153
|
-
return _getPrototypeOf(o);
|
154
|
-
}
|
155
|
-
import * as Browser from "./browser";
|
156
|
-
import { evokeByLocation } from "./evoke";
|
157
|
-
import CallApp from "./main";
|
158
|
-
import { AndroidWalletPackageName, IOSWalletAppId } from "./utils/config";
|
159
|
-
var OpenWallet = /*#__PURE__*/function (_CallApp) {
|
160
|
-
_inherits(OpenWallet, _CallApp);
|
161
|
-
var _super = _createSuper(OpenWallet);
|
162
|
-
function OpenWallet(config) {
|
163
|
-
var _this;
|
164
|
-
_classCallCheck(this, OpenWallet);
|
165
|
-
_this = _super.call(this);
|
166
|
-
_this.config = _objectSpread({}, config);
|
167
|
-
return _this;
|
168
|
-
}
|
169
|
-
/**
|
170
|
-
* @param options
|
171
|
-
*/
|
172
|
-
_createClass(OpenWallet, [{
|
173
|
-
key: 'openWallet',
|
174
|
-
value: function openWallet(options) {
|
175
|
-
var _options$intent;
|
176
|
-
this.open(_objectSpread(_objectSpread({}, options), {}, {
|
177
|
-
intent: {
|
178
|
-
package: AndroidWalletPackageName[options.walletName],
|
179
|
-
scheme: options.scheme || ((_options$intent = options.intent) === null || _options$intent === void 0 ? void 0 : _options$intent.scheme) || ''
|
180
|
-
}
|
181
|
-
}));
|
182
|
-
}
|
183
|
-
/**
|
184
|
-
* @param options
|
185
|
-
*/
|
186
|
-
}, {
|
187
|
-
key: 'openAppStore',
|
188
|
-
value: function openAppStore(walletName) {
|
189
|
-
var IOSAppStoreLink = 'itms-apps://itunes.apple.com/app/'.concat(IOSWalletAppId[walletName]);
|
190
|
-
var AndroidAppStoreLink = 'market://details?id='.concat(AndroidWalletPackageName[walletName]);
|
191
|
-
var link = Browser.isIOS ? IOSAppStoreLink : AndroidAppStoreLink;
|
192
|
-
evokeByLocation(link);
|
193
|
-
}
|
194
|
-
}]);
|
195
|
-
return OpenWallet;
|
196
|
-
}(CallApp);
|
197
|
-
export default OpenWallet;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
export interface EvokeAppBy {
|
2
|
-
url: string;
|
3
|
-
type: 'Scheme' | 'Link' | 'Intent';
|
4
|
-
}
|
5
|
-
export type SuccessCb = (evokeAppBy?: EvokeAppBy) => void;
|
6
|
-
export interface CallappConfig {
|
7
|
-
fallback?: () => void;
|
8
|
-
delay?: number;
|
9
|
-
fallbackUrl?: string;
|
10
|
-
successCb?: SuccessCb;
|
11
|
-
resultJudgmentTime?: number;
|
12
|
-
}
|
13
|
-
export interface CallappOptions
|
14
|
-
extends Omit<CallappConfig, 'successCb' | 'resultJudgmentTime'> {
|
15
|
-
scheme?: string;
|
16
|
-
intent?: {
|
17
|
-
package?: string;
|
18
|
-
scheme: string;
|
19
|
-
fallbackUrl?: string;
|
20
|
-
};
|
21
|
-
link?: string;
|
22
|
-
params?: Record<string, any>;
|
23
|
-
}
|
24
|
-
export type Hidden =
|
25
|
-
| 'hidden'
|
26
|
-
| 'webkitHidden'
|
27
|
-
| 'msHidden'
|
28
|
-
| 'mozHidden'
|
29
|
-
| undefined;
|
30
|
-
export type VisibilityChange =
|
31
|
-
| 'visibilitychange'
|
32
|
-
| 'webkitvisibilitychange'
|
33
|
-
| 'msvisibilitychange'
|
34
|
-
| 'mozvisibilitychange'
|
35
|
-
| undefined;
|
36
|
-
export interface EvokeAppResultOptions {
|
37
|
-
evokeAppBy: EvokeAppBy;
|
38
|
-
successCb?: SuccessCb;
|
39
|
-
timeout?: number;
|
40
|
-
}
|
41
|
-
export interface OpenWalletConfig extends CallappConfig {
|
42
|
-
walletName: string;
|
43
|
-
}
|
44
|
-
export interface OpenWalletOptions extends CallappOptions {
|
45
|
-
walletName: string;
|
46
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,24 +0,0 @@
|
|
1
|
-
export declare enum WalletType {
|
2
|
-
TnGD = 'TNG',
|
3
|
-
KKP = 'KAKAOPAY',
|
4
|
-
TMN = 'TRUEMONEY',
|
5
|
-
DANA = 'DANA',
|
6
|
-
GCash = 'GCASH',
|
7
|
-
AlipayHK = 'ALIPAY_HK',
|
8
|
-
}
|
9
|
-
export declare const AndroidWalletPackageName: {
|
10
|
-
TNG: string;
|
11
|
-
KAKAOPAY: string;
|
12
|
-
TRUEMONEY: string;
|
13
|
-
DANA: string;
|
14
|
-
GCASH: string;
|
15
|
-
ALIPAY_HK: string;
|
16
|
-
};
|
17
|
-
export declare const IOSWalletAppId: {
|
18
|
-
TNG: string;
|
19
|
-
KAKAOPAY: string;
|
20
|
-
TRUEMONEY: string;
|
21
|
-
DANA: string;
|
22
|
-
GCASH: string;
|
23
|
-
ALIPAY_HK: string;
|
24
|
-
};
|
@@ -1,57 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
-
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
5
|
-
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
6
|
-
*/
|
7
|
-
var _AndroidWalletPackage, _IOSWalletAppId;
|
8
|
-
function _typeof(obj) {
|
9
|
-
'@babel/helpers - typeof';
|
10
|
-
|
11
|
-
return _typeof = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (obj) {
|
12
|
-
return typeof obj;
|
13
|
-
} : function (obj) {
|
14
|
-
return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
|
15
|
-
}, _typeof(obj);
|
16
|
-
}
|
17
|
-
function _defineProperty(obj, key, value) {
|
18
|
-
key = _toPropertyKey(key);
|
19
|
-
if (key in obj) {
|
20
|
-
Object.defineProperty(obj, key, {
|
21
|
-
value: value,
|
22
|
-
enumerable: true,
|
23
|
-
configurable: true,
|
24
|
-
writable: true
|
25
|
-
});
|
26
|
-
} else {
|
27
|
-
obj[key] = value;
|
28
|
-
}
|
29
|
-
return obj;
|
30
|
-
}
|
31
|
-
function _toPropertyKey(arg) {
|
32
|
-
var key = _toPrimitive(arg, 'string');
|
33
|
-
return _typeof(key) === 'symbol' ? key : String(key);
|
34
|
-
}
|
35
|
-
function _toPrimitive(input, hint) {
|
36
|
-
if (_typeof(input) !== 'object' || input === null) return input;
|
37
|
-
var prim = input[Symbol.toPrimitive];
|
38
|
-
if (prim !== undefined) {
|
39
|
-
var res = prim.call(input, hint || 'default');
|
40
|
-
if (_typeof(res) !== 'object') return res;
|
41
|
-
throw new TypeError('@@toPrimitive must return a primitive value.');
|
42
|
-
}
|
43
|
-
return (hint === 'string' ? String : Number)(input);
|
44
|
-
}
|
45
|
-
export var WalletType;
|
46
|
-
(function (WalletType) {
|
47
|
-
WalletType['TnGD'] = 'TNG';
|
48
|
-
WalletType['KKP'] = 'KAKAOPAY';
|
49
|
-
WalletType['TMN'] = 'TRUEMONEY';
|
50
|
-
WalletType['DANA'] = 'DANA';
|
51
|
-
WalletType['GCash'] = 'GCASH';
|
52
|
-
WalletType['AlipayHK'] = 'ALIPAY_HK';
|
53
|
-
})(WalletType || (WalletType = {}));
|
54
|
-
// Android
|
55
|
-
export var AndroidWalletPackageName = (_AndroidWalletPackage = {}, _defineProperty(_AndroidWalletPackage, WalletType.TnGD, 'my.com.tngdigital.ewallet'), _defineProperty(_AndroidWalletPackage, WalletType.KKP, 'com.kakaopay.app'), _defineProperty(_AndroidWalletPackage, WalletType.TMN, 'th.co.truemoney.wallet'), _defineProperty(_AndroidWalletPackage, WalletType.DANA, 'id.dana'), _defineProperty(_AndroidWalletPackage, WalletType.GCash, 'com.globe.gcash.android'), _defineProperty(_AndroidWalletPackage, WalletType.AlipayHK, 'hk.alipay.wallet'), _AndroidWalletPackage);
|
56
|
-
// IOS
|
57
|
-
export var IOSWalletAppId = (_IOSWalletAppId = {}, _defineProperty(_IOSWalletAppId, WalletType.TnGD, 'id1344696702'), _defineProperty(_IOSWalletAppId, WalletType.KKP, 'id1464496236'), _defineProperty(_IOSWalletAppId, WalletType.TMN, 'id1345776130'), _defineProperty(_IOSWalletAppId, WalletType.DANA, 'id1437123008'), _defineProperty(_IOSWalletAppId, WalletType.GCash, 'id520020791'), _defineProperty(_IOSWalletAppId, WalletType.AlipayHK, 'id1210638245'), _IOSWalletAppId);
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { EvokeAppResultOptions } from '../types';
|
2
|
-
export declare function checkCallAppSuccess(
|
3
|
-
fallback?: () => void,
|
4
|
-
timeout?: number,
|
5
|
-
): void;
|
6
|
-
/**
|
7
|
-
* Listening page
|
8
|
-
*/
|
9
|
-
export declare function addEventListener(options: EvokeAppResultOptions): void;
|
10
|
-
/**
|
11
|
-
* Determine whether the URL is an http or application market link
|
12
|
-
* @param {[type]} url
|
13
|
-
* @return {Boolean} [description]
|
14
|
-
*/
|
15
|
-
export declare function checkIsHttpUrl(url: string): boolean;
|
@@ -1,98 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
-
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
5
|
-
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
6
|
-
*/
|
7
|
-
var hidden;
|
8
|
-
var visibilityChange;
|
9
|
-
var DEFAULT_TIMEOUT = 5000;
|
10
|
-
var timeStamp;
|
11
|
-
/**
|
12
|
-
* @returns
|
13
|
-
*/
|
14
|
-
function getSupportedProperty(document) {
|
15
|
-
if (typeof document === 'undefined') return;
|
16
|
-
if (typeof document.hidden !== 'undefined') {
|
17
|
-
hidden = 'hidden';
|
18
|
-
visibilityChange = 'visibilitychange';
|
19
|
-
} else if (typeof document.mozHidden !== 'undefined') {
|
20
|
-
hidden = 'mozHidden';
|
21
|
-
visibilityChange = 'mozvisibilitychange';
|
22
|
-
} else if (typeof document.msHidden !== 'undefined') {
|
23
|
-
hidden = 'msHidden';
|
24
|
-
visibilityChange = 'msvisibilitychange';
|
25
|
-
} else if (typeof document.webkitHidden !== 'undefined') {
|
26
|
-
hidden = 'webkitHidden';
|
27
|
-
visibilityChange = 'webkitvisibilitychange';
|
28
|
-
}
|
29
|
-
}
|
30
|
-
getSupportedProperty(document);
|
31
|
-
/**
|
32
|
-
* @returns
|
33
|
-
*/
|
34
|
-
function isPageHidden() {
|
35
|
-
if (!hidden) return false;
|
36
|
-
return document[hidden];
|
37
|
-
}
|
38
|
-
/**
|
39
|
-
* @param fallback
|
40
|
-
* @param timeout
|
41
|
-
*/
|
42
|
-
var timer;
|
43
|
-
export function checkCallAppSuccess(fallback, timeout) {
|
44
|
-
timeStamp = +new Date();
|
45
|
-
timer = setTimeout(function () {
|
46
|
-
var pageHidden = isPageHidden();
|
47
|
-
if (!pageHidden && fallback) {
|
48
|
-
fallback();
|
49
|
-
}
|
50
|
-
}, timeout || DEFAULT_TIMEOUT);
|
51
|
-
}
|
52
|
-
export function addEventListener(options) {
|
53
|
-
if (typeof visibilityChange !== 'undefined') {
|
54
|
-
document.addEventListener(visibilityChange, function () {
|
55
|
-
return handlePageHidden(options);
|
56
|
-
});
|
57
|
-
} else {
|
58
|
-
window.addEventListener('pagehide', function () {
|
59
|
-
return handlePageHidden(options);
|
60
|
-
});
|
61
|
-
}
|
62
|
-
}
|
63
|
-
function handlePageHidden(options) {
|
64
|
-
var evokeAppBy = options.evokeAppBy;
|
65
|
-
if (evokeAppBy === null || evokeAppBy === void 0 ? void 0 : evokeAppBy.url) {
|
66
|
-
handleSuccessCb(options);
|
67
|
-
clearTimer();
|
68
|
-
}
|
69
|
-
}
|
70
|
-
/**
|
71
|
-
* @param successCb
|
72
|
-
*/
|
73
|
-
function handleSuccessCb(_ref) {
|
74
|
-
var evokeAppBy = _ref.evokeAppBy,
|
75
|
-
successCb = _ref.successCb,
|
76
|
-
timeout = _ref.timeout;
|
77
|
-
if (successCb) {
|
78
|
-
// hack
|
79
|
-
var newTimeStamp = +new Date();
|
80
|
-
var newTimeout = timeout || DEFAULT_TIMEOUT;
|
81
|
-
var preTimeStamp = timeStamp || +new Date();
|
82
|
-
if (newTimeStamp - preTimeStamp < newTimeout) {
|
83
|
-
successCb(evokeAppBy);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
87
|
-
function clearTimer() {
|
88
|
-
if (timer) {
|
89
|
-
clearTimeout(timer);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
/**
|
93
|
-
* @param {[type]} url
|
94
|
-
* @return {Boolean} [description]
|
95
|
-
*/
|
96
|
-
export function checkIsHttpUrl(url) {
|
97
|
-
return /^(http|https|itms-apps|itms-appss|market):\/\//.test(url);
|
98
|
-
}
|
package/dist/esm/util/mock.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isLocalMock: () => boolean;
|
package/dist/esm/util/mock.js
DELETED
@@ -1,4 +0,0 @@
|
|
1
|
-
export var isLocalMock = function isLocalMock() {
|
2
|
-
var _window, _window$process, _window$process$env;
|
3
|
-
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$process = _window.process) === null || _window$process === void 0 ? void 0 : (_window$process$env = _window$process.env) === null || _window$process$env === void 0 ? void 0 : _window$process$env.NODE_ENV) === 'MOCK' && window.location.href.indexOf('LOCAL_MOCK=1') > -1;
|
4
|
-
};
|
File without changes
|