@alipay/ams-checkout 0.0.1711691167-dev.7 → 0.0.1712549252-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { Logger } from '../../util/logger';
1
+ import type { Logger } from "../../util/logger";
2
2
  /**
3
3
  * Bus 埋点内容定义
4
4
  */
@@ -4,11 +4,7 @@ export declare enum PaymentActionEnum {
4
4
  export declare enum ApplePayActionEnum {
5
5
  canMakePayments = "plugin_CARD_APPLE_PAY_available",
6
6
  createComponent = "plugin_CARD_APPLE_PAY_createComponent",
7
- destroyComponent = "plugin_CARD_APPLE_PAY_destroyComponent"
8
- }
9
- export declare enum PaypalActionEnum {
10
- mountComponent = "plugin_Paypal_mountComponent",
11
- destroyComponent = "plugin_Paypal_destroyComponent"
7
+ destoryComponent = "plugin_CARD_APPLE_PAY_destoryComponent"
12
8
  }
13
9
  export declare enum SDKCallbackActionEnum {
14
10
  onEventCallback = "onEventCallback"
@@ -5,14 +5,9 @@ export var PaymentActionEnum = /*#__PURE__*/function (PaymentActionEnum) {
5
5
  export var ApplePayActionEnum = /*#__PURE__*/function (ApplePayActionEnum) {
6
6
  ApplePayActionEnum["canMakePayments"] = "plugin_CARD_APPLE_PAY_available";
7
7
  ApplePayActionEnum["createComponent"] = "plugin_CARD_APPLE_PAY_createComponent";
8
- ApplePayActionEnum["destroyComponent"] = "plugin_CARD_APPLE_PAY_destroyComponent";
8
+ ApplePayActionEnum["destoryComponent"] = "plugin_CARD_APPLE_PAY_destoryComponent";
9
9
  return ApplePayActionEnum;
10
10
  }({});
11
- export var PaypalActionEnum = /*#__PURE__*/function (PaypalActionEnum) {
12
- PaypalActionEnum["mountComponent"] = "plugin_Paypal_mountComponent";
13
- PaypalActionEnum["destroyComponent"] = "plugin_Paypal_destroyComponent";
14
- return PaypalActionEnum;
15
- }({});
16
11
  export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum) {
17
12
  SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
18
13
  return SDKCallbackActionEnum;
@@ -29,19 +29,18 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
29
  */
30
30
  import { v4 as uuid } from 'uuid';
31
31
  import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
32
- import { ApplePayBusSubscriber } from "../../plugin/applepay";
33
32
  import ComponentApp from "../../plugin/component";
34
- import { ExtendPlugin } from "../../plugin/const";
35
- import { PaypalBusSubscriber } from "../../plugin/paypal";
36
33
  import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
37
34
  import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
38
35
  import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
39
36
  import { getSecurityConfigStorageKey } from "../../util/security";
37
+ import CoreInstance from "../instance/index";
40
38
  import { BusManager, BusMessage } from "../bus";
41
39
  import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
40
+ import { ApplePayBusSubscriber } from "../../plugin/applepay";
42
41
  import { SecurityBusSubscriber } from "../bus/ability/security";
43
42
  import { TrackerBusSubscriber } from "../bus/ability/tracker";
44
- import CoreInstance from "../instance/index";
43
+ import { ExtendPlugin } from "../../plugin/const";
45
44
  export var getComponentSign = function getComponentSign(params) {
46
45
  var _params$paymentSessio = params.paymentSessionConfig,
47
46
  _params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
@@ -230,7 +229,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
230
229
  BusManager.subscribe(new TrackerBusSubscriber(this.logger));
231
230
  // subscribe plugin
232
231
  BusManager.subscribe(new ApplePayBusSubscriber(this.logger));
233
- BusManager.subscribe(new PaypalBusSubscriber(this.logger));
234
232
 
235
233
  // register bus plugin
236
234
  ExtendPlugin.forEach(function (item) {
@@ -266,7 +264,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
266
264
  * only the channel described in the document will be called, and it will be returned as available by default
267
265
  * @param paymentMethod - described in the document
268
266
  * @param subPaymentMethod - described in the document
269
- * @returns
267
+ * @returns
270
268
  */
271
269
  }, {
272
270
  key: "canMakePayments",
@@ -324,8 +322,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
324
322
  _this4._eventCenter.emit(EVENT.error.name, error);
325
323
  return Promise.reject(error);
326
324
  }).then(function (appendParams) {
327
- var iframeNodesParams = appendParams.iframeNodesParams;
328
- _this4.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
329
325
  return _this4.createComponentProcess(appendParams);
330
326
  });
331
327
  }
@@ -414,8 +410,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
414
410
  _this6._eventCenter.emit(EVENT.error.name, error);
415
411
  return Promise.reject(error);
416
412
  }).then(function (appendParams) {
417
- var iframeNodesParams = appendParams.iframeNodesParams;
418
- _this6.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
419
413
  return _this6.mountComponentProcess(appendParams);
420
414
  });
421
415
  }
@@ -1,15 +1,8 @@
1
- /**
2
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
- * 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
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
- */
8
- import { ComponentActionNamesType } from 'src/plugin/type';
9
1
  import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig, IoptionsParams } from '../../types/index';
10
2
  import { EventCenter } from '../../util/index';
11
3
  import { Logger } from '../../util/logger';
12
4
  import { Security } from '../../util/security';
5
+ import { ComponentActionNamesType } from 'src/plugin/type';
13
6
  export default class AMSSDK {
14
7
  options: AMSCheckoutOptions;
15
8
  originOptions: IoptionsParams;
@@ -16,7 +16,6 @@ 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
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
-
20
19
  import { v4 as uuid } from 'uuid';
21
20
  import { sdkVersion } from "../../config/index";
22
21
  import { ERRORMESSAGE, EVENT } from "../../constant";
@@ -25,8 +24,8 @@ import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, productSceneEnu
25
24
  import { checkTimeElapsed, device, EventCenter, getOrSetStorageId, getType, queryParse, safeJson } from "../../util/index";
26
25
  import CallApp from "../../util/intl-callapp/es/main";
27
26
  import { LogConfig, Logger } from "../../util/logger";
28
- import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
29
27
  import { compareVersion } from "../../util/versionCompare";
28
+ import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
30
29
  import { BusManager, BusMessage } from "../bus";
31
30
  var AMSSDK = /*#__PURE__*/function () {
32
31
  function AMSSDK(options) {
@@ -62,11 +61,9 @@ var AMSSDK = /*#__PURE__*/function () {
62
61
  instanceId: this._instanceId
63
62
  });
64
63
  this.logger.initTracker();
65
- this.logger.setComponentStartTime(Date.now());
66
- this.logger.setTrackId(this._instanceId);
67
64
  this.logger.logInfo({
68
65
  title: 'NEW_AMSSDK_BY_MECHANT',
69
- msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale)
66
+ msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale, "}")
70
67
  }).send();
71
68
  this.preInitSecurity();
72
69
  }
@@ -112,13 +109,11 @@ var AMSSDK = /*#__PURE__*/function () {
112
109
  this.logger.logInfo({
113
110
  title: 'sdk_event_apiOnDestroy'
114
111
  }).send();
115
- var actionName = (_this$getBusActionNam = this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.destroyComponent;
112
+ var actionName = (_this$getBusActionNam = this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.destoryComponent;
116
113
  if (actionName && BusManager.isSubscribed(actionName)) {
117
- var _this$_appendParams;
118
114
  // 执行出错了,在通用拦截器返回
119
115
  BusManager.publish(new BusMessage(actionName, JSON.stringify({
120
- options: this.originOptions,
121
- selector: (_this$_appendParams = this._appendParams) === null || _this$_appendParams === void 0 || (_this$_appendParams = _this$_appendParams.iframeNodesParams) === null || _this$_appendParams === void 0 ? void 0 : _this$_appendParams.selector
116
+ options: this.originOptions
122
117
  })));
123
118
  }
124
119
  var _iterator = _createForOfIteratorHelper(this.plugins.values()),
@@ -320,14 +315,14 @@ var AMSSDK = /*#__PURE__*/function () {
320
315
  key: "_registerPlugin",
321
316
  value: function _registerPlugin(pluginId, plugin) {
322
317
  this.plugins.set(pluginId, plugin);
323
- if (plugin !== null && plugin !== void 0 && plugin.applyPlugin) {
324
- try {
318
+ try {
319
+ if (plugin.applyPlugin) {
325
320
  plugin.applyPlugin(this);
326
- } catch (error) {
327
- this.plugins.delete(pluginId);
328
- if (getType(error) === 'error') throw error;
329
- throw new Error("Failed to register plug-in\uFF1A".concat(pluginId, " Exception in the apply function of the plug-in"));
330
321
  }
322
+ } catch (error) {
323
+ this.plugins.delete(pluginId);
324
+ if (getType(error) === 'error') throw error;
325
+ throw new Error("Failed to register plug-in\uFF1A".concat(pluginId, " Exception in the apply function of the plug-in"));
331
326
  }
332
327
  }
333
328
  /**
@@ -342,7 +337,6 @@ var AMSSDK = /*#__PURE__*/function () {
342
337
  }
343
338
  return this.plugins.get(pluginId);
344
339
  }
345
-
346
340
  /**
347
341
  * @description Execute to open app or jump link
348
342
  */
@@ -14,7 +14,7 @@ export declare enum ApplePayComponentEvent {
14
14
  sdk_event_appleOnvalidatemerchant = "sdk_event_appleOnvalidatemerchant",
15
15
  sdk_event_appleSubmitToken = "sdk_event_appleSubmitToken",
16
16
  sdk_event_applePaymentResult = "sdk_event_applePaymentResult",
17
- sdk_event_appleDestroyComponent = "sdk_event_appleDestroyComponent"
17
+ sdk_event_appleDestoryComponent = "sdk_event_appleDestoryComponent"
18
18
  }
19
19
  /**
20
20
  * Apple pay Component
@@ -27,7 +27,7 @@ export var ApplePayComponentEvent = /*#__PURE__*/function (ApplePayComponentEven
27
27
  ApplePayComponentEvent["sdk_event_appleOnvalidatemerchant"] = "sdk_event_appleOnvalidatemerchant";
28
28
  ApplePayComponentEvent["sdk_event_appleSubmitToken"] = "sdk_event_appleSubmitToken";
29
29
  ApplePayComponentEvent["sdk_event_applePaymentResult"] = "sdk_event_applePaymentResult";
30
- ApplePayComponentEvent["sdk_event_appleDestroyComponent"] = "sdk_event_appleDestroyComponent";
30
+ ApplePayComponentEvent["sdk_event_appleDestoryComponent"] = "sdk_event_appleDestoryComponent";
31
31
  return ApplePayComponentEvent;
32
32
  }({});
33
33
 
@@ -55,8 +55,8 @@ var ApplePayComponent = /*#__PURE__*/function () {
55
55
 
56
56
  /**
57
57
  * Is Apple Pay Enabled
58
- * @param subTypeEnum
59
- * @returns
58
+ * @param subTypeEnum
59
+ * @returns
60
60
  */
61
61
  _createClass(ApplePayComponent, [{
62
62
  key: "canMakePayments",
@@ -66,8 +66,8 @@ var ApplePayComponent = /*#__PURE__*/function () {
66
66
 
67
67
  /**
68
68
  * Is Apple Pay Enabled
69
- * @param subTypeEnum
70
- * @returns
69
+ * @param subTypeEnum
70
+ * @returns
71
71
  */
72
72
  }, {
73
73
  key: "isAppPayEnabled",
@@ -12,6 +12,6 @@ export declare class ApplePayBusSubscriber extends BusSubscriber {
12
12
  protected onOptionalInit(context: BusContext, message: BusMessage): void;
13
13
  protected onCanMakePayments(context: BusContext, message: BusMessage): void;
14
14
  protected onCreateComponent(context: BusContext, message: BusMessage): void;
15
- protected onDestroyComponent(context: BusContext, message: BusMessage): void;
15
+ protected onDestoryComponent(context: BusContext, message: BusMessage): void;
16
16
  onMessage(context: BusContext, message: BusMessage): void;
17
17
  }
@@ -80,13 +80,13 @@ export var ApplePayBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
80
80
  this.applePay.submitPay(appendParams);
81
81
  }
82
82
  }, {
83
- key: "onDestroyComponent",
84
- value: function onDestroyComponent(context, message) {
83
+ key: "onDestoryComponent",
84
+ value: function onDestoryComponent(context, message) {
85
85
  this.applePay = null;
86
- console.log('onDestroyComponent', context, message);
86
+ console.log('onDestoryComponent', context, message);
87
87
  this.logger.logInfo({
88
88
  name: 'APPLE_PAY',
89
- title: ApplePayComponentEvent.sdk_event_appleDestroyComponent
89
+ title: ApplePayComponentEvent.sdk_event_appleDestoryComponent
90
90
  }, {
91
91
  biz: 'sdk',
92
92
  type: 'funnel'
@@ -105,8 +105,8 @@ export var ApplePayBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
105
105
  case ApplePayActionEnum.createComponent:
106
106
  this.onCreateComponent(context, message);
107
107
  break;
108
- case ApplePayActionEnum.destroyComponent:
109
- this.onDestroyComponent(context, message);
108
+ case ApplePayActionEnum.destoryComponent:
109
+ this.onDestoryComponent(context, message);
110
110
  break;
111
111
  default:
112
112
  console.log("Unknown action: " + message.getAction());
@@ -54,7 +54,7 @@ var ComponentApp = /*#__PURE__*/function () {
54
54
  _defineProperty(this, "_merchantAppointParam", void 0);
55
55
  _defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
56
56
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
57
- this._appVersion = '1.13.0';
57
+ this._appVersion = '1.11.0';
58
58
  this._isInitComponent = false;
59
59
  this._selector = "#".concat(COMPONENT_SECTION_ID);
60
60
  this.createIframeNode = function () {
@@ -94,7 +94,7 @@ var ComponentApp = /*#__PURE__*/function () {
94
94
  }, {
95
95
  key: "initLoggerMeta",
96
96
  value: function initLoggerMeta() {
97
- var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2, _this$_renderParams3;
97
+ var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2;
98
98
  var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
99
99
  var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
100
100
  this.AMSSDK.logger.setMedta({
@@ -110,9 +110,9 @@ var ComponentApp = /*#__PURE__*/function () {
110
110
  productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
111
111
  paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
112
112
  paymentMethodCategoryType: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.paymentMethodCategoryType,
113
- requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData,
114
- trackId: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData
113
+ requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData
115
114
  });
115
+ this.AMSSDK.logger.setComponentStartTime(Date.now());
116
116
  }
117
117
 
118
118
  /**
@@ -131,9 +131,9 @@ var ComponentApp = /*#__PURE__*/function () {
131
131
  }, {
132
132
  key: "initSecurity",
133
133
  value: function initSecurity() {
134
- var _this$_renderParams4,
134
+ var _this$_renderParams3,
135
135
  _this = this;
136
- var product = (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionMetaData) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionConfig) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.productScene;
136
+ var product = (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 || (_this$_renderParams3 = _this$_renderParams3.paymentSessionMetaData) === null || _this$_renderParams3 === void 0 || (_this$_renderParams3 = _this$_renderParams3.paymentSessionConfig) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.productScene;
137
137
  if (componentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
138
138
  if (componentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
139
139
  this.AMSSDK.logger.logInfo({
@@ -483,8 +483,7 @@ var ComponentApp = /*#__PURE__*/function () {
483
483
  _this5.AMSSDK.logger.logInfo({
484
484
  title: 'sdk_event_sdkQuery'
485
485
  }, {
486
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
487
- requestBody: params
486
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
488
487
  }).send();
489
488
  queryPaymentInfo(params, {
490
489
  env: _this5.AMSSDK.options.env.environment,
@@ -495,12 +494,6 @@ var ComponentApp = /*#__PURE__*/function () {
495
494
  value: Date.now()
496
495
  });
497
496
  resolve(res);
498
- _this5.AMSSDK.logger.logInfo({
499
- title: 'sdk_event_sdkQueryEnd'
500
- }, {
501
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
502
- responseBody: res
503
- }).send();
504
497
  }).catch(function (err) {
505
498
  if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
506
499
  return resolve({
@@ -510,13 +503,13 @@ var ComponentApp = /*#__PURE__*/function () {
510
503
  _this5.dispatchToSDK(EVENT.error.name, {
511
504
  code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
512
505
  });
513
- _this5.AMSSDK.logger.logError({
514
- title: 'sdk_event_sdkQuery_failed'
506
+ reject(err);
507
+ }).finally(function () {
508
+ _this5.AMSSDK.logger.logInfo({
509
+ title: 'sdk_event_sdkQueryEnd'
515
510
  }, {
516
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
517
- errorReason: err
511
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
518
512
  }).send();
519
- reject(err);
520
513
  });
521
514
  case 38:
522
515
  case "end":
@@ -535,16 +528,16 @@ var ComponentApp = /*#__PURE__*/function () {
535
528
  }, {
536
529
  key: "createSubmitPromise",
537
530
  value: function createSubmitPromise() {
538
- var _this$_renderParams5,
539
- _this$_renderParams6,
531
+ var _this$_renderParams4,
532
+ _this$_renderParams5,
540
533
  _this6 = this;
541
534
  this._performanceData.push({
542
535
  key: 'sdk_submit_start',
543
536
  value: Date.now()
544
537
  });
545
538
  var params = {
546
- paymentSessionData: this._renderParams && ((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData) || '',
547
- paymentSessionConfig: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 || (_this$_renderParams6 = _this$_renderParams6.paymentSessionMetaData) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionConfig
539
+ paymentSessionData: this._renderParams && ((_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.sessionData) || '',
540
+ paymentSessionConfig: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 || (_this$_renderParams5 = _this$_renderParams5.paymentSessionMetaData) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.paymentSessionConfig
548
541
  };
549
542
 
550
543
  // eslint-disable-next-line no-async-promise-executor
@@ -566,8 +559,7 @@ var ComponentApp = /*#__PURE__*/function () {
566
559
  _this6.AMSSDK.logger.logInfo({
567
560
  title: 'sdk_event_submitPay'
568
561
  }, {
569
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
570
- requestBody: params
562
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
571
563
  }).send();
572
564
  _context3.t0 = submitPayInfo;
573
565
  _context3.t1 = params;
@@ -590,23 +582,21 @@ var ComponentApp = /*#__PURE__*/function () {
590
582
  key: 'sdk_submit_end',
591
583
  value: Date.now()
592
584
  });
585
+ if (res !== null && res !== void 0 && res.success) {
586
+ resolve(res);
587
+ } else {
588
+ resolve(res);
589
+ }
590
+ }).catch(function () {
591
+ resolve({
592
+ success: false
593
+ });
594
+ }).finally(function () {
593
595
  _this6.AMSSDK.logger.logInfo({
594
596
  title: 'sdk_event_submitPayEnd'
595
597
  }, {
596
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
597
- responseBody: res
598
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
598
599
  }).send();
599
- resolve(res);
600
- }).catch(function (err) {
601
- _this6.AMSSDK.logger.logError({
602
- title: 'sdk_event_submitPay_failed'
603
- }, {
604
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
605
- responseBody: err
606
- }).send();
607
- resolve({
608
- success: false
609
- });
610
600
  });
611
601
  case 13:
612
602
  case "end":
@@ -1354,7 +1344,7 @@ var ComponentApp = /*#__PURE__*/function () {
1354
1344
  key: "sendRenderEvent",
1355
1345
  value: (function () {
1356
1346
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1357
- var _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, _this$_renderParams11, _this$_renderParams12, _this$AMSSDK$logger, _this$_renderParams13, _this$_renderParams14, _this$_renderParams15, _this$AMSSDK, _this$_renderParams16, res, submitRes;
1347
+ var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
1358
1348
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1359
1349
  while (1) switch (_context8.prev = _context8.next) {
1360
1350
  case 0:
@@ -1383,29 +1373,17 @@ var ComponentApp = /*#__PURE__*/function () {
1383
1373
  data: {
1384
1374
  queryResult: res,
1385
1375
  submitResult: submitRes,
1386
- sessionResult: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionMetaData,
1387
- paymentSessionData: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.sessionData,
1376
+ sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
1377
+ paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
1388
1378
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
1389
- renderDisplayType: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.renderDisplayType,
1390
- appearance: (_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.appearance,
1391
- notRedirectAfterComplete: ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.notRedirectAfterComplete) === true,
1379
+ renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
1380
+ appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
1381
+ notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
1392
1382
  merchantAppointParam: this._merchantAppointParam,
1393
1383
  envInfo: {
1394
1384
  screenHeight: screen.height,
1395
1385
  screenWidth: screen.width
1396
- },
1397
- logMetaData: _objectSpread(_objectSpread({
1398
- trackId: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData,
1399
- platform: this.platform,
1400
- firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
1401
- }, ((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig) || {}), {}, {
1402
- renderDisplayType: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.renderDisplayType,
1403
- sdkVersion: this._appVersion,
1404
- merchantId: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 || (_this$_renderParams15 = _this$_renderParams15.paymentSessionMetaData) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.clientId,
1405
- instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1406
- performanceData: this._performanceData,
1407
- paymentMethodType: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 || (_this$_renderParams16 = _this$_renderParams16.paymentSessionMetaData) === null || _this$_renderParams16 === void 0 || (_this$_renderParams16 = _this$_renderParams16.paymentMethodInfoView) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.paymentMethodType
1408
- })
1386
+ }
1409
1387
  }
1410
1388
  }
1411
1389
  });
@@ -1,11 +1,11 @@
1
- import { ApplePayActionEnum, PaymentActionEnum, PaypalActionEnum } from "../core/bus/interface";
2
- import { paymentMethodCategoryTypeEnum, PaypalMethodEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
1
+ import { ApplePayActionEnum, PaymentActionEnum } from "../core/bus/interface";
2
+ import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
3
3
  export var ExtendPlugin = [{
4
4
  sessionMatcher: {
5
5
  productScene: productSceneEnum.CASHIER_PAYMENT,
6
6
  productSceneVersion: ProductSceneVersion.V1,
7
7
  paymentMethodCategoryType: paymentMethodCategoryTypeEnum.CARD,
8
- paymentMethodTypes: ['CARD_APPLE_PAY']
8
+ paymentMethodTypes: ["CARD_APPLE_PAY"]
9
9
  },
10
10
  paymentChannelMatcher: {
11
11
  paymentMethod: 'ApplePay'
@@ -14,20 +14,6 @@ export var ExtendPlugin = [{
14
14
  canMakePayments: ApplePayActionEnum.canMakePayments,
15
15
  optional_init: PaymentActionEnum.optional_init,
16
16
  createComponent: ApplePayActionEnum.createComponent,
17
- destroyComponent: ApplePayActionEnum.destroyComponent
18
- }
19
- }, {
20
- sessionMatcher: {
21
- productScene: productSceneEnum.CASHIER_PAYMENT,
22
- productSceneVersion: ProductSceneVersion.V1,
23
- paymentMethodCategoryType: paymentMethodCategoryTypeEnum.APM,
24
- paymentMethodTypes: [PaypalMethodEnum.PAYPAL_CHECKOUT, PaypalMethodEnum.PAYPAL_PAYLATER, PaypalMethodEnum.PAYPAL_VAULT]
25
- },
26
- paymentChannelMatcher: {
27
- paymentMethod: 'Paypal'
28
- },
29
- busActionNames: {
30
- mountComponent: PaypalActionEnum.mountComponent,
31
- destroyComponent: PaypalActionEnum.destroyComponent
17
+ destoryComponent: ApplePayActionEnum.destoryComponent
32
18
  }
33
19
  }];
@@ -1,4 +1,4 @@
1
- import { BusSubscriber } from 'src/core/bus';
1
+ import { BusSubscriber } from '../core/bus';
2
2
  import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from '../types';
3
3
  export type IExtendPlugin = IExtendPluginItem[];
4
4
  export interface ComponentActionNamesType {
@@ -7,7 +7,7 @@ export interface ComponentActionNamesType {
7
7
  createComponent?: string;
8
8
  mountComponent?: string;
9
9
  submit?: string;
10
- destroyComponent?: string;
10
+ destoryComponent?: string;
11
11
  }
12
12
  export type IExtendPluginItem = {
13
13
  /**
@@ -81,19 +81,6 @@ export interface IappendIframeNodesParams extends IcreateComponent {
81
81
  paymentSessionMetaData: IpaymentSessionMetaData;
82
82
  renderDisplayType: renderDisplayTypeEnum;
83
83
  selector?: Iselector;
84
- paypalConfiguration?: IPaypalConfiguration;
85
- }
86
- export interface IPaypalConfiguration {
87
- style?: Object;
88
- blockPayPalCreditButton?: boolean;
89
- blockPayPalPayLaterButton?: boolean;
90
- displayPayPalPayLaterButtonOnly?: boolean;
91
- enableMessages?: boolean;
92
- intent?: payPalConfigurationIntentEnum;
93
- }
94
- export declare enum payPalConfigurationIntentEnum {
95
- 'intent' = "intent",
96
- 'capture' = "capture"
97
84
  }
98
85
  export interface IMerchantAppointParam {
99
86
  storedCard?: IStoredCard;
@@ -209,33 +196,6 @@ export interface IpaymentSessionMetaData {
209
196
  };
210
197
  };
211
198
  }
212
- export interface IPaymentSessionFactor {
213
- merchantInfo?: IMerchantInfo;
214
- paymentMethodInfo: IPaymentMethodInfo;
215
- }
216
- export interface IPaymentMethodInfo {
217
- paymentAmount?: IPaymentAmount;
218
- paymentMethodMetaData?: IPaymentMethodMetaData;
219
- paymentMethodType?: PaypalMethodEnum;
220
- paypal?: IPaypalConfig;
221
- }
222
- export type IPaypalConfig = {
223
- accessToken: string;
224
- };
225
- export interface IPaymentMethodMetaData {
226
- bindPaymentMethod?: string;
227
- boundPaymentMethod?: string;
228
- }
229
- export interface IMerchantInfo {
230
- channelMerchantAccountId?: string;
231
- }
232
- export interface IPaymentAmount {
233
- value?: string;
234
- currency?: PaymentAmountEnum;
235
- }
236
- export declare enum PaymentAmountEnum {
237
- USD = "USD"
238
- }
239
199
  export declare enum localeEnum {
240
200
  'en-US' = "en-US"
241
201
  }
@@ -495,10 +455,7 @@ export declare enum eventCodeEnum {
495
455
  /**
496
456
  * 当前为Apple Pay发起了Pay请求,但是用户关闭了页面
497
457
  */
498
- SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING",
499
- SDK_PAYMENT_WARN = "SDK_PAYMENT_WARN",
500
- SDK_PAYMENT_SHIPPINGCHANGE = "SDK_PAYMENT_SHIPPINGCHANGE",
501
- SDK_PAYMENT_APPROVE = "SDK_PAYMENT_APPROVE"
458
+ SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING"
502
459
  }
503
460
  export declare enum RedirectType {
504
461
  ApplinkUrl = "ApplinkUrl",
@@ -519,11 +476,6 @@ export interface CallbackEventInfo {
519
476
  export interface MultipleCallbackEvents {
520
477
  [key: string]: CallbackEventInfo;
521
478
  }
522
- export declare enum PaypalMethodEnum {
523
- PAYPAL_CHECKOUT = "PAYPAL_CHECKOUT",
524
- PAYPAL_VAULT = "PAYPAL_VAULT",
525
- PAYPAL_PAYLATER = "PAYPAL_PAYLATER"
526
- }
527
479
  export type PaymentMethodTypeEnum = 'ApplePay';
528
480
  export type ApplePaySubTypeEnum = 'ApplePayRecurringPayment';
529
481
  export type SubPaymentMethodTypeEnum = ApplePaySubTypeEnum;
@@ -41,15 +41,6 @@ export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodC
41
41
  paymentMethodCategoryTypeEnum["APM"] = "APM";
42
42
  return paymentMethodCategoryTypeEnum;
43
43
  }({});
44
- export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
45
- payPalConfigurationIntentEnum["intent"] = "intent";
46
- payPalConfigurationIntentEnum["capture"] = "capture";
47
- return payPalConfigurationIntentEnum;
48
- }({});
49
- export var PaymentAmountEnum = /*#__PURE__*/function (PaymentAmountEnum) {
50
- PaymentAmountEnum["USD"] = "USD";
51
- return PaymentAmountEnum;
52
- }({});
53
44
  export var localeEnum = /*#__PURE__*/function (localeEnum) {
54
45
  localeEnum["en-US"] = "en-US";
55
46
  return localeEnum;
@@ -167,9 +158,6 @@ export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
167
158
  eventCodeEnum["SDK_PAYMENT_ERROR"] = "SDK_PAYMENT_ERROR";
168
159
  eventCodeEnum["SDK_PAYMENT_CANCEL"] = "SDK_PAYMENT_CANCEL";
169
160
  eventCodeEnum["SDK_PAYMENT_PROCESSING"] = "SDK_PAYMENT_PROCESSING";
170
- eventCodeEnum["SDK_PAYMENT_WARN"] = "SDK_PAYMENT_WARN";
171
- eventCodeEnum["SDK_PAYMENT_SHIPPINGCHANGE"] = "SDK_PAYMENT_SHIPPINGCHANGE";
172
- eventCodeEnum["SDK_PAYMENT_APPROVE"] = "SDK_PAYMENT_APPROVE";
173
161
  return eventCodeEnum;
174
162
  }({});
175
163
  export var RedirectType = /*#__PURE__*/function (RedirectType) {
@@ -179,12 +167,6 @@ export var RedirectType = /*#__PURE__*/function (RedirectType) {
179
167
  RedirectType["Unknown"] = "Unknown";
180
168
  return RedirectType;
181
169
  }({});
182
- export var PaypalMethodEnum = /*#__PURE__*/function (PaypalMethodEnum) {
183
- PaypalMethodEnum["PAYPAL_CHECKOUT"] = "PAYPAL_CHECKOUT";
184
- PaypalMethodEnum["PAYPAL_VAULT"] = "PAYPAL_VAULT";
185
- PaypalMethodEnum["PAYPAL_PAYLATER"] = "PAYPAL_PAYLATER";
186
- return PaypalMethodEnum;
187
- }({});
188
170
  export var ProductSceneVersion = /*#__PURE__*/function (ProductSceneVersion) {
189
171
  ProductSceneVersion["V1"] = "1.0";
190
172
  ProductSceneVersion["V2"] = "2.0";
@@ -37,6 +37,5 @@ declare const addSetFontSizeEvent: () => void;
37
37
  */
38
38
  declare const getOrSetStorageId: (key: string, value?: string) => string;
39
39
  declare const checkTimeElapsed: () => boolean;
40
- declare const isFunction: (func: any) => boolean;
41
40
  declare function parseBase64ToString(base64: string): string;
42
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, };
41
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, };