@alipay/ams-checkout 1.22.0 → 1.24.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/config/index.d.ts +7 -7
- package/esm/config/index.js +10 -10
- package/esm/constant/index.d.ts +9 -0
- package/esm/constant/index.js +11 -0
- package/esm/core/bus/ability/globalData.d.ts +10 -0
- package/esm/core/bus/ability/globalData.js +89 -0
- package/esm/core/bus/ability/request.d.ts +10 -0
- package/esm/core/bus/ability/request.js +151 -0
- package/esm/core/bus/interface.d.ts +12 -0
- package/esm/core/bus/interface.js +16 -2
- package/esm/core/component/address.d.ts +2 -2
- package/esm/core/component/appPreloadProcessing.js +2 -0
- package/esm/core/component/ckp/index.d.ts +3 -3
- package/esm/core/component/ckp/index.js +6 -5
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +60 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +816 -0
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +491 -0
- package/esm/core/component/element/type.d.ts +184 -0
- package/esm/core/component/element/type.js +35 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/core/component/index.d.ts +5 -5
- package/esm/core/component/index.js +20 -16
- package/esm/core/drop-in/index.d.ts +2 -2
- package/esm/core/drop-in/index.js +2 -2
- package/esm/core/instance/index.d.ts +5 -5
- package/esm/core/instance/index.js +11 -10
- package/esm/foundation/core/index.d.ts +26 -0
- package/esm/foundation/core/index.js +301 -0
- package/esm/foundation/index.d.ts +72 -0
- package/esm/foundation/index.js +42 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +15 -0
- package/esm/foundation/product-processor/easysafepay/deps.js +9 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +26 -0
- package/esm/foundation/product-processor/easysafepay/index.js +536 -0
- package/esm/foundation/service/container/index.d.ts +28 -0
- package/esm/foundation/service/container/index.js +256 -0
- package/esm/foundation/service/container/popup.d.ts +17 -0
- package/esm/foundation/service/container/popup.js +103 -0
- package/esm/foundation/service/container/utils.d.ts +7 -0
- package/esm/foundation/service/container/utils.js +48 -0
- package/esm/foundation/service/event-bus/ability/callback.d.ts +9 -0
- package/esm/foundation/service/event-bus/ability/callback.js +55 -0
- package/esm/foundation/service/event-bus/ability/globalData.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/event-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/request.js +151 -0
- package/esm/foundation/service/event-bus/ability/security.d.ts +12 -0
- package/esm/foundation/service/event-bus/ability/security.js +151 -0
- package/esm/foundation/service/event-bus/ability/tracker.d.ts +9 -0
- package/esm/foundation/service/event-bus/ability/tracker.js +80 -0
- package/esm/foundation/service/event-bus/busManager.d.ts +127 -0
- package/esm/foundation/service/event-bus/busManager.js +398 -0
- package/esm/foundation/service/event-bus/index.d.ts +20 -0
- package/esm/foundation/service/event-bus/index.js +88 -0
- package/esm/foundation/service/event-center.d.ts +75 -0
- package/esm/foundation/service/event-center.js +244 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/global-data/index.js +69 -0
- package/esm/foundation/service/index.d.ts +19 -0
- package/esm/foundation/service/index.js +82 -0
- package/esm/foundation/service/log/index.d.ts +43 -0
- package/esm/foundation/service/log/index.js +235 -0
- package/esm/foundation/service/log/types.d.ts +32 -0
- package/esm/foundation/service/log/types.js +1 -0
- package/esm/foundation/service/requester/deps.d.ts +17 -0
- package/esm/foundation/service/requester/deps.js +11 -0
- package/esm/foundation/service/requester/requester.d.ts +22 -0
- package/esm/foundation/service/requester/requester.js +211 -0
- package/esm/foundation/service/security/index.d.ts +26 -0
- package/esm/foundation/service/security/index.js +216 -0
- package/esm/{util → foundation/service/security}/security.d.ts +2 -2
- package/esm/{util → foundation/service/security}/security.js +3 -3
- package/esm/foundation/types/index.d.ts +4 -0
- package/esm/foundation/types/index.js +4 -0
- package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
- package/esm/foundation/utils/gray_scale_utils.js +40 -0
- package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_context_utils.js +57 -0
- package/esm/foundation/utils/redirect_utils.d.ts +6 -0
- package/esm/foundation/utils/redirect_utils.js +99 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/system_events.js +71 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +37 -0
- package/esm/foundation/utils/web_app_url_utils.js +97 -0
- package/esm/index.d.ts +16 -10
- package/esm/index.js +70 -59
- package/esm/plugin/applepay/component.js +3 -3
- package/esm/plugin/applepay/service.d.ts +2 -2
- package/esm/plugin/applepay/service.js +2 -2
- package/esm/plugin/component/cashierApp.d.ts +7 -5
- package/esm/plugin/component/cashierApp.js +16 -8
- package/esm/plugin/component/channel.d.ts +4 -3
- package/esm/plugin/component/channel.js +37 -1
- package/esm/plugin/component/component.inline.style.d.ts +4 -4
- package/esm/plugin/component/component.inline.style.js +10 -7
- package/esm/plugin/component/component.popup.style.d.ts +15 -6
- package/esm/plugin/component/component.popup.style.js +33 -15
- package/esm/plugin/component/index.d.ts +8 -7
- package/esm/plugin/component/index.js +190 -113
- package/esm/plugin/const.js +5 -5
- package/esm/plugin/drop-in/index.d.ts +5 -5
- package/esm/plugin/drop-in/index.js +7 -7
- package/esm/plugin/payment-element/utils.d.ts +1 -1
- package/esm/plugin/payment-element/utils.js +2 -1
- package/esm/plugin/type.d.ts +4 -4
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +2 -0
- package/esm/types/index.d.ts +240 -38
- package/esm/types/index.js +103 -59
- package/esm/util/createIframeNode.d.ts +2 -2
- package/esm/util/createIframeNode.js +3 -3
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +3 -4
- package/package.json +2 -1
@@ -0,0 +1,97 @@
|
|
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 _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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
|
+
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 { ComponentSignEnum } from "../../types";
|
6
|
+
import { marmotMap } from "../../config";
|
7
|
+
import { queryParse, serialize } from "../../util";
|
8
|
+
import { isDebugLog } from "../../util/debug";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Tell the SDK which version of the Web App to load.
|
12
|
+
* Sent by server inside paymentSession.
|
13
|
+
*/
|
14
|
+
|
15
|
+
export var getWebAppUrl = function getWebAppUrl(params) {
|
16
|
+
var environment = params.environment,
|
17
|
+
sdkMetaData = params.sdkMetaData,
|
18
|
+
productSceneVersion = params.productSceneVersion,
|
19
|
+
paymentMethodCategoryType = params.paymentMethodCategoryType,
|
20
|
+
query = params.query;
|
21
|
+
var path = getAppPath(environment, sdkMetaData, productSceneVersion, paymentMethodCategoryType);
|
22
|
+
var _queryParse = queryParse(),
|
23
|
+
_sandbox = _queryParse._sandbox,
|
24
|
+
_light_sandbox = _queryParse._light_sandbox,
|
25
|
+
_queryParse$requestHo = _queryParse.requestHost,
|
26
|
+
requestHost = _queryParse$requestHo === void 0 ? '' : _queryParse$requestHo,
|
27
|
+
_queryParse$groupId = _queryParse.groupId,
|
28
|
+
groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
|
29
|
+
LOCAL_MOCK = _queryParse.LOCAL_MOCK,
|
30
|
+
_displayType = _queryParse._displayType;
|
31
|
+
var urlParams = {};
|
32
|
+
for (var key in query) {
|
33
|
+
urlParams[key] = '' + query[key];
|
34
|
+
}
|
35
|
+
urlParams.appMatched = sdkMetaData.webAppVersion ? 'true' : 'false';
|
36
|
+
urlParams.sdkVersion = sdkMetaData.sdkVersion;
|
37
|
+
urlParams.refUrl = window.location.href;
|
38
|
+
urlParams._componentStartTime = "".concat(Date.now());
|
39
|
+
if (LOCAL_MOCK) urlParams.LOCAL_MOCK = LOCAL_MOCK;
|
40
|
+
if (requestHost) urlParams.requestHost = requestHost;
|
41
|
+
if (groupId) urlParams.groupId = groupId;
|
42
|
+
if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
|
43
|
+
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
44
|
+
if (_displayType) urlParams.displayType = _displayType;
|
45
|
+
var locationSearch = serialize(urlParams);
|
46
|
+
if (isDebugLog()) {
|
47
|
+
console.log('appUpgrade#getIframeUrl#appMatched', urlParams.appMatched);
|
48
|
+
console.log('appUpgrade#getIframeUrl#url', path, locationSearch);
|
49
|
+
}
|
50
|
+
return {
|
51
|
+
path: path,
|
52
|
+
locationSearch: locationSearch
|
53
|
+
};
|
54
|
+
};
|
55
|
+
var getAppPath = function getAppPath() {
|
56
|
+
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'prod';
|
57
|
+
var sdkMetaData = arguments.length > 1 ? arguments[1] : undefined;
|
58
|
+
var productSceneVersion = arguments.length > 2 ? arguments[2] : undefined;
|
59
|
+
var paymentMethodCategoryType = arguments.length > 3 ? arguments[3] : undefined;
|
60
|
+
var _ref = queryParse() || {},
|
61
|
+
urlTestHost = _ref.host;
|
62
|
+
// only for test while testurl?host=https://xxxxx.test.html
|
63
|
+
if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
|
64
|
+
return urlTestHost;
|
65
|
+
}
|
66
|
+
var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
|
67
|
+
var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
|
68
|
+
var webAppVersion = sdkMetaData.webAppVersion;
|
69
|
+
return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.").concat(webAppVersion, ".html");
|
70
|
+
};
|
71
|
+
export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo) {
|
72
|
+
if (!extendInfo) {
|
73
|
+
return [];
|
74
|
+
}
|
75
|
+
try {
|
76
|
+
var _extendInfoJson$sdkUp;
|
77
|
+
var extendInfoJson = JSON.parse(extendInfo);
|
78
|
+
return extendInfoJson === null || extendInfoJson === void 0 || (_extendInfoJson$sdkUp = extendInfoJson.sdkUpgradeInfo) === null || _extendInfoJson$sdkUp === void 0 ? void 0 : _extendInfoJson$sdkUp.versions;
|
79
|
+
} catch (error) {
|
80
|
+
console.error('Parse the config for Web app failed#', error);
|
81
|
+
return [];
|
82
|
+
}
|
83
|
+
};
|
84
|
+
var getValidProductSceneVersion = function getValidProductSceneVersion(productScene, productSceneVer, paymentMethodCategoryType) {
|
85
|
+
var _supportMapping;
|
86
|
+
var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']));
|
87
|
+
var targetVersions = supportMapping[productScene + '_' + paymentMethodCategoryType];
|
88
|
+
if (!targetVersions) {
|
89
|
+
return '';
|
90
|
+
}
|
91
|
+
// 从左到右,从旧到新
|
92
|
+
var isSupport = targetVersions.find(function (it) {
|
93
|
+
return it === productSceneVer;
|
94
|
+
});
|
95
|
+
var latestVersion = targetVersions[targetVersions.length - 1];
|
96
|
+
return isSupport ? productSceneVer : latestVersion;
|
97
|
+
};
|
package/esm/index.d.ts
CHANGED
@@ -1,30 +1,36 @@
|
|
1
|
-
import { AMSComponent } from './core/component/index';
|
2
1
|
import { AddressComponent } from './core/component/address';
|
3
|
-
import {
|
2
|
+
import { ElementComponent } from './core/component/element';
|
3
|
+
import { AMSComponent } from './core/component/index';
|
4
|
+
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IOptionsParams } from './types';
|
4
5
|
export { AMSCheckoutPage } from './core/component/ckp';
|
5
6
|
export * from './types';
|
6
7
|
export declare class AMSCheckout extends AMSComponent {
|
7
|
-
constructor(_options:
|
8
|
+
constructor(_options: IOptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
8
9
|
}
|
9
10
|
export declare class AMSAutoDebit extends AMSCheckout {
|
10
|
-
constructor(options:
|
11
|
+
constructor(options: IOptionsParams);
|
11
12
|
}
|
12
13
|
export declare class AMSAutoDebitPay extends AMSCheckout {
|
13
|
-
constructor(options:
|
14
|
+
constructor(options: IOptionsParams);
|
14
15
|
}
|
15
|
-
export declare class AMSEasyPay
|
16
|
-
|
16
|
+
export declare class AMSEasyPay {
|
17
|
+
private core;
|
18
|
+
constructor(options: IOptionsParams);
|
19
|
+
createComponent(params: IcreateComponent): void;
|
17
20
|
}
|
18
21
|
export declare class AMSCashierPayment extends AMSCheckout {
|
19
|
-
constructor(options:
|
22
|
+
constructor(options: IOptionsParams);
|
20
23
|
}
|
21
24
|
export declare class AMSVaulting extends AMSCheckout {
|
22
|
-
constructor(options:
|
25
|
+
constructor(options: IOptionsParams);
|
23
26
|
}
|
24
27
|
export declare class AntomElement extends AMSCheckout {
|
25
|
-
constructor(options:
|
28
|
+
constructor(options: IOptionsParams);
|
26
29
|
}
|
27
30
|
export declare class AddressElement extends AddressComponent {
|
28
31
|
constructor(options: IoptionsAddressParams);
|
29
32
|
}
|
33
|
+
export declare class Element extends ElementComponent {
|
34
|
+
constructor(options: IElementOptions);
|
35
|
+
}
|
30
36
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -21,11 +21,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
21
21
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
22
22
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
23
23
|
*/
|
24
|
-
import { AMSAutoDebitAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSEasyPayAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion
|
25
|
-
import { AMSComponent } from "./core/component/index";
|
24
|
+
import { ADDRESSElementAppVersion, AMSAutoDebitAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSEasyPayAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
|
26
25
|
import { AddressComponent } from "./core/component/address";
|
27
|
-
import {
|
28
|
-
import {
|
26
|
+
import { ElementComponent } from "./core/component/element";
|
27
|
+
import { AMSComponent } from "./core/component/index";
|
28
|
+
import { AntomSDKCore } from "./foundation/core";
|
29
|
+
import { EasySafePayProcessor } from "./foundation/product-processor/easysafepay";
|
30
|
+
import { ComponentSignEnum, DisplayTypeEnum } from "./types";
|
31
|
+
import { ProductSceneEnum } from "./types/index";
|
32
|
+
import { LogConfig, Logger } from "./util/logger";
|
29
33
|
var logger = new Logger(LogConfig, true);
|
30
34
|
export { AMSCheckoutPage } from "./core/component/ckp";
|
31
35
|
export * from "./types";
|
@@ -50,10 +54,10 @@ export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
|
50
54
|
function AMSAutoDebit(options) {
|
51
55
|
_classCallCheck(this, AMSAutoDebit);
|
52
56
|
var _options = Object.assign({}, options, {
|
53
|
-
product:
|
57
|
+
product: ProductSceneEnum.AUTO_DEBIT,
|
54
58
|
appVersion: AMSAutoDebitAppVersion
|
55
59
|
});
|
56
|
-
return _super2.call(this, _options, [
|
60
|
+
return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_WALLET]);
|
57
61
|
}
|
58
62
|
return _createClass(AMSAutoDebit);
|
59
63
|
}(AMSCheckout);
|
@@ -63,64 +67,58 @@ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
|
63
67
|
function AMSAutoDebitPay(options) {
|
64
68
|
_classCallCheck(this, AMSAutoDebitPay);
|
65
69
|
var _options = Object.assign({}, options, {
|
66
|
-
product:
|
70
|
+
product: ProductSceneEnum.AUTO_DEBIT_PAY,
|
71
|
+
appVersion: AMSEasyPayAppVersion
|
67
72
|
});
|
68
|
-
return _super3.call(this, _options, [
|
73
|
+
return _super3.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
|
69
74
|
}
|
70
75
|
return _createClass(AMSAutoDebitPay);
|
71
76
|
}(AMSCheckout);
|
72
|
-
export var AMSEasyPay = /*#__PURE__*/function (
|
73
|
-
_inherits(AMSEasyPay, _AMSCheckout3);
|
74
|
-
var _super4 = _createSuper(AMSEasyPay);
|
77
|
+
export var AMSEasyPay = /*#__PURE__*/function () {
|
75
78
|
function AMSEasyPay(options) {
|
76
79
|
_classCallCheck(this, AMSEasyPay);
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
logger.logError({
|
95
|
-
title: 'performance_optimization_get_previousChannel_error'
|
96
|
-
}, {
|
97
|
-
error: error
|
80
|
+
_defineProperty(this, "core", void 0);
|
81
|
+
this.core = new AntomSDKCore();
|
82
|
+
this.core.registerProcessor(ProductSceneEnum.EASY_PAY, '', new EasySafePayProcessor());
|
83
|
+
this.core.init(options, ProductSceneEnum.EASY_PAY);
|
84
|
+
}
|
85
|
+
_createClass(AMSEasyPay, [{
|
86
|
+
key: "createComponent",
|
87
|
+
value: function createComponent(params) {
|
88
|
+
this.core.startBizFlow({
|
89
|
+
submitPayRequestExtra: {
|
90
|
+
notRedirectAfterComplete: params.notRedirectAfterComplete,
|
91
|
+
merchantAppointParam: params.merchantAppointParam
|
92
|
+
},
|
93
|
+
paymentSession: params.sessionData || params.paymentSessionData,
|
94
|
+
displayInfo: {
|
95
|
+
type: DisplayTypeEnum.popup
|
96
|
+
}
|
98
97
|
});
|
99
98
|
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
var _super5 = _createSuper(AMSCashierPayment);
|
99
|
+
}]);
|
100
|
+
return AMSEasyPay;
|
101
|
+
}();
|
102
|
+
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
103
|
+
_inherits(AMSCashierPayment, _AMSCheckout3);
|
104
|
+
var _super4 = _createSuper(AMSCashierPayment);
|
107
105
|
function AMSCashierPayment(options) {
|
108
106
|
_classCallCheck(this, AMSCashierPayment);
|
109
107
|
var _options = Object.assign({}, options, {
|
110
|
-
product:
|
108
|
+
product: ProductSceneEnum.CASHIER_PAYMENT,
|
111
109
|
appVersion: AMSCashierPaymentAppVersion
|
112
110
|
});
|
113
111
|
var currentChannelType;
|
114
112
|
try {
|
115
113
|
var previousChannelStr = localStorage.getItem('antom_checkout_previousChannel');
|
116
114
|
var previousChannel = JSON.parse(previousChannelStr) || {};
|
117
|
-
var
|
118
|
-
|
119
|
-
channelType =
|
120
|
-
if ([
|
115
|
+
var _ref = previousChannel || {},
|
116
|
+
_ref$channelType = _ref.channelType,
|
117
|
+
channelType = _ref$channelType === void 0 ? '' : _ref$channelType;
|
118
|
+
if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM, ComponentSignEnum.CASHIER_PAYMENT_BANK].includes(channelType)) {
|
121
119
|
currentChannelType = [channelType];
|
122
120
|
} else {
|
123
|
-
currentChannelType = [
|
121
|
+
currentChannelType = [ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM];
|
124
122
|
}
|
125
123
|
} catch (error) {
|
126
124
|
logger.logError({
|
@@ -129,47 +127,60 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout4) {
|
|
129
127
|
error: error
|
130
128
|
});
|
131
129
|
}
|
132
|
-
return
|
130
|
+
return _super4.call(this, _options, currentChannelType);
|
133
131
|
}
|
134
132
|
return _createClass(AMSCashierPayment);
|
135
133
|
}(AMSCheckout);
|
136
|
-
export var AMSVaulting = /*#__PURE__*/function (
|
137
|
-
_inherits(AMSVaulting,
|
138
|
-
var
|
134
|
+
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
135
|
+
_inherits(AMSVaulting, _AMSCheckout4);
|
136
|
+
var _super5 = _createSuper(AMSVaulting);
|
139
137
|
function AMSVaulting(options) {
|
140
138
|
_classCallCheck(this, AMSVaulting);
|
141
139
|
var _options = Object.assign({}, options, {
|
142
|
-
product:
|
140
|
+
product: ProductSceneEnum.VAULTING,
|
143
141
|
appVersion: AMSVaultingAppVersion
|
144
142
|
});
|
145
|
-
return
|
143
|
+
return _super5.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
|
146
144
|
}
|
147
145
|
return _createClass(AMSVaulting);
|
148
146
|
}(AMSCheckout);
|
149
|
-
export var AntomElement = /*#__PURE__*/function (
|
150
|
-
_inherits(AntomElement,
|
151
|
-
var
|
147
|
+
export var AntomElement = /*#__PURE__*/function (_AMSCheckout5) {
|
148
|
+
_inherits(AntomElement, _AMSCheckout5);
|
149
|
+
var _super6 = _createSuper(AntomElement);
|
152
150
|
function AntomElement(options) {
|
153
151
|
_classCallCheck(this, AntomElement);
|
154
152
|
var _options = Object.assign({}, options, {
|
155
|
-
product:
|
153
|
+
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
156
154
|
appVersion: AMSPaymentElementAppVersion
|
157
155
|
});
|
158
|
-
return
|
156
|
+
return _super6.call(this, _options, [ComponentSignEnum.ELEMENT_PAYMENT]);
|
159
157
|
}
|
160
158
|
return _createClass(AntomElement);
|
161
159
|
}(AMSCheckout);
|
162
160
|
export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
|
163
161
|
_inherits(AddressElement, _AddressComponent);
|
164
|
-
var
|
162
|
+
var _super7 = _createSuper(AddressElement);
|
165
163
|
function AddressElement(options) {
|
166
164
|
_classCallCheck(this, AddressElement);
|
167
165
|
var _options = Object.assign({}, options, {
|
168
|
-
product:
|
166
|
+
product: ProductSceneEnum.ELEMENT_ADDRESS,
|
169
167
|
appVersion: ADDRESSElementAppVersion
|
170
168
|
});
|
171
|
-
return
|
169
|
+
return _super7.call(this, _options);
|
172
170
|
}
|
173
171
|
return _createClass(AddressElement);
|
174
172
|
}(AddressComponent);
|
173
|
+
export var Element = /*#__PURE__*/function (_ElementComponent) {
|
174
|
+
_inherits(Element, _ElementComponent);
|
175
|
+
var _super8 = _createSuper(Element);
|
176
|
+
function Element(options) {
|
177
|
+
_classCallCheck(this, Element);
|
178
|
+
var _options = Object.assign({}, options, {
|
179
|
+
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
180
|
+
environment: options.environment
|
181
|
+
});
|
182
|
+
return _super8.call(this, _options);
|
183
|
+
}
|
184
|
+
return _createClass(Element);
|
185
|
+
}(ElementComponent);
|
175
186
|
export default AMSCheckout;
|
@@ -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 { EnvironmentEnum, eventCodeEnum, ProductSceneEnum } from "../../types";
|
19
19
|
import ApplePayService from "./service";
|
20
20
|
import { getApplePayPaymentSession, submitPayInfo } from "../../service";
|
21
21
|
import { BusManager, BusMessage } from "../../core/bus";
|
@@ -46,9 +46,9 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
46
46
|
_defineProperty(this, "isRecurring", false);
|
47
47
|
this.logger = logger;
|
48
48
|
this._options = Object.assign({
|
49
|
-
environment:
|
49
|
+
environment: EnvironmentEnum.prod
|
50
50
|
}, options, {
|
51
|
-
product:
|
51
|
+
product: ProductSceneEnum.CARD_APPLE_PAY
|
52
52
|
});
|
53
53
|
this._applePayService = new ApplePayService(logger);
|
54
54
|
}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
7
7
|
*/
|
8
8
|
import { IGetMerchantSession, ICompletePaymentAuthorized, ICompleteApplePay, ILogError } from './interface';
|
9
|
-
import { ApplePaySubTypeEnum,
|
9
|
+
import { ApplePaySubTypeEnum, IPaymentSessionMetaData } from '../../types';
|
10
10
|
import type { Logger } from '../../util/logger';
|
11
11
|
/**
|
12
12
|
* Apple Pay Service
|
@@ -49,6 +49,6 @@ declare class ApplePayService {
|
|
49
49
|
/**
|
50
50
|
* Start Pay
|
51
51
|
*/
|
52
|
-
startPay: (param:
|
52
|
+
startPay: (param: IPaymentSessionMetaData) => void;
|
53
53
|
}
|
54
54
|
export default ApplePayService;
|
@@ -1,16 +1,17 @@
|
|
1
|
-
import {
|
2
|
-
export declare const getAppPath: (environment: string, appVersion: string, componentSign:
|
1
|
+
import { ComponentSignEnum, Ianalytics, DisplayTypeEnum } from '../../types';
|
2
|
+
export declare const getAppPath: (environment: string, appVersion: string, componentSign: ComponentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean, localLink?: string) => any;
|
3
3
|
export declare const getAppDomain: (domainParams: {
|
4
4
|
environment: string;
|
5
5
|
appVersion: string;
|
6
|
-
componentSign:
|
6
|
+
componentSign: ComponentSignEnum;
|
7
7
|
productScene: string;
|
8
8
|
productSceneVersion: string;
|
9
9
|
extendInfo: string;
|
10
10
|
mid: string;
|
11
|
+
localLink: string;
|
11
12
|
}) => string;
|
12
13
|
export declare const getIframeUrl: (iframeParams: {
|
13
|
-
componentSign:
|
14
|
+
componentSign: ComponentSignEnum;
|
14
15
|
analytics?: Ianalytics;
|
15
16
|
productScene: string;
|
16
17
|
productSceneVersion: string;
|
@@ -19,9 +20,10 @@ export declare const getIframeUrl: (iframeParams: {
|
|
19
20
|
extendInfo?: string;
|
20
21
|
locale?: string;
|
21
22
|
instanceId: string;
|
22
|
-
renderDisplayType:
|
23
|
+
renderDisplayType: DisplayTypeEnum;
|
23
24
|
isPreload?: string;
|
24
25
|
hostSign?: string;
|
26
|
+
localLink?: string;
|
25
27
|
mid?: string;
|
26
28
|
}) => {
|
27
29
|
path: string;
|
@@ -16,7 +16,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
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
18
|
import { elementAppMarmotMap, marmotMap, sdkVersion } from "../../config/index";
|
19
|
-
import {
|
19
|
+
import { ComponentSignEnum, ComponentSignEnumV2 } from "../../types";
|
20
20
|
import { isDebugLog } from "../../util/debug";
|
21
21
|
import { queryParse, serialize } from "../../util/index";
|
22
22
|
import { Logger } from "../../util/logger";
|
@@ -59,8 +59,9 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
|
59
59
|
};
|
60
60
|
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
|
61
61
|
var _signSupportMap;
|
62
|
-
|
63
|
-
var
|
62
|
+
// 支持的WebApp产品版本
|
63
|
+
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(_signSupportMap, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']));
|
64
|
+
var supportProductSceneVersion = signSupportMap[componentSign] || [];
|
64
65
|
// 从左到右,从旧到新
|
65
66
|
var isSupport = supportProductSceneVersion.find(function (it) {
|
66
67
|
return it === productSceneVersion;
|
@@ -77,6 +78,7 @@ export var getAppPath = function getAppPath() {
|
|
77
78
|
var extendInfo = arguments.length > 5 ? arguments[5] : undefined;
|
78
79
|
var mid = arguments.length > 6 ? arguments[6] : undefined;
|
79
80
|
var sendLog = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
81
|
+
var localLink = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
|
80
82
|
var _ref = queryParse() || {},
|
81
83
|
urlTestHost = _ref.host;
|
82
84
|
var upgradeAppVersion = getAppVersion(extendInfo, productScene, mid, sendLog);
|
@@ -94,11 +96,14 @@ export var getAppPath = function getAppPath() {
|
|
94
96
|
}
|
95
97
|
var finalProductSceneVersion = getFinalProductSceneVersion(componentSign, productSceneVersion);
|
96
98
|
// only for test while testurl?host=https://xxxxx.test.html
|
99
|
+
if (localLink) {
|
100
|
+
return localLink;
|
101
|
+
}
|
97
102
|
if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
|
98
103
|
return urlTestHost;
|
99
104
|
}
|
100
105
|
// 地址应用特殊处理
|
101
|
-
if (componentSign ===
|
106
|
+
if (componentSign === ComponentSignEnum.ELEMENT_ADDRESS) {
|
102
107
|
return "".concat(elementAppMarmotMap[environment], "/element-address/").concat(finalAppVersion, "/pages/address/index.html");
|
103
108
|
}
|
104
109
|
// element应用特殊处理
|
@@ -127,9 +132,10 @@ export var getAppDomain = function getAppDomain(domainParams) {
|
|
127
132
|
productScene = domainParams.productScene,
|
128
133
|
productSceneVersion = domainParams.productSceneVersion,
|
129
134
|
extendInfo = domainParams.extendInfo,
|
130
|
-
mid = domainParams.mid
|
135
|
+
mid = domainParams.mid,
|
136
|
+
localLink = domainParams.localLink;
|
131
137
|
var reg = /^https?:\/\/([^/<>\s]+\.?)*/;
|
132
|
-
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo, mid));
|
138
|
+
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo, mid, false, localLink));
|
133
139
|
return macth && macth[0] || '';
|
134
140
|
};
|
135
141
|
export var getIframeUrl = function getIframeUrl(iframeParams) {
|
@@ -151,8 +157,10 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
151
157
|
_iframeParams$hostSig = iframeParams.hostSign,
|
152
158
|
hostSign = _iframeParams$hostSig === void 0 ? '' : _iframeParams$hostSig,
|
153
159
|
_iframeParams$mid = iframeParams.mid,
|
154
|
-
mid = _iframeParams$mid === void 0 ? '' : _iframeParams$mid
|
155
|
-
|
160
|
+
mid = _iframeParams$mid === void 0 ? '' : _iframeParams$mid,
|
161
|
+
_iframeParams$localLi = iframeParams.localLink,
|
162
|
+
localLink = _iframeParams$localLi === void 0 ? '' : _iframeParams$localLi;
|
163
|
+
var path = getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo || '', mid, true, localLink);
|
156
164
|
var appMatched = getMatchAppVersion(extendInfo, {
|
157
165
|
sdkVersion: sdkVersion,
|
158
166
|
productScene: productScene,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
type IChannelBehavior = {
|
1
|
+
import type { EventPayload, IPaymentSessionMetaData } from '../../types';
|
2
|
+
export type IChannelBehavior = {
|
3
3
|
usePaymentSessionAsQueryResult: boolean;
|
4
4
|
submitPayInSdk: boolean;
|
5
5
|
createIframeNode: boolean;
|
@@ -15,6 +15,7 @@ type GetDoubleFaParams = {
|
|
15
15
|
env: string;
|
16
16
|
sdkVersion: string;
|
17
17
|
};
|
18
|
-
export declare function getChannelBehavior(paymentSessionMetaData?:
|
18
|
+
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
|
19
19
|
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
20
|
+
export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
|
20
21
|
export {};
|
@@ -50,4 +50,40 @@ export function getDoubleFaUrl(params) {
|
|
50
50
|
};
|
51
51
|
var doubleFaBaseUrl = DOUBLE_FA_URL_MAPPING[env] || DOUBLE_FA_URL_MAPPING.prod;
|
52
52
|
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);
|
53
|
-
}
|
53
|
+
}
|
54
|
+
export var handleGooglePay = function handleGooglePay(data) {
|
55
|
+
return new Promise(function (resolve, reject) {
|
56
|
+
var _data$context;
|
57
|
+
var _data$context$data$da = data === null || data === void 0 || (_data$context = data.context) === null || _data$context === void 0 || (_data$context = _data$context.data) === null || _data$context === void 0 || (_data$context = _data$context.data) === null || _data$context === void 0 || (_data$context = _data$context.paymentMethodDetail) === null || _data$context === void 0 ? void 0 : _data$context.googlePayProps,
|
58
|
+
_data$context$data$da2 = _data$context$data$da.environment,
|
59
|
+
environment = _data$context$data$da2 === void 0 ? 'TEST' : _data$context$data$da2,
|
60
|
+
_data$context$data$da3 = _data$context$data$da.paymentRequest,
|
61
|
+
paymentRequest = _data$context$data$da3 === void 0 ? {} : _data$context$data$da3;
|
62
|
+
var script = document.createElement('script');
|
63
|
+
script.src = 'https://pay.google.com/gp/p/js/pay.js';
|
64
|
+
script.async = true;
|
65
|
+
document.body.appendChild(script);
|
66
|
+
// 执行googlePay sdk
|
67
|
+
script.onload = function () {
|
68
|
+
var paymentsClient = new window.google.payments.api.PaymentsClient({
|
69
|
+
environment: environment,
|
70
|
+
// 按钮为付款时需要传递的参数
|
71
|
+
paymentDataCallbacks: {
|
72
|
+
onPaymentAuthorized: function onPaymentAuthorized(paymentData) {
|
73
|
+
return {
|
74
|
+
transactionState: 'SUCCESS'
|
75
|
+
};
|
76
|
+
}
|
77
|
+
}
|
78
|
+
});
|
79
|
+
// 获取到googlePay token后返回消息给app
|
80
|
+
paymentsClient.loadPaymentData(paymentRequest).then(function (paymentData) {
|
81
|
+
if (paymentData) {
|
82
|
+
resolve(paymentData);
|
83
|
+
}
|
84
|
+
}).catch(function (err) {
|
85
|
+
reject(err);
|
86
|
+
});
|
87
|
+
};
|
88
|
+
});
|
89
|
+
};
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { ComponentSignEnum, PlatformEnum } from '../../types';
|
2
2
|
interface Options {
|
3
|
-
componentSign?:
|
3
|
+
componentSign?: ComponentSignEnum;
|
4
4
|
type: 'tabs' | 'Accordion';
|
5
5
|
isExpressCheckout?: boolean;
|
6
6
|
}
|
7
7
|
export declare const inlineComponentAddCss: () => void;
|
8
|
-
export declare const addInlineLoading: (_selector: HTMLDivElement, platform:
|
9
|
-
export declare const createInlineBaseElement: (selector: string) => HTMLDivElement;
|
8
|
+
export declare const addInlineLoading: (_selector: HTMLDivElement, platform: PlatformEnum, options?: Options) => void;
|
9
|
+
export declare const createInlineBaseElement: (selector: string, containerId?: string, selectorId?: string) => HTMLDivElement;
|
10
10
|
export {};
|