@alipay/ams-checkout 0.0.1710212811-dev.20 → 0.0.1710212811-dev.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,7 +61,10 @@ export declare class BusManager {
61
61
  private static traceError;
62
62
  static clear(): void;
63
63
  static addInterceptor(interceptor: BusInterceptor): void;
64
- static publishForResult(message: BusMessage, timeoutMs?: number): Promise<BusMessage>;
64
+ static publishForResult(message: BusMessage, config?: {
65
+ timeoutMs?: number;
66
+ fallback?: any;
67
+ }): Promise<BusMessage>;
65
68
  static publish(message: BusMessage, callback?: OnBusCallback): void;
66
69
  static subscribe(subscriber: BusSubscriber): void;
67
70
  static unsubscribe(subscriber: BusSubscriber): void;
@@ -146,16 +146,20 @@ export var BusManager = /*#__PURE__*/function () {
146
146
  }
147
147
  }, {
148
148
  key: "publishForResult",
149
- value: function publishForResult(message) {
149
+ value: function publishForResult(message, config) {
150
150
  var _this = this;
151
- var timeoutMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000;
152
151
  return new Promise(function (resolve, reject) {
152
+ var _config$timeoutMs;
153
153
  _this.publish(message, function (result) {
154
154
  resolve(result);
155
155
  });
156
156
  setTimeout(function () {
157
- reject('publish timeout');
158
- }, timeoutMs);
157
+ if ((config === null || config === void 0 ? void 0 : config.fallback) !== null) {
158
+ resolve(message.result(config === null || config === void 0 ? void 0 : config.fallback));
159
+ } else {
160
+ reject('publish timeout');
161
+ }
162
+ }, (_config$timeoutMs = config === null || config === void 0 ? void 0 : config.timeoutMs) !== null && _config$timeoutMs !== void 0 ? _config$timeoutMs : 2000);
159
163
  });
160
164
  }
161
165
  }, {
@@ -241,8 +241,10 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
241
241
  if (paymentMethod === PaymentMethodTypeEnum.ApplePay) {
242
242
  BusManager.publishForResult(new BusMessage(ApplePayActionEnum.canMakePayments, JSON.stringify({
243
243
  subPaymentMethod: subPaymentMethod
244
- }))).then(function (message) {
245
- resolve(message.getData() === 'true');
244
+ })), {
245
+ fallback: false
246
+ }).then(function (message) {
247
+ resolve(message.getJSONObject());
246
248
  }).catch(function (e) {
247
249
  _this3.logger.logInfo({
248
250
  title: 'canMakePayments_error'
package/esm/index.d.ts CHANGED
@@ -5,15 +5,12 @@
5
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
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
7
  */
8
- import ApplePayComponent from './plugin/applepay/component';
9
8
  import { AMSComponent } from './core/component/index';
10
9
  import { IoptionsParams, componentSignEnum } from './types';
11
10
  export * from './types';
12
11
  export declare class AMSCheckout extends AMSComponent {
13
12
  constructor(_options: any, channelType?: componentSignEnum[], productSceneVersion?: string);
14
13
  }
15
- export declare class AMSApplePay extends ApplePayComponent {
16
- }
17
14
  export declare class AMSAutoDebit extends AMSCheckout {
18
15
  constructor(options: IoptionsParams);
19
16
  }
package/esm/index.js CHANGED
@@ -18,7 +18,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
18
18
  * 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
19
19
  * 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.
20
20
  */
21
- import ApplePayComponent from "./plugin/applepay/component";
22
21
  import { AMSComponent } from "./core/component/index";
23
22
  import { componentSignEnum } from "./types";
24
23
  import { productSceneEnum } from "./types/index";
@@ -38,30 +37,21 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
38
37
  }
39
38
  return _createClass(AMSCheckout);
40
39
  }(AMSComponent);
41
- export var AMSApplePay = /*#__PURE__*/function (_ApplePayComponent) {
42
- _inherits(AMSApplePay, _ApplePayComponent);
43
- var _super2 = _createSuper(AMSApplePay);
44
- function AMSApplePay() {
45
- _classCallCheck(this, AMSApplePay);
46
- return _super2.apply(this, arguments);
47
- }
48
- return _createClass(AMSApplePay);
49
- }(ApplePayComponent);
50
40
  export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
51
41
  _inherits(AMSAutoDebit, _AMSCheckout);
52
- var _super3 = _createSuper(AMSAutoDebit);
42
+ var _super2 = _createSuper(AMSAutoDebit);
53
43
  function AMSAutoDebit(options) {
54
44
  _classCallCheck(this, AMSAutoDebit);
55
45
  var _options = Object.assign({}, options, {
56
46
  product: productSceneEnum.AUTO_DEBIT
57
47
  });
58
- return _super3.call(this, _options, [componentSignEnum.AUTO_DEBIT_WALLET]);
48
+ return _super2.call(this, _options, [componentSignEnum.AUTO_DEBIT_WALLET]);
59
49
  }
60
50
  return _createClass(AMSAutoDebit);
61
51
  }(AMSCheckout);
62
52
  export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout2) {
63
53
  _inherits(AMSEasyPay, _AMSCheckout2);
64
- var _super4 = _createSuper(AMSEasyPay);
54
+ var _super3 = _createSuper(AMSEasyPay);
65
55
  function AMSEasyPay(options) {
66
56
  _classCallCheck(this, AMSEasyPay);
67
57
  var _options = Object.assign({}, options, {
@@ -86,13 +76,13 @@ export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout2) {
86
76
  error: error
87
77
  });
88
78
  }
89
- return _super4.call(this, _options, [componentSignEnum.EASY_PAY_WALLET], currentProductSceneVersion);
79
+ return _super3.call(this, _options, [componentSignEnum.EASY_PAY_WALLET], currentProductSceneVersion);
90
80
  }
91
81
  return _createClass(AMSEasyPay);
92
82
  }(AMSCheckout);
93
83
  export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
94
84
  _inherits(AMSCashierPayment, _AMSCheckout3);
95
- var _super5 = _createSuper(AMSCashierPayment);
85
+ var _super4 = _createSuper(AMSCashierPayment);
96
86
  function AMSCashierPayment(options) {
97
87
  _classCallCheck(this, AMSCashierPayment);
98
88
  var _options = Object.assign({}, options, {
@@ -117,19 +107,19 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
117
107
  error: error
118
108
  });
119
109
  }
120
- return _super5.call(this, _options, currentChannelType);
110
+ return _super4.call(this, _options, currentChannelType);
121
111
  }
122
112
  return _createClass(AMSCashierPayment);
123
113
  }(AMSCheckout);
124
114
  export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
125
115
  _inherits(AMSVaulting, _AMSCheckout4);
126
- var _super6 = _createSuper(AMSVaulting);
116
+ var _super5 = _createSuper(AMSVaulting);
127
117
  function AMSVaulting(options) {
128
118
  _classCallCheck(this, AMSVaulting);
129
119
  var _options = Object.assign({}, options, {
130
120
  product: productSceneEnum.VAULTING
131
121
  });
132
- return _super6.call(this, _options, [componentSignEnum.CASHIER_PAYMENT_CARD]);
122
+ return _super5.call(this, _options, [componentSignEnum.CASHIER_PAYMENT_CARD]);
133
123
  }
134
124
  return _createClass(AMSVaulting);
135
125
  }(AMSCheckout);
@@ -137,7 +137,9 @@ var ApplePayComponent = /*#__PURE__*/function () {
137
137
  deviceIdParameter: {
138
138
  productScene: (_this$_parseData = _this._parseData) === null || _this$_parseData === void 0 || (_this$_parseData = _this$_parseData.paymentSessionConfig) === null || _this$_parseData === void 0 ? void 0 : _this$_parseData.productScene
139
139
  }
140
- })));
140
+ })), {
141
+ fallback: ""
142
+ });
141
143
  case 2:
142
144
  _context.t1 = _yield$BusManager$pub = _context.sent;
143
145
  _context.t0 = _context.t1 === null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1710212811-dev.20",
3
+ "version": "0.0.1710212811-dev.21",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",