@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.
Files changed (57) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/package.json +1 -54
  3. package/dist/esm/config/index.d.ts +0 -22
  4. package/dist/esm/config/index.js +0 -69
  5. package/dist/esm/constant/index.d.ts +0 -135
  6. package/dist/esm/constant/index.js +0 -135
  7. package/dist/esm/core/component/index.d.ts +0 -17
  8. package/dist/esm/core/component/index.js +0 -127
  9. package/dist/esm/core/drop-in/index.d.ts +0 -29
  10. package/dist/esm/core/drop-in/index.js +0 -104
  11. package/dist/esm/core/instance/index.d.ts +0 -67
  12. package/dist/esm/core/instance/index.js +0 -276
  13. package/dist/esm/image/cta.svg +0 -9
  14. package/dist/esm/index.d.ts +0 -22
  15. package/dist/esm/plugin/component/cashierApp.d.ts +0 -24
  16. package/dist/esm/plugin/component/cashierApp.js +0 -140
  17. package/dist/esm/plugin/component/component.style.d.ts +0 -8
  18. package/dist/esm/plugin/component/component.style.js +0 -15
  19. package/dist/esm/plugin/component/index.d.ts +0 -101
  20. package/dist/esm/plugin/component/index.js +0 -875
  21. package/dist/esm/plugin/drop-in/index.d.ts +0 -73
  22. package/dist/esm/plugin/drop-in/index.js +0 -323
  23. package/dist/esm/request/index.d.ts +0 -15
  24. package/dist/esm/request/index.js +0 -145
  25. package/dist/esm/request/utils.d.ts +0 -28
  26. package/dist/esm/request/utils.js +0 -59
  27. package/dist/esm/service/index.d.ts +0 -2
  28. package/dist/esm/service/index.js +0 -40
  29. package/dist/esm/types/index.d.ts +0 -194
  30. package/dist/esm/types/index.js +0 -94
  31. package/dist/esm/util/createIframeNode.d.ts +0 -5
  32. package/dist/esm/util/createIframeNode.js +0 -35
  33. package/dist/esm/util/get.d.ts +0 -25
  34. package/dist/esm/util/get.js +0 -145
  35. package/dist/esm/util/index.d.ts +0 -53
  36. package/dist/esm/util/index.js +0 -235
  37. package/dist/esm/util/intl-callapp/es/browser.d.ts +0 -21
  38. package/dist/esm/util/intl-callapp/es/browser.js +0 -42
  39. package/dist/esm/util/intl-callapp/es/evoke.d.ts +0 -13
  40. package/dist/esm/util/intl-callapp/es/evoke.js +0 -39
  41. package/dist/esm/util/intl-callapp/es/generate.d.ts +0 -29
  42. package/dist/esm/util/intl-callapp/es/generate.js +0 -44
  43. package/dist/esm/util/intl-callapp/es/index.d.ts +0 -43
  44. package/dist/esm/util/intl-callapp/es/index.js +0 -298
  45. package/dist/esm/util/intl-callapp/es/main.d.ts +0 -41
  46. package/dist/esm/util/intl-callapp/es/main.js +0 -305
  47. package/dist/esm/util/intl-callapp/es/openWallet.d.ts +0 -15
  48. package/dist/esm/util/intl-callapp/es/openWallet.js +0 -197
  49. package/dist/esm/util/intl-callapp/es/types.d.ts +0 -46
  50. package/dist/esm/util/intl-callapp/es/types.js +0 -1
  51. package/dist/esm/util/intl-callapp/es/utils/config.d.ts +0 -24
  52. package/dist/esm/util/intl-callapp/es/utils/config.js +0 -57
  53. package/dist/esm/util/intl-callapp/es/utils/index.d.ts +0 -15
  54. package/dist/esm/util/intl-callapp/es/utils/index.js +0 -98
  55. package/dist/esm/util/mock.d.ts +0 -1
  56. package/dist/esm/util/mock.js +0 -4
  57. /package/{dist/esm → esm}/index.js +0 -0
@@ -1,298 +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
- import * as Browser from "./browser";
88
- import { buildIFrame, evokeByIFrame, evokeByLocation, evokeByTagA } from "./evoke";
89
- import { generateIntent, generateLink } from "./generate";
90
- import { addEventListener, checkCallAppSuccess, checkIsHttpUrl } from "./utils/index";
91
- var EvokeAppType;
92
- (function (EvokeAppType) {
93
- EvokeAppType['SCHEME'] = 'Scheme';
94
- EvokeAppType['LINK'] = 'Link';
95
- EvokeAppType['INTENT'] = 'Intent';
96
- })(EvokeAppType || (EvokeAppType = {}));
97
- var CallApp = /*#__PURE__*/function () {
98
- function CallApp(config) {
99
- _classCallCheck(this, CallApp);
100
- this.config = void 0;
101
- this.timer = void 0;
102
- this.options = void 0;
103
- this.evokeAppBy = void 0;
104
- var defaultConfig = {
105
- delay: 0
106
- };
107
- this.config = _objectSpread(_objectSpread({}, defaultConfig), config);
108
- this.options = {};
109
- this.timer = null;
110
- this.evokeAppBy = {
111
- url: '',
112
- type: EvokeAppType.LINK
113
- };
114
- this.init();
115
- }
116
- _createClass(CallApp, [{
117
- key: 'init',
118
- value: function init() {
119
- buildIFrame();
120
- addEventListener({
121
- evokeAppBy: this.evokeAppBy,
122
- successCb: this.config.successCb,
123
- timeout: this.config.resultJudgmentTime
124
- });
125
- }
126
- /**
127
- * @param options
128
- */
129
- }, {
130
- key: 'open',
131
- value: function open(options) {
132
- this.options = options;
133
- var _this$options = this.options,
134
- scheme = _this$options.scheme,
135
- intent = _this$options.intent,
136
- link = _this$options.link,
137
- params = _this$options.params,
138
- fallback = _this$options.fallback;
139
- if (!scheme && !link && !intent) {
140
- console.error('请至少填一个链接');
141
- return;
142
- }
143
- if (link && checkIsHttpUrl(link)) {
144
- this.options.link = generateLink(link, params);
145
- this.handleLink();
146
- } else if (scheme && !checkIsHttpUrl(scheme)) {
147
- this.options.scheme = generateLink(scheme, params);
148
- this.handleScheme();
149
- } else if (intent && intent.scheme && intent.package) {
150
- this.handleIntent();
151
- } else if (fallback) {
152
- fallback();
153
- } else {
154
- console.error('唤端失败');
155
- }
156
- }
157
- }, {
158
- key: 'handleLink',
159
- value: function handleLink() {
160
- this.evokeAppBy.type = EvokeAppType.LINK;
161
- var _this$options2 = this.options,
162
- link = _this$options2.link,
163
- scheme = _this$options2.scheme,
164
- delay = _this$options2.delay,
165
- fallback = _this$options2.fallback;
166
- if (Browser.isIOS) {
167
- if (Browser.getIOSVersion() > 9) {
168
- this.evokeByLocationDelay(link, delay, fallback, this.handleScheme);
169
- } else if (scheme) {
170
- this.handleScheme();
171
- } else if (fallback) {
172
- fallback();
173
- } else {
174
- console.error('唤端失败');
175
- }
176
- } else {
177
- this.evokeByLocationDelay(link, delay, fallback, this.handleScheme);
178
- }
179
- }
180
- }, {
181
- key: 'handleIntent',
182
- value: function handleIntent() {
183
- this.evokeAppBy.type = EvokeAppType.INTENT;
184
- var _this$options3 = this.options,
185
- intent = _this$options3.intent,
186
- delay = _this$options3.delay,
187
- fallback = _this$options3.fallback;
188
- if (intent && intent.scheme && intent.package) {
189
- this.evokeByLocationDelay(generateIntent(intent.scheme, intent.package, intent.fallbackUrl), delay, fallback);
190
- }
191
- }
192
- }, {
193
- key: 'handleScheme',
194
- value: function handleScheme() {
195
- this.evokeAppBy.type = EvokeAppType.SCHEME;
196
- var _this$options4 = this.options,
197
- scheme = _this$options4.scheme,
198
- delay = _this$options4.delay,
199
- fallback = _this$options4.fallback;
200
- if (scheme) {
201
- if (Browser.isIOS) {
202
- this.handleIOSScheme();
203
- } else if (Browser.isOriginalChrome || Browser.isFirefox) {
204
- this.handleOriginalChrome();
205
- } else {
206
- this.evokeByIFrameDelay(scheme, delay, fallback);
207
- }
208
- }
209
- }
210
- }, {
211
- key: 'handleIOSScheme',
212
- value: function handleIOSScheme() {
213
- var _this$options5 = this.options,
214
- scheme = _this$options5.scheme,
215
- delay = _this$options5.delay,
216
- fallback = _this$options5.fallback;
217
- if (Browser.getIOSVersion() < 9) {
218
- this.evokeByIFrameDelay(scheme, delay, fallback);
219
- } else {
220
- this.evokeByTagADelay(scheme, delay, fallback);
221
- }
222
- }
223
- }, {
224
- key: 'handleOriginalChrome',
225
- value: function handleOriginalChrome() {
226
- var _this = this;
227
- var _this$options6 = this.options,
228
- scheme = _this$options6.scheme,
229
- intent = _this$options6.intent,
230
- delay = _this$options6.delay,
231
- fallback = _this$options6.fallback;
232
- var degradationStrategyFn = function degradationStrategyFn() {
233
- if (intent && intent.package) {
234
- _this.evokeByLocationDelay(generateIntent(scheme, intent.package, intent.fallbackUrl), delay, fallback, _this.handleIntent.bind(_this));
235
- }
236
- };
237
- this.evokeByLocationDelay(scheme, delay, fallback, degradationStrategyFn);
238
- }
239
- /**
240
- * @param evokeFn
241
- * @param delay
242
- * @param fallback
243
- * @param degradationStrategy
244
- */
245
- }, {
246
- key: 'evokeAppDelay',
247
- value: function evokeAppDelay(evokeFn, evokeAppByUrl, delay, fallback, degradationStrategy) {
248
- var _this2 = this;
249
- var newDelay = delay || this.config.delay;
250
- var newFallback = fallback || this.config.fallback;
251
- this.timer = setTimeout(function () {
252
- _this2.clearTimer();
253
- evokeFn();
254
- _this2.checkIsOpen(evokeAppByUrl, newFallback, degradationStrategy);
255
- }, newDelay);
256
- }
257
- }, {
258
- key: 'evokeByLocationDelay',
259
- value: function evokeByLocationDelay(url, delay, fallback, degradationStrategy) {
260
- this.evokeAppDelay(function () {
261
- return evokeByLocation(url);
262
- }, url, delay, fallback, degradationStrategy);
263
- }
264
- }, {
265
- key: 'evokeByTagADelay',
266
- value: function evokeByTagADelay(url, delay, fallback, degradationStrategy) {
267
- this.evokeAppDelay(function () {
268
- return evokeByTagA(url);
269
- }, url, delay, fallback, degradationStrategy);
270
- }
271
- }, {
272
- key: 'evokeByIFrameDelay',
273
- value: function evokeByIFrameDelay(url, delay, fallback, degradationStrategy) {
274
- this.evokeAppDelay(function () {
275
- return evokeByIFrame(url);
276
- }, url, delay, fallback, degradationStrategy);
277
- }
278
- /**
279
- * @param fallback
280
- * @returns
281
- */
282
- }, {
283
- key: 'checkIsOpen',
284
- value: function checkIsOpen(evokeAppByUrl, fallback, degradationStrategy) {
285
- this.evokeAppBy.url = evokeAppByUrl;
286
- return checkCallAppSuccess(degradationStrategy || fallback, this.config.resultJudgmentTime);
287
- }
288
- }, {
289
- key: 'clearTimer',
290
- value: function clearTimer() {
291
- if (this.timer) {
292
- clearTimeout(this.timer);
293
- }
294
- }
295
- }]);
296
- return CallApp;
297
- }();
298
- export default CallApp;
@@ -1,41 +0,0 @@
1
- /// <reference types="node" />
2
- import type { CallappConfig, CallappOptions, EvokeAppBy } from './types';
3
- declare class CallApp {
4
- config: CallappConfig;
5
- timer: NodeJS.Timeout | null;
6
- options: CallappOptions;
7
- evokeAppBy: EvokeAppBy;
8
- constructor(config?: CallappConfig);
9
- private init;
10
- /**
11
- * @param options
12
- */
13
- open(options: CallappOptions): void;
14
- private handleDegradationStrategy;
15
-
16
- private evokeLink;
17
-
18
- private evokeScheme;
19
-
20
- private handleIntent;
21
-
22
- private handleOriginalChrome;
23
- /**
24
- * @param evokeFn
25
- * @param delay
26
- * @param fallback
27
- * @param degradationStrategy
28
- */
29
- private evokeAppDelay;
30
- private evokeByLocationDelay;
31
- private evokeByTagADelay;
32
- private evokeByIFrameDelay;
33
- /**
34
- * @param fallback
35
- * @returns
36
- */
37
- private checkIsOpen;
38
-
39
- private clearTimer;
40
- }
41
- export default CallApp;
@@ -1,305 +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
- import * as Browser from "./browser";
88
- import { buildIFrame, evokeByIFrame, evokeByLocation, evokeByTagA } from "./evoke";
89
- import { generateIntent, generateLink } from "./generate";
90
- import { addEventListener, checkCallAppSuccess, checkIsHttpUrl } from "./utils/index";
91
- var EvokeAppType;
92
- (function (EvokeAppType) {
93
- EvokeAppType['SCHEME'] = 'Scheme';
94
- EvokeAppType['LINK'] = 'Link';
95
- EvokeAppType['INTENT'] = 'Intent';
96
- })(EvokeAppType || (EvokeAppType = {}));
97
- var CallApp = /*#__PURE__*/function () {
98
- function CallApp(config) {
99
- var _this = this;
100
- _classCallCheck(this, CallApp);
101
- this.config = void 0;
102
- this.timer = void 0;
103
- this.options = void 0;
104
- this.evokeAppBy = void 0;
105
- this.handleDegradationStrategy = function () {
106
- var _this$options = _this.options,
107
- scheme = _this$options.scheme,
108
- link = _this$options.link,
109
- intent = _this$options.intent,
110
- params = _this$options.params;
111
- if (link && scheme) {
112
- _this.options.link = generateLink(link, params);
113
- _this.options.scheme = generateLink(scheme, params);
114
- if (Browser.isIOS && Browser.getIOSVersion() > 9) {
115
- _this.evokeLink();
116
- } else {
117
- _this.evokeScheme(_this.evokeLink.bind(_this));
118
- }
119
- } else {
120
- if (link) {
121
- _this.options.link = generateLink(link, params);
122
- _this.evokeLink();
123
- } else if (scheme) {
124
- _this.options.scheme = generateLink(scheme, params);
125
- _this.evokeScheme();
126
- } else if (intent && intent.scheme && intent.package) {
127
- _this.handleIntent();
128
- }
129
- }
130
- };
131
- var defaultConfig = {
132
- delay: 0
133
- };
134
- this.config = _objectSpread(_objectSpread({}, defaultConfig), config);
135
- this.options = {};
136
- this.timer = null;
137
- this.evokeAppBy = {
138
- url: '',
139
- type: EvokeAppType.LINK
140
- };
141
- this.init();
142
- }
143
- _createClass(CallApp, [{
144
- key: 'init',
145
- value: function init() {
146
- buildIFrame();
147
- addEventListener({
148
- evokeAppBy: this.evokeAppBy,
149
- successCb: this.config.successCb,
150
- timeout: this.config.resultJudgmentTime
151
- });
152
- }
153
- /**
154
- * @param options
155
- */
156
- }, {
157
- key: 'open',
158
- value: function open(options) {
159
- this.options = options;
160
- var _this$options2 = this.options,
161
- scheme = _this$options2.scheme,
162
- intent = _this$options2.intent,
163
- link = _this$options2.link;
164
- if (!scheme && !link && !(intent === null || intent === void 0 ? void 0 : intent.scheme)) {
165
- throw new Error('请至少填一个链接');
166
- }
167
- /**
168
- * scheme不为(http|https|itms-apps|itms-appss|market)
169
- */
170
- if (scheme && checkIsHttpUrl(scheme)) {
171
- throw new Error('请填写正确格式的scheme');
172
- }
173
- /**
174
- * link为(http|https|itms-apps|itms-appss|market)
175
- */
176
- if (link && !checkIsHttpUrl(link)) {
177
- throw new Error('请填写正确格式的link');
178
- }
179
- if (intent && intent.scheme && checkIsHttpUrl(intent.scheme)) {
180
- throw new Error('请填写正确格式的intent');
181
- }
182
- this.handleDegradationStrategy();
183
- }
184
- }, {
185
- key: 'evokeLink',
186
- value: function evokeLink() {
187
- this.evokeAppBy.type = EvokeAppType.LINK;
188
- var _this$options3 = this.options,
189
- link = _this$options3.link,
190
- delay = _this$options3.delay;
191
- this.evokeByLocationDelay(link, delay);
192
- }
193
- }, {
194
- key: 'evokeScheme',
195
- value: function evokeScheme(degradationStrategy) {
196
- this.evokeAppBy.type = EvokeAppType.SCHEME;
197
- var _this$options4 = this.options,
198
- scheme = _this$options4.scheme,
199
- delay = _this$options4.delay,
200
- fallback = _this$options4.fallback;
201
- if (Browser.isIOS) {
202
- if (Browser.getIOSVersion() > 9) {
203
- this.evokeByTagADelay(scheme, delay, fallback, degradationStrategy);
204
- } else {
205
- if (Browser.isQQBrowser) {
206
- this.evokeByTagADelay(scheme, delay, fallback, degradationStrategy);
207
- } else {
208
- this.evokeByIFrameDelay(scheme, delay, fallback, degradationStrategy);
209
- }
210
- }
211
- } else {
212
- if (Browser.isOriginalChrome || Browser.isFirefox) {
213
- this.handleOriginalChrome();
214
- } else {
215
- this.evokeByIFrameDelay(scheme, delay, fallback, degradationStrategy);
216
- }
217
- }
218
- }
219
- }, {
220
- key: 'handleIntent',
221
- value: function handleIntent() {
222
- var _this2 = this;
223
- var _this$options5 = this.options,
224
- scheme = _this$options5.scheme,
225
- intent = _this$options5.intent,
226
- delay = _this$options5.delay,
227
- link = _this$options5.link,
228
- fallback = _this$options5.fallback;
229
- var tempScheme = (intent === null || intent === void 0 ? void 0 : intent.scheme) || scheme;
230
- if (tempScheme && !checkIsHttpUrl(tempScheme)) {
231
- this.evokeAppBy.type = EvokeAppType.INTENT;
232
- var degradationStrategyFn;
233
- if (link) {
234
- degradationStrategyFn = function degradationStrategyFn() {
235
- return _this2.evokeLink();
236
- };
237
- }
238
- this.evokeByLocationDelay(generateIntent(tempScheme, intent === null || intent === void 0 ? void 0 : intent.package, (intent === null || intent === void 0 ? void 0 : intent.fallbackUrl) || ''), delay, fallback, degradationStrategyFn);
239
- }
240
- }
241
- }, {
242
- key: 'handleOriginalChrome',
243
- value: function handleOriginalChrome() {
244
- this.handleIntent();
245
- }
246
- /**
247
- * @param evokeFn
248
- * @param delay
249
- * @param fallback
250
- * @param degradationStrategy
251
- */
252
- }, {
253
- key: 'evokeAppDelay',
254
- value: function evokeAppDelay(evokeFn, evokeAppByUrl, delay, fallback, degradationStrategy) {
255
- var _this3 = this;
256
- var newDelay = delay || this.config.delay;
257
- var newFallback = fallback || this.config.fallback;
258
- this.timer = setTimeout(function () {
259
- _this3.clearTimer();
260
- evokeFn();
261
- _this3.checkIsOpen(evokeAppByUrl, newFallback, degradationStrategy);
262
- }, newDelay);
263
- }
264
- }, {
265
- key: 'evokeByLocationDelay',
266
- value: function evokeByLocationDelay(url, delay, fallback, degradationStrategy) {
267
- this.evokeAppDelay(function () {
268
- return evokeByLocation(url);
269
- }, url, delay, fallback, degradationStrategy);
270
- }
271
- }, {
272
- key: 'evokeByTagADelay',
273
- value: function evokeByTagADelay(url, delay, fallback, degradationStrategy) {
274
- this.evokeAppDelay(function () {
275
- return evokeByTagA(url);
276
- }, url, delay, fallback, degradationStrategy);
277
- }
278
- }, {
279
- key: 'evokeByIFrameDelay',
280
- value: function evokeByIFrameDelay(url, delay, fallback, degradationStrategy) {
281
- this.evokeAppDelay(function () {
282
- return evokeByIFrame(url);
283
- }, url, delay, fallback, degradationStrategy);
284
- }
285
- /**
286
- * @param fallback
287
- * @returns
288
- */
289
- }, {
290
- key: 'checkIsOpen',
291
- value: function checkIsOpen(evokeAppByUrl, fallback, degradationStrategy) {
292
- this.evokeAppBy.url = evokeAppByUrl;
293
- return checkCallAppSuccess(degradationStrategy || fallback, this.config.resultJudgmentTime);
294
- }
295
- }, {
296
- key: 'clearTimer',
297
- value: function clearTimer() {
298
- if (this.timer) {
299
- clearTimeout(this.timer);
300
- }
301
- }
302
- }]);
303
- return CallApp;
304
- }();
305
- export default CallApp;
@@ -1,15 +0,0 @@
1
- import CallApp from './main';
2
- import type { OpenWalletConfig, OpenWalletOptions } from './types';
3
- import type { WalletType } from './utils/config';
4
- declare class OpenWallet extends CallApp {
5
- constructor(config?: OpenWalletConfig);
6
- /**
7
- * @param options
8
- */
9
- openWallet(options: OpenWalletOptions): void;
10
- /**
11
- * @param options
12
- */
13
- openAppStore(walletName: WalletType): void;
14
- }
15
- export default OpenWallet;