@alipay/ams-checkout 0.0.1742280578-dev.1 → 0.0.1742285920-dev.1
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/component/channel.d.ts +3 -1
- package/esm/component/channel.js +26 -62
- package/esm/component/component.inline.style.js +2 -2
- package/esm/component/popupWindow.style.js +4 -1
- package/esm/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/constant/easysafepay.d.ts +16 -0
- package/esm/constant/easysafepay.js +19 -0
- package/esm/constant/index.d.ts +34 -2
- package/esm/constant/index.js +36 -5
- package/esm/core/component/ckp/index.d.ts +2 -0
- package/esm/core/component/ckp/index.js +39 -5
- package/esm/core/component/element/elementContainerService/containerService.d.ts +33 -0
- package/esm/core/component/element/elementContainerService/containerService.js +123 -0
- package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
- package/esm/core/component/element/elementContainerService/index.js +63 -0
- package/esm/core/component/element/elementController/index.d.ts +27 -0
- package/esm/core/component/element/elementController/index.js +485 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.js +160 -0
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/authProcessor.js +125 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +96 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +380 -0
- package/esm/core/component/element/index.d.ts +7 -46
- package/esm/core/component/element/index.js +31 -923
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +365 -1
- package/esm/core/component/element/type.d.ts +45 -19
- package/esm/core/component/element/util.d.ts +69 -0
- package/esm/core/component/element/util.js +477 -0
- package/esm/core/component/index.d.ts +5 -1
- package/esm/core/component/index.js +1 -2
- package/esm/core/component/oldElement/index.d.ts +59 -0
- package/esm/core/component/oldElement/index.js +956 -0
- package/esm/core/component/oldElement/mock.d.ts +6 -0
- package/esm/core/component/oldElement/mock.js +567 -0
- package/esm/core/component/oldElement/type.d.ts +354 -0
- package/esm/core/component/oldElement/type.js +81 -0
- package/esm/core/instance/index.d.ts +1 -1
- package/esm/core/instance/index.js +1 -1
- package/esm/foundation/core/index.d.ts +9 -1
- package/esm/foundation/core/index.js +153 -49
- package/esm/foundation/index.d.ts +20 -0
- package/esm/foundation/index.js +13 -2
- package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
- package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
- package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
- package/esm/foundation/product-processor/autoDebit/index.js +466 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +3 -1
- package/esm/foundation/product-processor/easysafepay/deps.js +3 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +5 -0
- package/esm/foundation/product-processor/easysafepay/index.js +267 -128
- package/esm/foundation/product-processor/element/index.d.ts +7 -0
- package/esm/foundation/product-processor/element/index.js +24 -0
- package/esm/foundation/service/container/index.d.ts +12 -3
- package/esm/foundation/service/container/index.js +145 -16
- package/esm/foundation/service/container/popup.d.ts +1 -1
- package/esm/foundation/service/event-center.js +1 -0
- package/esm/foundation/service/log/keys.js +3 -1
- package/esm/foundation/service/log/types.d.ts +1 -0
- package/esm/foundation/service/requester/requester.js +5 -4
- package/esm/foundation/utils/preload_helper.d.ts +2 -2
- package/esm/foundation/utils/preload_helper.js +8 -4
- package/esm/foundation/utils/redirect_utils.js +34 -18
- package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
- package/esm/foundation/utils/web_app_url_utils.js +219 -8
- package/esm/index.d.ts +7 -4
- package/esm/index.js +98 -48
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +5 -5
- package/esm/plugin/component/channel.d.ts +3 -1
- package/esm/plugin/component/channel.js +10 -12
- package/esm/plugin/component/index.js +47 -44
- package/esm/plugin/type.d.ts +1 -1
- package/esm/types/index.d.ts +37 -3
- package/esm/types/index.js +10 -2
- package/esm/util/index.d.ts +7 -1
- package/esm/util/index.js +10 -1
- package/esm/util/redirect.d.ts +6 -0
- package/esm/util/redirect.js +54 -0
- package/package.json +27 -4
- /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
- /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/utils.js +0 -0
@@ -14,6 +14,8 @@ import { getApplePayPaymentSession, submitPayInfo } from "../../service";
|
|
14
14
|
import { EnvironmentEnum } from "../../types";
|
15
15
|
import { device, isEmpty } from "../../util";
|
16
16
|
import { APPLE_PAY_RECURRING_VERSION, APPLE_PAY_VERSION } from "../applepay/interface";
|
17
|
+
import { getDoubleFaUrlFromSession } from "../../foundation/utils/web_app_url_utils";
|
18
|
+
import { MODE } from "../../constant/easysafepay";
|
17
19
|
var APPLEPAYERRORENUM = /*#__PURE__*/function (APPLEPAYERRORENUM) {
|
18
20
|
APPLEPAYERRORENUM["APPLE_PAY_MISSING_DATA"] = "APPLE_PAY_MISSING_DATA";
|
19
21
|
APPLEPAYERRORENUM["APPLE_PAY_NOT_SUPPORTED"] = "APPLE_PAY_NOT_SUPPORTED";
|
@@ -27,7 +29,7 @@ var PAYMENT_STATUS = /*#__PURE__*/function (PAYMENT_STATUS) {
|
|
27
29
|
PAYMENT_STATUS["NORMAL"] = "NORMAL";
|
28
30
|
return PAYMENT_STATUS;
|
29
31
|
}(PAYMENT_STATUS || {});
|
30
|
-
export function getChannelBehavior(paymentSessionMetaData) {
|
32
|
+
export function getChannelBehavior(paymentSessionMetaData, notRedirectAfterComplete) {
|
31
33
|
var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4, _paymentSessionMetaDa5, _paymentSessionMetaDa6, _paymentSessionMetaDa7, _paymentSessionMetaDa8;
|
32
34
|
// TOSS EASYPAY 2.0
|
33
35
|
if ('BANKTRANSFER_QUICKPAY' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa2 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa2 === void 0 ? void 0 : _paymentSessionMetaDa2.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa3 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa3 === void 0 ? void 0 : _paymentSessionMetaDa3.paymentMethodCategoryType) === 'APM' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa4 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa4 === void 0 ? void 0 : _paymentSessionMetaDa4.productSceneVersion) === '2.0') {
|
@@ -40,7 +42,8 @@ export function getChannelBehavior(paymentSessionMetaData) {
|
|
40
42
|
buildSubmitPayExtParams: function buildSubmitPayExtParams(params) {
|
41
43
|
var callBackUrl = getDoubleFaUrl(params);
|
42
44
|
return {
|
43
|
-
callBackUrl: callBackUrl
|
45
|
+
callBackUrl: callBackUrl,
|
46
|
+
notRedirectAfterComplete: notRedirectAfterComplete === true
|
44
47
|
};
|
45
48
|
}
|
46
49
|
};
|
@@ -65,20 +68,15 @@ export function getDoubleFaUrl(params) {
|
|
65
68
|
var instanceId = params.instanceId,
|
66
69
|
paymentMethodType = params.paymentMethodType,
|
67
70
|
paymentSessionData = params.paymentSessionData,
|
71
|
+
paymentSessionObj = params.paymentSessionObj,
|
68
72
|
locale = params.locale,
|
69
73
|
env = params.env,
|
70
|
-
sdkVersion = params.sdkVersion
|
74
|
+
sdkVersion = params.sdkVersion,
|
75
|
+
notRedirectAfterComplete = params.notRedirectAfterComplete;
|
71
76
|
var isLandscapeOrientation = false; // Web 不含横屏
|
72
77
|
|
73
|
-
var
|
74
|
-
|
75
|
-
dev: "http://page.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
76
|
-
sit: "http://page.test.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
77
|
-
pre: "https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
78
|
-
prod: "https://ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html")
|
79
|
-
};
|
80
|
-
var doubleFaBaseUrl = DOUBLE_FA_URL_MAPPING[env] || DOUBLE_FA_URL_MAPPING.prod;
|
81
|
-
return "".concat(doubleFaBaseUrl, "?scene=cashierResultPage&instanceId=").concat(instanceId, "&paymentSessionData=").concat(encodeURIComponent(paymentSessionData), "&isLandscape=").concat(isLandscapeOrientation ? 'true' : '', "&pmt=").concat(paymentMethodType, "&locale=").concat(locale, "&sdkVersion=").concat(sdkVersion);
|
78
|
+
var baseDoubleFaUrl = getDoubleFaUrlFromSession(paymentSessionObj, env);
|
79
|
+
return "".concat(baseDoubleFaUrl) + '?' + "scene=cashierResultPage" + '&' + "instanceId=".concat(instanceId) + '&' + "paymentSessionData=".concat(encodeURIComponent(paymentSessionData)) + '&' + "isLandscape=".concat(isLandscapeOrientation ? 'true' : '') + '&' + "pmt=".concat(paymentMethodType) + '&' + "locale=".concat(locale) + '&' + "mode=".concat(MODE.SDK) + '&' + "sdkVersion=".concat(sdkVersion) + '&' + "¬RedirectAfterComplete=".concat(notRedirectAfterComplete);
|
82
80
|
}
|
83
81
|
export var handleGooglePay = function handleGooglePay(data) {
|
84
82
|
return new Promise(function (resolve, reject) {
|
@@ -20,10 +20,10 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
20
20
|
import { v4 as uuid } from 'uuid';
|
21
21
|
import { sdkVersion } from "../../config";
|
22
22
|
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
|
23
|
+
import { ElementPaymentMethod } from "../../core/component/oldElement/type";
|
23
24
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
24
25
|
import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, TargetEnum } from "../../types";
|
25
26
|
import { getType, isJsonString, isPC } from "../../util";
|
26
|
-
import { ElementPaymentMethod } from "../../core/component/element/type";
|
27
27
|
import { getBackScheme } from "../../util/getBackScheme";
|
28
28
|
import { isLocalMock } from "../../util/mock";
|
29
29
|
import { matchVersion } from "../../util/versionCompare";
|
@@ -261,7 +261,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
261
261
|
_this$_renderParams6,
|
262
262
|
_this$_renderParams7,
|
263
263
|
_this$_renderParams8,
|
264
|
-
_this$
|
264
|
+
_this$_renderParams12,
|
265
265
|
_this3 = this;
|
266
266
|
if (this._isInitComponent) {
|
267
267
|
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
@@ -350,10 +350,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
350
350
|
insertStyleSheet();
|
351
351
|
}
|
352
352
|
if (this._renderDisplayType === DisplayTypeEnum.popup) {
|
353
|
-
var _this$_renderParams10;
|
353
|
+
var _this$_renderParams10, _this$_renderParams11;
|
354
354
|
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
355
355
|
createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
356
|
-
var channelBehavior = getChannelBehavior((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.paymentSessionMetaData);
|
356
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.paymentSessionMetaData, ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.notRedirectAfterComplete) === true);
|
357
357
|
var onClickOutside = function onClickOutside() {};
|
358
358
|
if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
|
359
359
|
onClickOutside = this.closeBtnFunc.bind(this);
|
@@ -367,7 +367,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
367
367
|
this.renderPopupLoading(renderParams);
|
368
368
|
}
|
369
369
|
this.createApp(renderParams);
|
370
|
-
if ((_this$
|
370
|
+
if ((_this$_renderParams12 = this._renderParams) !== null && _this$_renderParams12 !== void 0 && (_this$_renderParams12 = _this$_renderParams12.paymentSessionMetaData) !== null && _this$_renderParams12 !== void 0 && (_this$_renderParams12 = _this$_renderParams12.connectFactor) !== null && _this$_renderParams12 !== void 0 && _this$_renderParams12.enableConnect) {
|
371
371
|
this._createLoadAppPromise();
|
372
372
|
return this.createIframeNode(this, insertedNode, this._renderDisplayType).then(function () {
|
373
373
|
return Promise.resolve();
|
@@ -408,7 +408,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
408
408
|
}, {
|
409
409
|
key: "renderInlineLoading",
|
410
410
|
value: function renderInlineLoading(renderParams, selector) {
|
411
|
-
var _renderParams$appeara, _this$
|
411
|
+
var _renderParams$appeara, _this$_renderParams13;
|
412
412
|
var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
|
413
413
|
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
414
414
|
var extendInfo = renderParams.paymentSessionMetaData.extendInfo;
|
@@ -421,7 +421,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
421
421
|
}
|
422
422
|
if (showLoading) addInlineLoading(selector, this.platform, {
|
423
423
|
componentSign: this._componentSign,
|
424
|
-
type: (_this$
|
424
|
+
type: (_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.appearance) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.layout) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.type,
|
425
425
|
isExpressCheckout: isExpressCheckout
|
426
426
|
});
|
427
427
|
}
|
@@ -468,8 +468,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
468
468
|
// eslint-disable-next-line no-async-promise-executor
|
469
469
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
470
470
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
471
|
-
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6, _this5$_renderParams7;
|
472
|
-
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$
|
471
|
+
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6, _this5$_renderParams7, _this5$_renderParams8;
|
472
|
+
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams9, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _this5$_renderParams10, _action$web2, _action$wap2, action, signType;
|
473
473
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
474
474
|
while (1) switch (_context2.prev = _context2.next) {
|
475
475
|
case 0:
|
@@ -563,7 +563,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
563
563
|
});
|
564
564
|
return _context2.abrupt("return");
|
565
565
|
case 26:
|
566
|
-
channelBehavior = getChannelBehavior((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
566
|
+
channelBehavior = getChannelBehavior((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData, ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.notRedirectAfterComplete) === true); // Easypay TOSS 渠道无需actionQuery
|
567
567
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
568
568
|
_context2.next = 29;
|
569
569
|
break;
|
@@ -594,7 +594,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
594
594
|
break;
|
595
595
|
}
|
596
596
|
_ref8 = params.paymentSessionConfig || {}, _ref8$productSceneVer = _ref8.productSceneVersion, productSceneVersion = _ref8$productSceneVer === void 0 ? '' : _ref8$productSceneVer, _ref8$productScene = _ref8.productScene, productScene = _ref8$productScene === void 0 ? '' : _ref8$productScene;
|
597
|
-
if (!((_this5$
|
597
|
+
if (!((_this5$_renderParams9 = _this5._renderParams) !== null && _this5$_renderParams9 !== void 0 && (_this5$_renderParams9 = _this5$_renderParams9.paymentSessionMetaData) !== null && _this5$_renderParams9 !== void 0 && (_this5$_renderParams9 = _this5$_renderParams9.action) !== null && _this5$_renderParams9 !== void 0 && _this5$_renderParams9.skipSdkQuery && enableEasypayApiOptimize)) {
|
598
598
|
_context2.next = 39;
|
599
599
|
break;
|
600
600
|
}
|
@@ -621,7 +621,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
621
621
|
_context2.next = 54;
|
622
622
|
break;
|
623
623
|
}
|
624
|
-
action = ((_this5$
|
624
|
+
action = ((_this5$_renderParams10 = _this5._renderParams) === null || _this5$_renderParams10 === void 0 || (_this5$_renderParams10 = _this5$_renderParams10.paymentSessionMetaData) === null || _this5$_renderParams10 === void 0 ? void 0 : _this5$_renderParams10.action) || {};
|
625
625
|
signType = isPC() ? action === null || action === void 0 || (_action$web2 = action.web) === null || _action$web2 === void 0 ? void 0 : _action$web2.signType : action === null || action === void 0 || (_action$wap2 = action.wap) === null || _action$wap2 === void 0 ? void 0 : _action$wap2.signType;
|
626
626
|
if (!(signType === 'SMS')) {
|
627
627
|
_context2.next = 49;
|
@@ -698,23 +698,24 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
698
698
|
}, {
|
699
699
|
key: "createSubmitPromise",
|
700
700
|
value: function createSubmitPromise() {
|
701
|
-
var _this$
|
702
|
-
_this$_renderParams14,
|
701
|
+
var _this$_renderParams14,
|
703
702
|
_this$_renderParams15,
|
703
|
+
_this$_renderParams16,
|
704
|
+
_this$_renderParams17,
|
704
705
|
_this6 = this;
|
705
706
|
this._performanceData.push({
|
706
707
|
key: 'sdk_submit_start',
|
707
708
|
value: Date.now()
|
708
709
|
});
|
709
710
|
var params = {
|
710
|
-
paymentSessionData: this._renderParams && ((_this$
|
711
|
-
paymentSessionConfig: (_this$
|
711
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.sessionData) || '',
|
712
|
+
paymentSessionConfig: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 || (_this$_renderParams15 = _this$_renderParams15.paymentSessionMetaData) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.paymentSessionConfig
|
712
713
|
};
|
713
|
-
var channelBehavior = getChannelBehavior((_this$
|
714
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.paymentSessionMetaData, ((_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.notRedirectAfterComplete) === true);
|
714
715
|
// eslint-disable-next-line no-async-promise-executor
|
715
716
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
716
717
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
717
|
-
var _channelBehavior$buil, _this6$_renderParams
|
718
|
+
var _channelBehavior$buil, _this6$_renderParams$, _this6$_renderParams4;
|
718
719
|
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _this6$_renderParams3, _ref10, _ref10$productSceneVe, productSceneVersion, _ref10$productScene, productScene, _ref11, _ref11$action, _ref11$action2, _ref11$action2$enable, enableSignAgreement, _ref11$action2$autoDe, autoDebitWithToken, _ref12, _ref12$paymentMethodI, _ref12$paymentMethodI2, _ref12$paymentMethodI3, paymentMethodType, isAppWebview, backScheme, extParams;
|
719
720
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
720
721
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -771,8 +772,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
771
772
|
locale: _this6.AMSSDK.options.locale,
|
772
773
|
paymentMethodType: (_this6$_renderParams$ = _this6._renderParams.paymentSessionMetaData) === null || _this6$_renderParams$ === void 0 || (_this6$_renderParams$ = _this6$_renderParams$.paymentMethodInfoView) === null || _this6$_renderParams$ === void 0 ? void 0 : _this6$_renderParams$.paymentMethodType,
|
773
774
|
paymentSessionData: _this6._renderParams.sessionData,
|
775
|
+
paymentSessionObj: _this6._renderParams.paymentSessionMetaData,
|
774
776
|
env: _this6.AMSSDK.options.env.environment,
|
775
|
-
sdkVersion: _this6._appVersion
|
777
|
+
sdkVersion: _this6._appVersion,
|
778
|
+
notRedirectAfterComplete: ((_this6$_renderParams4 = _this6._renderParams) === null || _this6$_renderParams4 === void 0 ? void 0 : _this6$_renderParams4.notRedirectAfterComplete) === true
|
776
779
|
})) || {};
|
777
780
|
params.extParams = extParams;
|
778
781
|
_context3.t0 = submitPayInfo;
|
@@ -1355,10 +1358,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1355
1358
|
});
|
1356
1359
|
}
|
1357
1360
|
if ((data === null || data === void 0 || (_data$context6 = data.context) === null || _data$context6 === void 0 ? void 0 : _data$context6.event) === EVENT.getApplePayToken.name) {
|
1358
|
-
var _this$
|
1361
|
+
var _this$_renderParams18, _this$_renderParams19;
|
1359
1362
|
var applePayService = new ApplePaySdk({
|
1360
|
-
paymentSessionData: (_this$
|
1361
|
-
parseData: (_this$
|
1363
|
+
paymentSessionData: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.sessionData,
|
1364
|
+
parseData: (_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.paymentSessionMetaData,
|
1362
1365
|
logger: this.AMSSDK.logger
|
1363
1366
|
});
|
1364
1367
|
applePayService.startPay().then(function (res) {
|
@@ -1445,10 +1448,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1445
1448
|
}, {
|
1446
1449
|
key: "handleSizeChanged",
|
1447
1450
|
value: function handleSizeChanged(data) {
|
1448
|
-
var _this$
|
1449
|
-
var _selector = (this === null || this === void 0 || (_this$
|
1451
|
+
var _this$_renderParams20, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$_renderParams24, _this$_renderParams25, _data$context$data4, _cashier$style;
|
1452
|
+
var _selector = (this === null || this === void 0 || (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 || (_this$_renderParams20 = _this$_renderParams20.selector) === null || _this$_renderParams20 === void 0 || (_this$_renderParams21 = _this$_renderParams20.indexOf) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.call(_this$_renderParams20, '#')) === -1 ? this === null || this === void 0 || (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.selector : this === null || this === void 0 || (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.selector) === null || _this$_renderParams23 === void 0 || (_this$_renderParams24 = _this$_renderParams23.slice) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.call(_this$_renderParams23, 1);
|
1450
1453
|
// 修改需当前文件搜索,这段注释appendAliasContainerId
|
1451
|
-
var appendAliasContainerId = this === null || this === void 0 || (_this$
|
1454
|
+
var appendAliasContainerId = this === null || this === void 0 || (_this$_renderParams25 = this._renderParams) === null || _this$_renderParams25 === void 0 ? void 0 : _this$_renderParams25.appendAliasContainerId;
|
1452
1455
|
var selectorId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat(_selector) : COMPONENT_CONTAINER_ID;
|
1453
1456
|
var cashier = document.getElementById(selectorId);
|
1454
1457
|
if (((_data$context$data4 = data.context.data) === null || _data$context$data4 === void 0 ? void 0 : _data$context$data4.height) <= 1 || data.context.data.height === parseInt(cashier === null || cashier === void 0 || (_cashier$style = cashier.style) === null || _cashier$style === void 0 ? void 0 : _cashier$style.height)) return;
|
@@ -1570,7 +1573,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1570
1573
|
};
|
1571
1574
|
var failCallback = function failCallback(type, url, durationInSeconds) {
|
1572
1575
|
_this8.dispatchToSDK(EVENT.eventCallback.name, {
|
1573
|
-
code: eventCodeEnum.
|
1576
|
+
code: eventCodeEnum.SDK_LAUNCH_PAYMENT_APP_ERROR,
|
1574
1577
|
message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
|
1575
1578
|
});
|
1576
1579
|
var extra = {
|
@@ -1799,7 +1802,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1799
1802
|
key: "sendRenderEvent",
|
1800
1803
|
value: (function () {
|
1801
1804
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1802
|
-
var _this$
|
1805
|
+
var _this$_renderParams26, _this$_renderParams27, _this$_renderParams28, _this$_renderParams29, _this$_renderParams30, _this$_renderParams31, _this$_renderParams32, _this$_renderParams33, _this$_renderParams34, _this$AMSSDK$logger, _this$_renderParams35, _this$_renderParams36, _this$_renderParams37, _this$AMSSDK, _this$_renderParams38, _this$_renderParams39, isAddressElement, res, submitRes;
|
1803
1806
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1804
1807
|
while (1) switch (_context8.prev = _context8.next) {
|
1805
1808
|
case 0:
|
@@ -1829,35 +1832,35 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1829
1832
|
data: {
|
1830
1833
|
queryResult: res,
|
1831
1834
|
submitResult: submitRes,
|
1832
|
-
sessionResult: (_this$
|
1833
|
-
paymentSessionData: (_this$
|
1835
|
+
sessionResult: (_this$_renderParams26 = this._renderParams) === null || _this$_renderParams26 === void 0 ? void 0 : _this$_renderParams26.paymentSessionMetaData,
|
1836
|
+
paymentSessionData: (_this$_renderParams27 = this._renderParams) === null || _this$_renderParams27 === void 0 ? void 0 : _this$_renderParams27.sessionData,
|
1834
1837
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1835
|
-
renderDisplayType: (_this$
|
1836
|
-
appearance: (_this$
|
1837
|
-
notRedirectAfterComplete: ((_this$
|
1838
|
+
renderDisplayType: (_this$_renderParams28 = this._renderParams) === null || _this$_renderParams28 === void 0 ? void 0 : _this$_renderParams28.renderDisplayType,
|
1839
|
+
appearance: (_this$_renderParams29 = this._renderParams) === null || _this$_renderParams29 === void 0 ? void 0 : _this$_renderParams29.appearance,
|
1840
|
+
notRedirectAfterComplete: ((_this$_renderParams30 = this._renderParams) === null || _this$_renderParams30 === void 0 ? void 0 : _this$_renderParams30.notRedirectAfterComplete) === true,
|
1838
1841
|
isAppWebview: this._isAppWebview,
|
1839
1842
|
merchantAppointParam: this._merchantAppointParam,
|
1840
1843
|
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1841
1844
|
/** 地址组件集成的参数 */
|
1842
|
-
configParams: (_this$
|
1843
|
-
prefillValue: (_this$
|
1844
|
-
componentSession: (_this$
|
1845
|
+
configParams: (_this$_renderParams31 = this._renderParams) === null || _this$_renderParams31 === void 0 ? void 0 : _this$_renderParams31.configParams,
|
1846
|
+
prefillValue: (_this$_renderParams32 = this._renderParams) === null || _this$_renderParams32 === void 0 ? void 0 : _this$_renderParams32.prefillValue,
|
1847
|
+
componentSession: (_this$_renderParams33 = this._renderParams) === null || _this$_renderParams33 === void 0 ? void 0 : _this$_renderParams33.componentSession,
|
1845
1848
|
envInfo: {
|
1846
1849
|
screenHeight: screen.height,
|
1847
1850
|
screenWidth: screen.width
|
1848
1851
|
},
|
1849
1852
|
logMetaData: _objectSpread(_objectSpread({
|
1850
|
-
trackId: (_this$
|
1853
|
+
trackId: (_this$_renderParams34 = this._renderParams) === null || _this$_renderParams34 === void 0 ? void 0 : _this$_renderParams34.sessionData,
|
1851
1854
|
platform: this.platform,
|
1852
1855
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1853
|
-
}, ((_this$
|
1854
|
-
renderDisplayType: (_this$
|
1856
|
+
}, ((_this$_renderParams35 = this._renderParams) === null || _this$_renderParams35 === void 0 || (_this$_renderParams35 = _this$_renderParams35.paymentSessionMetaData) === null || _this$_renderParams35 === void 0 ? void 0 : _this$_renderParams35.paymentSessionConfig) || {}), {}, {
|
1857
|
+
renderDisplayType: (_this$_renderParams36 = this._renderParams) === null || _this$_renderParams36 === void 0 ? void 0 : _this$_renderParams36.renderDisplayType,
|
1855
1858
|
sdkVersion: this._appVersion,
|
1856
|
-
merchantId: (_this$
|
1859
|
+
merchantId: (_this$_renderParams37 = this._renderParams) === null || _this$_renderParams37 === void 0 || (_this$_renderParams37 = _this$_renderParams37.paymentSessionMetaData) === null || _this$_renderParams37 === void 0 ? void 0 : _this$_renderParams37.clientId,
|
1857
1860
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1858
1861
|
performanceData: this._performanceData,
|
1859
|
-
paymentMethodType: (_this$
|
1860
|
-
skipRenderPaymentMethod: (_this$
|
1862
|
+
paymentMethodType: (_this$_renderParams38 = this._renderParams) === null || _this$_renderParams38 === void 0 || (_this$_renderParams38 = _this$_renderParams38.paymentSessionMetaData) === null || _this$_renderParams38 === void 0 || (_this$_renderParams38 = _this$_renderParams38.paymentMethodInfoView) === null || _this$_renderParams38 === void 0 ? void 0 : _this$_renderParams38.paymentMethodType,
|
1863
|
+
skipRenderPaymentMethod: (_this$_renderParams39 = this._renderParams) === null || _this$_renderParams39 === void 0 || (_this$_renderParams39 = _this$_renderParams39.paymentSessionMetaData) === null || _this$_renderParams39 === void 0 ? void 0 : _this$_renderParams39.skipRenderPaymentMethod
|
1861
1864
|
})
|
1862
1865
|
}
|
1863
1866
|
}
|
@@ -1919,10 +1922,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1919
1922
|
}, {
|
1920
1923
|
key: "hideComponentAnimation",
|
1921
1924
|
value: function hideComponentAnimation() {
|
1922
|
-
var _this$
|
1925
|
+
var _this$_renderParams40, _this$_renderParams41, _this$_renderParams42, _this$_renderParams43, _this$_renderParams44, _this$_renderParams45, _container$style;
|
1923
1926
|
// 修改需当前文件搜索,这段注释appendAliasContainerId
|
1924
|
-
var _selector = (this === null || this === void 0 || (_this$
|
1925
|
-
var appendAliasContainerId = this !== null && this !== void 0 && (_this$
|
1927
|
+
var _selector = (this === null || this === void 0 || (_this$_renderParams40 = this._renderParams) === null || _this$_renderParams40 === void 0 || (_this$_renderParams40 = _this$_renderParams40.selector) === null || _this$_renderParams40 === void 0 || (_this$_renderParams41 = _this$_renderParams40.indexOf) === null || _this$_renderParams41 === void 0 ? void 0 : _this$_renderParams41.call(_this$_renderParams40, '#')) === -1 ? this === null || this === void 0 || (_this$_renderParams42 = this._renderParams) === null || _this$_renderParams42 === void 0 ? void 0 : _this$_renderParams42.selector : this === null || this === void 0 || (_this$_renderParams43 = this._renderParams) === null || _this$_renderParams43 === void 0 || (_this$_renderParams43 = _this$_renderParams43.selector) === null || _this$_renderParams43 === void 0 || (_this$_renderParams44 = _this$_renderParams43.slice) === null || _this$_renderParams44 === void 0 ? void 0 : _this$_renderParams44.call(_this$_renderParams43, 1);
|
1928
|
+
var appendAliasContainerId = this !== null && this !== void 0 && (_this$_renderParams45 = this._renderParams) !== null && _this$_renderParams45 !== void 0 && _this$_renderParams45.appendAliasContainerId ? "-".concat(_selector) : '';
|
1926
1929
|
var inlineId = "".concat(COMPONENT_CONTAINER_ID).concat(appendAliasContainerId);
|
1927
1930
|
var container = document.getElementById(inlineId);
|
1928
1931
|
if (this.app && container) this.app.style.height = container === null || container === void 0 || (_container$style = container.style) === null || _container$style === void 0 ? void 0 : _container$style.height;
|
package/esm/plugin/type.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BusSubscriber } from '
|
1
|
+
import { BusSubscriber } from '../core/bus';
|
2
2
|
import { PaymentMethodCategoryTypeEnum, ProductSceneEnum, ProductSceneVersion } from '../types';
|
3
3
|
export type IExtendPlugin = IExtendPluginItem[];
|
4
4
|
export interface ComponentActionNamesType {
|
package/esm/types/index.d.ts
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
*/
|
8
8
|
import { IApplePayContactField } from '../plugin/applepay/interface';
|
9
9
|
export type onChange = () => onCnageResult;
|
10
|
-
export {
|
10
|
+
export { ElementType, PaymentElementLayout, ThemeType, type IElementOptions } from '../core/component/oldElement/type';
|
11
11
|
interface onCnageResult {
|
12
12
|
complete: boolean;
|
13
13
|
addressValue: AddressItem[];
|
@@ -76,7 +76,8 @@ export declare enum ComponentSignEnum {
|
|
76
76
|
'VAULTING_CARD' = "VAULTING_CARD",
|
77
77
|
'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT",
|
78
78
|
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
|
79
|
-
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
|
79
|
+
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL",
|
80
|
+
'AUTO_DEBIT_APM' = "AUTO_DEBIT_APM"
|
80
81
|
}
|
81
82
|
export declare enum ProductSceneEnum {
|
82
83
|
'EASY_PAY' = "EASY_PAY",
|
@@ -235,6 +236,9 @@ export interface frontModulesToBeLoadedInterface {
|
|
235
236
|
acquirerName: string;
|
236
237
|
scriptUrl: string;
|
237
238
|
}
|
239
|
+
type ActionDeviceInfo = {
|
240
|
+
signType?: string;
|
241
|
+
};
|
238
242
|
export interface PaymentSessionActionData {
|
239
243
|
amountConfirmRequired?: boolean;
|
240
244
|
autoDebitWithToken: boolean;
|
@@ -243,11 +247,16 @@ export interface PaymentSessionActionData {
|
|
243
247
|
requireFastSdk: boolean;
|
244
248
|
nonCompliant?: boolean;
|
245
249
|
nonInitSecuritySDK?: boolean;
|
250
|
+
signButtonDisplay?: boolean;
|
251
|
+
userSignAgreement?: boolean;
|
246
252
|
skipSdkQueryForm?: {
|
247
253
|
value: boolean;
|
248
254
|
version: string;
|
249
255
|
platform: string;
|
250
256
|
};
|
257
|
+
web: ActionDeviceInfo;
|
258
|
+
wap: ActionDeviceInfo;
|
259
|
+
app: ActionDeviceInfo;
|
251
260
|
}
|
252
261
|
export interface IPaymentSessionMetaData {
|
253
262
|
clientId?: string;
|
@@ -335,6 +344,7 @@ export interface IPaymentSessionMetaData {
|
|
335
344
|
enableConnect?: boolean;
|
336
345
|
};
|
337
346
|
skipRenderPaymentMethod?: boolean;
|
347
|
+
needAccountConfirmPage?: boolean;
|
338
348
|
}
|
339
349
|
export interface IPaymentSessionFactor {
|
340
350
|
merchantInfo?: IMerchantInfo;
|
@@ -581,6 +591,14 @@ export interface CashierSdkActionQueryResult {
|
|
581
591
|
channelOrderId?: string;
|
582
592
|
};
|
583
593
|
}
|
594
|
+
export interface CashierSdkActionQuerySessionResult extends IPaymentSessionMetaData {
|
595
|
+
success: boolean;
|
596
|
+
errorCode?: string;
|
597
|
+
errorMessage?: string;
|
598
|
+
message?: string;
|
599
|
+
errorStatus?: string;
|
600
|
+
traceId?: string;
|
601
|
+
}
|
584
602
|
/**
|
585
603
|
* Get App Pay Payment Session Request.
|
586
604
|
*/
|
@@ -630,8 +648,18 @@ export declare enum eventCodeEnum {
|
|
630
648
|
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
|
631
649
|
SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
|
632
650
|
SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
|
633
|
-
|
651
|
+
/**
|
652
|
+
* 拉取WEB应用&收银台失败
|
653
|
+
*/
|
654
|
+
SDK_LAUNCH_PAYMENT_APP_ERROR = "SDK_LAUNCH_PAYMENT_APP_ERROR",
|
655
|
+
/**
|
656
|
+
* 拉取WEB应用&收银台成功
|
657
|
+
*/
|
634
658
|
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS",
|
659
|
+
/**
|
660
|
+
@deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
|
661
|
+
*/
|
662
|
+
SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
|
635
663
|
SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
|
636
664
|
SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
|
637
665
|
SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
|
@@ -794,3 +822,9 @@ export declare enum RiskSdkInfoEnum {
|
|
794
822
|
NEED = "need",
|
795
823
|
NO_NEED = "noneed"
|
796
824
|
}
|
825
|
+
export type HandleCloseSource = 'behavior' | 'retention';
|
826
|
+
export declare enum EventLoggingEventId {
|
827
|
+
OnlyClose = "OnlyClose",
|
828
|
+
LeaveAnyWay = "LeaveAnyWay",
|
829
|
+
ContinuePaying = "ContinuePaying"
|
830
|
+
}
|
package/esm/types/index.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
10
10
|
|
11
|
-
export { ElementType,
|
11
|
+
export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/oldElement/type";
|
12
12
|
|
13
13
|
/**
|
14
14
|
* SDK options
|
@@ -37,6 +37,7 @@ export var ComponentSignEnum = /*#__PURE__*/function (ComponentSignEnum) {
|
|
37
37
|
ComponentSignEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
|
38
38
|
ComponentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
|
39
39
|
ComponentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
|
40
|
+
ComponentSignEnum["AUTO_DEBIT_APM"] = "AUTO_DEBIT_APM";
|
40
41
|
return ComponentSignEnum;
|
41
42
|
}({});
|
42
43
|
export var ProductSceneEnum = /*#__PURE__*/function (ProductSceneEnum) {
|
@@ -182,8 +183,9 @@ export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
|
|
182
183
|
eventCodeEnum["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
|
183
184
|
eventCodeEnum["SDK_INIT_PARAMETER_ERROR"] = "SDK_INIT_PARAMETER_ERROR";
|
184
185
|
eventCodeEnum["SDK_CREATECOMPONENT_ERROR"] = "SDK_CREATECOMPONENT_ERROR";
|
185
|
-
eventCodeEnum["
|
186
|
+
eventCodeEnum["SDK_LAUNCH_PAYMENT_APP_ERROR"] = "SDK_LAUNCH_PAYMENT_APP_ERROR";
|
186
187
|
eventCodeEnum["SDK_CALL_URL_SUCCESS"] = "SDK_CALL_URL_SUCCESS";
|
188
|
+
eventCodeEnum["SDK_CALL_URL_ERROR"] = "SDK_CALL_URL_ERROR";
|
187
189
|
eventCodeEnum["SDK_PAYMENT_SUCCESSFUL"] = "SDK_PAYMENT_SUCCESSFUL";
|
188
190
|
eventCodeEnum["SDK_PAYMENT_FAIL"] = "SDK_PAYMENT_FAIL";
|
189
191
|
eventCodeEnum["SDK_PAYMENT_ERROR"] = "SDK_PAYMENT_ERROR";
|
@@ -229,4 +231,10 @@ export var RiskSdkInfoEnum = /*#__PURE__*/function (RiskSdkInfoEnum) {
|
|
229
231
|
RiskSdkInfoEnum["NEED"] = "need";
|
230
232
|
RiskSdkInfoEnum["NO_NEED"] = "noneed";
|
231
233
|
return RiskSdkInfoEnum;
|
234
|
+
}({});
|
235
|
+
export var EventLoggingEventId = /*#__PURE__*/function (EventLoggingEventId) {
|
236
|
+
EventLoggingEventId["OnlyClose"] = "OnlyClose";
|
237
|
+
EventLoggingEventId["LeaveAnyWay"] = "LeaveAnyWay";
|
238
|
+
EventLoggingEventId["ContinuePaying"] = "ContinuePaying";
|
239
|
+
return EventLoggingEventId;
|
232
240
|
}({});
|
package/esm/util/index.d.ts
CHANGED
@@ -47,4 +47,10 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
|
|
47
47
|
loadCallback?: any;
|
48
48
|
}, logger: any): Promise<unknown>;
|
49
49
|
declare const isEmpty: (value: any) => boolean;
|
50
|
-
|
50
|
+
/**
|
51
|
+
* 判断一个值是否为真
|
52
|
+
* @param value 要判断的值
|
53
|
+
* @returns 如果值为true或者字符串"true"(不区分大小写),则返回true,否则返回false
|
54
|
+
*/
|
55
|
+
declare const isTrue: (value: unknown) => boolean;
|
56
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, isTrue, };
|
package/esm/util/index.js
CHANGED
@@ -343,4 +343,13 @@ var isEmpty = function isEmpty(value) {
|
|
343
343
|
}
|
344
344
|
return false;
|
345
345
|
};
|
346
|
-
|
346
|
+
|
347
|
+
/**
|
348
|
+
* 判断一个值是否为真
|
349
|
+
* @param value 要判断的值
|
350
|
+
* @returns 如果值为true或者字符串"true"(不区分大小写),则返回true,否则返回false
|
351
|
+
*/
|
352
|
+
var isTrue = function isTrue(value) {
|
353
|
+
return value === true || typeof value === 'string' && value.toLowerCase() === 'true';
|
354
|
+
};
|
355
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, isTrue };
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import { ERRORMESSAGE } from "../constant";
|
2
|
+
import CallApp from "./intl-callapp/es/main";
|
3
|
+
import { terminalTypeEnum } from "../types";
|
4
|
+
import { device } from ".";
|
5
|
+
export function redirect(data) {
|
6
|
+
return new Promise(function (resolve, reject) {
|
7
|
+
var terminalType = device.isMobile ? terminalTypeEnum.WAP : terminalTypeEnum.WEB;
|
8
|
+
var isWeb = terminalType === terminalTypeEnum.WEB;
|
9
|
+
var normalUrl = (data === null || data === void 0 ? void 0 : data.normalUrl) || '';
|
10
|
+
var schemeUrl = (data === null || data === void 0 ? void 0 : data.schemeUrl) || '';
|
11
|
+
var applinkUrl = (data === null || data === void 0 ? void 0 : data.applinkUrl) || '';
|
12
|
+
var callAppJudgeTime = (data === null || data === void 0 ? void 0 : data.callAppJudgeTime) || '';
|
13
|
+
var jumpFunc = function jumpFunc() {
|
14
|
+
if (normalUrl) {
|
15
|
+
resolve();
|
16
|
+
window.location.href = normalUrl;
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
reject(ERRORMESSAGE.SDK_LAUNCH_PAYMENT_APP_ERROR.CALL_APP_URL_ERROR);
|
20
|
+
};
|
21
|
+
var callAppFunc = function callAppFunc() {
|
22
|
+
if (!schemeUrl && !applinkUrl) {
|
23
|
+
jumpFunc();
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
var config = {
|
27
|
+
fallback: function fallback() {
|
28
|
+
jumpFunc();
|
29
|
+
},
|
30
|
+
successCb: function successCb() {
|
31
|
+
resolve();
|
32
|
+
},
|
33
|
+
delay: 0
|
34
|
+
};
|
35
|
+
if (callAppJudgeTime) {
|
36
|
+
config['resultJudgmentTime'] = callAppJudgeTime;
|
37
|
+
}
|
38
|
+
try {
|
39
|
+
var callLib = new CallApp(config);
|
40
|
+
callLib.open({
|
41
|
+
scheme: schemeUrl,
|
42
|
+
link: applinkUrl
|
43
|
+
});
|
44
|
+
} catch (error) {
|
45
|
+
jumpFunc();
|
46
|
+
}
|
47
|
+
};
|
48
|
+
if (isWeb) {
|
49
|
+
jumpFunc();
|
50
|
+
} else {
|
51
|
+
callAppFunc();
|
52
|
+
}
|
53
|
+
});
|
54
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@alipay/ams-checkout",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.1742285920-dev.1",
|
4
4
|
"description": "",
|
5
5
|
"author": "",
|
6
6
|
"main": "esm/index.js",
|
@@ -16,12 +16,31 @@
|
|
16
16
|
"scripts": {
|
17
17
|
"build": "father build",
|
18
18
|
"build:w": "father dev",
|
19
|
-
"dev": "father dev",
|
20
19
|
"ci": "npm run lint",
|
21
20
|
"cov": "jest --coverage",
|
21
|
+
"dev": "father dev",
|
22
22
|
"format": "prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"",
|
23
23
|
"lint": "eslint ./src",
|
24
|
-
"test": "jest"
|
24
|
+
"test": "jest --silent",
|
25
|
+
"tsc": "tsc --noEmit"
|
26
|
+
},
|
27
|
+
"commitlint": {
|
28
|
+
"extends": [
|
29
|
+
"@commitlint/config-conventional"
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"lint-staged": {
|
33
|
+
"*.{js,jsx}": [
|
34
|
+
"eslint --fix",
|
35
|
+
"prettier --write"
|
36
|
+
],
|
37
|
+
"*.{ts,tsx}": [
|
38
|
+
"eslint --fix",
|
39
|
+
"prettier --parser=typescript --write"
|
40
|
+
],
|
41
|
+
"*.{md,json}": [
|
42
|
+
"prettier --write"
|
43
|
+
]
|
25
44
|
},
|
26
45
|
"dependencies": {
|
27
46
|
"axios": "^1.3.4",
|
@@ -30,6 +49,8 @@
|
|
30
49
|
"devDependencies": {
|
31
50
|
"@babel/core": "^7.20.7",
|
32
51
|
"@babel/preset-env": "^7.20.2",
|
52
|
+
"@commitlint/cli": "^17.3.0",
|
53
|
+
"@commitlint/config-conventional": "^17.3.0",
|
33
54
|
"@testing-library/jest-dom": "^5.1.1",
|
34
55
|
"@testing-library/react": "^9.5.0",
|
35
56
|
"@types/jest": "^29.2.4",
|
@@ -51,7 +72,9 @@
|
|
51
72
|
"ts-node": "^10.9.1",
|
52
73
|
"typescript": "^4.9.5"
|
53
74
|
},
|
54
|
-
"engines": {
|
75
|
+
"engines": {
|
76
|
+
"install-node": "18"
|
77
|
+
},
|
55
78
|
"publishConfig": {
|
56
79
|
"access": "public"
|
57
80
|
}
|
File without changes
|