@alipay/ams-checkout 0.0.1726734012-dev.17 → 0.0.1726734012-dev.18
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 +7 -7
- package/esm/constant/index.d.ts +9 -0
- package/esm/constant/index.js +9 -0
- package/esm/core/component/element/index.d.ts +1 -0
- package/esm/core/component/element/index.js +75 -67
- package/esm/core/component/element/mock.d.ts +2 -0
- package/esm/core/component/element/mock.js +129 -53
- package/esm/core/component/element/type.d.ts +2 -2
- package/esm/core/component/element/type.js +2 -2
- package/esm/core/component/index.d.ts +0 -7
- package/esm/core/component/index.js +3 -26
- package/esm/core/instance/index.d.ts +1 -1
- package/esm/core/instance/index.js +13 -6
- package/esm/foundation/core/index.d.ts +0 -6
- package/esm/foundation/core/index.js +5 -15
- package/esm/foundation/index.d.ts +1 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -3
- package/esm/foundation/product-processor/easysafepay/index.js +30 -79
- package/esm/foundation/service/container/index.d.ts +0 -2
- package/esm/foundation/service/container/index.js +46 -49
- package/esm/foundation/utils/payment_product_utils.d.ts +1 -1
- package/esm/foundation/utils/payment_product_utils.js +2 -2
- package/esm/foundation/utils/preload_helper.d.ts +21 -0
- package/esm/foundation/utils/preload_helper.js +129 -0
- package/esm/index.d.ts +7 -7
- package/esm/index.js +79 -27
- package/esm/plugin/applepay/interface.d.ts +2 -2
- package/esm/plugin/component/channel.d.ts +41 -1
- package/esm/plugin/component/channel.js +589 -1
- package/esm/plugin/component/index.d.ts +1 -1
- package/esm/plugin/component/index.js +75 -40
- package/esm/types/index.d.ts +32 -2
- package/esm/types/index.js +3 -2
- package/esm/util/cashierPaymentUtils.d.ts +1 -0
- package/esm/util/cashierPaymentUtils.js +15 -0
- package/package.json +1 -1
@@ -21,14 +21,14 @@ export var ProductInfoCacheUtil = /*#__PURE__*/function () {
|
|
21
21
|
}
|
22
22
|
}, {
|
23
23
|
key: "getPreviousProductInfo",
|
24
|
-
value: function getPreviousProductInfo(productScene
|
24
|
+
value: function getPreviousProductInfo(productScene) {
|
25
25
|
var key = KEY_PREVIOUS_PRODUCT_INFO + '_' + productScene;
|
26
26
|
var previousProductInfoString = localStorage.getItem(key);
|
27
27
|
if (previousProductInfoString) {
|
28
28
|
try {
|
29
29
|
return JSON.parse(previousProductInfoString);
|
30
30
|
} catch (error) {
|
31
|
-
|
31
|
+
return null;
|
32
32
|
}
|
33
33
|
}
|
34
34
|
return null;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { PaymentMethodCategoryTypeEnum, ProductSceneEnum } from "../../types";
|
2
|
+
import { Security, SecurityRegionEnum } from "../../util/security";
|
3
|
+
export default class PreloadHelper {
|
4
|
+
private static isWebAppPreloaded;
|
5
|
+
private static isSecuritySDKPreloaded;
|
6
|
+
private static securitySdkMap;
|
7
|
+
static preloadWebApp(productScene: ProductSceneEnum, paymentMethodCategoryType: PaymentMethodCategoryTypeEnum, environment?: string): void;
|
8
|
+
static preloadSecuritySDK(product: ProductSceneEnum, securityRegion: SecurityRegionEnum): void;
|
9
|
+
static getSecuritySdk(scene: any): Security;
|
10
|
+
static buildWebAppPreloadUrl(productScene: ProductSceneEnum, paymentMethodCategoryType: PaymentMethodCategoryTypeEnum, environment: string): {
|
11
|
+
preloadUrl: string;
|
12
|
+
containerId: string;
|
13
|
+
};
|
14
|
+
/**
|
15
|
+
* @description Obtain risk control configuration in local storage
|
16
|
+
*/
|
17
|
+
static getSecurityConfigStorage(product: ProductSceneEnum): {
|
18
|
+
scene: string;
|
19
|
+
h5gateway: string;
|
20
|
+
};
|
21
|
+
}
|
@@ -0,0 +1,129 @@
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
|
+
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); }
|
8
|
+
import { sdkVersion } from "../../config";
|
9
|
+
import { createPreloadIframe } from "../service/container/utils";
|
10
|
+
import { ProductSceneEnum } from "../../types";
|
11
|
+
import { getWebAppUrl } from "../utils/web_app_url_utils";
|
12
|
+
import { ProductInfoCacheUtil } from "../utils/payment_product_utils";
|
13
|
+
import { getWebAppVersion } from "./payment_context_utils";
|
14
|
+
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security } from "../../util/security";
|
15
|
+
import { getOrSetStorageId, safeJson } from "../../util";
|
16
|
+
var MAX_CLEAR_TIME = 10000;
|
17
|
+
var PreloadHelper = /*#__PURE__*/function () {
|
18
|
+
function PreloadHelper() {
|
19
|
+
_classCallCheck(this, PreloadHelper);
|
20
|
+
}
|
21
|
+
_createClass(PreloadHelper, null, [{
|
22
|
+
key: "preloadWebApp",
|
23
|
+
value: function preloadWebApp(productScene, paymentMethodCategoryType) {
|
24
|
+
var environment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'prod';
|
25
|
+
if (this.isWebAppPreloaded) {
|
26
|
+
console.log('[web-sdk] web app already preloaded');
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
var _this$buildWebAppPrel = this.buildWebAppPreloadUrl(productScene, paymentMethodCategoryType, environment),
|
30
|
+
preloadUrl = _this$buildWebAppPrel.preloadUrl,
|
31
|
+
containerId = _this$buildWebAppPrel.containerId;
|
32
|
+
var preloadIframe = createPreloadIframe(containerId);
|
33
|
+
preloadIframe.src = preloadUrl;
|
34
|
+
var body = document.body || null;
|
35
|
+
if (body) {
|
36
|
+
console.log('[web-sdk] preload web app', preloadUrl);
|
37
|
+
body.appendChild(preloadIframe);
|
38
|
+
this.isWebAppPreloaded = true;
|
39
|
+
}
|
40
|
+
setTimeout(function () {
|
41
|
+
var container = document.getElementById(containerId);
|
42
|
+
if (container) {
|
43
|
+
console.log('[web-sdk] remove preload web app');
|
44
|
+
document.body.removeChild(container);
|
45
|
+
}
|
46
|
+
}, MAX_CLEAR_TIME);
|
47
|
+
}
|
48
|
+
}, {
|
49
|
+
key: "preloadSecuritySDK",
|
50
|
+
value: function preloadSecuritySDK(product, securityRegion) {
|
51
|
+
var _this = this;
|
52
|
+
if (this.isSecuritySDKPreloaded) {
|
53
|
+
console.log('[web-sdk] security sdk is already loaded');
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
var storage = PreloadHelper.getSecurityConfigStorage(product);
|
57
|
+
var scene = storage.scene || getSecurityScene(product);
|
58
|
+
var h5gateway = storage.h5gateway || getSecurityHost(securityRegion);
|
59
|
+
var securitySdk = new Security({
|
60
|
+
scene: scene,
|
61
|
+
h5gateway: h5gateway
|
62
|
+
});
|
63
|
+
securitySdk.initSecurity(function () {
|
64
|
+
_this.securitySdkMap.set(scene, securitySdk);
|
65
|
+
_this.isSecuritySDKPreloaded = true;
|
66
|
+
}, function () {
|
67
|
+
console.error('[web-sdk] securitySdk init failed');
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}, {
|
71
|
+
key: "getSecuritySdk",
|
72
|
+
value: function getSecuritySdk(scene) {
|
73
|
+
return this.securitySdkMap.get(scene);
|
74
|
+
}
|
75
|
+
}, {
|
76
|
+
key: "buildWebAppPreloadUrl",
|
77
|
+
value: function buildWebAppPreloadUrl(productScene, paymentMethodCategoryType, environment) {
|
78
|
+
var productSceneVersion = productScene === ProductSceneEnum.EASY_PAY ? '2.0' : '1.0';
|
79
|
+
var previousProductInfo = ProductInfoCacheUtil.getPreviousProductInfo(productScene);
|
80
|
+
if (previousProductInfo) {
|
81
|
+
productSceneVersion = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.productSceneVersion;
|
82
|
+
}
|
83
|
+
var containerId = "ams-checkout-component-".concat(productScene, "_").concat(paymentMethodCategoryType);
|
84
|
+
var sdkMetaData = {
|
85
|
+
productScene: productScene,
|
86
|
+
sdkVersion: sdkVersion,
|
87
|
+
webAppVersion: ''
|
88
|
+
};
|
89
|
+
sdkMetaData.webAppVersion = getWebAppVersion(sdkMetaData);
|
90
|
+
var preloadUrl = getWebAppUrl({
|
91
|
+
environment: environment,
|
92
|
+
sdkMetaData: sdkMetaData,
|
93
|
+
paymentMethodCategoryType: paymentMethodCategoryType,
|
94
|
+
isPreload: true,
|
95
|
+
productSceneVersion: productSceneVersion,
|
96
|
+
query: undefined
|
97
|
+
});
|
98
|
+
return {
|
99
|
+
preloadUrl: preloadUrl,
|
100
|
+
containerId: containerId
|
101
|
+
};
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* @description Obtain risk control configuration in local storage
|
106
|
+
*/
|
107
|
+
}, {
|
108
|
+
key: "getSecurityConfigStorage",
|
109
|
+
value: function getSecurityConfigStorage(product) {
|
110
|
+
var scene = '';
|
111
|
+
var h5gateway = '';
|
112
|
+
var securityConfigStorage = getOrSetStorageId(getSecurityConfigStorageKey(product));
|
113
|
+
if (securityConfigStorage) {
|
114
|
+
var config = safeJson(securityConfigStorage, {});
|
115
|
+
scene = config === null || config === void 0 ? void 0 : config.appName;
|
116
|
+
h5gateway = config === null || config === void 0 ? void 0 : config.h5gateway;
|
117
|
+
}
|
118
|
+
return {
|
119
|
+
scene: scene,
|
120
|
+
h5gateway: h5gateway
|
121
|
+
};
|
122
|
+
}
|
123
|
+
}]);
|
124
|
+
return PreloadHelper;
|
125
|
+
}();
|
126
|
+
_defineProperty(PreloadHelper, "isWebAppPreloaded", false);
|
127
|
+
_defineProperty(PreloadHelper, "isSecuritySDKPreloaded", false);
|
128
|
+
_defineProperty(PreloadHelper, "securitySdkMap", void 0);
|
129
|
+
export { PreloadHelper as default };
|
package/esm/index.d.ts
CHANGED
@@ -4,25 +4,25 @@ import { AMSComponent } from './core/component/index';
|
|
4
4
|
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams } from './types';
|
5
5
|
export { AMSCheckoutPage } from './core/component/ckp';
|
6
6
|
export * from './types';
|
7
|
+
import { SecurityRegionEnum } from './util/security';
|
7
8
|
export declare class AMSCheckout extends AMSComponent {
|
8
9
|
constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
9
|
-
static preload(_options: {
|
10
|
-
channelType: ComponentSignEnum[];
|
11
|
-
productSceneVersion: string;
|
12
|
-
securityRegion?: 'US' | 'SG' | 'DE';
|
13
|
-
}): void;
|
14
10
|
}
|
15
11
|
export declare class AMSAutoDebit extends AMSCheckout {
|
16
12
|
constructor(options: IoptionsParams);
|
13
|
+
static preload(securityRegion?: SecurityRegionEnum): void;
|
17
14
|
}
|
18
15
|
export declare class AMSAutoDebitPay extends AMSCheckout {
|
19
16
|
constructor(options: IoptionsParams);
|
17
|
+
static preload(securityRegion?: SecurityRegionEnum): void;
|
20
18
|
}
|
21
19
|
export declare class AMSCashierPayment extends AMSCheckout {
|
22
20
|
constructor(options: IoptionsParams);
|
21
|
+
static preload(securityRegion?: SecurityRegionEnum): void;
|
23
22
|
}
|
24
23
|
export declare class AMSVaulting extends AMSCheckout {
|
25
24
|
constructor(options: IoptionsParams);
|
25
|
+
static preload(securityRegion?: SecurityRegionEnum): void;
|
26
26
|
}
|
27
27
|
export declare class AntomElement extends AMSCheckout {
|
28
28
|
constructor(options: IoptionsParams);
|
@@ -33,11 +33,11 @@ export declare class AddressElement extends AddressComponent {
|
|
33
33
|
export declare class Element extends ElementComponent {
|
34
34
|
constructor(options: IElementOptions);
|
35
35
|
}
|
36
|
-
export default AMSCheckout;
|
37
36
|
export declare class AMSEasyPay {
|
38
37
|
private core;
|
39
38
|
constructor(options: IoptionsParams);
|
40
|
-
static preload(
|
39
|
+
static preload(): void;
|
41
40
|
createComponent(params: IcreateComponent): void;
|
42
41
|
unmount(): void;
|
43
42
|
}
|
43
|
+
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -1,12 +1,15 @@
|
|
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 _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
|
+
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
|
+
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; }
|
2
5
|
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
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
7
|
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; }
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
8
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
7
9
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
8
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
9
11
|
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); }
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10
13
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
11
14
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
12
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
@@ -25,15 +28,16 @@ import { ADDRESSElementAppVersion, AMSAutoDebitAppVersion, AMSCashierPaymentAppV
|
|
25
28
|
import { AddressComponent } from "./core/component/address";
|
26
29
|
import { ElementComponent } from "./core/component/element";
|
27
30
|
import { AMSComponent } from "./core/component/index";
|
28
|
-
import { ComponentSignEnum, DisplayTypeEnum } from "./types";
|
31
|
+
import { ComponentSignEnum, DisplayTypeEnum, PaymentMethodCategoryTypeEnum } from "./types";
|
29
32
|
import { ProductSceneEnum } from "./types/index";
|
30
33
|
import { LogConfig, Logger } from "./util/logger";
|
34
|
+
import PreloadHelper from "./foundation/utils/preload_helper";
|
31
35
|
var logger = new Logger(LogConfig, true);
|
32
36
|
export { AMSCheckoutPage } from "./core/component/ckp";
|
33
37
|
export * from "./types";
|
34
38
|
import { AntomSDKCore } from "./foundation/core";
|
35
39
|
import { EasySafePayProcessor } from "./foundation/product-processor/easysafepay";
|
36
|
-
import {
|
40
|
+
import { SecurityRegionEnum } from "./util/security";
|
37
41
|
export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
38
42
|
_inherits(AMSCheckout, _AMSComponent);
|
39
43
|
var _super = _createSuper(AMSCheckout);
|
@@ -44,21 +48,10 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
|
44
48
|
_this = _super.call(this, _objectSpread({
|
45
49
|
appVersion: AMSCheckoutAppVersion
|
46
50
|
}, _options));
|
47
|
-
|
48
|
-
_this.preloadComponent(channelType, productSceneVersion);
|
49
|
-
}
|
51
|
+
_this.preloadComponent(channelType, productSceneVersion);
|
50
52
|
return _this;
|
51
53
|
}
|
52
|
-
_createClass(AMSCheckout
|
53
|
-
key: "preload",
|
54
|
-
value: function preload(_options) {
|
55
|
-
AMSComponent.isSuccessfullyPreloaded = true;
|
56
|
-
AMSComponent.preload(_objectSpread(_objectSpread({}, _options), {}, {
|
57
|
-
appVersion: AMSCheckoutAppVersion
|
58
|
-
}));
|
59
|
-
}
|
60
|
-
}]);
|
61
|
-
return AMSCheckout;
|
54
|
+
return _createClass(AMSCheckout);
|
62
55
|
}(AMSComponent);
|
63
56
|
export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
64
57
|
_inherits(AMSAutoDebit, _AMSCheckout);
|
@@ -71,7 +64,15 @@ export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
|
71
64
|
});
|
72
65
|
return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_WALLET]);
|
73
66
|
}
|
74
|
-
|
67
|
+
_createClass(AMSAutoDebit, null, [{
|
68
|
+
key: "preload",
|
69
|
+
value: function preload() {
|
70
|
+
var securityRegion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SecurityRegionEnum.SG;
|
71
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT, PaymentMethodCategoryTypeEnum.WALLET);
|
72
|
+
PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT, securityRegion);
|
73
|
+
}
|
74
|
+
}]);
|
75
|
+
return AMSAutoDebit;
|
75
76
|
}(AMSCheckout);
|
76
77
|
export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
77
78
|
_inherits(AMSAutoDebitPay, _AMSCheckout2);
|
@@ -83,7 +84,15 @@ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
|
83
84
|
});
|
84
85
|
return _super3.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
|
85
86
|
}
|
86
|
-
|
87
|
+
_createClass(AMSAutoDebitPay, null, [{
|
88
|
+
key: "preload",
|
89
|
+
value: function preload() {
|
90
|
+
var securityRegion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SecurityRegionEnum.SG;
|
91
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT_PAY, PaymentMethodCategoryTypeEnum.WALLET);
|
92
|
+
PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT_PAY, securityRegion);
|
93
|
+
}
|
94
|
+
}]);
|
95
|
+
return AMSAutoDebitPay;
|
87
96
|
}(AMSCheckout);
|
88
97
|
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
89
98
|
_inherits(AMSCashierPayment, _AMSCheckout3);
|
@@ -115,7 +124,45 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
|
115
124
|
}
|
116
125
|
return _super4.call(this, _options, currentChannelType);
|
117
126
|
}
|
118
|
-
|
127
|
+
_createClass(AMSCashierPayment, null, [{
|
128
|
+
key: "preload",
|
129
|
+
value: function preload() {
|
130
|
+
var securityRegion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SecurityRegionEnum.SG;
|
131
|
+
try {
|
132
|
+
var channelTypes;
|
133
|
+
var previousChannelStr = localStorage.getItem('antom_checkout_previousChannel');
|
134
|
+
var previousChannel = JSON.parse(previousChannelStr) || {};
|
135
|
+
var _ref2 = previousChannel || {},
|
136
|
+
_ref2$channelType = _ref2.channelType,
|
137
|
+
channelType = _ref2$channelType === void 0 ? '' : _ref2$channelType;
|
138
|
+
if (ComponentSignEnum.CASHIER_PAYMENT_CARD === channelType) {
|
139
|
+
channelTypes = [PaymentMethodCategoryTypeEnum.CARD];
|
140
|
+
} else if (ComponentSignEnum.CASHIER_PAYMENT_APM === channelType) {
|
141
|
+
channelTypes = [PaymentMethodCategoryTypeEnum.APM];
|
142
|
+
} else if (ComponentSignEnum.CASHIER_PAYMENT_BANK === channelType) {
|
143
|
+
channelTypes = [PaymentMethodCategoryTypeEnum.BANK];
|
144
|
+
} else {
|
145
|
+
channelTypes = [PaymentMethodCategoryTypeEnum.CARD, PaymentMethodCategoryTypeEnum.APM];
|
146
|
+
}
|
147
|
+
var _iterator = _createForOfIteratorHelper(channelTypes),
|
148
|
+
_step;
|
149
|
+
try {
|
150
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
151
|
+
var _channelType = _step.value;
|
152
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.CASHIER_PAYMENT, _channelType);
|
153
|
+
}
|
154
|
+
} catch (err) {
|
155
|
+
_iterator.e(err);
|
156
|
+
} finally {
|
157
|
+
_iterator.f();
|
158
|
+
}
|
159
|
+
} catch (error) {
|
160
|
+
console.error('[web-sdk] preload web app error', error);
|
161
|
+
}
|
162
|
+
PreloadHelper.preloadSecuritySDK(ProductSceneEnum.CASHIER_PAYMENT, securityRegion);
|
163
|
+
}
|
164
|
+
}]);
|
165
|
+
return AMSCashierPayment;
|
119
166
|
}(AMSCheckout);
|
120
167
|
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
121
168
|
_inherits(AMSVaulting, _AMSCheckout4);
|
@@ -128,7 +175,15 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
|
128
175
|
});
|
129
176
|
return _super5.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
|
130
177
|
}
|
131
|
-
|
178
|
+
_createClass(AMSVaulting, null, [{
|
179
|
+
key: "preload",
|
180
|
+
value: function preload() {
|
181
|
+
var securityRegion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SecurityRegionEnum.SG;
|
182
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.CASHIER_PAYMENT, PaymentMethodCategoryTypeEnum.CARD);
|
183
|
+
PreloadHelper.preloadSecuritySDK(ProductSceneEnum.VAULTING, securityRegion);
|
184
|
+
}
|
185
|
+
}]);
|
186
|
+
return AMSVaulting;
|
132
187
|
}(AMSCheckout);
|
133
188
|
export var AntomElement = /*#__PURE__*/function (_AMSCheckout5) {
|
134
189
|
_inherits(AntomElement, _AMSCheckout5);
|
@@ -169,7 +224,6 @@ export var Element = /*#__PURE__*/function (_ElementComponent) {
|
|
169
224
|
}
|
170
225
|
return _createClass(Element);
|
171
226
|
}(ElementComponent);
|
172
|
-
export default AMSCheckout;
|
173
227
|
export var AMSEasyPay = /*#__PURE__*/function () {
|
174
228
|
function AMSEasyPay(options) {
|
175
229
|
_classCallCheck(this, AMSEasyPay);
|
@@ -200,12 +254,10 @@ export var AMSEasyPay = /*#__PURE__*/function () {
|
|
200
254
|
}
|
201
255
|
}], [{
|
202
256
|
key: "preload",
|
203
|
-
value: function preload(
|
204
|
-
|
205
|
-
var instanceId = uuid();
|
206
|
-
var SDkMetaData = core.transferEasyPaySDKVersion();
|
207
|
-
EasySafePayProcessor.preloadWebApp(options, instanceId, SDkMetaData);
|
257
|
+
value: function preload() {
|
258
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET);
|
208
259
|
}
|
209
260
|
}]);
|
210
261
|
return AMSEasyPay;
|
211
|
-
}();
|
262
|
+
}();
|
263
|
+
export default AMSCheckout;
|
@@ -37,8 +37,8 @@ export interface IApplePayPaymentContact {
|
|
37
37
|
countryCode: string;
|
38
38
|
}
|
39
39
|
export type IApplePayLineItemType = 'final' | 'pending';
|
40
|
-
export type ApplePayPaymentTiming =
|
41
|
-
export type ApplePayRecurringPaymentDateUnit =
|
40
|
+
export type ApplePayPaymentTiming = 'immediate' | 'recurring' | 'deferred' | 'automaticReload';
|
41
|
+
export type ApplePayRecurringPaymentDateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute';
|
42
42
|
/**
|
43
43
|
*
|
44
44
|
{
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import type
|
1
|
+
import { EventPayloadContext, type EventPayload, type IPaymentMethod, type IPaymentSessionMetaData } from '../../types';
|
2
|
+
import { Logger } from '../../util/logger';
|
2
3
|
export type IChannelBehavior = {
|
3
4
|
usePaymentSessionAsQueryResult: boolean;
|
4
5
|
submitPayInSdk: boolean;
|
@@ -18,4 +19,43 @@ type GetDoubleFaParams = {
|
|
18
19
|
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
|
19
20
|
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
20
21
|
export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
|
22
|
+
export declare class ApplePayService {
|
23
|
+
private APPLESDKURL;
|
24
|
+
private applePaySession;
|
25
|
+
private paymentSessionData;
|
26
|
+
private sessionResult;
|
27
|
+
/**
|
28
|
+
* @description 支付状态,pending:支付中,normal:正常
|
29
|
+
*/
|
30
|
+
private paymentStatus;
|
31
|
+
/**
|
32
|
+
* @description paymentRequest
|
33
|
+
*/
|
34
|
+
private paymentRequest;
|
35
|
+
private logger;
|
36
|
+
private dispatchToApp;
|
37
|
+
private paymentMethod;
|
38
|
+
constructor({ sessionData, paymentSessionMetaData, paymentMethod, logger, dispatchToApp, }: {
|
39
|
+
sessionData: string;
|
40
|
+
paymentSessionMetaData: IPaymentSessionMetaData;
|
41
|
+
paymentMethod: IPaymentMethod;
|
42
|
+
logger: Logger;
|
43
|
+
dispatchToApp: (payload: {
|
44
|
+
context: EventPayloadContext;
|
45
|
+
}) => void;
|
46
|
+
});
|
47
|
+
private startPay;
|
48
|
+
private setApplePayStatus;
|
49
|
+
private submitPay;
|
50
|
+
submit(): Promise<void>;
|
51
|
+
private getDeviceId;
|
52
|
+
private initApplePaySession;
|
53
|
+
private isCanMakePayments;
|
54
|
+
private loadApplePaySdk;
|
55
|
+
private abortPaySession;
|
56
|
+
private addEventListener;
|
57
|
+
private get initSessionParams();
|
58
|
+
private get isRequiredParameters();
|
59
|
+
private get checkScriptIsLoaded();
|
60
|
+
}
|
21
61
|
export {};
|