@alipay/ams-checkout 0.0.1744283958-dev.0 → 0.0.1744283958-dev.10
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/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +6 -0
- package/esm/constant/index.js +6 -0
- package/esm/core/component/element/elementContainerService/containerService.d.ts +3 -0
- package/esm/core/component/element/elementContainerService/containerService.js +17 -2
- package/esm/core/component/element/elementContainerService/index.d.ts +1 -0
- package/esm/core/component/element/elementContainerService/index.js +8 -0
- package/esm/core/component/element/elementController/index.d.ts +5 -0
- package/esm/core/component/element/elementController/index.js +188 -95
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +4 -1
- package/esm/core/component/element/elementProcessor/addressProcessor.js +28 -6
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +4 -1
- package/esm/core/component/element/elementProcessor/authProcessor.js +28 -566
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +2 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +6 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +53 -18
- package/esm/core/component/element/mock.d.ts +8 -0
- package/esm/core/component/element/mock.js +927 -0
- package/esm/core/component/element/type.d.ts +13 -0
- package/esm/core/component/element/util.d.ts +2 -1
- package/esm/core/component/element/util.js +124 -0
- package/esm/foundation/core/index.js +2 -1
- package/esm/foundation/index.d.ts +7 -0
- package/esm/foundation/index.js +3 -0
- package/esm/foundation/service/container/index.js +9 -2
- package/package.json +1 -1
@@ -13,6 +13,7 @@ declare abstract class BaseElementProcessor {
|
|
13
13
|
elementContainer: AntomSDKCore;
|
14
14
|
instanceId: string;
|
15
15
|
options: ElementProcessorOptions;
|
16
|
+
obtainDataRes: any;
|
16
17
|
eventCenter: EventCenter;
|
17
18
|
eventListener: {};
|
18
19
|
abstract beforeMount(): void;
|
@@ -32,5 +33,6 @@ declare abstract class BaseElementProcessor {
|
|
32
33
|
registerElementContainer(elementContainer: AntomSDKCore): void;
|
33
34
|
registerEventCenter(eventCenter: EventCenter): void;
|
34
35
|
registerEventListener(event: any, callback: any): void;
|
36
|
+
getObtainDataRes(): any;
|
35
37
|
}
|
36
38
|
export default BaseElementProcessor;
|
@@ -14,6 +14,7 @@ var BaseElementProcessor = /*#__PURE__*/function () {
|
|
14
14
|
_defineProperty(this, "elementContainer", void 0);
|
15
15
|
_defineProperty(this, "instanceId", void 0);
|
16
16
|
_defineProperty(this, "options", void 0);
|
17
|
+
_defineProperty(this, "obtainDataRes", void 0);
|
17
18
|
_defineProperty(this, "eventCenter", void 0);
|
18
19
|
_defineProperty(this, "eventListener", {});
|
19
20
|
this._setOptions(options);
|
@@ -73,6 +74,11 @@ var BaseElementProcessor = /*#__PURE__*/function () {
|
|
73
74
|
value: function registerEventListener(event, callback) {
|
74
75
|
this.eventCenter[event] = callback;
|
75
76
|
}
|
77
|
+
}, {
|
78
|
+
key: "getObtainDataRes",
|
79
|
+
value: function getObtainDataRes() {
|
80
|
+
return this.obtainDataRes;
|
81
|
+
}
|
76
82
|
}]);
|
77
83
|
return BaseElementProcessor;
|
78
84
|
}();
|
@@ -23,15 +23,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
23
23
|
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; }
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
25
25
|
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); }
|
26
|
-
import { parseSessionData } from "../..";
|
27
26
|
import PackageJson from "../../../../../package.json";
|
28
27
|
import { EVENT } from "../../../../constant";
|
29
28
|
import { ServiceProvider } from "../../../../foundation/service";
|
30
29
|
import { ApplePaySdk, handleGooglePay, isSkipRenderPaymentMethod } from "../../../../plugin/component/channel";
|
31
|
-
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
32
30
|
import { LogConfig, Logger } from "../../../../util/logger";
|
33
|
-
|
31
|
+
import { parseSessionData } from "../../index";
|
32
|
+
import { oneAccount, sdkAction } from "../mock";
|
33
|
+
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
34
34
|
import BaseElementProcessor from "./baseElementProcessor";
|
35
|
+
var logger = new Logger(LogConfig, true);
|
35
36
|
var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
36
37
|
_inherits(PaymentProcessor, _BaseElementProcessor);
|
37
38
|
var _super = _createSuper(PaymentProcessor);
|
@@ -50,17 +51,25 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
50
51
|
_createClass(PaymentProcessor, [{
|
51
52
|
key: "onReady",
|
52
53
|
value: function onReady(extraParam) {
|
54
|
+
var _this$elementContaine, _this$elementContaine2, _this$elementContaine3, _this$elementContaine4, _this$elementContaine5;
|
53
55
|
var paymentContext = this.elementContainer.getPaymentContext();
|
54
56
|
this.eventCenter.dispatchToApp({
|
55
57
|
event: 'renderComponent',
|
56
58
|
data: {
|
57
59
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
58
60
|
paymentSessionData: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionId,
|
59
|
-
queryResult: extraParam === null || extraParam === void 0 ? void 0 : extraParam.
|
61
|
+
queryResult: extraParam === null || extraParam === void 0 ? void 0 : extraParam.originActionQueryResult,
|
60
62
|
envInfo: {
|
61
63
|
screenHeight: screen.height,
|
62
64
|
screenWidth: screen.width
|
63
65
|
},
|
66
|
+
logMetaData: {
|
67
|
+
paymentMethodCategoryType: (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 ? void 0 : _this$elementContaine.getPaymentContext().paymentSessionObj.paymentSessionConfig.paymentMethodCategoryType,
|
68
|
+
productSceneVersion: (_this$elementContaine2 = this.elementContainer) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.getPaymentContext().paymentSessionObj.paymentSessionConfig.productSceneVersion,
|
69
|
+
trackId: (_this$elementContaine3 = this.elementContainer) === null || _this$elementContaine3 === void 0 ? void 0 : _this$elementContaine3.getPaymentContext().paymentSessionId,
|
70
|
+
merchantId: (_this$elementContaine4 = this.elementContainer) === null || _this$elementContaine4 === void 0 || (_this$elementContaine4 = _this$elementContaine4.getPaymentContext()) === null || _this$elementContaine4 === void 0 || (_this$elementContaine4 = _this$elementContaine4.paymentSessionObj) === null || _this$elementContaine4 === void 0 ? void 0 : _this$elementContaine4.clientId,
|
71
|
+
paymentMethodType: (_this$elementContaine5 = this.elementContainer) === null || _this$elementContaine5 === void 0 || (_this$elementContaine5 = _this$elementContaine5.getPaymentContext()) === null || _this$elementContaine5 === void 0 || (_this$elementContaine5 = _this$elementContaine5.paymentSessionObj) === null || _this$elementContaine5 === void 0 || (_this$elementContaine5 = _this$elementContaine5.paymentMethodInfoView) === null || _this$elementContaine5 === void 0 ? void 0 : _this$elementContaine5.paymentMethodType
|
72
|
+
},
|
64
73
|
appearance: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.displayInfo.appearance,
|
65
74
|
sessionResult: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionObj,
|
66
75
|
notRedirectAfterComplete: (extraParam === null || extraParam === void 0 ? void 0 : extraParam.notRedirectAfterComplete) === true,
|
@@ -131,12 +140,12 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
131
140
|
key: "initApplePaySdk",
|
132
141
|
value: function () {
|
133
142
|
var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
134
|
-
var _this$
|
135
|
-
var _this$
|
143
|
+
var _this$elementContaine7;
|
144
|
+
var _this$elementContaine6, paymentSessionObj, paymentSessionId;
|
136
145
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
137
146
|
while (1) switch (_context.prev = _context.next) {
|
138
147
|
case 0:
|
139
|
-
_this$
|
148
|
+
_this$elementContaine6 = (_this$elementContaine7 = this.elementContainer) === null || _this$elementContaine7 === void 0 ? void 0 : _this$elementContaine7.getPaymentContext(), paymentSessionObj = _this$elementContaine6.paymentSessionObj, paymentSessionId = _this$elementContaine6.paymentSessionId;
|
140
149
|
if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
|
141
150
|
_context.next = 13;
|
142
151
|
break;
|
@@ -229,22 +238,38 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
229
238
|
value: function () {
|
230
239
|
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
231
240
|
var _paymentSessionObj$co;
|
232
|
-
var requestService, _this$
|
241
|
+
var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo, merchantAppointParam, _this$options2, environment, locale, _ref4, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
|
233
242
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
234
243
|
while (1) switch (_context2.prev = _context2.next) {
|
235
244
|
case 0:
|
236
245
|
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
237
|
-
_this$
|
246
|
+
_this$elementContaine8 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine8.paymentSession, paymentSessionObj = _this$elementContaine8.paymentSessionObj, displayInfo = _this$elementContaine8.displayInfo;
|
247
|
+
merchantAppointParam = displayInfo.merchantAppointParam;
|
238
248
|
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
239
249
|
_ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
|
240
250
|
hostSign = paymentSession.split('&&')[1] || '';
|
241
251
|
isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
|
252
|
+
LOCAL_MOCK = window.location.href.indexOf('LOCAL_MOCK=1') !== -1;
|
242
253
|
generateActionQueryPromise = function generateActionQueryPromise() {
|
243
254
|
return new Promise(function (resolve, reject) {
|
244
|
-
|
255
|
+
var _displayInfo$merchant;
|
256
|
+
if (LOCAL_MOCK) {
|
257
|
+
setTimeout(function () {
|
258
|
+
resolve(sdkAction);
|
259
|
+
}, 100);
|
260
|
+
return;
|
261
|
+
}
|
262
|
+
var sdkRequestData = {
|
245
263
|
paymentSessionConfig: paymentSessionConfig,
|
246
264
|
paymentSessionData: paymentSession
|
247
|
-
}
|
265
|
+
};
|
266
|
+
if (displayInfo !== null && displayInfo !== void 0 && (_displayInfo$merchant = displayInfo.merchantAppointParam) !== null && _displayInfo$merchant !== void 0 && _displayInfo$merchant.storedCard) {
|
267
|
+
sdkRequestData.merchantAppointParam = displayInfo.merchantAppointParam;
|
268
|
+
}
|
269
|
+
if (Object.prototype.hasOwnProperty.call(displayInfo, 'notRedirectAfterComplete')) {
|
270
|
+
sdkRequestData.notRedirectAfterComplete = displayInfo.notRedirectAfterComplete;
|
271
|
+
}
|
272
|
+
requestService.request(sdkRequestData, {
|
248
273
|
env: environment,
|
249
274
|
envInfo: {
|
250
275
|
locale: locale
|
@@ -262,6 +287,12 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
262
287
|
};
|
263
288
|
generateOneAccountQueryPromise = function generateOneAccountQueryPromise() {
|
264
289
|
return new Promise(function (resolve, reject) {
|
290
|
+
if (LOCAL_MOCK) {
|
291
|
+
setTimeout(function () {
|
292
|
+
resolve(oneAccount);
|
293
|
+
}, 100);
|
294
|
+
return;
|
295
|
+
}
|
265
296
|
requestService.request({
|
266
297
|
paymentSessionConfig: paymentSessionConfig,
|
267
298
|
paymentSessionData: paymentSession,
|
@@ -283,18 +314,22 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
283
314
|
});
|
284
315
|
});
|
285
316
|
};
|
286
|
-
_context2.next =
|
317
|
+
_context2.next = 12;
|
287
318
|
return Promise.all(isConnect ? [generateActionQueryPromise(), generateOneAccountQueryPromise()] : [generateActionQueryPromise()]);
|
288
|
-
case
|
319
|
+
case 12:
|
289
320
|
_yield$Promise$all = _context2.sent;
|
290
321
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
291
|
-
|
292
|
-
|
322
|
+
originActionQueryResult = _yield$Promise$all2[0];
|
323
|
+
originOneAccountQueryResult = _yield$Promise$all2[1];
|
324
|
+
this.obtainDataRes = {
|
325
|
+
originActionQueryResult: originActionQueryResult,
|
326
|
+
originOneAccountQueryResult: originOneAccountQueryResult
|
327
|
+
};
|
293
328
|
return _context2.abrupt("return", {
|
294
|
-
|
295
|
-
|
329
|
+
originActionQueryResult: originActionQueryResult,
|
330
|
+
originOneAccountQueryResult: originOneAccountQueryResult
|
296
331
|
});
|
297
|
-
case
|
332
|
+
case 18:
|
298
333
|
case "end":
|
299
334
|
return _context2.stop();
|
300
335
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare const sdkAction: any;
|
2
|
+
export declare const oneAccount1: any;
|
3
|
+
export declare const oneAccount2: any;
|
4
|
+
export declare const oneAccount: any;
|
5
|
+
export declare const paymentResult: any;
|
6
|
+
export declare const submitResult: any;
|
7
|
+
export declare const sdkActionUpdate: any;
|
8
|
+
export declare const oneAccountUpdate: any;
|