@alipay/ams-checkout 0.0.1730107332-dev.4 → 0.0.1730107332-dev.41
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/esm/component/channel.d.ts +2 -3
- package/esm/component/channel.js +55 -29
- package/esm/component/component.inline.style.js +1 -1
- package/esm/component/component.popup.style.d.ts +1 -3
- package/esm/component/component.popup.style.js +1 -3
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +10 -10
- package/esm/constant/index.d.ts +3 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/bus/ability/callback.d.ts +9 -0
- package/esm/core/bus/ability/callback.js +55 -0
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/security.js +104 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/ability/tracker.js +77 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/index.js +366 -0
- package/esm/core/bus/interface.d.ts +36 -0
- package/esm/core/bus/interface.js +40 -0
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +89 -0
- package/esm/core/component/ckp/index.d.ts +27 -0
- package/esm/core/component/ckp/index.js +167 -0
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +60 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +816 -0
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +491 -0
- package/esm/core/component/element/type.d.ts +190 -0
- package/esm/core/component/element/type.js +35 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/core/component/index.d.ts +51 -0
- package/esm/core/component/index.js +531 -0
- package/esm/core/drop-in/index.d.ts +22 -0
- package/esm/core/drop-in/index.js +104 -0
- package/esm/core/instance/index.d.ts +89 -0
- package/esm/core/instance/index.js +499 -0
- package/esm/foundation/core/index.d.ts +3 -3
- package/esm/foundation/core/index.js +10 -8
- package/esm/foundation/index.d.ts +6 -5
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +6 -6
- package/esm/foundation/product-processor/easysafepay/deps.js +4 -4
- package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -3
- package/esm/foundation/product-processor/easysafepay/index.js +110 -243
- package/esm/foundation/service/api-bus/index.d.ts +2 -2
- package/esm/foundation/service/container/index.d.ts +4 -2
- package/esm/foundation/service/container/index.js +43 -1
- package/esm/foundation/service/event-center.d.ts +6 -4
- package/esm/foundation/service/event-center.js +47 -17
- package/esm/foundation/service/global-data/index.d.ts +2 -2
- package/esm/foundation/service/index.d.ts +2 -2
- package/esm/foundation/service/log/index.d.ts +2 -2
- package/esm/foundation/service/log/index.js +1 -1
- package/esm/foundation/service/requester/deps.d.ts +1 -1
- package/esm/foundation/service/requester/requester.d.ts +2 -2
- package/esm/foundation/service/security/index.d.ts +2 -2
- package/esm/foundation/service/security/index.js +5 -20
- package/esm/foundation/utils/redirect_utils.d.ts +5 -0
- package/esm/foundation/utils/redirect_utils.js +205 -58
- package/esm/foundation/utils/system_events.js +0 -5
- package/esm/foundation/utils/web_app_url_utils.js +1 -1
- package/esm/index.d.ts +31 -2
- package/esm/index.js +146 -6
- package/esm/plugin/applepay/component.d.ts +50 -0
- package/esm/plugin/applepay/component.js +339 -0
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/plugin/applepay/interface.d.ts +161 -0
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/plugin/applepay/service.d.ts +54 -0
- package/esm/plugin/applepay/service.js +289 -0
- package/esm/plugin/component/cashierApp.d.ts +36 -0
- package/esm/plugin/component/cashierApp.js +244 -0
- package/esm/plugin/component/channel.d.ts +21 -0
- package/esm/plugin/component/channel.js +89 -0
- package/esm/plugin/component/component.inline.style.d.ts +10 -0
- package/esm/plugin/component/component.inline.style.js +121 -0
- package/esm/plugin/component/component.popup.style.d.ts +16 -0
- package/esm/plugin/component/component.popup.style.js +174 -0
- package/esm/plugin/component/index.d.ts +127 -0
- package/esm/plugin/component/index.js +1896 -0
- package/esm/plugin/component/popupWindow.style.d.ts +11 -0
- package/esm/plugin/component/popupWindow.style.js +121 -0
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +33 -0
- package/esm/plugin/drop-in/index.d.ts +71 -0
- package/esm/plugin/drop-in/index.js +324 -0
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +390 -0
- package/esm/plugin/type.d.ts +34 -0
- package/esm/plugin/type.js +1 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +2 -0
- package/esm/types/index.d.ts +228 -26
- package/esm/types/index.js +54 -5
- package/esm/util/createIframeNode.d.ts +6 -0
- package/esm/util/createIframeNode.js +48 -0
- package/esm/util/getBackScheme.d.ts +2 -2
- package/esm/util/getBackScheme.js +2 -2
- package/esm/util/index.d.ts +11 -1
- package/esm/util/index.js +84 -3
- package/esm/util/intl-callapp/es/index.js +0 -1
- package/esm/util/security.d.ts +33 -0
- package/esm/util/security.js +182 -0
- package/package.json +2 -1
- package/esm/foundation/types/index.d.ts +0 -4
- package/esm/foundation/types/index.js +0 -4
@@ -20,72 +20,85 @@ export var redirect = function redirect(payload, instanceId) {
|
|
20
20
|
logService.logInfo({
|
21
21
|
title: 'sdk_event_call_url_start'
|
22
22
|
}, _objectSpread({}, payload)).send();
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
// 支持 target: _blank,新开tab页打开
|
40
|
-
if (payload.browserLinkTarget === TargetEnum.BLANK) {
|
41
|
-
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
42
|
-
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
43
|
-
window.open(payload.url);
|
44
|
-
return;
|
45
|
-
}
|
46
|
-
if (payload.browserLinkTarget === TargetEnum.REPLACE && !(payload !== null && payload !== void 0 && payload.applinkUrl) && !(payload !== null && payload !== void 0 && payload.schemeUrl)) {
|
47
|
-
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
48
|
-
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
49
|
-
window.location.replace(payload.url);
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
if (isPC()) {
|
53
|
-
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
54
|
-
window.location.href = payload.url;
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
if (!payload.schemeUrl && !payload.applinkUrl) {
|
58
|
-
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
59
|
-
window.location.href = payload.url;
|
60
|
-
}
|
61
|
-
// Use callApp lib to evoke
|
62
|
-
// TODO replace to npm
|
63
|
-
var callAppLib = new CallApp({
|
64
|
-
successCb: function successCb(evokeAppBy) {
|
65
|
-
var type = evokeAppBy.type == 'Scheme' ? RedirectType.SchemeUrl : RedirectType.ApplinkUrl;
|
66
|
-
successCallback(payload, type, evokeAppBy.url, serviceProvider);
|
23
|
+
try {
|
24
|
+
if (payload.isCallApp && payload.schemeUrl) {
|
25
|
+
var detectSuccessDelay = payload.callAppDetectSuccessDelay;
|
26
|
+
var _callAppLib = new CallApp({
|
27
|
+
successCb: function successCb() {
|
28
|
+
successCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
29
|
+
},
|
30
|
+
resultJudgmentTime: detectSuccessDelay
|
31
|
+
});
|
32
|
+
_callAppLib.open({
|
33
|
+
scheme: payload.schemeUrl,
|
34
|
+
fallback: function fallback() {
|
35
|
+
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
return;
|
67
39
|
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
40
|
+
// 支持 target: _blank,新开tab页打开
|
41
|
+
if (payload.browserLinkTarget === TargetEnum.BLANK) {
|
42
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
43
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
44
|
+
window.open(payload.url);
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
if (payload.browserLinkTarget === TargetEnum.REPLACE && !(payload !== null && payload !== void 0 && payload.applinkUrl) && !(payload !== null && payload !== void 0 && payload.schemeUrl)) {
|
48
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
49
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
50
|
+
window.location.replace(payload.url);
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
if (isPC()) {
|
54
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
55
|
+
window.location.href = payload.url;
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
if (!payload.schemeUrl && !payload.applinkUrl) {
|
59
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
60
|
+
window.location.href = payload.url;
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
// Use callApp lib to evoke
|
64
|
+
var callAppLib = new CallApp({
|
65
|
+
successCb: function successCb(evokeAppBy) {
|
66
|
+
var type = evokeAppBy.type == 'Scheme' ? RedirectType.SchemeUrl : RedirectType.ApplinkUrl;
|
67
|
+
successCallback(payload, type, evokeAppBy.url, serviceProvider);
|
75
68
|
}
|
69
|
+
});
|
70
|
+
var callSchemeUrl = function callSchemeUrl() {
|
76
71
|
callAppLib.open({
|
77
72
|
scheme: payload.schemeUrl,
|
78
73
|
fallback: function fallback() {
|
79
|
-
|
80
|
-
if (payload.
|
81
|
-
|
74
|
+
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
75
|
+
if (payload.url) {
|
76
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
77
|
+
window.location.href = payload.url;
|
82
78
|
}
|
83
|
-
window.location.href = payload.url;
|
84
|
-
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
85
79
|
}
|
86
80
|
});
|
81
|
+
};
|
82
|
+
if (payload.applinkUrl) {
|
83
|
+
callAppLib.open({
|
84
|
+
link: payload.applinkUrl,
|
85
|
+
fallback: function fallback() {
|
86
|
+
failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl, serviceProvider);
|
87
|
+
// Applink evoke failed, try to use scheme url
|
88
|
+
callSchemeUrl();
|
89
|
+
}
|
90
|
+
});
|
91
|
+
} else if (payload.schemeUrl) {
|
92
|
+
callSchemeUrl();
|
87
93
|
}
|
88
|
-
})
|
94
|
+
} catch (e) {
|
95
|
+
serviceProvider.getService('Log').logInfo({
|
96
|
+
title: 'sdk_event_call_url_failed'
|
97
|
+
}, {
|
98
|
+
redirectInfo: JSON.stringify(payload),
|
99
|
+
errorMessage: JSON.stringify(e)
|
100
|
+
}).send();
|
101
|
+
}
|
89
102
|
};
|
90
103
|
var successCallback = function successCallback(payload, type, url, serviceProvider) {
|
91
104
|
serviceProvider.getService('EventCenter').emit(EVENT.eventCallback.name, {
|
@@ -112,4 +125,138 @@ var failCallback = function failCallback(payload, type, url, serviceProvider) {
|
|
112
125
|
openType: type,
|
113
126
|
url: url
|
114
127
|
}).send();
|
115
|
-
};
|
128
|
+
};
|
129
|
+
var UA_MATCH_RULES = [{
|
130
|
+
matchRule: 'AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z]+) Safari\\/([0-9\\._]+)$',
|
131
|
+
iosScheme: 'https',
|
132
|
+
andScheme: ''
|
133
|
+
}, {
|
134
|
+
matchRule: 'HeyTapBrowser',
|
135
|
+
iosScheme: '',
|
136
|
+
andScheme: ''
|
137
|
+
}, {
|
138
|
+
matchRule: 'HuaweiBrowser',
|
139
|
+
iosScheme: '',
|
140
|
+
andScheme: ''
|
141
|
+
}, {
|
142
|
+
matchRule: 'Kwai',
|
143
|
+
iosScheme: 'kwai',
|
144
|
+
andScheme: ''
|
145
|
+
}, {
|
146
|
+
matchRule: 'MQQBrowser',
|
147
|
+
iosScheme: 'mttbrowser',
|
148
|
+
andScheme: ''
|
149
|
+
}, {
|
150
|
+
matchRule: 'MicroMessenger',
|
151
|
+
iosScheme: '',
|
152
|
+
andScheme: ''
|
153
|
+
}, {
|
154
|
+
matchRule: 'MiuiBrowser',
|
155
|
+
iosScheme: '',
|
156
|
+
andScheme: ''
|
157
|
+
}, {
|
158
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* CriOS\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z\\._a-z]+) Safari\\/([0-9\\._]+)$',
|
159
|
+
iosScheme: 'googlechrome',
|
160
|
+
andScheme: ''
|
161
|
+
}, {
|
162
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile Safari\\/([0-9\\._]+)$',
|
163
|
+
iosScheme: 'googlechrome',
|
164
|
+
andScheme: ''
|
165
|
+
}, {
|
166
|
+
matchRule: 'NewsArticle',
|
167
|
+
iosScheme: 'snssdk141',
|
168
|
+
andScheme: ''
|
169
|
+
}, {
|
170
|
+
matchRule: 'UCBrowser',
|
171
|
+
iosScheme: 'ucbrowser',
|
172
|
+
andScheme: ''
|
173
|
+
}, {
|
174
|
+
matchRule: 'VideoArticle',
|
175
|
+
iosScheme: 'snssdk32',
|
176
|
+
andScheme: ''
|
177
|
+
}, {
|
178
|
+
matchRule: 'VivoBrowser',
|
179
|
+
iosScheme: '',
|
180
|
+
andScheme: ''
|
181
|
+
}, {
|
182
|
+
matchRule: 'ZhongAnWebView',
|
183
|
+
iosScheme: 'zaapp',
|
184
|
+
andScheme: ''
|
185
|
+
}, {
|
186
|
+
matchRule: 'aweme',
|
187
|
+
iosScheme: 'snssdk1128',
|
188
|
+
andScheme: ''
|
189
|
+
}, {
|
190
|
+
matchRule: 'aweme_lite',
|
191
|
+
iosScheme: 'snssdk2329',
|
192
|
+
andScheme: ''
|
193
|
+
}, {
|
194
|
+
matchRule: 'com.xs.fm',
|
195
|
+
iosScheme: 'novelfm3040',
|
196
|
+
andScheme: ''
|
197
|
+
}, {
|
198
|
+
matchRule: 'netdisk',
|
199
|
+
iosScheme: '',
|
200
|
+
andScheme: ''
|
201
|
+
}, {
|
202
|
+
matchRule: 'qqnews',
|
203
|
+
iosScheme: 'qqnews',
|
204
|
+
andScheme: ''
|
205
|
+
}];
|
206
|
+
|
207
|
+
/**
|
208
|
+
* 通过配置规则检测 UA 和获得回跳 scheme
|
209
|
+
*/
|
210
|
+
export function getBackScheme(mockUa, logger) {
|
211
|
+
var ua = mockUa || window.navigator.userAgent || '';
|
212
|
+
// 获取规则
|
213
|
+
var uaMatchedRule = UA_MATCH_RULES;
|
214
|
+
var matchedRule;
|
215
|
+
var matched = null;
|
216
|
+
for (var i = 0; i < uaMatchedRule.length; i++) {
|
217
|
+
var rule = uaMatchedRule[i];
|
218
|
+
matched = ua.match(rule.matchRule);
|
219
|
+
if (matched) {
|
220
|
+
matchedRule = rule;
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
if (!matchedRule) {
|
225
|
+
logBackScheme(logger, ua, '');
|
226
|
+
return;
|
227
|
+
}
|
228
|
+
if (isAndroid(ua)) {
|
229
|
+
logBackScheme(logger, ua, matchedRule.andScheme);
|
230
|
+
return matchedRule.andScheme;
|
231
|
+
}
|
232
|
+
if (isIOS(ua)) {
|
233
|
+
logBackScheme(logger, ua, matchedRule.iosScheme);
|
234
|
+
return matchedRule.iosScheme;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
function logBackScheme(logger, userAgent, scheme) {
|
238
|
+
if (logger) {
|
239
|
+
logger.logInfo({
|
240
|
+
title: 'a3753.b101271.c377460'
|
241
|
+
}, {
|
242
|
+
userAgent: userAgent,
|
243
|
+
backScheme: scheme
|
244
|
+
});
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* 当前运行环境是否 Android
|
250
|
+
*/
|
251
|
+
function isAndroid(mockUA) {
|
252
|
+
var ua = (mockUA || navigator.userAgent).toLowerCase();
|
253
|
+
return /android|adr|linux/.test(ua);
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
* 当前运行环境是否 IOS
|
258
|
+
*/
|
259
|
+
function isIOS(mockUA) {
|
260
|
+
var ua = (mockUA || navigator.userAgent).toLowerCase();
|
261
|
+
return /iphone|ipad|ipod|ios|macintosh/.test(ua);
|
262
|
+
}
|
@@ -22,9 +22,6 @@ export var registerSystemEvents = function registerSystemEvents(eventCenter) {
|
|
22
22
|
form.submit();
|
23
23
|
}, 0);
|
24
24
|
};
|
25
|
-
var handleHeartBeat = function handleHeartBeat(data) {
|
26
|
-
// TODO:
|
27
|
-
};
|
28
25
|
var handleBeforeSubmit = function handleBeforeSubmit(data) {
|
29
26
|
if (eventCenter.isExist(EVENT.beforeSubmit.name)) {
|
30
27
|
eventCenter.emit(EVENT.beforeSubmit.name, data);
|
@@ -52,7 +49,6 @@ export var registerSystemEvents = function registerSystemEvents(eventCenter) {
|
|
52
49
|
});
|
53
50
|
};
|
54
51
|
eventCenter.listen(EVENT.submitForm.name, handleSubmitForm);
|
55
|
-
eventCenter.listen(EVENT.appHeartBeat.name, handleHeartBeat);
|
56
52
|
eventCenter.listen(EVENT.beforeSubmit.name, handleBeforeSubmit);
|
57
53
|
eventCenter.listen(EVENT.sendBroadcast.name, handleSendBroadcast);
|
58
54
|
// deprecated
|
@@ -60,7 +56,6 @@ export var registerSystemEvents = function registerSystemEvents(eventCenter) {
|
|
60
56
|
};
|
61
57
|
export var unRegisterSystemEvents = function unRegisterSystemEvents(eventCenter) {
|
62
58
|
eventCenter.unlisten(EVENT.submitForm.name);
|
63
|
-
eventCenter.unlisten(EVENT.appHeartBeat.name);
|
64
59
|
eventCenter.unlisten(EVENT.beforeSubmit.name);
|
65
60
|
eventCenter.unlisten(EVENT.sendBroadcast.name);
|
66
61
|
eventCenter.unlisten(EVENT.sendMuitiAppEventToSdk.name);
|
@@ -98,7 +98,7 @@ export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo)
|
|
98
98
|
};
|
99
99
|
var getValidProductSceneVersion = function getValidProductSceneVersion(productScene, productSceneVer, paymentMethodCategoryType) {
|
100
100
|
var _supportMapping;
|
101
|
-
var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']));
|
101
|
+
var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']));
|
102
102
|
var targetVersions = supportMapping[productScene + '_' + paymentMethodCategoryType];
|
103
103
|
if (!targetVersions) {
|
104
104
|
return '';
|
package/esm/index.d.ts
CHANGED
@@ -1,7 +1,36 @@
|
|
1
|
-
import {
|
1
|
+
import { AddressComponent } from './core/component/address';
|
2
|
+
import { ElementComponent } from './core/component/element';
|
3
|
+
import { AMSComponent } from './core/component/index';
|
4
|
+
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams } from './types';
|
5
|
+
export { AMSCheckoutPage } from './core/component/ckp';
|
2
6
|
export * from './types';
|
7
|
+
export declare class AMSCheckout extends AMSComponent {
|
8
|
+
constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
9
|
+
}
|
10
|
+
export declare class AMSAutoDebit extends AMSCheckout {
|
11
|
+
constructor(options: IoptionsParams);
|
12
|
+
}
|
13
|
+
export declare class AMSAutoDebitPay extends AMSCheckout {
|
14
|
+
constructor(options: IoptionsParams);
|
15
|
+
}
|
16
|
+
export declare class AMSCashierPayment extends AMSCheckout {
|
17
|
+
constructor(options: IoptionsParams);
|
18
|
+
}
|
19
|
+
export declare class AMSVaulting extends AMSCheckout {
|
20
|
+
constructor(options: IoptionsParams);
|
21
|
+
}
|
22
|
+
export declare class AntomElement extends AMSCheckout {
|
23
|
+
constructor(options: IoptionsParams);
|
24
|
+
}
|
25
|
+
export declare class AddressElement extends AddressComponent {
|
26
|
+
constructor(options: IoptionsAddressParams);
|
27
|
+
}
|
28
|
+
export declare class Element extends ElementComponent {
|
29
|
+
constructor(options: IElementOptions);
|
30
|
+
}
|
31
|
+
export default AMSCheckout;
|
3
32
|
export declare class AMSEasyPay {
|
4
33
|
private core;
|
5
|
-
constructor(options:
|
34
|
+
constructor(options: IoptionsParams);
|
6
35
|
createComponent(params: IcreateComponent): void;
|
7
36
|
}
|
package/esm/index.js
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
-
function
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
3
5
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
6
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
8
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
12
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
13
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
14
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
15
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
8
17
|
/**
|
9
18
|
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
10
19
|
*
|
@@ -12,12 +21,143 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
12
21
|
* 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
|
13
22
|
* 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.
|
14
23
|
*/
|
15
|
-
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
import {
|
24
|
+
import { ADDRESSElementAppVersion, AMSAutoDebitAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
|
25
|
+
import { AddressComponent } from "./core/component/address";
|
26
|
+
import { ElementComponent } from "./core/component/element";
|
27
|
+
import { AMSComponent } from "./core/component/index";
|
28
|
+
import { ComponentSignEnum, DisplayTypeEnum } from "./types";
|
19
29
|
import { ProductSceneEnum } from "./types/index";
|
30
|
+
import { LogConfig, Logger } from "./util/logger";
|
31
|
+
var logger = new Logger(LogConfig, true);
|
32
|
+
export { AMSCheckoutPage } from "./core/component/ckp";
|
20
33
|
export * from "./types";
|
34
|
+
import { AntomSDKCore } from "./foundation/core";
|
35
|
+
import { EasySafePayProcessor } from "./foundation/product-processor/easysafepay";
|
36
|
+
export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
37
|
+
_inherits(AMSCheckout, _AMSComponent);
|
38
|
+
var _super = _createSuper(AMSCheckout);
|
39
|
+
function AMSCheckout(_options, channelType) {
|
40
|
+
var _this;
|
41
|
+
var productSceneVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1.0';
|
42
|
+
_classCallCheck(this, AMSCheckout);
|
43
|
+
_this = _super.call(this, _objectSpread({
|
44
|
+
appVersion: AMSCheckoutAppVersion
|
45
|
+
}, _options));
|
46
|
+
_this.preloadComponent(channelType, productSceneVersion);
|
47
|
+
return _this;
|
48
|
+
}
|
49
|
+
return _createClass(AMSCheckout);
|
50
|
+
}(AMSComponent);
|
51
|
+
export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
52
|
+
_inherits(AMSAutoDebit, _AMSCheckout);
|
53
|
+
var _super2 = _createSuper(AMSAutoDebit);
|
54
|
+
function AMSAutoDebit(options) {
|
55
|
+
_classCallCheck(this, AMSAutoDebit);
|
56
|
+
var _options = Object.assign({}, options, {
|
57
|
+
product: ProductSceneEnum.AUTO_DEBIT,
|
58
|
+
appVersion: AMSAutoDebitAppVersion
|
59
|
+
});
|
60
|
+
return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_WALLET]);
|
61
|
+
}
|
62
|
+
return _createClass(AMSAutoDebit);
|
63
|
+
}(AMSCheckout);
|
64
|
+
export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
65
|
+
_inherits(AMSAutoDebitPay, _AMSCheckout2);
|
66
|
+
var _super3 = _createSuper(AMSAutoDebitPay);
|
67
|
+
function AMSAutoDebitPay(options) {
|
68
|
+
_classCallCheck(this, AMSAutoDebitPay);
|
69
|
+
var _options = Object.assign({}, options, {
|
70
|
+
product: ProductSceneEnum.AUTO_DEBIT_PAY
|
71
|
+
});
|
72
|
+
return _super3.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
|
73
|
+
}
|
74
|
+
return _createClass(AMSAutoDebitPay);
|
75
|
+
}(AMSCheckout);
|
76
|
+
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
77
|
+
_inherits(AMSCashierPayment, _AMSCheckout3);
|
78
|
+
var _super4 = _createSuper(AMSCashierPayment);
|
79
|
+
function AMSCashierPayment(options) {
|
80
|
+
_classCallCheck(this, AMSCashierPayment);
|
81
|
+
var _options = Object.assign({}, options, {
|
82
|
+
product: ProductSceneEnum.CASHIER_PAYMENT,
|
83
|
+
appVersion: AMSCashierPaymentAppVersion
|
84
|
+
});
|
85
|
+
var currentChannelType;
|
86
|
+
try {
|
87
|
+
var previousChannelStr = localStorage.getItem('antom_checkout_previousChannel');
|
88
|
+
var previousChannel = JSON.parse(previousChannelStr) || {};
|
89
|
+
var _ref = previousChannel || {},
|
90
|
+
_ref$channelType = _ref.channelType,
|
91
|
+
channelType = _ref$channelType === void 0 ? '' : _ref$channelType;
|
92
|
+
if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM, ComponentSignEnum.CASHIER_PAYMENT_BANK].includes(channelType)) {
|
93
|
+
currentChannelType = [channelType];
|
94
|
+
} else {
|
95
|
+
currentChannelType = [ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM];
|
96
|
+
}
|
97
|
+
} catch (error) {
|
98
|
+
logger.logError({
|
99
|
+
title: 'performance_optimization_get_previousChannel_error'
|
100
|
+
}, {
|
101
|
+
error: error
|
102
|
+
});
|
103
|
+
}
|
104
|
+
return _super4.call(this, _options, currentChannelType);
|
105
|
+
}
|
106
|
+
return _createClass(AMSCashierPayment);
|
107
|
+
}(AMSCheckout);
|
108
|
+
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
109
|
+
_inherits(AMSVaulting, _AMSCheckout4);
|
110
|
+
var _super5 = _createSuper(AMSVaulting);
|
111
|
+
function AMSVaulting(options) {
|
112
|
+
_classCallCheck(this, AMSVaulting);
|
113
|
+
var _options = Object.assign({}, options, {
|
114
|
+
product: ProductSceneEnum.VAULTING,
|
115
|
+
appVersion: AMSVaultingAppVersion
|
116
|
+
});
|
117
|
+
return _super5.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
|
118
|
+
}
|
119
|
+
return _createClass(AMSVaulting);
|
120
|
+
}(AMSCheckout);
|
121
|
+
export var AntomElement = /*#__PURE__*/function (_AMSCheckout5) {
|
122
|
+
_inherits(AntomElement, _AMSCheckout5);
|
123
|
+
var _super6 = _createSuper(AntomElement);
|
124
|
+
function AntomElement(options) {
|
125
|
+
_classCallCheck(this, AntomElement);
|
126
|
+
var _options = Object.assign({}, options, {
|
127
|
+
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
128
|
+
appVersion: AMSPaymentElementAppVersion
|
129
|
+
});
|
130
|
+
return _super6.call(this, _options, [ComponentSignEnum.ELEMENT_PAYMENT]);
|
131
|
+
}
|
132
|
+
return _createClass(AntomElement);
|
133
|
+
}(AMSCheckout);
|
134
|
+
export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
|
135
|
+
_inherits(AddressElement, _AddressComponent);
|
136
|
+
var _super7 = _createSuper(AddressElement);
|
137
|
+
function AddressElement(options) {
|
138
|
+
_classCallCheck(this, AddressElement);
|
139
|
+
var _options = Object.assign({}, options, {
|
140
|
+
product: ProductSceneEnum.ELEMENT_ADDRESS,
|
141
|
+
appVersion: ADDRESSElementAppVersion
|
142
|
+
});
|
143
|
+
return _super7.call(this, _options);
|
144
|
+
}
|
145
|
+
return _createClass(AddressElement);
|
146
|
+
}(AddressComponent);
|
147
|
+
export var Element = /*#__PURE__*/function (_ElementComponent) {
|
148
|
+
_inherits(Element, _ElementComponent);
|
149
|
+
var _super8 = _createSuper(Element);
|
150
|
+
function Element(options) {
|
151
|
+
_classCallCheck(this, Element);
|
152
|
+
var _options = Object.assign({}, options, {
|
153
|
+
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
154
|
+
environment: options.environment
|
155
|
+
});
|
156
|
+
return _super8.call(this, _options);
|
157
|
+
}
|
158
|
+
return _createClass(Element);
|
159
|
+
}(ElementComponent);
|
160
|
+
export default AMSCheckout;
|
21
161
|
export var AMSEasyPay = /*#__PURE__*/function () {
|
22
162
|
function AMSEasyPay(options) {
|
23
163
|
_classCallCheck(this, AMSEasyPay);
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
+
*
|
4
|
+
* 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:
|
5
|
+
* 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
|
6
|
+
* 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.
|
7
|
+
*/
|
8
|
+
import { ApplePaySubTypeEnum, IAppendParams, IApplePayOptionsParams } from '../../types';
|
9
|
+
import type { Logger } from '../../util/logger';
|
10
|
+
export declare enum ApplePayComponentEvent {
|
11
|
+
sdk_event_appleAvailable = "sdk_event_appleAvailable",
|
12
|
+
sdk_event_appleCreateComponent = "sdk_event_appleCreateComponent",
|
13
|
+
sdk_event_appleShowPaymentSheet = "sdk_event_appleShowPaymentSheet",
|
14
|
+
sdk_event_appleOnvalidatemerchant = "sdk_event_appleOnvalidatemerchant",
|
15
|
+
sdk_event_appleSubmitToken = "sdk_event_appleSubmitToken",
|
16
|
+
sdk_event_applePaymentResult = "sdk_event_applePaymentResult",
|
17
|
+
sdk_event_appleDestroyComponent = "sdk_event_appleDestroyComponent"
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* Apple pay Component
|
21
|
+
*/
|
22
|
+
declare class ApplePayComponent {
|
23
|
+
private _applePayService;
|
24
|
+
private _parseData;
|
25
|
+
private _sessionData;
|
26
|
+
private _isFinish;
|
27
|
+
private _options;
|
28
|
+
private logger;
|
29
|
+
private isRecurring;
|
30
|
+
constructor(options: IApplePayOptionsParams, logger: Logger);
|
31
|
+
/**
|
32
|
+
* Is Apple Pay Enabled
|
33
|
+
* @param subTypeEnum
|
34
|
+
* @returns
|
35
|
+
*/
|
36
|
+
canMakePayments(subTypeEnum?: ApplePaySubTypeEnum): boolean;
|
37
|
+
/**
|
38
|
+
* Is Apple Pay Enabled
|
39
|
+
* @param subTypeEnum
|
40
|
+
* @returns
|
41
|
+
*/
|
42
|
+
isAppPayEnabled(subTypeEnum?: ApplePaySubTypeEnum): boolean;
|
43
|
+
private onEventCallback;
|
44
|
+
/**
|
45
|
+
* Submit Pay
|
46
|
+
* @param paymentSessionData
|
47
|
+
*/
|
48
|
+
submitPay(appendParams: IAppendParams): void;
|
49
|
+
}
|
50
|
+
export default ApplePayComponent;
|