@alipay/ams-checkout 0.0.1744283958-dev.6 → 0.0.1744283958-dev.9
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/component/element/elementProcessor/addressProcessor.js +1 -1
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +31 -15
- package/esm/foundation/core/index.js +2 -1
- package/esm/foundation/index.d.ts +6 -0
- package/esm/foundation/index.js +2 -0
- package/esm/foundation/service/container/index.js +2 -2
- package/package.json +1 -1
@@ -81,7 +81,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
81
81
|
analytics = _this$options.analytics,
|
82
82
|
locale = _this$options.locale;
|
83
83
|
var version = PackageJson.version;
|
84
|
-
var pageUrl = "/
|
84
|
+
var pageUrl = "/element-address/".concat(version, "/pages/address/index.html");
|
85
85
|
return _generateIframeSrc({
|
86
86
|
paymentSession: paymentSession,
|
87
87
|
paymentSessionObj: paymentSessionObj,
|
@@ -23,16 +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 "../../index";
|
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
|
-
import { oneAccount, sdkAction } from "../mock";
|
33
30
|
import { LogConfig, Logger } from "../../../../util/logger";
|
34
|
-
|
31
|
+
import { parseSessionData } from "../../index";
|
32
|
+
import { oneAccount, sdkAction } from "../mock";
|
33
|
+
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
35
34
|
import BaseElementProcessor from "./baseElementProcessor";
|
35
|
+
var logger = new Logger(LogConfig, true);
|
36
36
|
var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
37
37
|
_inherits(PaymentProcessor, _BaseElementProcessor);
|
38
38
|
var _super = _createSuper(PaymentProcessor);
|
@@ -51,6 +51,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
51
51
|
_createClass(PaymentProcessor, [{
|
52
52
|
key: "onReady",
|
53
53
|
value: function onReady(extraParam) {
|
54
|
+
var _this$elementContaine, _this$elementContaine2, _this$elementContaine3, _this$elementContaine4, _this$elementContaine5;
|
54
55
|
var paymentContext = this.elementContainer.getPaymentContext();
|
55
56
|
this.eventCenter.dispatchToApp({
|
56
57
|
event: 'renderComponent',
|
@@ -62,6 +63,13 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
62
63
|
screenHeight: screen.height,
|
63
64
|
screenWidth: screen.width
|
64
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
|
+
},
|
65
73
|
appearance: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.displayInfo.appearance,
|
66
74
|
sessionResult: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionObj,
|
67
75
|
notRedirectAfterComplete: (extraParam === null || extraParam === void 0 ? void 0 : extraParam.notRedirectAfterComplete) === true,
|
@@ -132,12 +140,12 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
132
140
|
key: "initApplePaySdk",
|
133
141
|
value: function () {
|
134
142
|
var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
135
|
-
var _this$
|
136
|
-
var _this$
|
143
|
+
var _this$elementContaine7;
|
144
|
+
var _this$elementContaine6, paymentSessionObj, paymentSessionId;
|
137
145
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
138
146
|
while (1) switch (_context.prev = _context.next) {
|
139
147
|
case 0:
|
140
|
-
_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;
|
141
149
|
if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
|
142
150
|
_context.next = 13;
|
143
151
|
break;
|
@@ -230,12 +238,13 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
230
238
|
value: function () {
|
231
239
|
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
232
240
|
var _paymentSessionObj$co;
|
233
|
-
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;
|
234
242
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
235
243
|
while (1) switch (_context2.prev = _context2.next) {
|
236
244
|
case 0:
|
237
245
|
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
238
|
-
_this$
|
246
|
+
_this$elementContaine8 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine8.paymentSession, paymentSessionObj = _this$elementContaine8.paymentSessionObj, displayInfo = _this$elementContaine8.displayInfo;
|
247
|
+
merchantAppointParam = displayInfo.merchantAppointParam;
|
239
248
|
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
240
249
|
_ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
|
241
250
|
hostSign = paymentSession.split('&&')[1] || '';
|
@@ -243,17 +252,24 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
243
252
|
LOCAL_MOCK = window.location.href.indexOf('LOCAL_MOCK=1') !== -1;
|
244
253
|
generateActionQueryPromise = function generateActionQueryPromise() {
|
245
254
|
return new Promise(function (resolve, reject) {
|
255
|
+
var _displayInfo$merchant;
|
246
256
|
if (LOCAL_MOCK) {
|
247
257
|
setTimeout(function () {
|
248
|
-
resolve(oneAccount);
|
249
258
|
resolve(sdkAction);
|
250
259
|
}, 100);
|
251
260
|
return;
|
252
261
|
}
|
253
|
-
|
262
|
+
var sdkRequestData = {
|
254
263
|
paymentSessionConfig: paymentSessionConfig,
|
255
264
|
paymentSessionData: paymentSession
|
256
|
-
}
|
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, {
|
257
273
|
env: environment,
|
258
274
|
envInfo: {
|
259
275
|
locale: locale
|
@@ -298,9 +314,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
298
314
|
});
|
299
315
|
});
|
300
316
|
};
|
301
|
-
_context2.next =
|
317
|
+
_context2.next = 12;
|
302
318
|
return Promise.all(isConnect ? [generateActionQueryPromise(), generateOneAccountQueryPromise()] : [generateActionQueryPromise()]);
|
303
|
-
case
|
319
|
+
case 12:
|
304
320
|
_yield$Promise$all = _context2.sent;
|
305
321
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
306
322
|
originActionQueryResult = _yield$Promise$all2[0];
|
@@ -313,7 +329,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
313
329
|
originActionQueryResult: originActionQueryResult,
|
314
330
|
originOneAccountQueryResult: originOneAccountQueryResult
|
315
331
|
});
|
316
|
-
case
|
332
|
+
case 18:
|
317
333
|
case "end":
|
318
334
|
return _context2.stop();
|
319
335
|
}
|
@@ -406,7 +406,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
406
406
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
407
407
|
var containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
|
408
408
|
var cleanElement = function cleanElement() {
|
409
|
-
|
409
|
+
var _this3$paymentContext;
|
410
|
+
containerService.cleanContainer((_this3$paymentContext = _this3.paymentContext) === null || _this3$paymentContext === void 0 ? void 0 : _this3$paymentContext.displayInfo);
|
410
411
|
cleanMockup();
|
411
412
|
removeRetentionPopup();
|
412
413
|
// TODO @/component this.removeEventListener();
|
@@ -28,7 +28,13 @@ export declare class DisplayInfo {
|
|
28
28
|
selector: string;
|
29
29
|
appearance?: Record<string, any>;
|
30
30
|
appendAliasContainerId?: boolean;
|
31
|
+
merchantAppointParam?: {
|
32
|
+
storedCard: {
|
33
|
+
needCVV: boolean;
|
34
|
+
};
|
35
|
+
};
|
31
36
|
iframeStyle?: Partial<CSSStyleDeclaration>;
|
37
|
+
notRedirectAfterComplete?: boolean;
|
32
38
|
constructor();
|
33
39
|
}
|
34
40
|
/**
|
package/esm/foundation/index.js
CHANGED
@@ -26,7 +26,9 @@ export var DisplayInfo = /*#__PURE__*/_createClass(function DisplayInfo() {
|
|
26
26
|
_defineProperty(this, "appearance", void 0);
|
27
27
|
// append selector name to containerId
|
28
28
|
_defineProperty(this, "appendAliasContainerId", void 0);
|
29
|
+
_defineProperty(this, "merchantAppointParam", void 0);
|
29
30
|
_defineProperty(this, "iframeStyle", void 0);
|
31
|
+
_defineProperty(this, "notRedirectAfterComplete", void 0);
|
30
32
|
this.platform = isPC() ? PlatformEnum.desktop : PlatformEnum.mobile;
|
31
33
|
this.isRetention = true;
|
32
34
|
this.type = DisplayTypeEnum.popup;
|
@@ -90,7 +90,7 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
90
90
|
value: function cleanContainer(displayInfo) {
|
91
91
|
var _document$getElementB;
|
92
92
|
// selector and container
|
93
|
-
var selector = displayInfo.type === DisplayTypeEnum.inline ? displayInfo.selector : COMPONENT_CONTAINER_ID;
|
93
|
+
var selector = (displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.type) === DisplayTypeEnum.inline ? displayInfo.selector : COMPONENT_CONTAINER_ID;
|
94
94
|
var selectorDom = document.querySelector(selector);
|
95
95
|
if (selectorDom) {
|
96
96
|
selectorDom.innerHTML = '';
|
@@ -101,7 +101,7 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
101
101
|
this.eventCenter.cleanIFrames();
|
102
102
|
|
103
103
|
// animation
|
104
|
-
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(displayInfo.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
104
|
+
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
105
105
|
}
|
106
106
|
}, {
|
107
107
|
key: "showLoading",
|