@alipay/ams-checkout 0.0.1726734012-dev.2 → 0.0.1726734012-dev.21

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.
Files changed (37) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +7 -7
  3. package/esm/config/index.js +7 -7
  4. package/esm/constant/index.d.ts +9 -0
  5. package/esm/constant/index.js +9 -0
  6. package/esm/core/component/element/index.d.ts +1 -0
  7. package/esm/core/component/element/index.js +75 -67
  8. package/esm/core/component/element/mock.d.ts +2 -0
  9. package/esm/core/component/element/mock.js +129 -53
  10. package/esm/core/component/element/type.d.ts +2 -2
  11. package/esm/core/component/element/type.js +2 -2
  12. package/esm/core/component/index.d.ts +1 -3
  13. package/esm/core/component/index.js +14 -52
  14. package/esm/core/instance/index.js +12 -2
  15. package/esm/foundation/core/index.js +4 -4
  16. package/esm/foundation/index.d.ts +1 -1
  17. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -2
  18. package/esm/foundation/product-processor/easysafepay/index.js +29 -73
  19. package/esm/foundation/service/container/index.d.ts +0 -2
  20. package/esm/foundation/service/container/index.js +46 -47
  21. package/esm/foundation/utils/payment_product_utils.d.ts +1 -1
  22. package/esm/foundation/utils/payment_product_utils.js +2 -2
  23. package/esm/foundation/utils/preload_helper.d.ts +21 -0
  24. package/esm/foundation/utils/preload_helper.js +142 -0
  25. package/esm/index.d.ts +7 -2
  26. package/esm/index.js +95 -10
  27. package/esm/plugin/applepay/interface.d.ts +2 -2
  28. package/esm/plugin/component/channel.d.ts +41 -1
  29. package/esm/plugin/component/channel.js +589 -1
  30. package/esm/plugin/component/index.d.ts +1 -1
  31. package/esm/plugin/component/index.js +75 -39
  32. package/esm/types/index.d.ts +38 -2
  33. package/esm/types/index.js +3 -2
  34. package/esm/util/cashierPaymentUtils.d.ts +1 -0
  35. package/esm/util/cashierPaymentUtils.js +15 -0
  36. package/esm/util/security.js +1 -0
  37. 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, onError) {
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
- onError(error === null || error === void 0 ? void 0 : error.message);
31
+ return null;
32
32
  }
33
33
  }
34
34
  return null;
@@ -0,0 +1,21 @@
1
+ import { PaymentMethodCategoryTypeEnum, ProductSceneEnum } from "../../types";
2
+ import { Security } from '../../util/security';
3
+ export default class PreloadHelper {
4
+ static isWebAppPreloaded: boolean;
5
+ static isSecuritySDKPreloaded: boolean;
6
+ private static securitySdkMap;
7
+ static preloadWebApp(productScene: ProductSceneEnum, paymentMethodCategoryType: PaymentMethodCategoryTypeEnum, environment?: string): void;
8
+ static preloadSecuritySDK(product: ProductSceneEnum, securityRegion?: string): 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,142 @@
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
+ try {
26
+ if (this.isWebAppPreloaded) {
27
+ console.log('[web-sdk] web app already preloaded');
28
+ return;
29
+ }
30
+ var _this$buildWebAppPrel = this.buildWebAppPreloadUrl(productScene, paymentMethodCategoryType, environment),
31
+ preloadUrl = _this$buildWebAppPrel.preloadUrl,
32
+ containerId = _this$buildWebAppPrel.containerId;
33
+ var preloadIframe = createPreloadIframe(containerId);
34
+ preloadIframe.src = preloadUrl;
35
+ var body = document.body || null;
36
+ if (body) {
37
+ console.log('[web-sdk] preload web app, url: ', preloadUrl);
38
+ body.appendChild(preloadIframe);
39
+ this.isWebAppPreloaded = true;
40
+ }
41
+ setTimeout(function () {
42
+ var container = document.getElementById(containerId);
43
+ if (container) {
44
+ console.log('[web-sdk] remove preload web app');
45
+ document.body.removeChild(container);
46
+ }
47
+ }, MAX_CLEAR_TIME);
48
+ } catch (error) {
49
+ console.error('[web-sdk] preload web app failed', error);
50
+ }
51
+ }
52
+ }, {
53
+ key: "preloadSecuritySDK",
54
+ value: function preloadSecuritySDK(product) {
55
+ var _this = this;
56
+ var securityRegion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'SG';
57
+ try {
58
+ if (this.isSecuritySDKPreloaded) {
59
+ console.log('[web-sdk] security sdk is already loaded');
60
+ return;
61
+ }
62
+ var storage = PreloadHelper.getSecurityConfigStorage(product);
63
+ var scene = storage.scene || getSecurityScene(product);
64
+ var h5gateway = storage.h5gateway || getSecurityHost(securityRegion);
65
+ var securitySdk = new Security({
66
+ scene: scene,
67
+ h5gateway: h5gateway
68
+ });
69
+ debugger;
70
+ securitySdk.initSecurity(function () {
71
+ console.log(_this.securitySdkMap, 'this.securitySdkMap');
72
+ _this.securitySdkMap.set(scene, securitySdk);
73
+ _this.isSecuritySDKPreloaded = true;
74
+ console.log('[web-sdk] preload security sdk succeed');
75
+ }, function () {
76
+ console.error('[web-sdk] preload security sdk failed');
77
+ });
78
+ } catch (error) {
79
+ console.error('[web-sdk] preload security sdk failed', error);
80
+ }
81
+ }
82
+ }, {
83
+ key: "getSecuritySdk",
84
+ value: function getSecuritySdk(scene) {
85
+ var result = this.securitySdkMap.get(scene);
86
+ return result;
87
+ }
88
+ }, {
89
+ key: "buildWebAppPreloadUrl",
90
+ value: function buildWebAppPreloadUrl(productScene, paymentMethodCategoryType, environment) {
91
+ var productSceneVersion = productScene === ProductSceneEnum.EASY_PAY ? '2.0' : '1.0';
92
+ var previousProductInfo = ProductInfoCacheUtil.getPreviousProductInfo(productScene);
93
+ if (previousProductInfo) {
94
+ productSceneVersion = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.productSceneVersion;
95
+ }
96
+ var containerId = "ams-checkout-component-".concat(productScene, "_").concat(paymentMethodCategoryType);
97
+ var sdkMetaData = {
98
+ productScene: productScene,
99
+ sdkVersion: sdkVersion,
100
+ webAppVersion: ''
101
+ };
102
+ sdkMetaData.webAppVersion = getWebAppVersion(sdkMetaData);
103
+ var preloadUrl = getWebAppUrl({
104
+ environment: environment,
105
+ sdkMetaData: sdkMetaData,
106
+ paymentMethodCategoryType: paymentMethodCategoryType,
107
+ isPreload: true,
108
+ productSceneVersion: productSceneVersion,
109
+ query: undefined
110
+ });
111
+ return {
112
+ preloadUrl: preloadUrl,
113
+ containerId: containerId
114
+ };
115
+ }
116
+
117
+ /**
118
+ * @description Obtain risk control configuration in local storage
119
+ */
120
+ }, {
121
+ key: "getSecurityConfigStorage",
122
+ value: function getSecurityConfigStorage(product) {
123
+ var scene = '';
124
+ var h5gateway = '';
125
+ var securityConfigStorage = getOrSetStorageId(getSecurityConfigStorageKey(product));
126
+ if (securityConfigStorage) {
127
+ var config = safeJson(securityConfigStorage, {});
128
+ scene = config === null || config === void 0 ? void 0 : config.appName;
129
+ h5gateway = config === null || config === void 0 ? void 0 : config.h5gateway;
130
+ }
131
+ return {
132
+ scene: scene,
133
+ h5gateway: h5gateway
134
+ };
135
+ }
136
+ }]);
137
+ return PreloadHelper;
138
+ }();
139
+ _defineProperty(PreloadHelper, "isWebAppPreloaded", false);
140
+ _defineProperty(PreloadHelper, "isSecuritySDKPreloaded", false);
141
+ _defineProperty(PreloadHelper, "securitySdkMap", new Map());
142
+ export { PreloadHelper as default };
package/esm/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AddressComponent } from './core/component/address';
2
2
  import { ElementComponent } from './core/component/element';
3
3
  import { AMSComponent } from './core/component/index';
4
- import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams } from './types';
4
+ import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions } from './types';
5
5
  export { AMSCheckoutPage } from './core/component/ckp';
6
6
  export * from './types';
7
7
  export declare class AMSCheckout extends AMSComponent {
@@ -9,15 +9,19 @@ export declare class AMSCheckout extends AMSComponent {
9
9
  }
10
10
  export declare class AMSAutoDebit extends AMSCheckout {
11
11
  constructor(options: IoptionsParams);
12
+ static preload(options?: IPreloadOptions): void;
12
13
  }
13
14
  export declare class AMSAutoDebitPay extends AMSCheckout {
14
15
  constructor(options: IoptionsParams);
16
+ static preload(options?: IPreloadOptions): void;
15
17
  }
16
18
  export declare class AMSCashierPayment extends AMSCheckout {
17
19
  constructor(options: IoptionsParams);
20
+ static preload(options?: IPreloadOptions): void;
18
21
  }
19
22
  export declare class AMSVaulting extends AMSCheckout {
20
23
  constructor(options: IoptionsParams);
24
+ static preload(options?: IPreloadOptions): void;
21
25
  }
22
26
  export declare class AntomElement extends AMSCheckout {
23
27
  constructor(options: IoptionsParams);
@@ -28,10 +32,11 @@ export declare class AddressElement extends AddressComponent {
28
32
  export declare class Element extends ElementComponent {
29
33
  constructor(options: IElementOptions);
30
34
  }
31
- export default AMSCheckout;
32
35
  export declare class AMSEasyPay {
33
36
  private core;
34
37
  constructor(options: IoptionsParams);
38
+ static preload(options?: IPreloadOptions): void;
35
39
  createComponent(params: IcreateComponent): void;
36
40
  unmount(): void;
37
41
  }
42
+ export default AMSCheckout;
package/esm/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _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; }
@@ -25,9 +28,10 @@ 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";
@@ -43,9 +47,7 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
43
47
  _this = _super.call(this, _objectSpread({
44
48
  appVersion: AMSCheckoutAppVersion
45
49
  }, _options));
46
- // this.preloadComponent(channelType, productSceneVersion);
47
- _this.channelType = channelType;
48
- _this.productSceneVersion = productSceneVersion;
50
+ _this.preloadComponent(channelType, productSceneVersion);
49
51
  return _this;
50
52
  }
51
53
  return _createClass(AMSCheckout);
@@ -61,7 +63,18 @@ export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
61
63
  });
62
64
  return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_WALLET]);
63
65
  }
64
- return _createClass(AMSAutoDebit);
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;
65
78
  }(AMSCheckout);
66
79
  export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
67
80
  _inherits(AMSAutoDebitPay, _AMSCheckout2);
@@ -73,7 +86,18 @@ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
73
86
  });
74
87
  return _super3.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
75
88
  }
76
- return _createClass(AMSAutoDebitPay);
89
+ _createClass(AMSAutoDebitPay, null, [{
90
+ key: "preload",
91
+ value: function preload() {
92
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
93
+ securityRegion: 'SG',
94
+ environment: 'prod'
95
+ };
96
+ PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
97
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT_PAY, options.securityRegion);
98
+ }
99
+ }]);
100
+ return AMSAutoDebitPay;
77
101
  }(AMSCheckout);
78
102
  export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
79
103
  _inherits(AMSCashierPayment, _AMSCheckout3);
@@ -105,7 +129,48 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
105
129
  }
106
130
  return _super4.call(this, _options, currentChannelType);
107
131
  }
108
- return _createClass(AMSCashierPayment);
132
+ _createClass(AMSCashierPayment, null, [{
133
+ key: "preload",
134
+ value: function preload() {
135
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
136
+ securityRegion: 'SG',
137
+ environment: 'prod'
138
+ };
139
+ try {
140
+ var channelTypes;
141
+ var previousChannelStr = localStorage.getItem('antom_checkout_previousChannel');
142
+ var previousChannel = JSON.parse(previousChannelStr) || {};
143
+ var _ref2 = previousChannel || {},
144
+ _ref2$channelType = _ref2.channelType,
145
+ channelType = _ref2$channelType === void 0 ? '' : _ref2$channelType;
146
+ if (ComponentSignEnum.CASHIER_PAYMENT_CARD === channelType) {
147
+ channelTypes = [PaymentMethodCategoryTypeEnum.CARD];
148
+ } else if (ComponentSignEnum.CASHIER_PAYMENT_APM === channelType) {
149
+ channelTypes = [PaymentMethodCategoryTypeEnum.APM];
150
+ } else if (ComponentSignEnum.CASHIER_PAYMENT_BANK === channelType) {
151
+ channelTypes = [PaymentMethodCategoryTypeEnum.BANK];
152
+ } else {
153
+ channelTypes = [PaymentMethodCategoryTypeEnum.CARD, PaymentMethodCategoryTypeEnum.APM];
154
+ }
155
+ var _iterator = _createForOfIteratorHelper(channelTypes),
156
+ _step;
157
+ try {
158
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
159
+ var _channelType = _step.value;
160
+ PreloadHelper.preloadWebApp(ProductSceneEnum.CASHIER_PAYMENT, _channelType, options.environment);
161
+ }
162
+ } catch (err) {
163
+ _iterator.e(err);
164
+ } finally {
165
+ _iterator.f();
166
+ }
167
+ } catch (error) {
168
+ console.error('[web-sdk] preload web app error', error);
169
+ }
170
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.CASHIER_PAYMENT, options.securityRegion);
171
+ }
172
+ }]);
173
+ return AMSCashierPayment;
109
174
  }(AMSCheckout);
110
175
  export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
111
176
  _inherits(AMSVaulting, _AMSCheckout4);
@@ -118,7 +183,18 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
118
183
  });
119
184
  return _super5.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
120
185
  }
121
- return _createClass(AMSVaulting);
186
+ _createClass(AMSVaulting, null, [{
187
+ key: "preload",
188
+ value: function preload() {
189
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
190
+ securityRegion: 'SG',
191
+ environment: 'prod'
192
+ };
193
+ PreloadHelper.preloadWebApp(ProductSceneEnum.CASHIER_PAYMENT, PaymentMethodCategoryTypeEnum.CARD, options.environment);
194
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.VAULTING, options.securityRegion);
195
+ }
196
+ }]);
197
+ return AMSVaulting;
122
198
  }(AMSCheckout);
123
199
  export var AntomElement = /*#__PURE__*/function (_AMSCheckout5) {
124
200
  _inherits(AntomElement, _AMSCheckout5);
@@ -159,7 +235,6 @@ export var Element = /*#__PURE__*/function (_ElementComponent) {
159
235
  }
160
236
  return _createClass(Element);
161
237
  }(ElementComponent);
162
- export default AMSCheckout;
163
238
  export var AMSEasyPay = /*#__PURE__*/function () {
164
239
  function AMSEasyPay(options) {
165
240
  _classCallCheck(this, AMSEasyPay);
@@ -188,6 +263,16 @@ export var AMSEasyPay = /*#__PURE__*/function () {
188
263
  value: function unmount() {
189
264
  this.core.destroy();
190
265
  }
266
+ }], [{
267
+ key: "preload",
268
+ value: function preload() {
269
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
270
+ securityRegion: 'SG',
271
+ environment: 'prod'
272
+ };
273
+ PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
274
+ }
191
275
  }]);
192
276
  return AMSEasyPay;
193
- }();
277
+ }();
278
+ 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 = "immediate" | "recurring" | "deferred" | "automaticReload";
41
- export type ApplePayRecurringPaymentDateUnit = "year" | "month" | "day" | "hour" | "minute";
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 { EventPayload, IPaymentSessionMetaData } from '../../types';
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 {};