@alipay/ams-checkout 0.0.1710212811-dev.11 → 0.0.1710212811-dev.12
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/core/bus/ability/security.d.ts +1 -1
- package/esm/core/bus/ability/security.js +27 -14
- package/esm/core/bus/index.js +7 -1
- package/esm/core/component/index.d.ts +1 -1
- package/esm/core/component/index.js +2 -3
- package/esm/plugin/applepay/component.js +54 -16
- package/esm/plugin/applepay/index.js +0 -1
- package/package.json +1 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DeviceIdParameter } from '../../../types';
|
2
2
|
import { BusContext, BusMessage, BusSubscriber } from '../index';
|
3
|
-
export type onDeviceIdCallback = (deviceIdParameter
|
3
|
+
export type onDeviceIdCallback = (deviceIdParameter?: DeviceIdParameter, isPolling?: boolean) => Promise<string>;
|
4
4
|
export declare class SecurityBusSubscriber extends BusSubscriber {
|
5
5
|
private _onDeviceIdCallback?;
|
6
6
|
constructor(onDeviceIdCallback?: onDeviceIdCallback);
|
@@ -37,38 +37,51 @@ export var SecurityBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
37
37
|
key: "getSecurityDeviceId",
|
38
38
|
value: function () {
|
39
39
|
var _getSecurityDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(context, message) {
|
40
|
-
var data, deviceId;
|
40
|
+
var data, deviceId, _deviceId;
|
41
41
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
42
42
|
while (1) switch (_context.prev = _context.next) {
|
43
43
|
case 0:
|
44
44
|
console.log('getSecurityDeviceId', message);
|
45
45
|
if (!this._onDeviceIdCallback) {
|
46
|
-
_context.next =
|
46
|
+
_context.next = 22;
|
47
47
|
break;
|
48
48
|
}
|
49
49
|
data = message.getJSONObject();
|
50
50
|
_context.prev = 3;
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
if (!(data !== null && data !== void 0 && data.deviceIdParameter)) {
|
52
|
+
_context.next = 11;
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
_context.next = 7;
|
56
|
+
return this._onDeviceIdCallback(data === null || data === void 0 ? void 0 : data.deviceIdParameter, true === (data === null || data === void 0 ? void 0 : data.isPolling));
|
57
|
+
case 7:
|
54
58
|
deviceId = _context.sent;
|
55
59
|
context === null || context === void 0 || context.onCallBack(message.result(deviceId));
|
60
|
+
_context.next = 15;
|
61
|
+
break;
|
62
|
+
case 11:
|
56
63
|
_context.next = 13;
|
64
|
+
return this._onDeviceIdCallback();
|
65
|
+
case 13:
|
66
|
+
_deviceId = _context.sent;
|
67
|
+
context === null || context === void 0 || context.onCallBack(message.result(_deviceId));
|
68
|
+
case 15:
|
69
|
+
_context.next = 20;
|
57
70
|
break;
|
58
|
-
case
|
59
|
-
_context.prev =
|
71
|
+
case 17:
|
72
|
+
_context.prev = 17;
|
60
73
|
_context.t0 = _context["catch"](3);
|
61
|
-
context === null || context === void 0 || context.onCallBack(message.result());
|
62
|
-
case
|
63
|
-
_context.next =
|
74
|
+
context === null || context === void 0 || context.onCallBack(message.result(""));
|
75
|
+
case 20:
|
76
|
+
_context.next = 23;
|
64
77
|
break;
|
65
|
-
case
|
66
|
-
context === null || context === void 0 || context.onCallBack(message.result());
|
67
|
-
case
|
78
|
+
case 22:
|
79
|
+
context === null || context === void 0 || context.onCallBack(message.result(""));
|
80
|
+
case 23:
|
68
81
|
case "end":
|
69
82
|
return _context.stop();
|
70
83
|
}
|
71
|
-
}, _callee, this, [[3,
|
84
|
+
}, _callee, this, [[3, 17]]);
|
72
85
|
}));
|
73
86
|
function getSecurityDeviceId(_x, _x2) {
|
74
87
|
return _getSecurityDeviceId.apply(this, arguments);
|
package/esm/core/bus/index.js
CHANGED
@@ -160,7 +160,13 @@ export var BusManager = /*#__PURE__*/function () {
|
|
160
160
|
}, {
|
161
161
|
key: "publish",
|
162
162
|
value: function publish(message, callback) {
|
163
|
-
var
|
163
|
+
var _callBack = function _callBack(result) {
|
164
|
+
BusManager.traceLog(BusManager, 'publish result ' + (message === null || message === void 0 ? void 0 : message.getAction()), result === null || result === void 0 ? void 0 : result.getData());
|
165
|
+
if (callback) {
|
166
|
+
callback(result);
|
167
|
+
}
|
168
|
+
};
|
169
|
+
var context = new BusContext(_callBack);
|
164
170
|
var actionName = message.getAction();
|
165
171
|
var subscribers = BusManager.subscribersMap.get(actionName);
|
166
172
|
BusManager.traceLog(BusManager, 'publish', message);
|
@@ -21,7 +21,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
21
21
|
* @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.
|
22
22
|
*/
|
23
23
|
createComponent(params: IcreateComponent): Promise<void>;
|
24
|
-
isApplePay
|
24
|
+
private isApplePay;
|
25
25
|
preloadComponent(channelType: any, productSceneVersion: any): void;
|
26
26
|
clearPreloadIframe(isTimeOut?: boolean): void;
|
27
27
|
/**
|
@@ -291,13 +291,12 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
291
291
|
}, {
|
292
292
|
key: "isApplePay",
|
293
293
|
value: function isApplePay(paymentSessionData) {
|
294
|
-
var _parseData$paymentSes2;
|
294
|
+
var _parseData$paymentSes2, _parseData$paymentSes3;
|
295
295
|
var _parseSessionData3 = parseSessionData(paymentSessionData),
|
296
296
|
_parseSessionData4 = _slicedToArray(_parseSessionData3, 2),
|
297
297
|
parseData = _parseSessionData4[0],
|
298
298
|
sessionData = _parseSessionData4[1];
|
299
|
-
|
300
|
-
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";
|
299
|
+
return sessionData && (parseData === null || parseData === void 0 || (_parseData$paymentSes2 = parseData.paymentSessionConfig) === null || _parseData$paymentSes2 === void 0 ? void 0 : _parseData$paymentSes2.productScene) === productSceneEnum.CASHIER_PAYMENT && (parseData === null || parseData === void 0 || (_parseData$paymentSes3 = parseData.paymentSessionFactor) === null || _parseData$paymentSes3 === void 0 || (_parseData$paymentSes3 = _parseData$paymentSes3.paymentMethodInfo) === null || _parseData$paymentSes3 === void 0 ? void 0 : _parseData$paymentSes3.paymentMethodType) === "CARD_APPLE_PAY";
|
301
300
|
}
|
302
301
|
}, {
|
303
302
|
key: "preloadComponent",
|
@@ -132,6 +132,7 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
132
132
|
*/
|
133
133
|
var getMerchantSession = /*#__PURE__*/function () {
|
134
134
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
135
|
+
var _yield$BusManager$pub;
|
135
136
|
var validationUrl, requestParams;
|
136
137
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
137
138
|
while (1) switch (_context.prev = _context.next) {
|
@@ -149,16 +150,34 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
149
150
|
_context.next = 8;
|
150
151
|
return BusManager.publishForResult(new BusMessage(SecuritySDKActionEnum.getSecurityDeviceId));
|
151
152
|
case 8:
|
152
|
-
_context.
|
153
|
-
_context.
|
154
|
-
|
153
|
+
_context.t5 = _yield$BusManager$pub = _context.sent;
|
154
|
+
_context.t4 = _context.t5 === null;
|
155
|
+
if (_context.t4) {
|
156
|
+
_context.next = 12;
|
157
|
+
break;
|
158
|
+
}
|
159
|
+
_context.t4 = _yield$BusManager$pub === void 0;
|
160
|
+
case 12:
|
161
|
+
if (!_context.t4) {
|
162
|
+
_context.next = 16;
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
_context.t6 = void 0;
|
166
|
+
_context.next = 17;
|
167
|
+
break;
|
168
|
+
case 16:
|
169
|
+
_context.t6 = _yield$BusManager$pub.getData();
|
170
|
+
case 17:
|
171
|
+
_context.t7 = _context.t6;
|
172
|
+
_context.t8 = {
|
173
|
+
deviceId: _context.t7
|
155
174
|
};
|
156
|
-
_context.
|
175
|
+
_context.t9 = {
|
157
176
|
env: _context.t3,
|
158
|
-
envInfo: _context.
|
177
|
+
envInfo: _context.t8
|
159
178
|
};
|
160
|
-
_context.
|
161
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t1, _context.t2, _context.
|
179
|
+
_context.t10 = _this.logger;
|
180
|
+
return _context.abrupt("return", (0, _context.t0)(_context.t1, _context.t2, _context.t9, _context.t10).then(function (res) {
|
162
181
|
if (res !== null && res !== void 0 && res.success && res.merchantSessionObject) {
|
163
182
|
return Promise.resolve(res.merchantSessionObject);
|
164
183
|
}
|
@@ -169,7 +188,7 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
169
188
|
}).catch(function (error) {
|
170
189
|
return Promise.reject(error);
|
171
190
|
}));
|
172
|
-
case
|
191
|
+
case 22:
|
173
192
|
case "end":
|
174
193
|
return _context.stop();
|
175
194
|
}
|
@@ -186,6 +205,7 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
186
205
|
*/
|
187
206
|
var completePaymentAuthorized = /*#__PURE__*/function () {
|
188
207
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
208
|
+
var _yield$BusManager$pub2;
|
189
209
|
var paymentToken, params;
|
190
210
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
191
211
|
while (1) switch (_context2.prev = _context2.next) {
|
@@ -203,16 +223,34 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
203
223
|
_context2.next = 7;
|
204
224
|
return BusManager.publishForResult(new BusMessage(SecuritySDKActionEnum.getSecurityDeviceId));
|
205
225
|
case 7:
|
206
|
-
_context2.
|
207
|
-
_context2.
|
208
|
-
|
226
|
+
_context2.t4 = _yield$BusManager$pub2 = _context2.sent;
|
227
|
+
_context2.t3 = _context2.t4 === null;
|
228
|
+
if (_context2.t3) {
|
229
|
+
_context2.next = 11;
|
230
|
+
break;
|
231
|
+
}
|
232
|
+
_context2.t3 = _yield$BusManager$pub2 === void 0;
|
233
|
+
case 11:
|
234
|
+
if (!_context2.t3) {
|
235
|
+
_context2.next = 15;
|
236
|
+
break;
|
237
|
+
}
|
238
|
+
_context2.t5 = void 0;
|
239
|
+
_context2.next = 16;
|
240
|
+
break;
|
241
|
+
case 15:
|
242
|
+
_context2.t5 = _yield$BusManager$pub2.getData();
|
243
|
+
case 16:
|
244
|
+
_context2.t6 = _context2.t5;
|
245
|
+
_context2.t7 = {
|
246
|
+
deviceId: _context2.t6
|
209
247
|
};
|
210
|
-
_context2.
|
248
|
+
_context2.t8 = {
|
211
249
|
env: _context2.t2,
|
212
|
-
envInfo: _context2.
|
250
|
+
envInfo: _context2.t7
|
213
251
|
};
|
214
|
-
_context2.
|
215
|
-
return _context2.abrupt("return", (0, _context2.t0)(_context2.t1, _context2.
|
252
|
+
_context2.t9 = _this.logger;
|
253
|
+
return _context2.abrupt("return", (0, _context2.t0)(_context2.t1, _context2.t8, _context2.t9).then(function (res) {
|
216
254
|
_this.logger.logInfo({
|
217
255
|
name: 'APPLE_PAY',
|
218
256
|
title: 'submitPayStatus',
|
@@ -230,7 +268,7 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
230
268
|
}).catch(function (error) {
|
231
269
|
return Promise.reject(error);
|
232
270
|
}));
|
233
|
-
case
|
271
|
+
case 21:
|
234
272
|
case "end":
|
235
273
|
return _context2.stop();
|
236
274
|
}
|
@@ -59,7 +59,6 @@ export var ApplePayBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
59
59
|
var data = message.getJSONObject();
|
60
60
|
console.log('onCreateComponent', message);
|
61
61
|
this.applePay = new ApplePayComponent(_objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.options), {}, {
|
62
|
-
// todo 需要补充其它参数的桥接
|
63
62
|
onEventCallback: function onEventCallback(state) {
|
64
63
|
console.log('onCreateComponent#onEventCallback', state);
|
65
64
|
if (state) {
|