@alipay/ams-checkout 0.0.1742280578-dev.1 → 0.0.1742285920-dev.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/esm/component/channel.d.ts +3 -1
- package/esm/component/channel.js +26 -62
- package/esm/component/component.inline.style.js +2 -2
- package/esm/component/popupWindow.style.js +4 -1
- package/esm/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/constant/easysafepay.d.ts +16 -0
- package/esm/constant/easysafepay.js +19 -0
- package/esm/constant/index.d.ts +34 -2
- package/esm/constant/index.js +36 -5
- package/esm/core/component/ckp/index.d.ts +2 -0
- package/esm/core/component/ckp/index.js +39 -5
- package/esm/core/component/element/elementContainerService/containerService.d.ts +33 -0
- package/esm/core/component/element/elementContainerService/containerService.js +123 -0
- package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
- package/esm/core/component/element/elementContainerService/index.js +63 -0
- package/esm/core/component/element/elementController/index.d.ts +27 -0
- package/esm/core/component/element/elementController/index.js +485 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.js +160 -0
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/authProcessor.js +125 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +96 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +380 -0
- package/esm/core/component/element/index.d.ts +7 -46
- package/esm/core/component/element/index.js +31 -923
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +365 -1
- package/esm/core/component/element/type.d.ts +45 -19
- package/esm/core/component/element/util.d.ts +69 -0
- package/esm/core/component/element/util.js +477 -0
- package/esm/core/component/index.d.ts +5 -1
- package/esm/core/component/index.js +1 -2
- package/esm/core/component/oldElement/index.d.ts +59 -0
- package/esm/core/component/oldElement/index.js +956 -0
- package/esm/core/component/oldElement/mock.d.ts +6 -0
- package/esm/core/component/oldElement/mock.js +567 -0
- package/esm/core/component/oldElement/type.d.ts +354 -0
- package/esm/core/component/oldElement/type.js +81 -0
- package/esm/core/instance/index.d.ts +1 -1
- package/esm/core/instance/index.js +1 -1
- package/esm/foundation/core/index.d.ts +9 -1
- package/esm/foundation/core/index.js +153 -49
- package/esm/foundation/index.d.ts +20 -0
- package/esm/foundation/index.js +13 -2
- package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
- package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
- package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
- package/esm/foundation/product-processor/autoDebit/index.js +466 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +3 -1
- package/esm/foundation/product-processor/easysafepay/deps.js +3 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +5 -0
- package/esm/foundation/product-processor/easysafepay/index.js +267 -128
- package/esm/foundation/product-processor/element/index.d.ts +7 -0
- package/esm/foundation/product-processor/element/index.js +24 -0
- package/esm/foundation/service/container/index.d.ts +12 -3
- package/esm/foundation/service/container/index.js +145 -16
- package/esm/foundation/service/container/popup.d.ts +1 -1
- package/esm/foundation/service/event-center.js +1 -0
- package/esm/foundation/service/log/keys.js +3 -1
- package/esm/foundation/service/log/types.d.ts +1 -0
- package/esm/foundation/service/requester/requester.js +5 -4
- package/esm/foundation/utils/preload_helper.d.ts +2 -2
- package/esm/foundation/utils/preload_helper.js +8 -4
- package/esm/foundation/utils/redirect_utils.js +34 -18
- package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
- package/esm/foundation/utils/web_app_url_utils.js +219 -8
- package/esm/index.d.ts +7 -4
- package/esm/index.js +98 -48
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +5 -5
- package/esm/plugin/component/channel.d.ts +3 -1
- package/esm/plugin/component/channel.js +10 -12
- package/esm/plugin/component/index.js +47 -44
- package/esm/plugin/type.d.ts +1 -1
- package/esm/types/index.d.ts +37 -3
- package/esm/types/index.js +10 -2
- package/esm/util/index.d.ts +7 -1
- package/esm/util/index.js +10 -1
- package/esm/util/redirect.d.ts +6 -0
- package/esm/util/redirect.js +54 -0
- package/package.json +27 -4
- /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
- /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/utils.js +0 -0
@@ -1,25 +1,36 @@
|
|
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 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; }
|
2
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 _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
6
|
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); }
|
5
|
-
import {
|
6
|
-
import {
|
7
|
+
import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config";
|
8
|
+
import { ESP_PAGE_NAME } from "../../constant/easysafepay";
|
9
|
+
import { ComponentSignEnum, ProductSceneEnum } from "../../types";
|
7
10
|
import { queryParse, serialize } from "../../util";
|
8
11
|
import { isDebugLog } from "../../util/debug";
|
12
|
+
import { compareVersion } from "../../util/versionCompare";
|
9
13
|
|
10
14
|
/**
|
11
15
|
* Tell the SDK which version of the Web App to load.
|
12
16
|
* Sent by server inside paymentSession.
|
13
17
|
*/
|
14
18
|
|
19
|
+
/**
|
20
|
+
* Tell the SDK which Web App URL to load.
|
21
|
+
* Sent by server inside paymentSession.
|
22
|
+
*/
|
23
|
+
|
15
24
|
export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
16
25
|
var environment = params.environment,
|
17
26
|
sdkMetaData = params.sdkMetaData,
|
27
|
+
productScene = params.productScene,
|
18
28
|
productSceneVersion = params.productSceneVersion,
|
19
29
|
paymentMethodCategoryType = params.paymentMethodCategoryType,
|
20
30
|
query = params.query,
|
21
|
-
isPreload = params.isPreload
|
22
|
-
|
31
|
+
isPreload = params.isPreload,
|
32
|
+
v2Url = params.v2Url;
|
33
|
+
var path = getAppPath(environment, sdkMetaData, productScene, productSceneVersion, paymentMethodCategoryType, v2Url);
|
23
34
|
var _queryParse = queryParse(),
|
24
35
|
_sandbox = _queryParse._sandbox,
|
25
36
|
_light_sandbox = _queryParse._light_sandbox,
|
@@ -57,6 +68,30 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
|
57
68
|
locationSearch: locationSearch
|
58
69
|
};
|
59
70
|
};
|
71
|
+
export var getWebAppV2Url = function getWebAppV2Url(params) {
|
72
|
+
var productScene = params.productScene,
|
73
|
+
isPreload = params.isPreload,
|
74
|
+
mid = params.mid,
|
75
|
+
extendInfo = params.extendInfo,
|
76
|
+
environment = params.environment;
|
77
|
+
var webAppUrlMatchConfig = parseWebAppUrlMatchConfig(extendInfo);
|
78
|
+
var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig, environment);
|
79
|
+
var info = getWebAppUrlInfo(_objectSpread(_objectSpread({}, params), {}, {
|
80
|
+
v2Url: v2Url
|
81
|
+
}));
|
82
|
+
if (!isPreload && v2Url && info.path) {
|
83
|
+
console.log('[web-sdk] save web app, url: ', info.path);
|
84
|
+
saveLocalCheckoutUrl(productScene, info.path);
|
85
|
+
}
|
86
|
+
var webAppUrl;
|
87
|
+
if (info.path.indexOf('?') !== -1) {
|
88
|
+
webAppUrl = "".concat(info.path, "&").concat(info.locationSearch);
|
89
|
+
} else {
|
90
|
+
webAppUrl = "".concat(info.path, "?").concat(info.locationSearch);
|
91
|
+
}
|
92
|
+
console.log('[web-sdk] web app, url: ', webAppUrl);
|
93
|
+
return webAppUrl;
|
94
|
+
};
|
60
95
|
export var getWebAppUrl = function getWebAppUrl(params) {
|
61
96
|
var info = getWebAppUrlInfo(params);
|
62
97
|
var webAppUrl;
|
@@ -70,8 +105,10 @@ export var getWebAppUrl = function getWebAppUrl(params) {
|
|
70
105
|
var getAppPath = function getAppPath() {
|
71
106
|
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'prod';
|
72
107
|
var sdkMetaData = arguments.length > 1 ? arguments[1] : undefined;
|
73
|
-
var
|
74
|
-
var
|
108
|
+
var productScene = arguments.length > 2 ? arguments[2] : undefined;
|
109
|
+
var productSceneVersion = arguments.length > 3 ? arguments[3] : undefined;
|
110
|
+
var paymentMethodCategoryType = arguments.length > 4 ? arguments[4] : undefined;
|
111
|
+
var v2Url = arguments.length > 5 ? arguments[5] : undefined;
|
75
112
|
var _ref = queryParse() || {},
|
76
113
|
urlTestHost = _ref.host;
|
77
114
|
// only for test while testurl?host=https://xxxxx.test.html
|
@@ -81,7 +118,15 @@ var getAppPath = function getAppPath() {
|
|
81
118
|
var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
|
82
119
|
var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
|
83
120
|
var webAppVersion = sdkMetaData.webAppVersion;
|
84
|
-
|
121
|
+
if (productSceneWithPaymentMethodCategoryType === ComponentSignEnum.AUTO_DEBIT_APM) {
|
122
|
+
return "".concat(v2AppMarmotMap[environment], "/auto-debit/").concat(webAppVersion, "/pages/trustly/index.html");
|
123
|
+
}
|
124
|
+
switch (productScene) {
|
125
|
+
case ProductSceneEnum.EASY_PAY:
|
126
|
+
return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene, environment);
|
127
|
+
default:
|
128
|
+
return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.").concat(webAppVersion, ".html");
|
129
|
+
}
|
85
130
|
};
|
86
131
|
export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo) {
|
87
132
|
if (!extendInfo) {
|
@@ -96,9 +141,21 @@ export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo)
|
|
96
141
|
return [];
|
97
142
|
}
|
98
143
|
};
|
144
|
+
export var parseWebAppUrlMatchConfig = function parseWebAppUrlMatchConfig(extendInfo) {
|
145
|
+
if (!extendInfo) {
|
146
|
+
return [];
|
147
|
+
}
|
148
|
+
try {
|
149
|
+
var extendInfoJson = JSON.parse(extendInfo);
|
150
|
+
return extendInfoJson === null || extendInfoJson === void 0 ? void 0 : extendInfoJson.checkoutInfo;
|
151
|
+
} catch (error) {
|
152
|
+
console.error('Parse the url config for Web app failed#', error);
|
153
|
+
return [];
|
154
|
+
}
|
155
|
+
};
|
99
156
|
var getValidProductSceneVersion = function getValidProductSceneVersion(productScene, productSceneVer, paymentMethodCategoryType) {
|
100
157
|
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(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']));
|
158
|
+
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(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']), ComponentSignEnum.AUTO_DEBIT_APM, ['1.0']));
|
102
159
|
var targetVersions = supportMapping[productScene + '_' + paymentMethodCategoryType];
|
103
160
|
if (!targetVersions) {
|
104
161
|
return '';
|
@@ -109,4 +166,158 @@ var getValidProductSceneVersion = function getValidProductSceneVersion(productSc
|
|
109
166
|
});
|
110
167
|
var latestVersion = targetVersions[targetVersions.length - 1];
|
111
168
|
return isSupport ? productSceneVer : latestVersion;
|
169
|
+
};
|
170
|
+
var KEY_CHECKOUT_URL = "web_url_";
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Save the current checkout URL to localStorage for the specified product scene.
|
174
|
+
*
|
175
|
+
* @param productScene - The product scene for which the checkout URL should be saved.
|
176
|
+
*/
|
177
|
+
export var saveLocalCheckoutUrl = function saveLocalCheckoutUrl(productScene, url) {
|
178
|
+
var key = KEY_CHECKOUT_URL + productScene;
|
179
|
+
localStorage.setItem(key, url);
|
180
|
+
};
|
181
|
+
|
182
|
+
/**
|
183
|
+
* 获取从外部动态下发的V2AppUrl.
|
184
|
+
*
|
185
|
+
* @param config - sessionData解析来的checkoutInfo列表.
|
186
|
+
*/
|
187
|
+
export var getMatchedWebAppV2Url = function getMatchedWebAppV2Url(productScene) {
|
188
|
+
var mid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
189
|
+
var configs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
190
|
+
var env = arguments.length > 3 ? arguments[3] : undefined;
|
191
|
+
switch (productScene) {
|
192
|
+
case ProductSceneEnum.EASY_PAY:
|
193
|
+
return matchEasySafePayV2Url({
|
194
|
+
configs: configs,
|
195
|
+
mid: mid,
|
196
|
+
env: env,
|
197
|
+
pageName: ESP_PAGE_NAME.SDK_PORTAL
|
198
|
+
});
|
199
|
+
default:
|
200
|
+
return defaultCheckoutUrl(productScene, env);
|
201
|
+
}
|
202
|
+
};
|
203
|
+
|
204
|
+
/**
|
205
|
+
* 获取ESP从sessionData.checkoutInfo内动态下发的Url.
|
206
|
+
*/
|
207
|
+
export var matchEasySafePayV2Url = function matchEasySafePayV2Url(params) {
|
208
|
+
var _params$configs = params.configs,
|
209
|
+
configs = _params$configs === void 0 ? [] : _params$configs,
|
210
|
+
_params$mid = params.mid,
|
211
|
+
mid = _params$mid === void 0 ? '' : _params$mid,
|
212
|
+
env = params.env,
|
213
|
+
pageName = params.pageName;
|
214
|
+
var matchURLByMid = function matchURLByMid() {
|
215
|
+
var sortedConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
216
|
+
var targetConfigEntry = sortedConfigs.find(function (configEntry) {
|
217
|
+
var _configEntry$mids;
|
218
|
+
var isMatchMid = !!(configEntry !== null && configEntry !== void 0 && (_configEntry$mids = configEntry.mids) !== null && _configEntry$mids !== void 0 && _configEntry$mids.includes(mid));
|
219
|
+
var isMatchVersion = compareVersion(sdkVersion, configEntry.minSDKVersion) >= 0;
|
220
|
+
if (isMatchMid && isMatchVersion) {
|
221
|
+
return configEntry;
|
222
|
+
}
|
223
|
+
});
|
224
|
+
return targetConfigEntry;
|
225
|
+
};
|
226
|
+
var matchURLBySDKVersion = function matchURLBySDKVersion() {
|
227
|
+
var sortedConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
228
|
+
var targetConfigEntry = sortedConfigs.find(function (configEntry) {
|
229
|
+
var isCommonConfig = (configEntry === null || configEntry === void 0 ? void 0 : configEntry.mids) === undefined;
|
230
|
+
var isMatchVersion = compareVersion(sdkVersion, configEntry.minSDKVersion) >= 0;
|
231
|
+
if (isCommonConfig && isMatchVersion) {
|
232
|
+
return configEntry;
|
233
|
+
}
|
234
|
+
});
|
235
|
+
return targetConfigEntry;
|
236
|
+
};
|
237
|
+
var matchConfig = function matchConfig() {
|
238
|
+
// 按SDK版本降排序
|
239
|
+
var sortedConfig = configs.sort(function (a, b) {
|
240
|
+
return compareVersion(b.minSDKVersion, a.minSDKVersion);
|
241
|
+
});
|
242
|
+
|
243
|
+
// 匹配仅针对部分商户生效(mid),且符合版本号的URL
|
244
|
+
var matchedURLByMid = matchURLByMid(sortedConfig);
|
245
|
+
if (matchedURLByMid) return matchedURLByMid;
|
246
|
+
|
247
|
+
// 匹配对所有商户生效(无mid),且符合版本号的URL
|
248
|
+
var matchedURLBySDKVersion = matchURLBySDKVersion(sortedConfig);
|
249
|
+
if (matchedURLBySDKVersion) return matchedURLBySDKVersion;
|
250
|
+
};
|
251
|
+
var defaultEspUrl = getDefaultEasySafePayPageUrl(pageName, env);
|
252
|
+
|
253
|
+
// 匹配config
|
254
|
+
var config = matchConfig();
|
255
|
+
if (!config) return defaultEspUrl;
|
256
|
+
|
257
|
+
// 根据pageName匹配URL
|
258
|
+
if (pageName === ESP_PAGE_NAME.SDK_PORTAL) return (config === null || config === void 0 ? void 0 : config.url) || defaultEspUrl;
|
259
|
+
if (pageName === ESP_PAGE_NAME.DOUBLE_FA) return (config === null || config === void 0 ? void 0 : config.doubleFa) || defaultEspUrl;
|
260
|
+
return defaultEspUrl;
|
261
|
+
};
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Retrieve the saved checkout URL from localStorage for the specified product scene.
|
265
|
+
* If no url is found, a default checkout url string is returned.
|
266
|
+
*
|
267
|
+
* @param productScene - The product scene for which the checkout URL should be retrieved.
|
268
|
+
*/
|
269
|
+
export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene, environment) {
|
270
|
+
var key = KEY_CHECKOUT_URL + productScene;
|
271
|
+
var previousCheckoutUrl = localStorage.getItem(key);
|
272
|
+
return previousCheckoutUrl !== null && previousCheckoutUrl !== void 0 ? previousCheckoutUrl : defaultCheckoutUrl(productScene, environment);
|
273
|
+
};
|
274
|
+
|
275
|
+
/**
|
276
|
+
* Provide default checkout URL for the specified product scene.
|
277
|
+
* Return URL for 'EASY_PAY' product scene, while for other product scenes, it returns an empty string as they are not currently in use
|
278
|
+
*
|
279
|
+
* @param productScene - The product scene for which the default checkout URL should be provided.
|
280
|
+
*/
|
281
|
+
export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
|
282
|
+
var environment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'prod';
|
283
|
+
switch (productScene) {
|
284
|
+
case ProductSceneEnum.EASY_PAY:
|
285
|
+
return getDefaultEasySafePayPageUrl(ESP_PAGE_NAME.SDK_PORTAL, environment);
|
286
|
+
default:
|
287
|
+
return '';
|
288
|
+
}
|
289
|
+
};
|
290
|
+
|
291
|
+
/**
|
292
|
+
* V2应用EasySafePay 热更新兜底URL构建规则
|
293
|
+
* 1. 兜底URL版本与sdk版本保持一致
|
294
|
+
* 2. DEV环境下html新增版本前缀
|
295
|
+
**/
|
296
|
+
export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(pageName, env) {
|
297
|
+
// 生成的URL EXAMPLE:
|
298
|
+
// const DEFAULT_DOUBLE_FA_URL_MAPPING = {
|
299
|
+
// local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index-1.36.0.html',
|
300
|
+
// dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index-1.36.0.html',
|
301
|
+
// sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
|
302
|
+
// pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
|
303
|
+
// prod: 'https://checkout.antom.com/easysafepay/1.36.0/pages/double-fa/index.html',
|
304
|
+
// };
|
305
|
+
var environment = env || 'prod';
|
306
|
+
if (environment === 'dev') return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index-").concat(sdkVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index.html");
|
307
|
+
};
|
308
|
+
|
309
|
+
/**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
|
310
|
+
//TODO 后续需要构造一个类,专门用于构造&存储web应用url
|
311
|
+
export var getDoubleFaUrlFromSession = function getDoubleFaUrlFromSession(paymentSessionObj) {
|
312
|
+
var env = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'prod';
|
313
|
+
var mid = paymentSessionObj.clientId;
|
314
|
+
var extendInfo = paymentSessionObj.extendInfo;
|
315
|
+
var configs = parseWebAppUrlMatchConfig(extendInfo);
|
316
|
+
var url = matchEasySafePayV2Url({
|
317
|
+
configs: configs,
|
318
|
+
mid: mid,
|
319
|
+
env: env,
|
320
|
+
pageName: ESP_PAGE_NAME.DOUBLE_FA
|
321
|
+
});
|
322
|
+
return url;
|
112
323
|
};
|
package/esm/index.d.ts
CHANGED
@@ -7,10 +7,6 @@ export * from './types';
|
|
7
7
|
export declare class AMSCheckout extends AMSComponent {
|
8
8
|
constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
9
9
|
}
|
10
|
-
export declare class AMSAutoDebit extends AMSCheckout {
|
11
|
-
constructor(options: IoptionsParams);
|
12
|
-
static preload(options?: IPreloadOptions): void;
|
13
|
-
}
|
14
10
|
export declare class AMSAutoDebitPay extends AMSCheckout {
|
15
11
|
constructor(options: IoptionsParams);
|
16
12
|
static preload(options?: IPreloadOptions): void;
|
@@ -39,4 +35,11 @@ export declare class AMSEasyPay {
|
|
39
35
|
createComponent(params: IcreateComponent): void;
|
40
36
|
unmount(): void;
|
41
37
|
}
|
38
|
+
export declare class AMSAutoDebit {
|
39
|
+
private core;
|
40
|
+
constructor(options: IoptionsParams);
|
41
|
+
createComponent(params: IcreateComponent): Promise<void>;
|
42
|
+
unmount(): void;
|
43
|
+
static preload(options?: IPreloadOptions): void;
|
44
|
+
}
|
42
45
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -1,4 +1,7 @@
|
|
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
2
5
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
3
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
@@ -24,19 +27,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
24
27
|
* 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
|
25
28
|
* 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.
|
26
29
|
*/
|
27
|
-
import { ADDRESSElementAppVersion,
|
30
|
+
import { ADDRESSElementAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
|
28
31
|
import { AddressComponent } from "./core/component/address";
|
29
32
|
import { ElementComponent } from "./core/component/element";
|
33
|
+
// import { ElementComponent } from './core/component/oldElement';
|
30
34
|
import { AMSComponent } from "./core/component/index";
|
31
|
-
import
|
35
|
+
import PreloadHelper from "./foundation/utils/preload_helper";
|
36
|
+
import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, PaymentMethodCategoryTypeEnum } from "./types";
|
32
37
|
import { ProductSceneEnum } from "./types/index";
|
33
38
|
import { LogConfig, Logger } from "./util/logger";
|
34
|
-
import PreloadHelper from "./foundation/utils/preload_helper";
|
35
39
|
var logger = new Logger(LogConfig, true);
|
36
40
|
export { AMSCheckoutPage } from "./core/component/ckp";
|
37
41
|
export * from "./types";
|
38
42
|
import { AntomSDKCore } from "./foundation/core";
|
43
|
+
import { AutoDebitProcessor } from "./foundation/product-processor/autoDebit";
|
39
44
|
import { EasySafePayProcessor } from "./foundation/product-processor/easysafepay";
|
45
|
+
import { EVENT } from "./constant";
|
40
46
|
export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
41
47
|
_inherits(AMSCheckout, _AMSComponent);
|
42
48
|
var _super = _createSuper(AMSCheckout);
|
@@ -52,39 +58,15 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
|
52
58
|
}
|
53
59
|
return _createClass(AMSCheckout);
|
54
60
|
}(AMSComponent);
|
55
|
-
export var
|
56
|
-
_inherits(
|
57
|
-
var _super2 = _createSuper(
|
58
|
-
function AMSAutoDebit(options) {
|
59
|
-
_classCallCheck(this, AMSAutoDebit);
|
60
|
-
var _options = Object.assign({}, options, {
|
61
|
-
product: ProductSceneEnum.AUTO_DEBIT,
|
62
|
-
appVersion: AMSAutoDebitAppVersion
|
63
|
-
});
|
64
|
-
return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_WALLET]);
|
65
|
-
}
|
66
|
-
_createClass(AMSAutoDebit, null, [{
|
67
|
-
key: "preload",
|
68
|
-
value: function preload() {
|
69
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
70
|
-
securityRegion: 'SG',
|
71
|
-
environment: 'prod'
|
72
|
-
};
|
73
|
-
PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
|
74
|
-
PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT, options.securityRegion);
|
75
|
-
}
|
76
|
-
}]);
|
77
|
-
return AMSAutoDebit;
|
78
|
-
}(AMSCheckout);
|
79
|
-
export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
80
|
-
_inherits(AMSAutoDebitPay, _AMSCheckout2);
|
81
|
-
var _super3 = _createSuper(AMSAutoDebitPay);
|
61
|
+
export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout) {
|
62
|
+
_inherits(AMSAutoDebitPay, _AMSCheckout);
|
63
|
+
var _super2 = _createSuper(AMSAutoDebitPay);
|
82
64
|
function AMSAutoDebitPay(options) {
|
83
65
|
_classCallCheck(this, AMSAutoDebitPay);
|
84
66
|
var _options = Object.assign({}, options, {
|
85
67
|
product: ProductSceneEnum.AUTO_DEBIT_PAY
|
86
68
|
});
|
87
|
-
return
|
69
|
+
return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
|
88
70
|
}
|
89
71
|
_createClass(AMSAutoDebitPay, null, [{
|
90
72
|
key: "preload",
|
@@ -99,9 +81,9 @@ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
|
99
81
|
}]);
|
100
82
|
return AMSAutoDebitPay;
|
101
83
|
}(AMSCheckout);
|
102
|
-
export var AMSCashierPayment = /*#__PURE__*/function (
|
103
|
-
_inherits(AMSCashierPayment,
|
104
|
-
var
|
84
|
+
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout2) {
|
85
|
+
_inherits(AMSCashierPayment, _AMSCheckout2);
|
86
|
+
var _super3 = _createSuper(AMSCashierPayment);
|
105
87
|
function AMSCashierPayment(options) {
|
106
88
|
_classCallCheck(this, AMSCashierPayment);
|
107
89
|
var _options = Object.assign({}, options, {
|
@@ -127,7 +109,7 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
|
127
109
|
errorMessage: error
|
128
110
|
});
|
129
111
|
}
|
130
|
-
return
|
112
|
+
return _super3.call(this, _options, currentChannelType);
|
131
113
|
}
|
132
114
|
_createClass(AMSCashierPayment, null, [{
|
133
115
|
key: "preload",
|
@@ -172,16 +154,16 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
|
172
154
|
}]);
|
173
155
|
return AMSCashierPayment;
|
174
156
|
}(AMSCheckout);
|
175
|
-
export var AMSVaulting = /*#__PURE__*/function (
|
176
|
-
_inherits(AMSVaulting,
|
177
|
-
var
|
157
|
+
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout3) {
|
158
|
+
_inherits(AMSVaulting, _AMSCheckout3);
|
159
|
+
var _super4 = _createSuper(AMSVaulting);
|
178
160
|
function AMSVaulting(options) {
|
179
161
|
_classCallCheck(this, AMSVaulting);
|
180
162
|
var _options = Object.assign({}, options, {
|
181
163
|
product: ProductSceneEnum.VAULTING,
|
182
164
|
appVersion: AMSVaultingAppVersion
|
183
165
|
});
|
184
|
-
return
|
166
|
+
return _super4.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
|
185
167
|
}
|
186
168
|
_createClass(AMSVaulting, null, [{
|
187
169
|
key: "preload",
|
@@ -196,42 +178,42 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
|
196
178
|
}]);
|
197
179
|
return AMSVaulting;
|
198
180
|
}(AMSCheckout);
|
199
|
-
export var AntomElement = /*#__PURE__*/function (
|
200
|
-
_inherits(AntomElement,
|
201
|
-
var
|
181
|
+
export var AntomElement = /*#__PURE__*/function (_AMSCheckout4) {
|
182
|
+
_inherits(AntomElement, _AMSCheckout4);
|
183
|
+
var _super5 = _createSuper(AntomElement);
|
202
184
|
function AntomElement(options) {
|
203
185
|
_classCallCheck(this, AntomElement);
|
204
186
|
var _options = Object.assign({}, options, {
|
205
187
|
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
206
188
|
appVersion: AMSPaymentElementAppVersion
|
207
189
|
});
|
208
|
-
return
|
190
|
+
return _super5.call(this, _options, [ComponentSignEnum.ELEMENT_PAYMENT]);
|
209
191
|
}
|
210
192
|
return _createClass(AntomElement);
|
211
193
|
}(AMSCheckout);
|
212
194
|
export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
|
213
195
|
_inherits(AddressElement, _AddressComponent);
|
214
|
-
var
|
196
|
+
var _super6 = _createSuper(AddressElement);
|
215
197
|
function AddressElement(options) {
|
216
198
|
_classCallCheck(this, AddressElement);
|
217
199
|
var _options = Object.assign({}, options, {
|
218
200
|
product: ProductSceneEnum.ELEMENT_ADDRESS,
|
219
201
|
appVersion: ADDRESSElementAppVersion
|
220
202
|
});
|
221
|
-
return
|
203
|
+
return _super6.call(this, _options);
|
222
204
|
}
|
223
205
|
return _createClass(AddressElement);
|
224
206
|
}(AddressComponent);
|
225
207
|
export var Element = /*#__PURE__*/function (_ElementComponent) {
|
226
208
|
_inherits(Element, _ElementComponent);
|
227
|
-
var
|
209
|
+
var _super7 = _createSuper(Element);
|
228
210
|
function Element(options) {
|
229
211
|
_classCallCheck(this, Element);
|
230
212
|
var _options = Object.assign({}, options, {
|
231
213
|
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
232
214
|
environment: options.environment
|
233
215
|
});
|
234
|
-
return
|
216
|
+
return _super7.call(this, _options);
|
235
217
|
}
|
236
218
|
return _createClass(Element);
|
237
219
|
}(ElementComponent);
|
@@ -270,9 +252,77 @@ export var AMSEasyPay = /*#__PURE__*/function () {
|
|
270
252
|
securityRegion: 'SG',
|
271
253
|
environment: 'prod'
|
272
254
|
};
|
273
|
-
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
|
255
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment, true);
|
274
256
|
}
|
275
257
|
}]);
|
276
258
|
return AMSEasyPay;
|
277
259
|
}();
|
260
|
+
export var AMSAutoDebit = /*#__PURE__*/function () {
|
261
|
+
function AMSAutoDebit(options) {
|
262
|
+
_classCallCheck(this, AMSAutoDebit);
|
263
|
+
_defineProperty(this, "core", void 0);
|
264
|
+
this.core = new AntomSDKCore();
|
265
|
+
this.core.registerProcessor(ProductSceneEnum.AUTO_DEBIT, '', new AutoDebitProcessor());
|
266
|
+
this.core.init(options, ProductSceneEnum.AUTO_DEBIT);
|
267
|
+
}
|
268
|
+
_createClass(AMSAutoDebit, [{
|
269
|
+
key: "createComponent",
|
270
|
+
value: function () {
|
271
|
+
var _createComponent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
272
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
273
|
+
while (1) switch (_context.prev = _context.next) {
|
274
|
+
case 0:
|
275
|
+
_context.prev = 0;
|
276
|
+
_context.next = 3;
|
277
|
+
return this.core.startBizFlow({
|
278
|
+
submitPayRequestExtra: {
|
279
|
+
notRedirectAfterComplete: params.notRedirectAfterComplete,
|
280
|
+
merchantAppointParam: params.merchantAppointParam
|
281
|
+
},
|
282
|
+
paymentSession: params.sessionData || params.paymentSessionData,
|
283
|
+
displayInfo: {
|
284
|
+
type: DisplayTypeEnum.popup
|
285
|
+
},
|
286
|
+
isAppWebview: params.isAppWebview
|
287
|
+
});
|
288
|
+
case 3:
|
289
|
+
_context.next = 9;
|
290
|
+
break;
|
291
|
+
case 5:
|
292
|
+
_context.prev = 5;
|
293
|
+
_context.t0 = _context["catch"](0);
|
294
|
+
this.core.getServiceProvider().getService('EventCenter').emit(EVENT.eventCallback.name, {
|
295
|
+
code: eventCodeEnum.SDK_CREATEPAYMENT_PARAMETER_ERROR,
|
296
|
+
message: (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || 'Initialization parameter exception.'
|
297
|
+
});
|
298
|
+
this.core.destroy();
|
299
|
+
case 9:
|
300
|
+
case "end":
|
301
|
+
return _context.stop();
|
302
|
+
}
|
303
|
+
}, _callee, this, [[0, 5]]);
|
304
|
+
}));
|
305
|
+
function createComponent(_x) {
|
306
|
+
return _createComponent.apply(this, arguments);
|
307
|
+
}
|
308
|
+
return createComponent;
|
309
|
+
}()
|
310
|
+
}, {
|
311
|
+
key: "unmount",
|
312
|
+
value: function unmount() {
|
313
|
+
this.core.destroy();
|
314
|
+
}
|
315
|
+
}], [{
|
316
|
+
key: "preload",
|
317
|
+
value: function preload() {
|
318
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
319
|
+
securityRegion: 'SG',
|
320
|
+
environment: 'prod'
|
321
|
+
};
|
322
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
|
323
|
+
PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT, options.securityRegion);
|
324
|
+
}
|
325
|
+
}]);
|
326
|
+
return AMSAutoDebit;
|
327
|
+
}();
|
278
328
|
export default AMSCheckout;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ComponentSignEnum,
|
1
|
+
import { ComponentSignEnum, DisplayTypeEnum, Ianalytics } from '../../types';
|
2
2
|
export declare const getAppPath: (environment: string, appVersion: string, componentSign: ComponentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean, elementLink?: string) => any;
|
3
3
|
export declare const getAppDomain: (domainParams: {
|
4
4
|
environment: string;
|
@@ -15,7 +15,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
15
15
|
* 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
|
16
16
|
* 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.
|
17
17
|
*/
|
18
|
-
import {
|
18
|
+
import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config/index";
|
19
19
|
import { ComponentSignEnum, ComponentSignEnumV2 } from "../../types";
|
20
20
|
import { isDebugLog } from "../../util/debug";
|
21
21
|
import { queryParse, serialize } from "../../util/index";
|
@@ -59,7 +59,7 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
|
59
59
|
};
|
60
60
|
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
|
61
61
|
var _signSupportMap;
|
62
|
-
var signSupportMap = (_signSupportMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_signSupportMap, 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(_signSupportMap, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0.0']));
|
62
|
+
var signSupportMap = (_signSupportMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_signSupportMap, 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(_defineProperty(_signSupportMap, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0.0']), ComponentSignEnum.AUTO_DEBIT_APM, ['1.0']));
|
63
63
|
var supportProductSceneVersion = signSupportMap[componentSign] || [];
|
64
64
|
// 从左到右,从旧到新
|
65
65
|
var isSupport = supportProductSceneVersion.find(function (it) {
|
@@ -103,7 +103,7 @@ export var getAppPath = function getAppPath() {
|
|
103
103
|
}
|
104
104
|
// 地址应用特殊处理
|
105
105
|
if (componentSign === ComponentSignEnum.ELEMENT_ADDRESS) {
|
106
|
-
return "".concat(
|
106
|
+
return "".concat(v2AppMarmotMap[environment], "/element-address/").concat(finalAppVersion, "/pages/address/index.html");
|
107
107
|
}
|
108
108
|
// element应用特殊处理
|
109
109
|
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
|
@@ -117,9 +117,9 @@ export var getAppPath = function getAppPath() {
|
|
117
117
|
}
|
118
118
|
if (isExpressCheckout) {
|
119
119
|
// express_checkout模式走单独映射
|
120
|
-
return "".concat(
|
120
|
+
return "".concat(v2AppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/express_checkout/index.html");
|
121
121
|
} else {
|
122
|
-
return "".concat(
|
122
|
+
return "".concat(v2AppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html");
|
123
123
|
}
|
124
124
|
}
|
125
125
|
return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
|
@@ -11,12 +11,14 @@ export type IChannelBehavior = {
|
|
11
11
|
type GetDoubleFaParams = {
|
12
12
|
instanceId: string;
|
13
13
|
paymentSessionData: string;
|
14
|
+
paymentSessionObj: IPaymentSessionMetaData;
|
14
15
|
locale: string;
|
15
16
|
paymentMethodType: string;
|
16
17
|
env: string;
|
17
18
|
sdkVersion: string;
|
19
|
+
notRedirectAfterComplete: boolean;
|
18
20
|
};
|
19
|
-
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
|
21
|
+
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData, notRedirectAfterComplete?: boolean): IChannelBehavior | undefined;
|
20
22
|
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
21
23
|
export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
|
22
24
|
export declare class ApplePaySdk {
|