@alipay/ams-checkout 0.0.1710212811-dev.3 → 0.0.1710212811-dev.31

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 (34) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/core/bus/ability/callback.d.ts +9 -0
  3. package/esm/core/bus/ability/callback.js +55 -0
  4. package/esm/core/bus/ability/security.d.ts +10 -0
  5. package/esm/core/bus/ability/security.js +104 -0
  6. package/esm/core/bus/ability/tracker.d.ts +9 -0
  7. package/esm/core/bus/ability/tracker.js +77 -0
  8. package/esm/core/bus/index.d.ts +72 -0
  9. package/esm/core/bus/index.js +309 -0
  10. package/esm/core/bus/interface.d.ts +32 -0
  11. package/esm/core/bus/interface.js +35 -0
  12. package/esm/core/component/index.d.ts +15 -1
  13. package/esm/core/component/index.js +185 -28
  14. package/esm/core/instance/index.d.ts +5 -1
  15. package/esm/core/instance/index.js +41 -4
  16. package/esm/index.d.ts +0 -3
  17. package/esm/index.js +8 -18
  18. package/esm/{core/applepay/index.d.ts → plugin/applepay/component.d.ts} +15 -8
  19. package/esm/{core/applepay/index.js → plugin/applepay/component.js} +123 -170
  20. package/esm/plugin/applepay/index.d.ts +17 -0
  21. package/esm/plugin/applepay/index.js +100 -0
  22. package/esm/{common → plugin}/applepay/interface.d.ts +1 -1
  23. package/esm/{common/applepay/index.d.ts → plugin/applepay/service.d.ts} +2 -1
  24. package/esm/{common/applepay/index.js → plugin/applepay/service.js} +45 -32
  25. package/esm/plugin/component/index.d.ts +2 -2
  26. package/esm/plugin/component/index.js +9 -9
  27. package/esm/plugin/const.d.ts +2 -0
  28. package/esm/plugin/const.js +19 -0
  29. package/esm/plugin/type.d.ts +33 -0
  30. package/esm/plugin/type.js +2 -0
  31. package/esm/types/index.d.ts +20 -11
  32. package/esm/types/index.js +7 -8
  33. package/package.json +1 -1
  34. /package/esm/{common → plugin}/applepay/interface.js +0 -0
@@ -17,8 +17,14 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
17
17
  */
18
18
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
19
  import { APPLE_PAY_VERSION, APPLE_PAY_RECURRING_VERSION } from "./interface";
20
- import { ApplePaySubTypeEnum } from "../../types";
21
-
20
+ import { eventCodeEnum } from "../../types";
21
+ var PaymentState = /*#__PURE__*/function (PaymentState) {
22
+ PaymentState[PaymentState["notStarted"] = 0] = "notStarted";
23
+ PaymentState[PaymentState["pending"] = 1] = "pending";
24
+ PaymentState[PaymentState["fail"] = 2] = "fail";
25
+ PaymentState[PaymentState["success"] = 3] = "success";
26
+ return PaymentState;
27
+ }(PaymentState || {});
22
28
  /**
23
29
  * Apple Pay Service
24
30
  */
@@ -29,6 +35,7 @@ var ApplePayService = /*#__PURE__*/function () {
29
35
  _defineProperty(this, "merchantIdentifier", void 0);
30
36
  _defineProperty(this, "merchantName", void 0);
31
37
  _defineProperty(this, "session", void 0);
38
+ _defineProperty(this, "paymentState", void 0);
32
39
  _defineProperty(this, "getMerchantSession", void 0);
33
40
  _defineProperty(this, "completePaymentAuthorized", void 0);
34
41
  _defineProperty(this, "completeApplePay", void 0);
@@ -41,11 +48,12 @@ var ApplePayService = /*#__PURE__*/function () {
41
48
  merchantIdentifier: _this.merchantIdentifier,
42
49
  validationUrl: event.validationURL
43
50
  }).then(function (merchantSessionObjectString) {
51
+ console.log("onvalidatemerchant#merchantSessionObjectString", merchantSessionObjectString);
44
52
  var merchantSessionObject = JSON.parse(merchantSessionObjectString);
45
53
  _this.session.completeMerchantValidation(merchantSessionObject);
46
54
  _this.applePayTrace('completeMerchantValidation');
47
55
  }).catch(function (error) {
48
- _this.logError('MerchantValidationError', error);
56
+ _this.logError(eventCodeEnum.SDK_PAYMENT_FAIL, 'MerchantValidationError', error);
49
57
  _this.session.abort();
50
58
  });
51
59
  });
@@ -56,19 +64,22 @@ var ApplePayService = /*#__PURE__*/function () {
56
64
  ApplePaySession = _window.ApplePaySession;
57
65
  var exception = function exception(error) {
58
66
  _this.session.completePayment(ApplePaySession.STATUS_FAILURE);
59
- _this.logError('PaymentAuthorizedError', error);
67
+ _this.logError(eventCodeEnum.SDK_PAYMENT_FAIL, 'PaymentAuthorizedError', error);
60
68
  _this.session.abort();
61
69
  };
62
70
  if (event !== null && event !== void 0 && (_event$payment = event.payment) !== null && _event$payment !== void 0 && _event$payment.token) {
63
71
  _this.applePayTrace('completePaymentAuthorized');
72
+ _this.paymentState = PaymentState.pending;
64
73
  _this.completePaymentAuthorized({
65
74
  paymentToken: JSON.stringify(event.payment.token)
66
75
  }).then(function (data) {
67
76
  _this.applePayTrace('completeApplePay');
68
77
  _this.session.completePayment(ApplePaySession.STATUS_SUCCESS);
69
78
  _this.completeApplePay(data);
79
+ _this.paymentState = PaymentState.success;
70
80
  }).catch(function (error) {
71
81
  exception(error);
82
+ _this.paymentState = PaymentState.fail;
72
83
  });
73
84
  } else {
74
85
  exception();
@@ -91,25 +102,23 @@ var ApplePayService = /*#__PURE__*/function () {
91
102
  order = paymentSessionFactor.order,
92
103
  recurringInfo = paymentSessionFactor.recurringInfo;
93
104
  _this.merchantIdentifier = merchantInfo === null || merchantInfo === void 0 ? void 0 : merchantInfo.partnerId;
94
- if (!(extendInfo !== null && extendInfo !== void 0 && extendInfo.merchantCapabilities) || !(extendInfo !== null && extendInfo !== void 0 && extendInfo.supportedNetworks) || !(merchantInfo !== null && merchantInfo !== void 0 && merchantInfo.registeredCountry) || !(paymentAmount !== null && paymentAmount !== void 0 && paymentAmount.currency) || !(paymentAmount !== null && paymentAmount !== void 0 && paymentAmount.value)) {
95
- _this.logError("invalid session data");
105
+ if (!(extendInfo !== null && extendInfo !== void 0 && extendInfo.merchantCapabilities) || !(extendInfo !== null && extendInfo !== void 0 && extendInfo.supportedNetworks) || !(merchantInfo !== null && merchantInfo !== void 0 && merchantInfo.registeredCountry) || !(paymentAmount !== null && paymentAmount !== void 0 && paymentAmount.currency) || !(paymentAmount !== null && paymentAmount !== void 0 && paymentAmount.value) || !(merchantInfo !== null && merchantInfo !== void 0 && merchantInfo.merchantName)) {
106
+ _this.logError(eventCodeEnum.SDK_PAYMENT_ERROR, "Abnormal paymentSessionFactor");
96
107
  return;
97
108
  }
98
- // todo 补充参数校验
99
109
  if (recurringInfo) {
100
110
  var _recurringInfo$interv;
101
- if (!(order !== null && order !== void 0 && order.orderDescription) || recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.managementURL) {
102
- _this.logError("invalid session data");
111
+ if (!(order !== null && order !== void 0 && order.orderDescription) || !(recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.managementURL)) {
112
+ _this.logError(eventCodeEnum.SDK_PAYMENT_ERROR, "Abnormal recurringInfo");
103
113
  return;
104
114
  }
105
- // && order
106
115
  var lineItem = {
107
116
  type: 'final',
108
117
  label: recurringInfo.title,
109
118
  amount: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.value,
110
119
  paymentTiming: "recurring",
111
- recurringPaymentStartDate: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.startDate ? new Date(recurringInfo.startDate) : null,
112
- recurringPaymentEndDate: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.endDate ? new Date(recurringInfo.endDate) : null,
120
+ recurringPaymentStartDate: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.startDate ? new Date(Number(recurringInfo.startDate) * 1000) : null,
121
+ recurringPaymentEndDate: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.endDate ? new Date(Number(recurringInfo.endDate) * 1000) : null,
113
122
  recurringPaymentIntervalUnit: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.intervalUnit ? recurringInfo.intervalUnit : "month",
114
123
  recurringPaymentIntervalCount: (_recurringInfo$interv = recurringInfo === null || recurringInfo === void 0 ? void 0 : recurringInfo.intervalCount) !== null && _recurringInfo$interv !== void 0 ? _recurringInfo$interv : 1
115
124
  };
@@ -117,7 +126,6 @@ var ApplePayService = /*#__PURE__*/function () {
117
126
  // 不知道显示在哪里
118
127
  paymentDescription: order === null || order === void 0 ? void 0 : order.orderDescription,
119
128
  billingAgreement: recurringInfo.agreementDescription,
120
- // todo
121
129
  regularBilling: lineItem,
122
130
  managementURL: recurringInfo === null || recurringInfo === void 0 ? void 0 : recurringInfo.managementURL,
123
131
  tokenNotificationURL: recurringInfo === null || recurringInfo === void 0 ? void 0 : recurringInfo.tokenNotificationURL
@@ -127,11 +135,7 @@ var ApplePayService = /*#__PURE__*/function () {
127
135
  supportedNetworks: extendInfo === null || extendInfo === void 0 ? void 0 : extendInfo.supportedNetworks,
128
136
  countryCode: merchantInfo === null || merchantInfo === void 0 ? void 0 : merchantInfo.registeredCountry,
129
137
  currencyCode: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.currency,
130
- total: {
131
- type: 'final',
132
- label: extendInfo === null || extendInfo === void 0 ? void 0 : extendInfo.merchantName,
133
- amount: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.value
134
- },
138
+ total: lineItem,
135
139
  recurringPaymentRequest: recurringRequest,
136
140
  lineItems: [lineItem]
137
141
  };
@@ -144,7 +148,7 @@ var ApplePayService = /*#__PURE__*/function () {
144
148
  currencyCode: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.currency,
145
149
  total: {
146
150
  type: 'final',
147
- label: extendInfo === null || extendInfo === void 0 ? void 0 : extendInfo.merchantName,
151
+ label: merchantInfo === null || merchantInfo === void 0 ? void 0 : merchantInfo.merchantName,
148
152
  amount: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.value
149
153
  }
150
154
  };
@@ -153,8 +157,16 @@ var ApplePayService = /*#__PURE__*/function () {
153
157
  _this.session.onvalidatemerchant = _this.onvalidatemerchant;
154
158
  _this.session.onpaymentauthorized = _this.onpaymentauthorized;
155
159
  _this.session.oncancel = function () {
156
- _this.logError('UserCancel');
157
- _this.session.abort();
160
+ if (_this.paymentState === PaymentState.pending) {
161
+ _this.logError(eventCodeEnum.SDK_PAYMENT_PROCESSING, 'Payment processing but user dismissed the sheet');
162
+ } else {
163
+ _this.logError(eventCodeEnum.SDK_PAYMENT_CANCEL, 'User dismissed the sheet');
164
+ }
165
+ try {
166
+ _this.session.abort();
167
+ } catch (error) {
168
+ console.log("session.abort() error");
169
+ }
158
170
  };
159
171
  _this.session.begin();
160
172
  _this.applePayTrace('sessionBegin');
@@ -177,6 +189,7 @@ var ApplePayService = /*#__PURE__*/function () {
177
189
  this.completeApplePay = completeApplePay;
178
190
  this.logError = logError;
179
191
  this.applePayTrace = applePayTrace;
192
+ this.paymentState = PaymentState.notStarted;
180
193
  }
181
194
 
182
195
  /**
@@ -185,21 +198,13 @@ var ApplePayService = /*#__PURE__*/function () {
185
198
  * @returns
186
199
  */
187
200
  }, {
188
- key: "canMakePayments",
189
- value: function canMakePayments(subTypeEnum) {
190
- if (ApplePaySubTypeEnum.ApplePayRecurringPayment === subTypeEnum) {
191
- return window.ApplePaySession ? window.ApplePaySession.canMakePayments() && window.ApplePaySession.supportsVersion(APPLE_PAY_RECURRING_VERSION) : false;
192
- }
193
- return window.ApplePaySession ? window.ApplePaySession.canMakePayments() && window.ApplePaySession.supportsVersion(APPLE_PAY_VERSION) : false;
194
- }
195
-
201
+ key: "hasActiveCard",
202
+ value: (
196
203
  /**
197
204
  * has Active Card in Apple Pay
198
205
  * @param merchantIdentifier
199
206
  */
200
- }, {
201
- key: "hasActiveCard",
202
- value: (function () {
207
+ function () {
203
208
  var _hasActiveCard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(merchantIdentifier) {
204
209
  var _window3, ApplePaySession;
205
210
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -224,6 +229,14 @@ var ApplePayService = /*#__PURE__*/function () {
224
229
  }
225
230
  return hasActiveCard;
226
231
  }())
232
+ }], [{
233
+ key: "canMakePayments",
234
+ value: function canMakePayments(subTypeEnum) {
235
+ if ('ApplePayRecurringPayment' === subTypeEnum) {
236
+ return window.ApplePaySession ? window.ApplePaySession.canMakePayments() && window.ApplePaySession.supportsVersion(APPLE_PAY_RECURRING_VERSION) : false;
237
+ }
238
+ return window.ApplePaySession ? window.ApplePaySession.canMakePayments() && window.ApplePaySession.supportsVersion(APPLE_PAY_VERSION) : false;
239
+ }
227
240
  }]);
228
241
  return ApplePayService;
229
242
  }();
@@ -1,6 +1,6 @@
1
1
  import type AMSCheckout from '../../core/instance';
2
2
  import type { eventPayload, eventPayloadContext, IappendIframeNodesParams, IMerchantAppointParam, Iselector } from '../../types';
3
- import { componentSignEnum, platformEnum, renderDisplayTypeEnum } from '../../types';
3
+ import { componentSignEnum, DeviceIdParameter, platformEnum, renderDisplayTypeEnum } from '../../types';
4
4
  type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;
5
5
  export default class ComponentApp {
6
6
  app: null | HTMLIFrameElement;
@@ -44,7 +44,7 @@ export default class ComponentApp {
44
44
  setPreloadRender(renderFunc: any): void;
45
45
  private initSecurity;
46
46
  private logDeviceId;
47
- private getDeviceIdAndLog;
47
+ getDeviceIdAndLog(deviceIdParameter?: DeviceIdParameter, isPolling?: boolean): Promise<string>;
48
48
  /**
49
49
  * @description render iframe content
50
50
  */
@@ -364,7 +364,7 @@ var ComponentApp = /*#__PURE__*/function () {
364
364
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
365
365
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
366
366
  var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
367
- var envInfo, params, _this5$_renderParams$, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
367
+ var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref4, _ref4$productSceneVer, productSceneVersion, _ref4$productScene, productScene, _ref5, _ref5$action, _ref5$action2, _ref5$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
368
368
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
369
369
  while (1) switch (_context2.prev = _context2.next) {
370
370
  case 0:
@@ -380,7 +380,7 @@ var ComponentApp = /*#__PURE__*/function () {
380
380
  /**
381
381
  * @description Simulated or unnecessary scenarios
382
382
  */
383
- _this5$_renderParams$ = (_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData, extendInfo = _this5$_renderParams$.extendInfo;
383
+ _ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
384
384
  enableVaultingApiOptimize = false;
385
385
  enableEasypayApiOptimize = false;
386
386
  try {
@@ -427,8 +427,8 @@ var ComponentApp = /*#__PURE__*/function () {
427
427
  _context2.next = 26;
428
428
  break;
429
429
  }
430
- _ref3 = params.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer, _ref3$productScene = _ref3.productScene, productScene = _ref3$productScene === void 0 ? '' : _ref3$productScene;
431
- _ref4 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
430
+ _ref4 = params.paymentSessionConfig || {}, _ref4$productSceneVer = _ref4.productSceneVersion, productSceneVersion = _ref4$productSceneVer === void 0 ? '' : _ref4$productSceneVer, _ref4$productScene = _ref4.productScene, productScene = _ref4$productScene === void 0 ? '' : _ref4$productScene;
431
+ _ref5 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref5$action = _ref5.action, _ref5$action2 = _ref5$action === void 0 ? {} : _ref5$action, _ref5$action2$autoDeb = _ref5$action2.autoDebitWithToken, autoDebitWithToken = _ref5$action2$autoDeb === void 0 ? false : _ref5$action2$autoDeb;
432
432
  if (!((_this5$_renderParams7 = _this5._renderParams) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.action) !== null && _this5$_renderParams7 !== void 0 && _this5$_renderParams7.skipSdkQuery && enableEasypayApiOptimize)) {
433
433
  _context2.next = 21;
434
434
  break;
@@ -542,7 +542,7 @@ var ComponentApp = /*#__PURE__*/function () {
542
542
 
543
543
  // eslint-disable-next-line no-async-promise-executor
544
544
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
545
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
545
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
546
546
  var _this6$_renderParams;
547
547
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
548
548
  while (1) switch (_context3.prev = _context3.next) {
@@ -605,7 +605,7 @@ var ComponentApp = /*#__PURE__*/function () {
605
605
  }, _callee3);
606
606
  }));
607
607
  return function (_x3) {
608
- return _ref5.apply(this, arguments);
608
+ return _ref6.apply(this, arguments);
609
609
  };
610
610
  }());
611
611
  }
@@ -1196,9 +1196,9 @@ var ComponentApp = /*#__PURE__*/function () {
1196
1196
  }
1197
1197
  }, {
1198
1198
  key: "handleDeclareInfo",
1199
- value: function handleDeclareInfo(_ref6) {
1200
- var _ref6$closeDialogData = _ref6.closeDialogData,
1201
- closeDialogData = _ref6$closeDialogData === void 0 ? {} : _ref6$closeDialogData;
1199
+ value: function handleDeclareInfo(_ref7) {
1200
+ var _ref7$closeDialogData = _ref7.closeDialogData,
1201
+ closeDialogData = _ref7$closeDialogData === void 0 ? {} : _ref7$closeDialogData;
1202
1202
  _handleDeclareInfo({
1203
1203
  closeDialogData: closeDialogData
1204
1204
  });
@@ -0,0 +1,2 @@
1
+ import { IExtendPlugin } from './type';
2
+ export declare const ExtendPlugin: IExtendPlugin;
@@ -0,0 +1,19 @@
1
+ import { ApplePayActionEnum, PaymentActionEnum } from "../core/bus/interface";
2
+ import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
3
+ export var ExtendPlugin = [{
4
+ sessionMatcher: {
5
+ productScene: productSceneEnum.CASHIER_PAYMENT,
6
+ productSceneVersion: ProductSceneVersion.V1,
7
+ paymentMethodCategoryType: paymentMethodCategoryTypeEnum.CARD,
8
+ paymentMethodTypes: ["CARD_APPLE_PAY"]
9
+ },
10
+ paymentChannelMatcher: {
11
+ paymentMethod: 'ApplePay'
12
+ },
13
+ busActionNames: {
14
+ canMakePayments: ApplePayActionEnum.canMakePayments,
15
+ optional_init: PaymentActionEnum.optional_init,
16
+ createComponent: ApplePayActionEnum.createComponent,
17
+ destoryComponent: ApplePayActionEnum.destoryComponent
18
+ }
19
+ }];
@@ -0,0 +1,33 @@
1
+ import { BusSubscriber } from '../core/bus';
2
+ import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from '../types';
3
+ export type IExtendPlugin = IExtendPluginItem[];
4
+ export interface ComponentActionNamesType {
5
+ canMakePayments?: string;
6
+ optional_init?: string;
7
+ createComponent?: string;
8
+ mountComponent?: string;
9
+ submit?: string;
10
+ destoryComponent?: string;
11
+ }
12
+ export type IExtendPluginItem = {
13
+ /**
14
+ * 以下为sessionData匹配的场景
15
+ */
16
+ sessionMatcher?: {
17
+ productScene: productSceneEnum;
18
+ productSceneVersion: ProductSceneVersion;
19
+ paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
20
+ paymentMethodTypes: string[];
21
+ };
22
+ /**
23
+ * 用于无sessionData场景,比如:canMakePayments
24
+ */
25
+ paymentChannelMatcher?: {
26
+ paymentMethod: string;
27
+ };
28
+ /**
29
+ * 以下plugin 实现的定义
30
+ */
31
+ busActionNames: ComponentActionNamesType;
32
+ busSubscriber?: BusSubscriber;
33
+ };
@@ -0,0 +1,2 @@
1
+ ;
2
+ export {};
@@ -138,11 +138,11 @@ export interface IpaymentSessionMetaData {
138
138
  extendInfo?: {
139
139
  merchantCapabilities?: string[];
140
140
  supportedNetworks?: string[];
141
- merchantName?: string;
142
141
  };
143
142
  merchantInfo?: {
144
143
  registeredCountry?: string;
145
144
  partnerId?: string;
145
+ merchantName?: string;
146
146
  };
147
147
  order?: {
148
148
  orderDescription: string;
@@ -239,8 +239,8 @@ export declare enum platformEnum {
239
239
  desktop = "desktop",
240
240
  mobile = "mobile"
241
241
  }
242
- type EventCallbackResult = {
243
- result: {
242
+ export type EventCallbackResult = {
243
+ result?: {
244
244
  resultCode: string;
245
245
  resultStatus: string;
246
246
  resultMessage: string;
@@ -448,9 +448,14 @@ export declare enum eventCodeEnum {
448
448
  SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
449
449
  SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
450
450
  SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS",
451
- SDK_PAYMENT_FINISH = "SDK_PAYMENT_FINISH",
451
+ SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
452
452
  SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
453
- SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL"
453
+ SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
454
+ SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL",
455
+ /**
456
+ * 当前为Apple Pay发起了Pay请求,但是用户关闭了页面
457
+ */
458
+ SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING"
454
459
  }
455
460
  export declare enum RedirectType {
456
461
  ApplinkUrl = "ApplinkUrl",
@@ -471,11 +476,15 @@ export interface CallbackEventInfo {
471
476
  export interface MultipleCallbackEvents {
472
477
  [key: string]: CallbackEventInfo;
473
478
  }
474
- export declare enum PaymentMethodTypeEnum {
475
- ApplePay = "ApplePay"
476
- }
477
- export declare enum ApplePaySubTypeEnum {
478
- ApplePayRecurringPayment = "ApplePayRecurringPayment"
479
- }
479
+ export type PaymentMethodTypeEnum = 'ApplePay';
480
+ export type ApplePaySubTypeEnum = 'ApplePayRecurringPayment';
480
481
  export type SubPaymentMethodTypeEnum = ApplePaySubTypeEnum;
482
+ export declare enum ProductSceneVersion {
483
+ V1 = "1.0",
484
+ V2 = "2.0"
485
+ }
486
+ export type IAppendParams = {
487
+ componentSign: componentSignEnum;
488
+ iframeNodesParams: IappendIframeNodesParams;
489
+ };
481
490
  export {};
@@ -153,9 +153,11 @@ export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
153
153
  eventCodeEnum["SDK_CREATECOMPONENT_ERROR"] = "SDK_CREATECOMPONENT_ERROR";
154
154
  eventCodeEnum["SDK_CALL_URL_ERROR"] = "SDK_CALL_URL_ERROR";
155
155
  eventCodeEnum["SDK_CALL_URL_SUCCESS"] = "SDK_CALL_URL_SUCCESS";
156
- eventCodeEnum["SDK_PAYMENT_FINISH"] = "SDK_PAYMENT_FINISH";
156
+ eventCodeEnum["SDK_PAYMENT_SUCCESSFUL"] = "SDK_PAYMENT_SUCCESSFUL";
157
157
  eventCodeEnum["SDK_PAYMENT_FAIL"] = "SDK_PAYMENT_FAIL";
158
+ eventCodeEnum["SDK_PAYMENT_ERROR"] = "SDK_PAYMENT_ERROR";
158
159
  eventCodeEnum["SDK_PAYMENT_CANCEL"] = "SDK_PAYMENT_CANCEL";
160
+ eventCodeEnum["SDK_PAYMENT_PROCESSING"] = "SDK_PAYMENT_PROCESSING";
159
161
  return eventCodeEnum;
160
162
  }({});
161
163
  export var RedirectType = /*#__PURE__*/function (RedirectType) {
@@ -165,11 +167,8 @@ export var RedirectType = /*#__PURE__*/function (RedirectType) {
165
167
  RedirectType["Unknown"] = "Unknown";
166
168
  return RedirectType;
167
169
  }({});
168
- export var PaymentMethodTypeEnum = /*#__PURE__*/function (PaymentMethodTypeEnum) {
169
- PaymentMethodTypeEnum["ApplePay"] = "ApplePay";
170
- return PaymentMethodTypeEnum;
171
- }({});
172
- export var ApplePaySubTypeEnum = /*#__PURE__*/function (ApplePaySubTypeEnum) {
173
- ApplePaySubTypeEnum["ApplePayRecurringPayment"] = "ApplePayRecurringPayment";
174
- return ApplePaySubTypeEnum;
170
+ export var ProductSceneVersion = /*#__PURE__*/function (ProductSceneVersion) {
171
+ ProductSceneVersion["V1"] = "1.0";
172
+ ProductSceneVersion["V2"] = "2.0";
173
+ return ProductSceneVersion;
175
174
  }({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1710212811-dev.3",
3
+ "version": "0.0.1710212811-dev.31",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",
File without changes