@alipay/ams-checkout 0.0.1720491429-dev.0 → 0.0.1720509876-dev.0
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 +1 -0
- package/esm/config/index.js +8 -0
- package/esm/core/component/index.d.ts +1 -1
- package/esm/core/component/index.js +14 -6
- package/esm/index.d.ts +3 -0
- package/esm/index.js +12 -0
- package/esm/plugin/component/cashierApp.d.ts +3 -3
- package/esm/plugin/component/cashierApp.js +13 -3
- package/esm/plugin/component/component.popup.style.d.ts +1 -0
- package/esm/plugin/component/component.popup.style.js +3 -0
- package/esm/plugin/component/index.js +55 -57
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.js +1 -0
- package/esm/types/index.d.ts +10 -4
- package/esm/types/index.js +7 -0
- package/package.json +1 -1
package/esm/config/index.d.ts
CHANGED
package/esm/config/index.js
CHANGED
@@ -22,4 +22,12 @@ export var marmotConfigMap = {
|
|
22
22
|
light_sandbox: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
23
23
|
prod: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json'
|
24
24
|
};
|
25
|
+
export var elementAppMarmotMap = {
|
26
|
+
dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
|
27
|
+
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
|
28
|
+
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
|
29
|
+
sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
|
30
|
+
light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
|
31
|
+
prod: 'https://ac.alipay.com/page/antom-web-checkout-v2'
|
32
|
+
};
|
25
33
|
export var sdkVersion = json.version;
|
@@ -31,7 +31,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
31
31
|
createComponent(params: IcreateComponent): Promise<void>;
|
32
32
|
private createComponentProcess;
|
33
33
|
preloadComponent(channelType: any, productSceneVersion: any): void;
|
34
|
-
clearPreloadIframe
|
34
|
+
private clearPreloadIframe;
|
35
35
|
/**
|
36
36
|
* @description Create and render components in the specified element area
|
37
37
|
* @param params - The data source created by the component, necessary sessionData, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
|
@@ -14,6 +14,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
14
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
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
16
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
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
17
21
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
18
22
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
23
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -33,7 +37,7 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
|
33
37
|
import ComponentApp from "../../plugin/component";
|
34
38
|
import { ExtendPlugin } from "../../plugin/const";
|
35
39
|
import { PaypalBusSubscriber } from "../../plugin/paypal";
|
36
|
-
import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
40
|
+
import { componentSignEnum, ComponentSignEnumV2, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
37
41
|
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
38
42
|
import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
|
39
43
|
import { getSecurityConfigStorageKey } from "../../util/security";
|
@@ -49,7 +53,9 @@ export var getComponentSign = function getComponentSign(params) {
|
|
49
53
|
productScene = _params$paymentSessio3 === void 0 ? '' : _params$paymentSessio3,
|
50
54
|
_params$paymentSessio4 = _params$paymentSessio2.paymentMethodCategoryType,
|
51
55
|
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
|
52
|
-
|
56
|
+
if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType);
|
57
|
+
if (productScene) return "".concat(productScene);
|
58
|
+
return componentSignEnum.NONE;
|
53
59
|
};
|
54
60
|
export var parseSessionData = function parseSessionData(sessionData) {
|
55
61
|
try {
|
@@ -91,6 +97,12 @@ var handleParams = function handleParams(params) {
|
|
91
97
|
parseData = _handleSessionData2[0],
|
92
98
|
sessionData = _handleSessionData2[1];
|
93
99
|
var componentSign = getComponentSign(parseData);
|
100
|
+
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === renderDisplayTypeEnum.popup) {
|
101
|
+
return Promise.reject({
|
102
|
+
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
103
|
+
message: "unsupported payment method"
|
104
|
+
});
|
105
|
+
}
|
94
106
|
if (componentSign === componentSignEnum.NONE) {
|
95
107
|
// eslint-disable-next-line prefer-promise-reject-errors
|
96
108
|
return Promise.reject({
|
@@ -200,7 +212,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
200
212
|
localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
|
201
213
|
}
|
202
214
|
}
|
203
|
-
|
204
215
|
/**
|
205
216
|
* 初始化 Bus总线的能力
|
206
217
|
*/
|
@@ -262,7 +273,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
262
273
|
}
|
263
274
|
});
|
264
275
|
}
|
265
|
-
|
266
276
|
/**
|
267
277
|
* To determine whether the corresponding payment method is available,
|
268
278
|
* only the channel described in the document will be called, and it will be returned as available by default
|
@@ -302,7 +312,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
302
312
|
}
|
303
313
|
});
|
304
314
|
}
|
305
|
-
|
306
315
|
/**
|
307
316
|
* @description Create component application
|
308
317
|
* @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.
|
@@ -442,7 +451,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
442
451
|
this.savePreviousChannel(iframeNodesParams);
|
443
452
|
return this.pluginAppendIframe(appendParams);
|
444
453
|
}
|
445
|
-
|
446
454
|
/**
|
447
455
|
* @description Execute payment submission process
|
448
456
|
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
package/esm/index.d.ts
CHANGED
@@ -23,4 +23,7 @@ export declare class AMSCashierPayment extends AMSCheckout {
|
|
23
23
|
export declare class AMSVaulting extends AMSCheckout {
|
24
24
|
constructor(options: IoptionsParams);
|
25
25
|
}
|
26
|
+
export declare class AMSPaymentElement extends AMSCheckout {
|
27
|
+
constructor(options: IoptionsParams);
|
28
|
+
}
|
26
29
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -123,4 +123,16 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
|
123
123
|
}
|
124
124
|
return _createClass(AMSVaulting);
|
125
125
|
}(AMSCheckout);
|
126
|
+
export var AMSPaymentElement = /*#__PURE__*/function (_AMSCheckout5) {
|
127
|
+
_inherits(AMSPaymentElement, _AMSCheckout5);
|
128
|
+
var _super6 = _createSuper(AMSPaymentElement);
|
129
|
+
function AMSPaymentElement(options) {
|
130
|
+
_classCallCheck(this, AMSPaymentElement);
|
131
|
+
var _options = Object.assign({}, options, {
|
132
|
+
product: productSceneEnum.ELEMENT_PAYMENT
|
133
|
+
});
|
134
|
+
return _super6.call(this, _options, [componentSignEnum.ELEMENT_PAYMENT]);
|
135
|
+
}
|
136
|
+
return _createClass(AMSPaymentElement);
|
137
|
+
}(AMSCheckout);
|
126
138
|
export default AMSCheckout;
|
@@ -16,13 +16,13 @@ export declare const getIframeUrl: (iframeParams: {
|
|
16
16
|
productSceneVersion: string;
|
17
17
|
environment: string;
|
18
18
|
appVersion: string;
|
19
|
-
extendInfo
|
20
|
-
locale
|
19
|
+
extendInfo?: string;
|
20
|
+
locale?: string;
|
21
21
|
instanceId: string;
|
22
22
|
renderDisplayType: renderDisplayTypeEnum;
|
23
23
|
isPreload?: string;
|
24
24
|
hostSign?: string;
|
25
|
-
mid
|
25
|
+
mid?: string;
|
26
26
|
}) => {
|
27
27
|
path: string;
|
28
28
|
locationSearch: string;
|
@@ -1,4 +1,10 @@
|
|
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
2
8
|
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; }
|
3
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
10
|
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); }
|
@@ -9,8 +15,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
9
15
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
10
16
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
11
17
|
*/
|
12
|
-
import { marmotMap, sdkVersion } from "../../config/index";
|
13
|
-
import { componentSignEnum } from "../../types";
|
18
|
+
import { marmotMap, sdkVersion, elementAppMarmotMap } from "../../config/index";
|
19
|
+
import { componentSignEnum, ComponentSignEnumV2 } from "../../types";
|
14
20
|
import { isDebugLog } from "../../util/debug";
|
15
21
|
import { queryParse, serialize } from "../../util/index";
|
16
22
|
import { Logger } from "../../util/logger";
|
@@ -52,7 +58,7 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
|
52
58
|
}
|
53
59
|
};
|
54
60
|
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
|
55
|
-
var signSupportMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentSignEnum.NONE, ['']), componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), componentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), componentSignEnum.EASY_PAY_APM, ['2.0']), componentSignEnum.VAULTING_CARD, ['1.0']);
|
61
|
+
var signSupportMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentSignEnum.NONE, ['']), componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), componentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), componentSignEnum.EASY_PAY_APM, ['2.0']), componentSignEnum.VAULTING_CARD, ['1.0']), componentSignEnum.ELEMENT_PAYMENT, ['1.0']);
|
56
62
|
var supportProductSceneVersion = signSupportMap[componentSign];
|
57
63
|
// 从左到右,从旧到新
|
58
64
|
var isSupport = supportProductSceneVersion.find(function (it) {
|
@@ -90,6 +96,10 @@ export var getAppPath = function getAppPath() {
|
|
90
96
|
if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
|
91
97
|
return urlTestHost;
|
92
98
|
}
|
99
|
+
// element应用特殊处理
|
100
|
+
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
|
101
|
+
return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene, "/index.html");
|
102
|
+
}
|
93
103
|
return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
|
94
104
|
};
|
95
105
|
export var getAppDomain = function getAppDomain(domainParams) {
|
@@ -168,4 +168,7 @@ export var handleDeclareInfo = function handleDeclareInfo(_ref) {
|
|
168
168
|
} catch (error) {
|
169
169
|
console.error(error);
|
170
170
|
}
|
171
|
+
};
|
172
|
+
export var slideInAndOutKeyframes = function slideInAndOutKeyframes(id, height) {
|
173
|
+
return "@keyframes ".concat(id, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(height, "px;\n }\n }\n @keyframes ").concat(id, "-slide-out {\n 0% {\n height: ").concat(height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
|
171
174
|
};
|
@@ -27,7 +27,8 @@ import { matchVersion } from "../../util/versionCompare";
|
|
27
27
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
28
28
|
import { getChannelBehavior } from "./channel";
|
29
29
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
30
|
-
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
30
|
+
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
|
31
|
+
import { handlePaymentSessionConfig } from "../payment-element/utils";
|
31
32
|
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
32
33
|
window.changingPageHeight = window.innerHeight;
|
33
34
|
var ComponentApp = /*#__PURE__*/function () {
|
@@ -57,7 +58,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
57
58
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
58
59
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
59
60
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
60
|
-
this._appVersion = '1.
|
61
|
+
this._appVersion = '1.20.0';
|
61
62
|
this._isInitComponent = false;
|
62
63
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
63
64
|
this.createIframeNode = function () {
|
@@ -298,7 +299,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
298
299
|
}).send();
|
299
300
|
if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
|
300
301
|
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
|
301
|
-
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
302
|
+
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
302
303
|
this.handleAuthUrlInfo(authUrlInfo);
|
303
304
|
return;
|
304
305
|
}
|
@@ -414,9 +415,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
414
415
|
}, {
|
415
416
|
key: "createActionQueryPromise",
|
416
417
|
value: function createActionQueryPromise() {
|
417
|
-
var
|
418
|
-
_this5 = this;
|
419
|
-
var paymentMethodType = (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentSessionMetaData) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentMethodInfoView) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.paymentMethodType;
|
418
|
+
var _this5 = this;
|
420
419
|
this._performanceData.push({
|
421
420
|
key: 'sdk_action_query_start',
|
422
421
|
value: Date.now()
|
@@ -426,7 +425,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
426
425
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
427
426
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
428
427
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
429
|
-
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7,
|
428
|
+
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _this5$_renderParams8, _action$web2, _action$wap2, action, signType;
|
430
429
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
431
430
|
while (1) switch (_context2.prev = _context2.next) {
|
432
431
|
case 0:
|
@@ -462,22 +461,28 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
462
461
|
success: true
|
463
462
|
}));
|
464
463
|
case 9:
|
464
|
+
if (componentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
|
465
|
+
params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
|
466
|
+
}
|
467
|
+
|
468
|
+
// 绑卡跳过actionQuery接口
|
469
|
+
// 目前只有绑卡加上 skipSdkQueryForm 判断
|
465
470
|
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
466
|
-
_context2.next =
|
471
|
+
_context2.next = 22;
|
467
472
|
break;
|
468
473
|
}
|
469
474
|
if (!enableVaultingApiOptimize) {
|
470
|
-
_context2.next =
|
475
|
+
_context2.next = 22;
|
471
476
|
break;
|
472
477
|
}
|
473
478
|
if (!skipSdkQueryForm) {
|
474
|
-
_context2.next =
|
479
|
+
_context2.next = 19;
|
475
480
|
break;
|
476
481
|
}
|
477
482
|
// 优先判断 skipSdkQueryForm
|
478
483
|
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
479
484
|
if (!ifSkip) {
|
480
|
-
_context2.next =
|
485
|
+
_context2.next = 17;
|
481
486
|
break;
|
482
487
|
}
|
483
488
|
resolve({
|
@@ -485,12 +490,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
485
490
|
success: true
|
486
491
|
});
|
487
492
|
return _context2.abrupt("return");
|
488
|
-
case
|
489
|
-
_context2.next =
|
493
|
+
case 17:
|
494
|
+
_context2.next = 22;
|
490
495
|
break;
|
491
|
-
case
|
496
|
+
case 19:
|
492
497
|
if (!skipSdkQuery) {
|
493
|
-
_context2.next =
|
498
|
+
_context2.next = 22;
|
494
499
|
break;
|
495
500
|
}
|
496
501
|
resolve({
|
@@ -498,10 +503,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
498
503
|
success: true
|
499
504
|
});
|
500
505
|
return _context2.abrupt("return");
|
501
|
-
case
|
506
|
+
case 22:
|
502
507
|
channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
503
508
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
504
|
-
_context2.next =
|
509
|
+
_context2.next = 25;
|
505
510
|
break;
|
506
511
|
}
|
507
512
|
return _context2.abrupt("return", resolve({
|
@@ -509,29 +514,28 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
509
514
|
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
510
515
|
success: true
|
511
516
|
}));
|
512
|
-
case
|
517
|
+
case 25:
|
513
518
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
514
|
-
_context2.next =
|
519
|
+
_context2.next = 31;
|
515
520
|
break;
|
516
521
|
}
|
517
522
|
params.paymentMethodType = 'CARD';
|
518
|
-
_context2.next =
|
523
|
+
_context2.next = 29;
|
519
524
|
return _this5.getDeviceIdAndLog();
|
520
|
-
case
|
525
|
+
case 29:
|
521
526
|
envInfo.deviceId = _context2.sent;
|
522
527
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
523
528
|
envInfo.extendInfo = {
|
524
529
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
525
530
|
};
|
526
531
|
}
|
527
|
-
case
|
532
|
+
case 31:
|
528
533
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
529
534
|
_context2.next = 40;
|
530
535
|
break;
|
531
536
|
}
|
532
537
|
_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;
|
533
|
-
|
534
|
-
if (!((_this5$_renderParams8 = _this5._renderParams) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.action) !== null && _this5$_renderParams8 !== void 0 && _this5$_renderParams8.skipSdkQuery && enableEasypayApiOptimize)) {
|
538
|
+
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)) {
|
535
539
|
_context2.next = 35;
|
536
540
|
break;
|
537
541
|
}
|
@@ -558,7 +562,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
558
562
|
_context2.next = 50;
|
559
563
|
break;
|
560
564
|
}
|
561
|
-
action = ((_this5$
|
565
|
+
action = ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 || (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.action) || {};
|
562
566
|
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;
|
563
567
|
if (!(signType === 'SMS')) {
|
564
568
|
_context2.next = 45;
|
@@ -637,24 +641,24 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
637
641
|
}, {
|
638
642
|
key: "createSubmitPromise",
|
639
643
|
value: function createSubmitPromise() {
|
640
|
-
var _this$
|
644
|
+
var _this$_renderParams11,
|
645
|
+
_this$_renderParams12,
|
641
646
|
_this$_renderParams13,
|
642
|
-
_this$_renderParams14,
|
643
647
|
_this6 = this;
|
644
648
|
this._performanceData.push({
|
645
649
|
key: 'sdk_submit_start',
|
646
650
|
value: Date.now()
|
647
651
|
});
|
648
652
|
var params = {
|
649
|
-
paymentSessionData: this._renderParams && ((_this$
|
650
|
-
paymentSessionConfig: (_this$
|
653
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.sessionData) || '',
|
654
|
+
paymentSessionConfig: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 || (_this$_renderParams12 = _this$_renderParams12.paymentSessionMetaData) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.paymentSessionConfig
|
651
655
|
};
|
652
|
-
var channelBehavior = getChannelBehavior((_this$
|
656
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionMetaData);
|
653
657
|
// eslint-disable-next-line no-async-promise-executor
|
654
658
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
655
|
-
var
|
659
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
656
660
|
var _channelBehavior$buil, _this6$_renderParams$;
|
657
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2,
|
661
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref10, _ref10$productSceneVe, productSceneVersion, _ref10$productScene, productScene, _ref11, _ref11$action, _ref11$action2, _ref11$action2$enable, enableSignAgreement, _ref11$action2$autoDe, autoDebitWithToken, extParams;
|
658
662
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
659
663
|
while (1) switch (_context3.prev = _context3.next) {
|
660
664
|
case 0:
|
@@ -666,8 +670,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
666
670
|
shouldSkipSubmitPayInSDK = !((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign;
|
667
671
|
}
|
668
672
|
if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
669
|
-
|
670
|
-
|
673
|
+
_ref10 = params.paymentSessionConfig || {}, _ref10$productSceneVe = _ref10.productSceneVersion, productSceneVersion = _ref10$productSceneVe === void 0 ? '' : _ref10$productSceneVe, _ref10$productScene = _ref10.productScene, productScene = _ref10$productScene === void 0 ? '' : _ref10$productScene;
|
674
|
+
_ref11 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref11$action = _ref11.action, _ref11$action2 = _ref11$action === void 0 ? {} : _ref11$action, _ref11$action2$enable = _ref11$action2.enableSignAgreement, enableSignAgreement = _ref11$action2$enable === void 0 ? false : _ref11$action2$enable, _ref11$action2$autoDe = _ref11$action2.autoDebitWithToken, autoDebitWithToken = _ref11$action2$autoDe === void 0 ? false : _ref11$action2$autoDe;
|
671
675
|
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
672
676
|
///EasyPay 2.0 首次传signAgreement字段
|
673
677
|
params['signAgreement'] = enableSignAgreement;
|
@@ -745,7 +749,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
745
749
|
}, _callee3);
|
746
750
|
}));
|
747
751
|
return function (_x3) {
|
748
|
-
return
|
752
|
+
return _ref9.apply(this, arguments);
|
749
753
|
};
|
750
754
|
}());
|
751
755
|
}
|
@@ -795,13 +799,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
795
799
|
productScene: componentSign,
|
796
800
|
productSceneVersion: productSceneVersion,
|
797
801
|
environment: this.AMSSDK.options.env.environment,
|
798
|
-
// TODO 确定一下这个参数是干啥的
|
799
802
|
appVersion: this._appVersion,
|
800
|
-
extendInfo: '',
|
801
|
-
locale: '',
|
802
803
|
instanceId: '',
|
803
|
-
isPreload: 'true'
|
804
|
-
mid: ''
|
804
|
+
isPreload: 'true'
|
805
805
|
}),
|
806
806
|
path = _getIframeUrl.path,
|
807
807
|
locationSearch = _getIframeUrl.locationSearch;
|
@@ -1244,9 +1244,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1244
1244
|
|
1245
1245
|
// 此style用于弹窗出现和高度变化时动画,动画不同,属性不同
|
1246
1246
|
this.app.style.height = parseInt(this.app.style.height) > 0 ? '100%' : "".concat(data.context.data.height, "px");
|
1247
|
-
|
1248
1247
|
// 弹出和弹入动画
|
1249
|
-
var runkeyframes =
|
1248
|
+
var runkeyframes = slideInAndOutKeyframes(COMPONENT_CONTAINER_ID, data.context.data.height);
|
1250
1249
|
// 创建style标签
|
1251
1250
|
var style = document.createElement('style');
|
1252
1251
|
style.id = animationStyleId;
|
@@ -1256,7 +1255,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1256
1255
|
style.innerHTML = runkeyframes;
|
1257
1256
|
// 将style样式存放到head标签
|
1258
1257
|
document.getElementsByTagName('head')[0].appendChild(style);
|
1259
|
-
|
1260
1258
|
// size变动时动画
|
1261
1259
|
setTimeout(function () {
|
1262
1260
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
@@ -1376,9 +1374,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1376
1374
|
}
|
1377
1375
|
}, {
|
1378
1376
|
key: "handleDeclareInfo",
|
1379
|
-
value: function handleDeclareInfo(
|
1380
|
-
var
|
1381
|
-
closeDialogData =
|
1377
|
+
value: function handleDeclareInfo(_ref12) {
|
1378
|
+
var _ref12$closeDialogDat = _ref12.closeDialogData,
|
1379
|
+
closeDialogData = _ref12$closeDialogDat === void 0 ? {} : _ref12$closeDialogDat;
|
1382
1380
|
_handleDeclareInfo({
|
1383
1381
|
closeDialogData: closeDialogData
|
1384
1382
|
});
|
@@ -1519,7 +1517,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1519
1517
|
key: "sendRenderEvent",
|
1520
1518
|
value: (function () {
|
1521
1519
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1522
|
-
var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$
|
1520
|
+
var _this$_renderParams14, _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$AMSSDK$logger, _this$_renderParams20, _this$_renderParams21, _this$_renderParams22, _this$AMSSDK, _this$_renderParams23, res, submitRes;
|
1523
1521
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1524
1522
|
while (1) switch (_context8.prev = _context8.next) {
|
1525
1523
|
case 0:
|
@@ -1548,12 +1546,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1548
1546
|
data: {
|
1549
1547
|
queryResult: res,
|
1550
1548
|
submitResult: submitRes,
|
1551
|
-
sessionResult: (_this$
|
1552
|
-
paymentSessionData: (_this$
|
1549
|
+
sessionResult: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData,
|
1550
|
+
paymentSessionData: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.sessionData,
|
1553
1551
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1554
|
-
renderDisplayType: (_this$
|
1555
|
-
appearance: (_this$
|
1556
|
-
notRedirectAfterComplete: ((_this$
|
1552
|
+
renderDisplayType: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.renderDisplayType,
|
1553
|
+
appearance: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.appearance,
|
1554
|
+
notRedirectAfterComplete: ((_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.notRedirectAfterComplete) === true,
|
1557
1555
|
merchantAppointParam: this._merchantAppointParam,
|
1558
1556
|
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1559
1557
|
envInfo: {
|
@@ -1561,16 +1559,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1561
1559
|
screenWidth: screen.width
|
1562
1560
|
},
|
1563
1561
|
logMetaData: _objectSpread(_objectSpread({
|
1564
|
-
trackId: (_this$
|
1562
|
+
trackId: (_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.sessionData,
|
1565
1563
|
platform: this.platform,
|
1566
1564
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1567
|
-
}, ((_this$
|
1568
|
-
renderDisplayType: (_this$
|
1565
|
+
}, ((_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 || (_this$_renderParams20 = _this$_renderParams20.paymentSessionMetaData) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.paymentSessionConfig) || {}), {}, {
|
1566
|
+
renderDisplayType: (_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.renderDisplayType,
|
1569
1567
|
sdkVersion: this._appVersion,
|
1570
|
-
merchantId: (_this$
|
1568
|
+
merchantId: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 || (_this$_renderParams22 = _this$_renderParams22.paymentSessionMetaData) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.clientId,
|
1571
1569
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1572
1570
|
performanceData: this._performanceData,
|
1573
|
-
paymentMethodType: (_this$
|
1571
|
+
paymentMethodType: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentMethodInfoView) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.paymentMethodType
|
1574
1572
|
})
|
1575
1573
|
}
|
1576
1574
|
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export var handlePaymentSessionConfig = function handlePaymentSessionConfig(config) {
|
2
|
+
return {
|
3
|
+
productScene: config === null || config === void 0 ? void 0 : config.productScene,
|
4
|
+
productSceneVersion: config === null || config === void 0 ? void 0 : config.productSceneVersion
|
5
|
+
};
|
6
|
+
};
|
@@ -380,6 +380,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
380
380
|
break;
|
381
381
|
case PaypalActionEnum.destroyComponent:
|
382
382
|
this.destroyComponent(context, message);
|
383
|
+
break;
|
383
384
|
default:
|
384
385
|
console.log('Unknown action: ' + message.getAction());
|
385
386
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -40,6 +40,9 @@ export interface IcreatePaymentParams {
|
|
40
40
|
backgroundColor?: string;
|
41
41
|
};
|
42
42
|
}
|
43
|
+
export declare enum ComponentSignEnumV2 {
|
44
|
+
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
|
45
|
+
}
|
43
46
|
export declare enum componentSignEnum {
|
44
47
|
'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
|
45
48
|
'EASY_PAY_APM' = "EASY_PAY_APM",
|
@@ -48,7 +51,8 @@ export declare enum componentSignEnum {
|
|
48
51
|
'CASHIER_PAYMENT_APM' = "CASHIER_PAYMENT_APM",
|
49
52
|
'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
|
50
53
|
'NONE' = "NONE",
|
51
|
-
'VAULTING_CARD' = "VAULTING_CARD"
|
54
|
+
'VAULTING_CARD' = "VAULTING_CARD",
|
55
|
+
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
|
52
56
|
}
|
53
57
|
export declare enum productSceneEnum {
|
54
58
|
'EASY_PAY' = "EASY_PAY",
|
@@ -56,13 +60,15 @@ export declare enum productSceneEnum {
|
|
56
60
|
'AUTO_DEBIT' = "AUTO_DEBIT",
|
57
61
|
'VAULTING' = "VAULTING",
|
58
62
|
'FLASH_BUY' = "FLASH_BUY",
|
59
|
-
'CARD_APPLE_PAY' = "CARD_APPLE_PAY"
|
63
|
+
'CARD_APPLE_PAY' = "CARD_APPLE_PAY",
|
64
|
+
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT"
|
60
65
|
}
|
61
66
|
export declare enum paymentMethodCategoryTypeEnum {
|
62
67
|
'CARD' = "CARD",
|
63
68
|
'WALLET' = "WALLET",
|
64
69
|
'BANK' = "BANK",
|
65
|
-
'APM' = "APM"
|
70
|
+
'APM' = "APM",
|
71
|
+
'ALL' = "ALL"
|
66
72
|
}
|
67
73
|
export interface DeviceIdParameter {
|
68
74
|
scene?: string;
|
@@ -115,7 +121,7 @@ export interface Isubmit {
|
|
115
121
|
}
|
116
122
|
export interface IpaymentSessionConfig {
|
117
123
|
productScene: productSceneEnum;
|
118
|
-
paymentMethodCategoryType
|
124
|
+
paymentMethodCategoryType?: paymentMethodCategoryTypeEnum;
|
119
125
|
productSceneVersion: string;
|
120
126
|
}
|
121
127
|
export interface IpaymentSecurityConfig {
|