@alipay/ams-checkout 0.0.1742280578-dev.0 → 0.0.1742285920-dev.0
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 +468 -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 +66 -47
- 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
@@ -24,18 +24,20 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
24
24
|
* 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
25
|
* 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
26
|
*/
|
27
|
-
import { ADDRESSElementAppVersion,
|
27
|
+
import { ADDRESSElementAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
|
28
28
|
import { AddressComponent } from "./core/component/address";
|
29
29
|
import { ElementComponent } from "./core/component/element";
|
30
|
+
// import { ElementComponent } from './core/component/oldElement';
|
30
31
|
import { AMSComponent } from "./core/component/index";
|
32
|
+
import PreloadHelper from "./foundation/utils/preload_helper";
|
31
33
|
import { ComponentSignEnum, DisplayTypeEnum, PaymentMethodCategoryTypeEnum } from "./types";
|
32
34
|
import { ProductSceneEnum } from "./types/index";
|
33
35
|
import { LogConfig, Logger } from "./util/logger";
|
34
|
-
import PreloadHelper from "./foundation/utils/preload_helper";
|
35
36
|
var logger = new Logger(LogConfig, true);
|
36
37
|
export { AMSCheckoutPage } from "./core/component/ckp";
|
37
38
|
export * from "./types";
|
38
39
|
import { AntomSDKCore } from "./foundation/core";
|
40
|
+
import { AutoDebitProcessor } from "./foundation/product-processor/autoDebit";
|
39
41
|
import { EasySafePayProcessor } from "./foundation/product-processor/easysafepay";
|
40
42
|
export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
41
43
|
_inherits(AMSCheckout, _AMSComponent);
|
@@ -52,39 +54,15 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
|
52
54
|
}
|
53
55
|
return _createClass(AMSCheckout);
|
54
56
|
}(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);
|
57
|
+
export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout) {
|
58
|
+
_inherits(AMSAutoDebitPay, _AMSCheckout);
|
59
|
+
var _super2 = _createSuper(AMSAutoDebitPay);
|
82
60
|
function AMSAutoDebitPay(options) {
|
83
61
|
_classCallCheck(this, AMSAutoDebitPay);
|
84
62
|
var _options = Object.assign({}, options, {
|
85
63
|
product: ProductSceneEnum.AUTO_DEBIT_PAY
|
86
64
|
});
|
87
|
-
return
|
65
|
+
return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
|
88
66
|
}
|
89
67
|
_createClass(AMSAutoDebitPay, null, [{
|
90
68
|
key: "preload",
|
@@ -99,9 +77,9 @@ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
|
99
77
|
}]);
|
100
78
|
return AMSAutoDebitPay;
|
101
79
|
}(AMSCheckout);
|
102
|
-
export var AMSCashierPayment = /*#__PURE__*/function (
|
103
|
-
_inherits(AMSCashierPayment,
|
104
|
-
var
|
80
|
+
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout2) {
|
81
|
+
_inherits(AMSCashierPayment, _AMSCheckout2);
|
82
|
+
var _super3 = _createSuper(AMSCashierPayment);
|
105
83
|
function AMSCashierPayment(options) {
|
106
84
|
_classCallCheck(this, AMSCashierPayment);
|
107
85
|
var _options = Object.assign({}, options, {
|
@@ -127,7 +105,7 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
|
127
105
|
errorMessage: error
|
128
106
|
});
|
129
107
|
}
|
130
|
-
return
|
108
|
+
return _super3.call(this, _options, currentChannelType);
|
131
109
|
}
|
132
110
|
_createClass(AMSCashierPayment, null, [{
|
133
111
|
key: "preload",
|
@@ -172,16 +150,16 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
|
172
150
|
}]);
|
173
151
|
return AMSCashierPayment;
|
174
152
|
}(AMSCheckout);
|
175
|
-
export var AMSVaulting = /*#__PURE__*/function (
|
176
|
-
_inherits(AMSVaulting,
|
177
|
-
var
|
153
|
+
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout3) {
|
154
|
+
_inherits(AMSVaulting, _AMSCheckout3);
|
155
|
+
var _super4 = _createSuper(AMSVaulting);
|
178
156
|
function AMSVaulting(options) {
|
179
157
|
_classCallCheck(this, AMSVaulting);
|
180
158
|
var _options = Object.assign({}, options, {
|
181
159
|
product: ProductSceneEnum.VAULTING,
|
182
160
|
appVersion: AMSVaultingAppVersion
|
183
161
|
});
|
184
|
-
return
|
162
|
+
return _super4.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
|
185
163
|
}
|
186
164
|
_createClass(AMSVaulting, null, [{
|
187
165
|
key: "preload",
|
@@ -196,42 +174,42 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
|
196
174
|
}]);
|
197
175
|
return AMSVaulting;
|
198
176
|
}(AMSCheckout);
|
199
|
-
export var AntomElement = /*#__PURE__*/function (
|
200
|
-
_inherits(AntomElement,
|
201
|
-
var
|
177
|
+
export var AntomElement = /*#__PURE__*/function (_AMSCheckout4) {
|
178
|
+
_inherits(AntomElement, _AMSCheckout4);
|
179
|
+
var _super5 = _createSuper(AntomElement);
|
202
180
|
function AntomElement(options) {
|
203
181
|
_classCallCheck(this, AntomElement);
|
204
182
|
var _options = Object.assign({}, options, {
|
205
183
|
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
206
184
|
appVersion: AMSPaymentElementAppVersion
|
207
185
|
});
|
208
|
-
return
|
186
|
+
return _super5.call(this, _options, [ComponentSignEnum.ELEMENT_PAYMENT]);
|
209
187
|
}
|
210
188
|
return _createClass(AntomElement);
|
211
189
|
}(AMSCheckout);
|
212
190
|
export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
|
213
191
|
_inherits(AddressElement, _AddressComponent);
|
214
|
-
var
|
192
|
+
var _super6 = _createSuper(AddressElement);
|
215
193
|
function AddressElement(options) {
|
216
194
|
_classCallCheck(this, AddressElement);
|
217
195
|
var _options = Object.assign({}, options, {
|
218
196
|
product: ProductSceneEnum.ELEMENT_ADDRESS,
|
219
197
|
appVersion: ADDRESSElementAppVersion
|
220
198
|
});
|
221
|
-
return
|
199
|
+
return _super6.call(this, _options);
|
222
200
|
}
|
223
201
|
return _createClass(AddressElement);
|
224
202
|
}(AddressComponent);
|
225
203
|
export var Element = /*#__PURE__*/function (_ElementComponent) {
|
226
204
|
_inherits(Element, _ElementComponent);
|
227
|
-
var
|
205
|
+
var _super7 = _createSuper(Element);
|
228
206
|
function Element(options) {
|
229
207
|
_classCallCheck(this, Element);
|
230
208
|
var _options = Object.assign({}, options, {
|
231
209
|
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
232
210
|
environment: options.environment
|
233
211
|
});
|
234
|
-
return
|
212
|
+
return _super7.call(this, _options);
|
235
213
|
}
|
236
214
|
return _createClass(Element);
|
237
215
|
}(ElementComponent);
|
@@ -270,9 +248,50 @@ export var AMSEasyPay = /*#__PURE__*/function () {
|
|
270
248
|
securityRegion: 'SG',
|
271
249
|
environment: 'prod'
|
272
250
|
};
|
273
|
-
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
|
251
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment, true);
|
274
252
|
}
|
275
253
|
}]);
|
276
254
|
return AMSEasyPay;
|
277
255
|
}();
|
256
|
+
export var AMSAutoDebit = /*#__PURE__*/function () {
|
257
|
+
function AMSAutoDebit(options) {
|
258
|
+
_classCallCheck(this, AMSAutoDebit);
|
259
|
+
_defineProperty(this, "core", void 0);
|
260
|
+
this.core = new AntomSDKCore();
|
261
|
+
this.core.registerProcessor(ProductSceneEnum.AUTO_DEBIT, '', new AutoDebitProcessor());
|
262
|
+
this.core.init(options, ProductSceneEnum.AUTO_DEBIT);
|
263
|
+
}
|
264
|
+
_createClass(AMSAutoDebit, [{
|
265
|
+
key: "createComponent",
|
266
|
+
value: function createComponent(params) {
|
267
|
+
return this.core.startBizFlow({
|
268
|
+
submitPayRequestExtra: {
|
269
|
+
notRedirectAfterComplete: params.notRedirectAfterComplete,
|
270
|
+
merchantAppointParam: params.merchantAppointParam
|
271
|
+
},
|
272
|
+
paymentSession: params.sessionData || params.paymentSessionData,
|
273
|
+
displayInfo: {
|
274
|
+
type: DisplayTypeEnum.popup
|
275
|
+
},
|
276
|
+
isAppWebview: params.isAppWebview
|
277
|
+
});
|
278
|
+
}
|
279
|
+
}, {
|
280
|
+
key: "unmount",
|
281
|
+
value: function unmount() {
|
282
|
+
this.core.destroy();
|
283
|
+
}
|
284
|
+
}], [{
|
285
|
+
key: "preload",
|
286
|
+
value: function preload() {
|
287
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
288
|
+
securityRegion: 'SG',
|
289
|
+
environment: 'prod'
|
290
|
+
};
|
291
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
|
292
|
+
PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT, options.securityRegion);
|
293
|
+
}
|
294
|
+
}]);
|
295
|
+
return AMSAutoDebit;
|
296
|
+
}();
|
278
297
|
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 {
|
@@ -14,6 +14,8 @@ import { getApplePayPaymentSession, submitPayInfo } from "../../service";
|
|
14
14
|
import { EnvironmentEnum } from "../../types";
|
15
15
|
import { device, isEmpty } from "../../util";
|
16
16
|
import { APPLE_PAY_RECURRING_VERSION, APPLE_PAY_VERSION } from "../applepay/interface";
|
17
|
+
import { getDoubleFaUrlFromSession } from "../../foundation/utils/web_app_url_utils";
|
18
|
+
import { MODE } from "../../constant/easysafepay";
|
17
19
|
var APPLEPAYERRORENUM = /*#__PURE__*/function (APPLEPAYERRORENUM) {
|
18
20
|
APPLEPAYERRORENUM["APPLE_PAY_MISSING_DATA"] = "APPLE_PAY_MISSING_DATA";
|
19
21
|
APPLEPAYERRORENUM["APPLE_PAY_NOT_SUPPORTED"] = "APPLE_PAY_NOT_SUPPORTED";
|
@@ -27,7 +29,7 @@ var PAYMENT_STATUS = /*#__PURE__*/function (PAYMENT_STATUS) {
|
|
27
29
|
PAYMENT_STATUS["NORMAL"] = "NORMAL";
|
28
30
|
return PAYMENT_STATUS;
|
29
31
|
}(PAYMENT_STATUS || {});
|
30
|
-
export function getChannelBehavior(paymentSessionMetaData) {
|
32
|
+
export function getChannelBehavior(paymentSessionMetaData, notRedirectAfterComplete) {
|
31
33
|
var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4, _paymentSessionMetaDa5, _paymentSessionMetaDa6, _paymentSessionMetaDa7, _paymentSessionMetaDa8;
|
32
34
|
// TOSS EASYPAY 2.0
|
33
35
|
if ('BANKTRANSFER_QUICKPAY' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa2 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa2 === void 0 ? void 0 : _paymentSessionMetaDa2.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa3 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa3 === void 0 ? void 0 : _paymentSessionMetaDa3.paymentMethodCategoryType) === 'APM' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa4 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa4 === void 0 ? void 0 : _paymentSessionMetaDa4.productSceneVersion) === '2.0') {
|
@@ -40,7 +42,8 @@ export function getChannelBehavior(paymentSessionMetaData) {
|
|
40
42
|
buildSubmitPayExtParams: function buildSubmitPayExtParams(params) {
|
41
43
|
var callBackUrl = getDoubleFaUrl(params);
|
42
44
|
return {
|
43
|
-
callBackUrl: callBackUrl
|
45
|
+
callBackUrl: callBackUrl,
|
46
|
+
notRedirectAfterComplete: notRedirectAfterComplete === true
|
44
47
|
};
|
45
48
|
}
|
46
49
|
};
|
@@ -65,20 +68,15 @@ export function getDoubleFaUrl(params) {
|
|
65
68
|
var instanceId = params.instanceId,
|
66
69
|
paymentMethodType = params.paymentMethodType,
|
67
70
|
paymentSessionData = params.paymentSessionData,
|
71
|
+
paymentSessionObj = params.paymentSessionObj,
|
68
72
|
locale = params.locale,
|
69
73
|
env = params.env,
|
70
|
-
sdkVersion = params.sdkVersion
|
74
|
+
sdkVersion = params.sdkVersion,
|
75
|
+
notRedirectAfterComplete = params.notRedirectAfterComplete;
|
71
76
|
var isLandscapeOrientation = false; // Web 不含横屏
|
72
77
|
|
73
|
-
var
|
74
|
-
|
75
|
-
dev: "http://page.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
76
|
-
sit: "http://page.test.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
77
|
-
pre: "https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
78
|
-
prod: "https://ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html")
|
79
|
-
};
|
80
|
-
var doubleFaBaseUrl = DOUBLE_FA_URL_MAPPING[env] || DOUBLE_FA_URL_MAPPING.prod;
|
81
|
-
return "".concat(doubleFaBaseUrl, "?scene=cashierResultPage&instanceId=").concat(instanceId, "&paymentSessionData=").concat(encodeURIComponent(paymentSessionData), "&isLandscape=").concat(isLandscapeOrientation ? 'true' : '', "&pmt=").concat(paymentMethodType, "&locale=").concat(locale, "&sdkVersion=").concat(sdkVersion);
|
78
|
+
var baseDoubleFaUrl = getDoubleFaUrlFromSession(paymentSessionObj, env);
|
79
|
+
return "".concat(baseDoubleFaUrl) + '?' + "scene=cashierResultPage" + '&' + "instanceId=".concat(instanceId) + '&' + "paymentSessionData=".concat(encodeURIComponent(paymentSessionData)) + '&' + "isLandscape=".concat(isLandscapeOrientation ? 'true' : '') + '&' + "pmt=".concat(paymentMethodType) + '&' + "locale=".concat(locale) + '&' + "mode=".concat(MODE.SDK) + '&' + "sdkVersion=".concat(sdkVersion) + '&' + "¬RedirectAfterComplete=".concat(notRedirectAfterComplete);
|
82
80
|
}
|
83
81
|
export var handleGooglePay = function handleGooglePay(data) {
|
84
82
|
return new Promise(function (resolve, reject) {
|