@alipay/ams-checkout 0.0.1710212811-dev.3 → 0.0.1710212811-dev.5
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.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/common/applepay/index.d.ts +1 -1
- package/esm/common/applepay/index.js +11 -11
- package/esm/core/applepay/index.d.ts +1 -1
- package/esm/core/applepay/index.js +1 -1
- package/esm/core/bus/ability/sdk.d.ts +9 -0
- package/esm/core/bus/ability/sdk.js +55 -0
- package/esm/core/bus/index.d.ts +63 -0
- package/esm/core/bus/index.js +287 -0
- package/esm/core/bus/interface.d.ts +24 -0
- package/esm/core/bus/interface.js +31 -0
- package/esm/core/component/index.d.ts +7 -1
- package/esm/core/component/index.js +91 -17
- package/esm/core/instance/index.d.ts +1 -0
- package/esm/core/instance/index.js +2 -0
- package/esm/plugin/applepay/index.d.ts +15 -0
- package/esm/plugin/applepay/index.js +99 -0
- package/esm/plugin/component/index.js +9 -9
- package/package.json +1 -1
@@ -1,4 +1,6 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
2
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
5
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
6
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -28,11 +30,15 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
30
|
import { v4 as uuid } from 'uuid';
|
29
31
|
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
30
32
|
import ComponentApp from "../../plugin/component";
|
31
|
-
import { componentSignEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
33
|
+
import { componentSignEnum, modeEnum, networkModeEnum, PaymentMethodTypeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
32
34
|
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
33
35
|
import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
|
34
36
|
import { getSecurityConfigStorageKey } from "../../util/security";
|
35
37
|
import CoreInstance from "../instance/index";
|
38
|
+
import { BusManager, BusMessage } from "../bus";
|
39
|
+
import { ApplePayActionEnum, PaymentActionEnum } from "../bus/interface";
|
40
|
+
import { SDKCallbackBusSubscriber } from "../bus/ability/sdk";
|
41
|
+
import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
36
42
|
export var getComponentSign = function getComponentSign(params) {
|
37
43
|
var _params$paymentSessio = params.paymentSessionConfig,
|
38
44
|
_params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
|
@@ -114,6 +120,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
114
120
|
// Register Cashier Application Plug in
|
115
121
|
_this._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
|
116
122
|
_this._componentApp = _this._getPlugin(COMPONENTPLUGINID);
|
123
|
+
_this.registerBusAbility();
|
117
124
|
return _this;
|
118
125
|
}
|
119
126
|
_createClass(AMSComponent, [{
|
@@ -188,6 +195,54 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
188
195
|
localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
|
189
196
|
}
|
190
197
|
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* 初始化 Bus总线的能力
|
201
|
+
*/
|
202
|
+
}, {
|
203
|
+
key: "registerBusAbility",
|
204
|
+
value: function registerBusAbility() {
|
205
|
+
var _this2 = this,
|
206
|
+
_this$originOptions;
|
207
|
+
BusManager.clear();
|
208
|
+
BusManager.addInterceptor({
|
209
|
+
onPublishException: function onPublishException(message, e) {
|
210
|
+
_this2.logger.logInfo({
|
211
|
+
title: 'onPublishException'
|
212
|
+
}, _objectSpread(_objectSpread({}, message), {}, {
|
213
|
+
errorMessage: JSON.stringify(e)
|
214
|
+
}));
|
215
|
+
}
|
216
|
+
});
|
217
|
+
BusManager.subscribe(new SDKCallbackBusSubscriber((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.onEventCallback));
|
218
|
+
BusManager.subscribe(new ApplePayBusSubscriber());
|
219
|
+
BusManager.publish(new BusMessage(PaymentActionEnum.optional_init, JSON.stringify(this.originOptions)));
|
220
|
+
}
|
221
|
+
}, {
|
222
|
+
key: "canMakePayments",
|
223
|
+
value: function canMakePayments(paymentMethod, subPaymentMethod) {
|
224
|
+
var _this3 = this;
|
225
|
+
// 判断支付方式是否可用
|
226
|
+
return new Promise(function (resolve) {
|
227
|
+
if (paymentMethod === PaymentMethodTypeEnum.ApplePay) {
|
228
|
+
BusManager.publishForResult(new BusMessage(ApplePayActionEnum.canMakePayments, JSON.stringify({
|
229
|
+
subPaymentMethod: subPaymentMethod
|
230
|
+
}))).then(function (message) {
|
231
|
+
resolve(message.getJSONObject().result);
|
232
|
+
}).catch(function (e) {
|
233
|
+
_this3.logger.logInfo({
|
234
|
+
title: 'canMakePayments_error'
|
235
|
+
}, {
|
236
|
+
params: JSON.stringify(e)
|
237
|
+
});
|
238
|
+
resolve(false);
|
239
|
+
});
|
240
|
+
} else {
|
241
|
+
resolve(true);
|
242
|
+
}
|
243
|
+
});
|
244
|
+
}
|
245
|
+
|
191
246
|
/**
|
192
247
|
* @description Create component application
|
193
248
|
* @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
|
@@ -195,7 +250,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
195
250
|
}, {
|
196
251
|
key: "createComponent",
|
197
252
|
value: function createComponent(params) {
|
198
|
-
var
|
253
|
+
var _this4 = this;
|
199
254
|
this.clearPreloadIframe();
|
200
255
|
return this.parameterInitAndCheck({
|
201
256
|
params: params,
|
@@ -203,23 +258,42 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
203
258
|
}).then(function (_params) {
|
204
259
|
return handleParams(_params);
|
205
260
|
}).catch(function (error) {
|
206
|
-
|
261
|
+
_this4.logger.logError({
|
207
262
|
title: 'sdk_error_parameter'
|
208
263
|
}, {
|
209
264
|
params: JSON.stringify(params)
|
210
265
|
}).send();
|
211
|
-
|
266
|
+
_this4._eventCenter.emit(EVENT.error.name, error);
|
212
267
|
return Promise.reject(error);
|
213
268
|
}).then(function (appendParams) {
|
269
|
+
if (_this4.isApplePay(params === null || params === void 0 ? void 0 : params.paymentSessionData) && BusManager.isSubscribed(ApplePayActionEnum.createComponent)) {
|
270
|
+
// 执行出错了,在通用拦截器返回
|
271
|
+
BusManager.publish(new BusMessage(ApplePayActionEnum.createComponent, JSON.stringify({
|
272
|
+
paymentSessionData: params === null || params === void 0 ? void 0 : params.paymentSessionData,
|
273
|
+
options: _this4.originOptions
|
274
|
+
})));
|
275
|
+
return;
|
276
|
+
}
|
214
277
|
var iframeNodesParams = appendParams.iframeNodesParams;
|
215
|
-
|
216
|
-
return
|
278
|
+
_this4.savePreviousChannel(iframeNodesParams);
|
279
|
+
return _this4.pluginAppendIframe(appendParams);
|
217
280
|
});
|
218
281
|
}
|
282
|
+
}, {
|
283
|
+
key: "isApplePay",
|
284
|
+
value: function isApplePay(paymentSessionData) {
|
285
|
+
var _parseData$paymentSes2;
|
286
|
+
var _parseSessionData3 = parseSessionData(paymentSessionData),
|
287
|
+
_parseSessionData4 = _slicedToArray(_parseSessionData3, 2),
|
288
|
+
parseData = _parseSessionData4[0],
|
289
|
+
sessionData = _parseSessionData4[1];
|
290
|
+
// todo 补充全量判断
|
291
|
+
return sessionData && (parseData === null || parseData === void 0 || (_parseData$paymentSes2 = parseData.paymentSessionFactor) === null || _parseData$paymentSes2 === void 0 || (_parseData$paymentSes2 = _parseData$paymentSes2.paymentMethodInfo) === null || _parseData$paymentSes2 === void 0 ? void 0 : _parseData$paymentSes2.paymentMethodType) === "CARD_APPLE_PAY";
|
292
|
+
}
|
219
293
|
}, {
|
220
294
|
key: "preloadComponent",
|
221
295
|
value: function preloadComponent(channelType, productSceneVersion) {
|
222
|
-
var
|
296
|
+
var _this5 = this;
|
223
297
|
this.channelType = channelType;
|
224
298
|
this.productSceneVersion = productSceneVersion;
|
225
299
|
var MAX_CLEAR_TIME = 10000;
|
@@ -235,7 +309,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
235
309
|
});
|
236
310
|
}
|
237
311
|
setTimeout(function () {
|
238
|
-
|
312
|
+
_this5.clearPreloadIframe(true);
|
239
313
|
}, MAX_CLEAR_TIME);
|
240
314
|
}
|
241
315
|
}, {
|
@@ -266,7 +340,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
266
340
|
}, {
|
267
341
|
key: "mountComponent",
|
268
342
|
value: function mountComponent(params, selector) {
|
269
|
-
var
|
343
|
+
var _this6 = this;
|
270
344
|
this.clearPreloadIframe();
|
271
345
|
return this.parameterInitAndCheck({
|
272
346
|
params: params,
|
@@ -275,17 +349,17 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
275
349
|
}).then(function (_params) {
|
276
350
|
return handleParams(_params);
|
277
351
|
}).catch(function (error) {
|
278
|
-
|
352
|
+
_this6.logger.logError({
|
279
353
|
title: 'sdk_error_parameter'
|
280
354
|
}, {
|
281
355
|
params: JSON.stringify(params)
|
282
356
|
}).send();
|
283
|
-
|
357
|
+
_this6._eventCenter.emit(EVENT.error.name, error);
|
284
358
|
return Promise.reject(error);
|
285
359
|
}).then(function (appendParams) {
|
286
360
|
var iframeNodesParams = appendParams.iframeNodesParams;
|
287
|
-
|
288
|
-
return
|
361
|
+
_this6.savePreviousChannel(iframeNodesParams);
|
362
|
+
return _this6.pluginAppendIframe(appendParams);
|
289
363
|
});
|
290
364
|
}
|
291
365
|
/**
|
@@ -296,22 +370,22 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
296
370
|
}, {
|
297
371
|
key: "submit",
|
298
372
|
value: function submit(data) {
|
299
|
-
var
|
373
|
+
var _this7 = this;
|
300
374
|
return new Promise(function (resolve, reject) {
|
301
375
|
try {
|
302
376
|
var eventCallbackId = uuid();
|
303
377
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
304
|
-
|
378
|
+
_this7._eventCenter.once(eventCallbackId, function (_data) {
|
305
379
|
resolve(_data);
|
306
380
|
});
|
307
|
-
|
381
|
+
_this7._componentApp.dispatchToApp({
|
308
382
|
context: {
|
309
383
|
event: 'submitPay',
|
310
384
|
eventCallbackId: eventCallbackId,
|
311
385
|
data: data
|
312
386
|
}
|
313
387
|
});
|
314
|
-
|
388
|
+
_this7.logger.logInfo({
|
315
389
|
title: 'sdk_event_apiSubmit'
|
316
390
|
});
|
317
391
|
} catch (error) {
|
@@ -30,6 +30,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
30
30
|
function AMSSDK(options) {
|
31
31
|
_classCallCheck(this, AMSSDK);
|
32
32
|
_defineProperty(this, "options", void 0);
|
33
|
+
_defineProperty(this, "originOptions", void 0);
|
33
34
|
_defineProperty(this, "logger", void 0);
|
34
35
|
_defineProperty(this, "_eventCenter", void 0);
|
35
36
|
_defineProperty(this, "_instanceId", void 0);
|
@@ -37,6 +38,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
37
38
|
_defineProperty(this, "securitySdkMap", void 0);
|
38
39
|
_defineProperty(this, "plugins", void 0);
|
39
40
|
this._instanceId = uuid();
|
41
|
+
this.originOptions = options;
|
40
42
|
this.options = {};
|
41
43
|
this._eventCenter = new EventCenter();
|
42
44
|
this._initEvent(options);
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { BusContext, BusMessage, BusSubscriber } from "../../core/bus";
|
2
|
+
export declare class ApplePayInitMessage {
|
3
|
+
private environment;
|
4
|
+
private locale;
|
5
|
+
}
|
6
|
+
export declare class ApplePayBusSubscriber extends BusSubscriber {
|
7
|
+
private applePay;
|
8
|
+
constructor();
|
9
|
+
actionNames(): string[];
|
10
|
+
protected onOptionalInit(context: BusContext, message: BusMessage): void;
|
11
|
+
protected onCanMakePayments(context: BusContext, message: BusMessage): void;
|
12
|
+
protected onCreateComponent(context: BusContext, message: BusMessage): void;
|
13
|
+
protected onDestoryComponent(context: BusContext, message: BusMessage): void;
|
14
|
+
onMessage(context: BusContext, message: BusMessage): void;
|
15
|
+
}
|
@@ -0,0 +1,99 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
5
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
6
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
7
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
8
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
10
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14
|
+
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; }
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
16
|
+
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); }
|
17
|
+
import { BusManager, BusMessage, BusSubscriber } from "../../core/bus";
|
18
|
+
import { ApplePayActionEnum, PaymentActionEnum, SDKCallbackActionEnum } from "../../core/bus/interface";
|
19
|
+
import ApplePayComponent from "../../core/applepay";
|
20
|
+
import ApplePayService from "../../common/applepay";
|
21
|
+
export var ApplePayInitMessage = /*#__PURE__*/_createClass(function ApplePayInitMessage() {
|
22
|
+
_classCallCheck(this, ApplePayInitMessage);
|
23
|
+
_defineProperty(this, "environment", void 0);
|
24
|
+
_defineProperty(this, "locale", void 0);
|
25
|
+
});
|
26
|
+
export var ApplePayBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
27
|
+
_inherits(ApplePayBusSubscriber, _BusSubscriber);
|
28
|
+
var _super = _createSuper(ApplePayBusSubscriber);
|
29
|
+
function ApplePayBusSubscriber() {
|
30
|
+
var _this;
|
31
|
+
_classCallCheck(this, ApplePayBusSubscriber);
|
32
|
+
_this = _super.call(this);
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "applePay", void 0);
|
34
|
+
return _this;
|
35
|
+
}
|
36
|
+
_createClass(ApplePayBusSubscriber, [{
|
37
|
+
key: "actionNames",
|
38
|
+
value: function actionNames() {
|
39
|
+
return Object.values(ApplePayActionEnum).concat(Object.values(PaymentActionEnum));
|
40
|
+
}
|
41
|
+
}, {
|
42
|
+
key: "onOptionalInit",
|
43
|
+
value: function onOptionalInit(context, message) {
|
44
|
+
console.log('onOptionalInit', message.getData());
|
45
|
+
}
|
46
|
+
}, {
|
47
|
+
key: "onCanMakePayments",
|
48
|
+
value: function onCanMakePayments(context, message) {
|
49
|
+
var _message$getJSONObjec;
|
50
|
+
console.log('onCanMakePayments', message.getData());
|
51
|
+
var canMakePayments = ApplePayService.canMakePayments((_message$getJSONObjec = message.getJSONObject()) === null || _message$getJSONObjec === void 0 ? void 0 : _message$getJSONObjec.subPaymentMethod);
|
52
|
+
context === null || context === void 0 || context.onCallBack(message.result(canMakePayments));
|
53
|
+
}
|
54
|
+
}, {
|
55
|
+
key: "onCreateComponent",
|
56
|
+
value: function onCreateComponent(context, message) {
|
57
|
+
var data = message.getJSONObject();
|
58
|
+
console.log('onCreateComponent', message);
|
59
|
+
this.applePay = new ApplePayComponent(_objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.options), {}, {
|
60
|
+
// todo 需要补充其它参数的桥接
|
61
|
+
onEventCallback: function onEventCallback(state) {
|
62
|
+
console.log('onCreateComponent#onEventCallback', state);
|
63
|
+
if (state) {
|
64
|
+
BusManager.publish(new BusMessage(SDKCallbackActionEnum.onEventCallback, JSON.stringify(state)));
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}));
|
68
|
+
var paymentSessionData = data === null || data === void 0 ? void 0 : data.paymentSessionData;
|
69
|
+
this.applePay.submitPay(paymentSessionData);
|
70
|
+
}
|
71
|
+
}, {
|
72
|
+
key: "onDestoryComponent",
|
73
|
+
value: function onDestoryComponent(context, message) {
|
74
|
+
this.applePay = null;
|
75
|
+
console.log('onDestoryComponent', context, message);
|
76
|
+
}
|
77
|
+
}, {
|
78
|
+
key: "onMessage",
|
79
|
+
value: function onMessage(context, message) {
|
80
|
+
switch (message.getAction()) {
|
81
|
+
case PaymentActionEnum.optional_init:
|
82
|
+
this.onOptionalInit(context, message);
|
83
|
+
break;
|
84
|
+
case ApplePayActionEnum.canMakePayments:
|
85
|
+
this.onCanMakePayments(context, message);
|
86
|
+
break;
|
87
|
+
case ApplePayActionEnum.createComponent:
|
88
|
+
this.onCreateComponent(context, message);
|
89
|
+
break;
|
90
|
+
case ApplePayActionEnum.destoryComponent:
|
91
|
+
this.onDestoryComponent(context, message);
|
92
|
+
break;
|
93
|
+
default:
|
94
|
+
console.log("Unknown action: " + message.getAction());
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}]);
|
98
|
+
return ApplePayBusSubscriber;
|
99
|
+
}(BusSubscriber);
|
@@ -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,
|
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
|
-
|
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
|
-
|
431
|
-
|
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
|
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
|
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(
|
1200
|
-
var
|
1201
|
-
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
|
});
|