@alipay/ams-checkout 1.30.0 → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) 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/core/component/ckp/index.js +2 -0
  5. package/esm/core/component/element/components/address.d.ts +1 -1
  6. package/esm/core/component/element/components/address.js +2 -2
  7. package/esm/core/component/element/components/payment.d.ts +1 -1
  8. package/esm/core/component/element/components/payment.js +2 -2
  9. package/esm/core/component/element/index.d.ts +7 -6
  10. package/esm/core/component/element/index.js +287 -222
  11. package/esm/core/component/element/type.d.ts +171 -12
  12. package/esm/core/component/element/type.js +48 -3
  13. package/esm/core/component/index.js +5 -0
  14. package/esm/core/instance/index.js +12 -1
  15. package/esm/foundation/index.d.ts +1 -1
  16. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -2
  17. package/esm/foundation/product-processor/easysafepay/index.js +29 -73
  18. package/esm/foundation/service/container/index.d.ts +0 -2
  19. package/esm/foundation/service/container/index.js +20 -47
  20. package/esm/foundation/utils/payment_product_utils.d.ts +1 -1
  21. package/esm/foundation/utils/payment_product_utils.js +2 -2
  22. package/esm/foundation/utils/preload_helper.d.ts +21 -0
  23. package/esm/foundation/utils/preload_helper.js +143 -0
  24. package/esm/index.d.ts +7 -2
  25. package/esm/index.js +94 -7
  26. package/esm/plugin/component/index.d.ts +1 -0
  27. package/esm/plugin/component/index.js +24 -11
  28. package/esm/service/index.d.ts +0 -1
  29. package/esm/service/index.js +0 -2
  30. package/esm/types/index.d.ts +8 -117
  31. package/esm/types/index.js +2 -34
  32. package/esm/util/security.d.ts +1 -0
  33. package/esm/util/security.js +3 -1
  34. package/esm/util/spm-map.d.ts +3 -0
  35. package/esm/util/spm-map.js +3 -0
  36. package/package.json +1 -1
  37. package/esm/service/element.d.ts +0 -4
  38. package/esm/service/element.js +0 -51
@@ -1,4 +1,25 @@
1
- import { ActionForm, ConnectErrorCode, ElementPaymentMethod } from '../../../types';
1
+ import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IPaymentMethod } from '../../../types';
2
+ export declare enum ElementPaymentEvent {
3
+ RENDER_COMPONENT = "renderComponent",
4
+ CAPTURE_ASSET = "onCaptureAsset",
5
+ SIGN_OUT = "onSignout",
6
+ BLUR = "onBlur",
7
+ VALIDATE = "submitPay",
8
+ SUBMIT_RISK = "onSubmitRisk",
9
+ AFTER_SUBMIT = "onAfterSubmit",
10
+ SIZE_CHANGE = "onSizeChange",
11
+ LAUNCH = "onLaunch",
12
+ CALLBACK = "callback",
13
+ SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
14
+ LOG = "log",
15
+ HANDLE_PAYMENT = "handlePayment"
16
+ }
17
+ export declare enum ElementPaymentMethod {
18
+ CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
19
+ AUTH_ELEMENT = "AUTH_ELEMENT",
20
+ ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
21
+ PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
22
+ }
2
23
  export declare enum ThemeType {
3
24
  NostalgicGray = "nostalgicGray",
4
25
  Default = "default",
@@ -7,13 +28,27 @@ export declare enum ThemeType {
7
28
  GamingPurple = "gamingPurple",
8
29
  AgateGreen = "agateGreen"
9
30
  }
31
+ export declare enum ElementType {
32
+ auth = "auth",
33
+ address = "address",
34
+ payment = "payment"
35
+ }
36
+ export declare enum PaymentElementLayout {
37
+ Tabs = "tabs",
38
+ Accordion = "Accordion"
39
+ }
40
+ export declare enum MountElementType {
41
+ auth = "AUTH_ELEMENT",
42
+ address = "ADDRESS_ELEMENT",
43
+ payment = "PAYMENT_ELEMENT"
44
+ }
10
45
  export declare const addressTheme: {
11
46
  default: string;
12
47
  night: string;
13
48
  };
14
49
  export declare enum EventCallbackCode {
15
- FAILED = "FAILED",
16
- SUCCESS = "SUCCESS"
50
+ SDK_CREATE_COMPONENT_ERROR = "SDK_CREATE_COMPONENT_ERROR",
51
+ SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR"
17
52
  }
18
53
  export declare enum ELEMENT_ENVIRONMENT {
19
54
  DEV = "DEV",
@@ -25,17 +60,16 @@ export declare enum ELEMENT_ENVIRONMENT {
25
60
  }
26
61
  export type ELEMENT_ENVIRONMENT_TYPE = keyof typeof ELEMENT_ENVIRONMENT | (typeof ELEMENT_ENVIRONMENT)[keyof typeof ELEMENT_ENVIRONMENT];
27
62
  export interface IElementOptions {
28
- sessionData: string;
29
63
  environment?: ELEMENT_ENVIRONMENT_TYPE;
30
64
  locale?: string;
31
- mode?: string;
32
65
  version?: string;
33
66
  appearance?: {
34
67
  theme: ThemeType.Default | ThemeType.Night;
35
68
  };
36
- onEventCallback?: ({ code, message }: {
69
+ onEventCallback?: ({ code, message, result }: {
37
70
  code: EventCallbackCode;
38
71
  message: string;
72
+ result?: any;
39
73
  }) => void;
40
74
  loading?: {
41
75
  onStartLoading: () => void;
@@ -45,6 +79,7 @@ export interface IElementOptions {
45
79
  export interface AddressMountComponentsParams {
46
80
  configParams?: AddressMountConfig;
47
81
  prefillValue: Array<AddressSubmitData>;
82
+ sessionData: string;
48
83
  appearance: {
49
84
  themeType: string;
50
85
  };
@@ -57,6 +92,7 @@ export interface AddressMountComponentsParams {
57
92
  }
58
93
  interface BaseMountOptions<T = void> {
59
94
  configParams?: T;
95
+ sessionData: string;
60
96
  debugProps?: {
61
97
  localLink: string;
62
98
  };
@@ -78,22 +114,51 @@ interface AddressMountConfig {
78
114
  hideFields?: Array<HideField>;
79
115
  }
80
116
  export interface AddressMountOptions extends BaseMountOptions<AddressMountConfig> {
81
- type: 'address';
117
+ type: ElementType.address;
82
118
  prefillValue: Array<AddressSubmitData>;
83
119
  appearance?: {
84
- theme: ThemeType.Default | ThemeType.Night;
120
+ theme?: ThemeType.Default | ThemeType.Night;
85
121
  };
86
122
  }
87
123
  export interface LinkAuthMountOptions extends BaseMountOptions {
88
- type: 'auth';
124
+ type: ElementType.auth;
89
125
  appearance?: {
90
- theme: ThemeType;
126
+ theme?: ThemeType;
91
127
  };
92
128
  }
93
129
  export interface PaymentMountOptions extends BaseMountOptions {
94
- type: 'payment';
130
+ type: ElementType.payment;
95
131
  appearance?: {
96
- theme: ThemeType;
132
+ theme?: ThemeType;
133
+ layout?: {
134
+ type: PaymentElementLayout;
135
+ };
136
+ variables?: {
137
+ 'content-primary': string;
138
+ 'content-secondary': string;
139
+ 'content-tertiary': string;
140
+ 'content-quaternary': string;
141
+ 'background-primary': string;
142
+ 'background-secondary': string;
143
+ 'background-disable': string;
144
+ 'background-transparency': string;
145
+ 'border-primary': string;
146
+ 'border-secondary': string;
147
+ 'border-disable': string;
148
+ 'action-normal': string;
149
+ 'action-hover': string;
150
+ 'action-disable': string;
151
+ 'action-secondary': string;
152
+ 'state-failure': string;
153
+ 'state-warning': string;
154
+ 'state-success': string;
155
+ 'state-info': string;
156
+ 'state-marketing': string;
157
+ 'radius-backup': string;
158
+ 'radius-module': string;
159
+ 'radius-component': string;
160
+ 'radius-button': string;
161
+ };
97
162
  };
98
163
  }
99
164
  export declare enum AddressEventCallbackName {
@@ -188,4 +253,98 @@ export interface SubmitFuncResult {
188
253
  success: boolean;
189
254
  msg: string;
190
255
  }
256
+ declare enum AccountStatusEnum {
257
+ EFFECTIVE = "EFFECTIVE",
258
+ UNREGISTERED = "UNREGISTERED"
259
+ }
260
+ type IAccountInfo = {
261
+ email?: string;
262
+ verifyId?: string;
263
+ accountStatus?: AccountStatusEnum;
264
+ oneAccountId?: string;
265
+ needOtp?: boolean;
266
+ errorMsg?: string;
267
+ inputStatus?: 'success' | 'loading' | 'error' | 'focused' | '';
268
+ resendLeftTimes?: number;
269
+ };
270
+ interface ShippingsItem {
271
+ shippingName: {
272
+ firstName: string;
273
+ lastName: string;
274
+ };
275
+ prefer: '1' | '0';
276
+ shippingId: string;
277
+ shippingPhoneNo: string;
278
+ shippingAddress: {
279
+ region: string;
280
+ state: string;
281
+ city: string;
282
+ address1: string;
283
+ address2: string;
284
+ zipCode: string;
285
+ };
286
+ }
287
+ interface Estimate {
288
+ unit: string;
289
+ value: number;
290
+ }
291
+ interface DeliveryEstimate {
292
+ maximum: Estimate;
293
+ minimum: Estimate;
294
+ }
295
+ interface FixedAmount {
296
+ amount: number;
297
+ currency: string;
298
+ }
299
+ interface ShippingRateData {
300
+ displayName: string;
301
+ deliveryEstimate: DeliveryEstimate;
302
+ fixedAmount: FixedAmount;
303
+ }
304
+ interface ShippingAddress {
305
+ address1: string;
306
+ address2: string;
307
+ city: string;
308
+ region: string;
309
+ state: string;
310
+ zipCode: string;
311
+ }
312
+ interface IUserName {
313
+ firstName: string;
314
+ middleName?: string;
315
+ lastName: string;
316
+ fullName?: string;
317
+ }
318
+ type Shippings = ShippingsItem[];
319
+ type IPaymentMethods = IPaymentMethod[];
320
+ interface CKPShipping {
321
+ shippingRateId?: string;
322
+ shippingRateData?: ShippingRateData;
323
+ shippingAddress: ShippingAddress;
324
+ shippingFee?: IAmount;
325
+ shippingFeeView?: IAmountView;
326
+ shippingDescription?: string;
327
+ deliveryEstimate?: DeliveryEstimate;
328
+ shippingFeeId?: string;
329
+ shippingName?: IUserName;
330
+ shippingPhoneNo?: string;
331
+ shipToEmail?: string;
332
+ notes?: string;
333
+ }
334
+ export interface AccountQueryRequest {
335
+ paymentSessionData: string;
336
+ paymentSessionConfig: any;
337
+ accountInfo: IAccountInfo;
338
+ }
339
+ export interface AccountQueryResult {
340
+ accountInfo: IAccountInfo;
341
+ actionForm?: ActionForm;
342
+ paymentMethods: IPaymentMethods;
343
+ shippings: Shippings;
344
+ success: boolean;
345
+ errorCode?: string;
346
+ errorMessage?: string;
347
+ errorStatus?: string;
348
+ shippingInfo?: CKPShipping;
349
+ }
191
350
  export {};
@@ -2,6 +2,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
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
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
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
+ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
6
+ ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
7
+ ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
8
+ ElementPaymentEvent["SIGN_OUT"] = "onSignout";
9
+ ElementPaymentEvent["BLUR"] = "onBlur";
10
+ ElementPaymentEvent["VALIDATE"] = "submitPay";
11
+ ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
12
+ ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
13
+ ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
14
+ ElementPaymentEvent["LAUNCH"] = "onLaunch";
15
+ ElementPaymentEvent["CALLBACK"] = "callback";
16
+ ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
17
+ ElementPaymentEvent["LOG"] = "log";
18
+ ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
19
+ return ElementPaymentEvent;
20
+ }({});
21
+ export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
22
+ ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
23
+ ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
24
+ ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
25
+ ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
26
+ return ElementPaymentMethod;
27
+ }({});
5
28
  export var ThemeType = /*#__PURE__*/function (ThemeType) {
6
29
  ThemeType["NostalgicGray"] = "nostalgicGray";
7
30
  ThemeType["Default"] = "default";
@@ -11,10 +34,27 @@ export var ThemeType = /*#__PURE__*/function (ThemeType) {
11
34
  ThemeType["AgateGreen"] = "agateGreen";
12
35
  return ThemeType;
13
36
  }({});
37
+ export var ElementType = /*#__PURE__*/function (ElementType) {
38
+ ElementType["auth"] = "auth";
39
+ ElementType["address"] = "address";
40
+ ElementType["payment"] = "payment";
41
+ return ElementType;
42
+ }({});
43
+ export var PaymentElementLayout = /*#__PURE__*/function (PaymentElementLayout) {
44
+ PaymentElementLayout["Tabs"] = "tabs";
45
+ PaymentElementLayout["Accordion"] = "Accordion";
46
+ return PaymentElementLayout;
47
+ }({});
48
+ export var MountElementType = /*#__PURE__*/function (MountElementType) {
49
+ MountElementType["auth"] = "AUTH_ELEMENT";
50
+ MountElementType["address"] = "ADDRESS_ELEMENT";
51
+ MountElementType["payment"] = "PAYMENT_ELEMENT";
52
+ return MountElementType;
53
+ }({});
14
54
  export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
15
55
  export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
16
- EventCallbackCode["FAILED"] = "FAILED";
17
- EventCallbackCode["SUCCESS"] = "SUCCESS";
56
+ EventCallbackCode["SDK_CREATE_COMPONENT_ERROR"] = "SDK_CREATE_COMPONENT_ERROR";
57
+ EventCallbackCode["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
18
58
  return EventCallbackCode;
19
59
  }({});
20
60
  export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
@@ -33,4 +73,9 @@ export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbac
33
73
  return AddressEventCallbackName;
34
74
  }({});
35
75
 
36
- // export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
76
+ // export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
77
+ var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
78
+ AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
79
+ AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
80
+ return AccountStatusEnum;
81
+ }(AccountStatusEnum || {}); // element 接口start
@@ -50,6 +50,7 @@ import { SecurityBusSubscriber } from "../bus/ability/security";
50
50
  import { TrackerBusSubscriber } from "../bus/ability/tracker";
51
51
  import CoreInstance from "../instance/index";
52
52
  import { loadChannelPneumaticControl } from "./appPreloadProcessing";
53
+ import PreloadHelper from "../../foundation/utils/preload_helper";
53
54
  export var getComponentSign = function getComponentSign(params) {
54
55
  var _params$paymentSessio = params.paymentSessionConfig,
55
56
  _params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
@@ -388,6 +389,10 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
388
389
  key: "preloadComponent",
389
390
  value: function preloadComponent(channelType, productSceneVersion) {
390
391
  var _this6 = this;
392
+ if (PreloadHelper.isWebAppPreloaded) {
393
+ console.log('[web-sdk] web app already preloaded');
394
+ return;
395
+ }
391
396
  this.channelType = channelType;
392
397
  this.productSceneVersion = productSceneVersion;
393
398
  var MAX_CLEAR_TIME = 10000;
@@ -31,6 +31,7 @@ import { LogConfig, Logger } from "../../util/logger";
31
31
  import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
32
32
  import { compareVersion } from "../../util/versionCompare";
33
33
  import { BusManager, BusMessage } from "../bus";
34
+ import PreloadHelper from "../../foundation/utils/preload_helper";
34
35
  var AMSSDK = /*#__PURE__*/function () {
35
36
  function AMSSDK(options) {
36
37
  _classCallCheck(this, AMSSDK);
@@ -168,7 +169,10 @@ var AMSSDK = /*#__PURE__*/function () {
168
169
  var sdk = this._getSecuritySDKByProductScene({
169
170
  product: product || scene
170
171
  });
171
- if (sdk) return;
172
+ if (sdk) {
173
+ console.log('[web-sdk] skip init security sdk because it is already loaded');
174
+ return;
175
+ }
172
176
  this._newSecuritySDKByScene({
173
177
  product: product || scene,
174
178
  region: SecurityRegionEnum.SG
@@ -197,6 +201,13 @@ var AMSSDK = /*#__PURE__*/function () {
197
201
  var storage = this.getSecurityConfigStorage(securityConfig.product);
198
202
  var scene = storage.scene || getSecurityScene(securityConfig.product);
199
203
  var securitySdk = this.securitySdkMap.get(scene);
204
+ if (!securitySdk) {
205
+ securitySdk = PreloadHelper.getSecuritySdk(scene);
206
+ if (securitySdk) {
207
+ console.log('[web-sdk] return security sdk from preloaded');
208
+ this.securitySdkMap.set(scene, securitySdk);
209
+ }
210
+ }
200
211
  return securitySdk;
201
212
  }
202
213
  /**
@@ -67,7 +67,7 @@ export interface SDKMetaData {
67
67
  productScene: ProductSceneEnum;
68
68
  sdkVersion: string;
69
69
  webAppVersion: string;
70
- greyscaleId: number;
70
+ greyscaleId?: number;
71
71
  }
72
72
  export interface InitContext {
73
73
  initOptions: IoptionsParams;
@@ -11,8 +11,6 @@ export declare class EasySafePayProcessor implements ProductProcessor {
11
11
  private SECURITY_SDK_INIT_TIMEOUT;
12
12
  init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
13
13
  startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
14
- private preloadWebApp;
15
- private buildWebAppPreloadUrl;
16
14
  private buildWebAppUrl;
17
15
  private buildRedirectResult;
18
16
  /**
@@ -16,7 +16,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
16
16
  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; }
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
18
  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); }
19
- import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
19
+ import PreloadHelper from "../../../foundation/utils/preload_helper";
20
+ import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
20
21
  export var EasySafePayProcessor = /*#__PURE__*/function () {
21
22
  function EasySafePayProcessor() {
22
23
  _classCallCheck(this, EasySafePayProcessor);
@@ -39,7 +40,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
39
40
  this.instanceId = instanceId;
40
41
  this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
41
42
  this.securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
42
- this.preloadWebApp(config, this.instanceId, sdkMetaData);
43
+
44
+ // preload web app
45
+ PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment);
43
46
  }
44
47
  }, {
45
48
  key: "startBizFlow",
@@ -103,53 +106,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
103
106
  }
104
107
  return startBizFlow;
105
108
  }()
106
- }, {
107
- key: "preloadWebApp",
108
- value: function preloadWebApp(config, instanceId, sdkMetaData) {
109
- // trigger preload
110
- var containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
111
- var _this$buildWebAppPrel = this.buildWebAppPreloadUrl(config, instanceId, sdkMetaData),
112
- taskId = _this$buildWebAppPrel.taskId,
113
- webUrl = _this$buildWebAppPrel.webUrl;
114
- containerService.preload(taskId, webUrl);
115
- }
116
- }, {
117
- key: "buildWebAppPreloadUrl",
118
- value: function buildWebAppPreloadUrl(initConfig, instanceId, sdkMetaData) {
119
- var _this = this,
120
- _initConfig$analytics;
121
- var previousProductInfo = ProductInfoCacheUtil.getPreviousProductInfo(ProductSceneEnum.EASY_PAY, function (errorMsg) {
122
- if (errorMsg) {
123
- _this.logger.logError({
124
- title: 'performance_optimization_get_previousChannel_error'
125
- }, {
126
- errorMessage: errorMsg
127
- });
128
- }
129
- });
130
- var paymentMethodCategoryType = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.paymentMethodCategoryType;
131
- var productSceneVersion = (previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.productSceneVersion) || '2.0';
132
- var taskId = "ams-checkout-component-".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
133
- var hostSign = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.hostSign;
134
- var webUrl = WebAppUrlUtil.getWebAppUrl({
135
- environment: initConfig.environment,
136
- paymentMethodCategoryType: paymentMethodCategoryType,
137
- sdkMetaData: sdkMetaData,
138
- isPreload: true,
139
- productSceneVersion: productSceneVersion,
140
- query: {
141
- analyticsEnabled: (_initConfig$analytics = initConfig.analytics) === null || _initConfig$analytics === void 0 ? void 0 : _initConfig$analytics.enabled,
142
- displayType: DisplayTypeEnum.popup,
143
- instanceId: instanceId,
144
- locale: initConfig.locale,
145
- hostSign: hostSign
146
- }
147
- });
148
- return {
149
- webUrl: webUrl,
150
- taskId: taskId
151
- };
152
- }
153
109
  }, {
154
110
  key: "buildWebAppUrl",
155
111
  value: function buildWebAppUrl() {
@@ -205,7 +161,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
205
161
  }, {
206
162
  key: "sendRequestAndWaitWebLaunch",
207
163
  value: function sendRequestAndWaitWebLaunch() {
208
- var _this2 = this;
164
+ var _this = this;
209
165
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
210
166
  var webLaunchPromise = new Promise(function (resolve) {
211
167
  eventCenter.listen('onLaunch', function (res) {
@@ -215,25 +171,25 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
215
171
 
216
172
  // 等请求和 Web启动都Ready之后,发送renderComponent
217
173
  Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
218
- var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6;
174
+ var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext$4;
219
175
  var _ref2 = _slicedToArray(_ref, 3),
220
176
  _initSecurityRes = _ref2[0],
221
177
  submitRes = _ref2[1],
222
178
  _webLaunchRes = _ref2[2];
223
- var logMetaData = _this2.logger.getLogConfig().mdata;
179
+ var logMetaData = _this.logger.getLogConfig().mdata;
224
180
  eventCenter.dispatchToApp({
225
181
  event: 'renderComponent',
226
182
  data: {
227
- sessionResult: (_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj,
183
+ sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
228
184
  submitResult: submitRes,
229
- paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSessionId,
185
+ paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
230
186
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
231
- renderDisplayType: _this2.paymentContext.displayInfo.type,
232
- appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
233
- notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
234
- isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
235
- merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
236
- allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
187
+ renderDisplayType: _this.paymentContext.displayInfo.type,
188
+ appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
189
+ notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
190
+ isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
191
+ merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
192
+ allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
237
193
  envInfo: {
238
194
  screenHeight: screen.height,
239
195
  screenWidth: screen.width
@@ -242,7 +198,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
242
198
  trackId: logMetaData.requestSeq,
243
199
  platform: logMetaData.platform,
244
200
  firstLogTime: logMetaData.firstLogTime
245
- }, ((_this2$paymentContext6 = _this2.paymentContext.paymentSessionObj) === null || _this2$paymentContext6 === void 0 ? void 0 : _this2$paymentContext6.paymentSessionConfig) || {}), {}, {
201
+ }, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
246
202
  renderDisplayType: logMetaData.renderDisplayType,
247
203
  sdkVersion: logMetaData.sdkVersion,
248
204
  merchantId: logMetaData.merchantId,
@@ -257,21 +213,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
257
213
  key: "processSubmitPay",
258
214
  value: function () {
259
215
  var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
260
- var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$2;
261
- var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
216
+ var _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$6;
217
+ var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$5, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
262
218
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
263
219
  while (1) switch (_context2.prev = _context2.next) {
264
220
  case 0:
265
221
  submitParams = {
266
- paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionId) || '',
267
- paymentSessionConfig: (_this$paymentContext2 = this.paymentContext) === null || _this$paymentContext2 === void 0 || (_this$paymentContext2 = _this$paymentContext2.paymentSessionObj) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionConfig
222
+ paymentSessionData: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionId) || '',
223
+ paymentSessionConfig: (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionConfig
268
224
  };
269
225
  _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
270
- _ref4 = ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
226
+ _ref4 = ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
271
227
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
272
228
  ///EasyPay 2.0 首次传signAgreement字段
273
229
  submitParams['signAgreement'] = enableSignAgreement;
274
- paymentMethodType = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType;
230
+ paymentMethodType = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$5 === void 0 || (_this$paymentContext$5 = _this$paymentContext$5.paymentMethodInfoView) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.paymentMethodType;
275
231
  isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
276
232
  if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
277
233
  backScheme = getBackScheme(undefined, this.logger);
@@ -302,7 +258,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
302
258
  extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
303
259
  instanceId: this.instanceId,
304
260
  locale: this.initConfig.locale,
305
- paymentMethodType: (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentMethodInfoView) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.paymentMethodType,
261
+ paymentMethodType: (_this$paymentContext$6 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$6 === void 0 || (_this$paymentContext$6 = _this$paymentContext$6.paymentMethodInfoView) === null || _this$paymentContext$6 === void 0 ? void 0 : _this$paymentContext$6.paymentMethodType,
306
262
  paymentSessionData: this.paymentContext.paymentSessionId,
307
263
  env: this.initConfig.environment,
308
264
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
@@ -369,13 +325,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
369
325
  key: "acquireApdidToken",
370
326
  value: function () {
371
327
  var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
372
- var _this$paymentContext$3;
328
+ var _this$paymentContext$7;
373
329
  var securityService, productScene, deviceId;
374
330
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
375
331
  while (1) switch (_context3.prev = _context3.next) {
376
332
  case 0:
377
333
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
378
- productScene = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentSessionConfig) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.productScene;
334
+ productScene = (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentSessionConfig) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.productScene;
379
335
  deviceId = securityService.getDeviceId({
380
336
  productScene: productScene
381
337
  });
@@ -395,14 +351,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
395
351
  key: "initSecuritySDK",
396
352
  value: function () {
397
353
  var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
398
- var _this$paymentContext$4, _this$paymentContext$5, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay, shouldInitSecuritySDK;
354
+ var _this$paymentContext$8, _this$paymentContext$9, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay, shouldInitSecuritySDK;
399
355
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
400
356
  while (1) switch (_context4.prev = _context4.next) {
401
357
  case 0:
402
358
  _context4.prev = 0;
403
359
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
404
- nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
405
- nonInitSecuritySDK = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.nonInitSecuritySDK;
360
+ nonCompliant = (_this$paymentContext$8 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.nonCompliant;
361
+ nonInitSecuritySDK = (_this$paymentContext$9 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$9 === void 0 ? void 0 : _this$paymentContext$9.nonInitSecuritySDK;
406
362
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
407
363
  shouldInitSecuritySDK = false;
408
364
  if (nonInitSecuritySDK) {
@@ -16,8 +16,6 @@ export declare class ContainerService implements Service {
16
16
  update(): void;
17
17
  load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
18
18
  cleanContainer(displayInfo: DisplayInfo): void;
19
- preload(taskId: string, url: string): void;
20
- clearPreloadContainer(taskId: string): void;
21
19
  showLoading(container: HTMLDivElement, displayInfo: DisplayInfo): void;
22
20
  dismissLoading(isKeepMockup?: boolean): void;
23
21
  customizeLoading(listener: (event: 'SDK_START_OF_LOADING' | 'SDK_END_OF_LOADING') => void): void;