@alipay/ams-checkout 0.0.1761013649-dev.0 → 0.0.1761220900-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/constant/auto-debit.d.ts +12 -0
- package/esm/constant/auto-debit.js +15 -0
- package/esm/constant/element.d.ts +26 -0
- package/esm/constant/element.js +30 -0
- package/esm/constant/index.d.ts +1 -1
- package/esm/constant/index.js +4 -4
- package/esm/core/component/element/elementController/index.js +2 -2
- package/esm/core/component/element/elementProcessor/addressProcessor.js +2 -3
- package/esm/core/component/element/elementProcessor/authProcessor.js +2 -3
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +1 -1
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +30 -28
- package/esm/foundation/utils/web_app_url_utils.d.ts +0 -2
- package/esm/foundation/utils/web_app_url_utils.js +10 -15
- package/esm/index.d.ts +13 -52
- package/esm/index.js +19 -339
- package/esm/loader/Proxy.d.ts +5 -0
- package/esm/loader/Proxy.js +244 -0
- package/esm/loader/constant.d.ts +33 -0
- package/esm/loader/constant.js +35 -0
- package/esm/loader/index.d.ts +18 -0
- package/esm/loader/index.js +23 -0
- package/esm/loader/utils/common.d.ts +9 -0
- package/esm/loader/utils/common.js +53 -0
- package/esm/loader/utils/debugger.d.ts +7 -0
- package/esm/loader/utils/debugger.js +15 -0
- package/esm/loader/utils/loadSDK.d.ts +3 -0
- package/esm/loader/utils/loadSDK.js +75 -0
- package/esm/loader/utils/logger.d.ts +10 -0
- package/esm/loader/utils/logger.js +59 -0
- package/esm/main.d.ts +45 -0
- package/esm/main.js +329 -0
- package/esm/plugin/component/cashierApp.js +5 -4
- package/esm/util/integrationType.d.ts +21 -0
- package/esm/util/integrationType.js +51 -0
- package/esm/util/logger.d.ts +2 -0
- package/esm/util/logger.js +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-Debit V2构建产物page名称
|
|
3
|
+
*/
|
|
4
|
+
export var AUTO_DEBIT_PAGE_NAME = /*#__PURE__*/function (AUTO_DEBIT_PAGE_NAME) {
|
|
5
|
+
AUTO_DEBIT_PAGE_NAME["TRUSTLY"] = "trustly";
|
|
6
|
+
return AUTO_DEBIT_PAGE_NAME;
|
|
7
|
+
}({});
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Auto-Debit V2(不带域名)
|
|
11
|
+
*/
|
|
12
|
+
export var AUTO_DEBIT_PAGE_URL = /*#__PURE__*/function (AUTO_DEBIT_PAGE_URL) {
|
|
13
|
+
AUTO_DEBIT_PAGE_URL["TRUSTLY"] = "/auto-debit/pages/trustly/index.html";
|
|
14
|
+
return AUTO_DEBIT_PAGE_URL;
|
|
15
|
+
}({});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element 构建产物page名称
|
|
3
|
+
*/
|
|
4
|
+
export declare const ELEMENT_PAGE_NAME: {
|
|
5
|
+
CODE_VIEW: string;
|
|
6
|
+
ELEMENT_PAYMENT: string;
|
|
7
|
+
EXPRESS_CHECKOUT: string;
|
|
8
|
+
IFRAME_ELEMENT: string;
|
|
9
|
+
INSTRUCTION_GUIDE: string;
|
|
10
|
+
THREED_PAGE: string;
|
|
11
|
+
ELEMENT_AUTH: string;
|
|
12
|
+
ADDRESS: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Element 各页面URL(不带域名)
|
|
16
|
+
*/
|
|
17
|
+
export declare enum ELEMENT_PAGE_URL {
|
|
18
|
+
CODE_VIEW = "/elements/pages/code-view/index.html",
|
|
19
|
+
ELEMENT_PAYMENT = "/elements/pages/element-payment/index.html",
|
|
20
|
+
EXPRESS_CHECKOUT = "/elements/pages/express_checkout/index.html",
|
|
21
|
+
IFRAME_ELEMENT = "/elements/pages/iframe-element/index.html",
|
|
22
|
+
INSTRUCTION_GUIDE = "/elements/pages/instruction-guide/index.html",
|
|
23
|
+
THREED_PAGE = "/elements/pages/threed-page/index.html",
|
|
24
|
+
ELEMENT_AUTH = "/auth-element/pages/element_auth/index.html",
|
|
25
|
+
ADDRESS = "/element-address/pages/address/index.html"
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element 构建产物page名称
|
|
3
|
+
*/
|
|
4
|
+
export var ELEMENT_PAGE_NAME = {
|
|
5
|
+
CODE_VIEW: 'code-view',
|
|
6
|
+
ELEMENT_PAYMENT: 'element-payment',
|
|
7
|
+
EXPRESS_CHECKOUT: 'express_checkout',
|
|
8
|
+
IFRAME_ELEMENT: 'iframe-element',
|
|
9
|
+
INSTRUCTION_GUIDE: 'instruction-guide',
|
|
10
|
+
THREED_PAGE: 'threed-page',
|
|
11
|
+
// AuthElement
|
|
12
|
+
ELEMENT_AUTH: 'element_auth',
|
|
13
|
+
// AdressElement
|
|
14
|
+
ADDRESS: 'address'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Element 各页面URL(不带域名)
|
|
19
|
+
*/
|
|
20
|
+
export var ELEMENT_PAGE_URL = /*#__PURE__*/function (ELEMENT_PAGE_URL) {
|
|
21
|
+
ELEMENT_PAGE_URL["CODE_VIEW"] = "/elements/pages/code-view/index.html";
|
|
22
|
+
ELEMENT_PAGE_URL["ELEMENT_PAYMENT"] = "/elements/pages/element-payment/index.html";
|
|
23
|
+
ELEMENT_PAGE_URL["EXPRESS_CHECKOUT"] = "/elements/pages/express_checkout/index.html";
|
|
24
|
+
ELEMENT_PAGE_URL["IFRAME_ELEMENT"] = "/elements/pages/iframe-element/index.html";
|
|
25
|
+
ELEMENT_PAGE_URL["INSTRUCTION_GUIDE"] = "/elements/pages/instruction-guide/index.html";
|
|
26
|
+
ELEMENT_PAGE_URL["THREED_PAGE"] = "/elements/pages/threed-page/index.html";
|
|
27
|
+
ELEMENT_PAGE_URL["ELEMENT_AUTH"] = "/auth-element/pages/element_auth/index.html";
|
|
28
|
+
ELEMENT_PAGE_URL["ADDRESS"] = "/element-address/pages/address/index.html";
|
|
29
|
+
return ELEMENT_PAGE_URL;
|
|
30
|
+
}({});
|
package/esm/constant/index.d.ts
CHANGED
package/esm/constant/index.js
CHANGED
|
@@ -98,14 +98,14 @@ export var ERRORMESSAGE = {
|
|
|
98
98
|
code: 'UI_STATE_ERROR',
|
|
99
99
|
message: 'An error occurred. The transaction cannot be initiated.'
|
|
100
100
|
},
|
|
101
|
-
|
|
102
|
-
code: '
|
|
101
|
+
INITALIZE_TIMEOUT: {
|
|
102
|
+
code: 'INITALIZE_TIMEOUT',
|
|
103
103
|
API: {
|
|
104
|
-
code: '
|
|
104
|
+
code: 'INITALIZE_API_TIMEOUT',
|
|
105
105
|
message: 'An error occurred. The transaction cannot be initiated.'
|
|
106
106
|
},
|
|
107
107
|
WEB: {
|
|
108
|
-
code: '
|
|
108
|
+
code: 'INITALIZE_WEB_TIMEOUT',
|
|
109
109
|
message: 'An error occurred; the transaction cannot be initiated.'
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -195,7 +195,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
195
195
|
title: 'sdk_event_web_app_timeout'
|
|
196
196
|
});
|
|
197
197
|
resolve({
|
|
198
|
-
error: ERRORMESSAGE.
|
|
198
|
+
error: ERRORMESSAGE.INITALIZE_TIMEOUT.WEB
|
|
199
199
|
});
|
|
200
200
|
}, TIMEOUT_DURATION);
|
|
201
201
|
}
|
|
@@ -642,7 +642,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
642
642
|
_context5.t0 = _context5["catch"](1);
|
|
643
643
|
this.handleInitializationError();
|
|
644
644
|
readyCallback({
|
|
645
|
-
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.
|
|
645
|
+
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.INITALIZE_TIMEOUT.API), {}, {
|
|
646
646
|
traceId: _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.traceId
|
|
647
647
|
})
|
|
648
648
|
});
|
|
@@ -20,8 +20,8 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
20
20
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
21
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
22
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
+
import { ELEMENT_PAGE_URL } from "../../../../constant/element";
|
|
23
24
|
import { parseSessionData } from "../..";
|
|
24
|
-
import { ADDRESSElementAppVersion } from "../../../../config";
|
|
25
25
|
import { ProductSceneEnum } from "../../../../types";
|
|
26
26
|
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
|
27
27
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
@@ -95,7 +95,6 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
95
95
|
environment = _this$options.env.environment,
|
|
96
96
|
analytics = _this$options.analytics,
|
|
97
97
|
locale = _this$options.locale;
|
|
98
|
-
var pageUrl = "/element-address/".concat(ADDRESSElementAppVersion, "/pages/address/index.html");
|
|
99
98
|
return _generateIframeSrc({
|
|
100
99
|
paymentSession: paymentSession,
|
|
101
100
|
paymentSessionObj: paymentSessionObj,
|
|
@@ -104,7 +103,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
104
103
|
locale: locale,
|
|
105
104
|
link: link,
|
|
106
105
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
107
|
-
pageUrl:
|
|
106
|
+
pageUrl: ELEMENT_PAGE_URL.ADDRESS,
|
|
108
107
|
instanceId: instanceId
|
|
109
108
|
});
|
|
110
109
|
}
|
|
@@ -17,7 +17,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
17
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
19
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
-
import {
|
|
20
|
+
import { ELEMENT_PAGE_URL } from "../../../../constant/element";
|
|
21
21
|
import { parseSessionData } from "../../index";
|
|
22
22
|
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
|
23
23
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
@@ -69,7 +69,6 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
69
69
|
environment = _this$options.env.environment,
|
|
70
70
|
analytics = _this$options.analytics,
|
|
71
71
|
locale = _this$options.locale;
|
|
72
|
-
var pageUrl = "/auth-element/".concat(AUTHElementAppVersion, "/pages/element_auth/index.html");
|
|
73
72
|
return _generateIframeSrc({
|
|
74
73
|
paymentSession: paymentSession,
|
|
75
74
|
paymentSessionObj: paymentSessionObj,
|
|
@@ -78,7 +77,7 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
78
77
|
locale: locale,
|
|
79
78
|
link: link,
|
|
80
79
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
81
|
-
pageUrl:
|
|
80
|
+
pageUrl: ELEMENT_PAGE_URL.ELEMENT_AUTH,
|
|
82
81
|
instanceId: instanceId
|
|
83
82
|
});
|
|
84
83
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogService } from
|
|
1
|
+
import { LogService } from '../../../../foundation/service/log';
|
|
2
2
|
import BaseElementProcessor from './baseElementProcessor';
|
|
3
3
|
declare class PaymentProcessor extends BaseElementProcessor {
|
|
4
4
|
private ApplePayService;
|
|
@@ -23,6 +23,7 @@ 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 { ELEMENT_PAGE_URL } from "../../../../constant/element";
|
|
26
27
|
import { EVENT } from "../../../../constant";
|
|
27
28
|
import { ServiceProvider } from "../../../../foundation/service";
|
|
28
29
|
import { ApplePaySdk, handleGooglePay, isSkipRenderPaymentMethod } from "../../../../plugin/component/channel";
|
|
@@ -32,8 +33,16 @@ import { parseSessionData } from "../../index";
|
|
|
32
33
|
import { oneAccount, sdkAction } from "../mock";
|
|
33
34
|
import { generateIframeSrc as _generateIframeSrc, isElementPad, isElementPC, safeStringify } from "../util";
|
|
34
35
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
35
|
-
import { AMSPaymentElementAppVersion } from "../../../../config";
|
|
36
36
|
var logger = new Logger(LogConfig, true);
|
|
37
|
+
var isExpressCheckout = function isExpressCheckout(extendInfo) {
|
|
38
|
+
try {
|
|
39
|
+
var _JSON$parse;
|
|
40
|
+
var expressCheckout = JSON.parse((_JSON$parse = JSON.parse(extendInfo)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.expressCheckout);
|
|
41
|
+
return !!expressCheckout;
|
|
42
|
+
} catch (_) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
37
46
|
var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
38
47
|
_inherits(PaymentProcessor, _BaseElementProcessor);
|
|
39
48
|
var _super = _createSuper(PaymentProcessor);
|
|
@@ -119,6 +128,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
119
128
|
});
|
|
120
129
|
});
|
|
121
130
|
});
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
132
|
this.eventCenter.listen(EVENT.getApplePayToken.name, function (data) {
|
|
123
133
|
var _this2$elementContain = _this2.elementContainer.getPaymentContext(),
|
|
124
134
|
paymentSessionId = _this2$elementContain.paymentSessionId,
|
|
@@ -151,12 +161,12 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
151
161
|
key: "initApplePaySdk",
|
|
152
162
|
value: function () {
|
|
153
163
|
var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
154
|
-
var _this$
|
|
155
|
-
var
|
|
164
|
+
var _this$elementContaine6;
|
|
165
|
+
var _ref, paymentSessionObj, paymentSessionId;
|
|
156
166
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
157
167
|
while (1) switch (_context.prev = _context.next) {
|
|
158
168
|
case 0:
|
|
159
|
-
|
|
169
|
+
_ref = ((_this$elementContaine6 = this.elementContainer) === null || _this$elementContaine6 === void 0 ? void 0 : _this$elementContaine6.getPaymentContext()) || {}, paymentSessionObj = _ref.paymentSessionObj, paymentSessionId = _ref.paymentSessionId;
|
|
160
170
|
if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
|
|
161
171
|
_context.next = 13;
|
|
162
172
|
break;
|
|
@@ -209,28 +219,20 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
209
219
|
}
|
|
210
220
|
}, {
|
|
211
221
|
key: "generateIframeSrc",
|
|
212
|
-
value: function generateIframeSrc(
|
|
213
|
-
var link =
|
|
214
|
-
instanceId =
|
|
222
|
+
value: function generateIframeSrc(_ref2) {
|
|
223
|
+
var link = _ref2.link,
|
|
224
|
+
instanceId = _ref2.instanceId;
|
|
215
225
|
this.instanceId = instanceId;
|
|
216
|
-
var
|
|
217
|
-
paymentSession =
|
|
218
|
-
paymentSessionObj =
|
|
219
|
-
sdkMetaData =
|
|
226
|
+
var _ref3 = this.elementContainer.getPaymentContext() || {},
|
|
227
|
+
paymentSession = _ref3.paymentSession,
|
|
228
|
+
paymentSessionObj = _ref3.paymentSessionObj,
|
|
229
|
+
sdkMetaData = _ref3.sdkMetaData;
|
|
220
230
|
var _this$options = this.options,
|
|
221
231
|
environment = _this$options.env.environment,
|
|
222
232
|
analytics = _this$options.analytics,
|
|
223
233
|
locale = _this$options.locale;
|
|
224
|
-
var
|
|
225
|
-
extendInfo =
|
|
226
|
-
var pageUrl = "/elements/".concat(AMSPaymentElementAppVersion, "/pages/element_payment/index.html");
|
|
227
|
-
try {
|
|
228
|
-
var _JSON$parse;
|
|
229
|
-
var expressCheckout = JSON.parse((_JSON$parse = JSON.parse(extendInfo)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.expressCheckout);
|
|
230
|
-
if (expressCheckout) {
|
|
231
|
-
pageUrl = "/elements/".concat(AMSPaymentElementAppVersion, "/pages/express_checkout/index.html");
|
|
232
|
-
}
|
|
233
|
-
} catch (error) {}
|
|
234
|
+
var _ref4 = paymentSessionObj || {},
|
|
235
|
+
extendInfo = _ref4.extendInfo;
|
|
234
236
|
var url = _generateIframeSrc({
|
|
235
237
|
paymentSession: paymentSession,
|
|
236
238
|
paymentSessionObj: paymentSessionObj,
|
|
@@ -239,7 +241,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
239
241
|
locale: locale,
|
|
240
242
|
link: link,
|
|
241
243
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
242
|
-
pageUrl:
|
|
244
|
+
pageUrl: isExpressCheckout(extendInfo) ? ELEMENT_PAGE_URL.EXPRESS_CHECKOUT : ELEMENT_PAGE_URL.ELEMENT_PAYMENT,
|
|
243
245
|
instanceId: instanceId
|
|
244
246
|
});
|
|
245
247
|
this.setElementUrl(url);
|
|
@@ -251,16 +253,16 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
251
253
|
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
252
254
|
var _paymentSessionObj$co,
|
|
253
255
|
_this3 = this;
|
|
254
|
-
var requestService, _this$
|
|
256
|
+
var requestService, _this$elementContaine7, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref5, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
|
|
255
257
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
256
258
|
while (1) switch (_context2.prev = _context2.next) {
|
|
257
259
|
case 0:
|
|
258
260
|
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
|
259
|
-
_this$
|
|
261
|
+
_this$elementContaine7 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine7.paymentSession, paymentSessionObj = _this$elementContaine7.paymentSessionObj, displayInfo = _this$elementContaine7.displayInfo;
|
|
260
262
|
_displayInfo = displayInfo;
|
|
261
263
|
debugProps = _displayInfo.debugProps;
|
|
262
264
|
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
|
263
|
-
|
|
265
|
+
_ref5 = paymentSessionObj || {}, paymentSessionConfig = _ref5.paymentSessionConfig;
|
|
264
266
|
hostSign = paymentSession.split('&&')[1] || '';
|
|
265
267
|
isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
|
|
266
268
|
LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
|
|
@@ -392,9 +394,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
392
394
|
}
|
|
393
395
|
}, {
|
|
394
396
|
key: "update",
|
|
395
|
-
value: function update(
|
|
396
|
-
var data =
|
|
397
|
-
paymentSessionData =
|
|
397
|
+
value: function update(_ref6) {
|
|
398
|
+
var data = _ref6.data,
|
|
399
|
+
paymentSessionData = _ref6.paymentSessionData;
|
|
398
400
|
var _parseSessionData = parseSessionData(paymentSessionData),
|
|
399
401
|
_parseSessionData2 = _slicedToArray(_parseSessionData, 2),
|
|
400
402
|
parseData = _parseSessionData2[0],
|
|
@@ -108,8 +108,6 @@ export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum, envir
|
|
|
108
108
|
export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum, environment?: string) => string;
|
|
109
109
|
/**
|
|
110
110
|
* V2应用EasySafePay 热更新兜底URL构建规则
|
|
111
|
-
* 1. 兜底URL版本与sdk版本保持一致
|
|
112
|
-
* 2. DEV环境下html新增版本前缀
|
|
113
111
|
**/
|
|
114
112
|
export declare const getDefaultEasySafePayPageUrl: (pageName: ESP_PAGE_NAME, env: string) => string;
|
|
115
113
|
/**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
|
|
@@ -5,6 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
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); }
|
|
7
7
|
import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config";
|
|
8
|
+
import { AUTO_DEBIT_PAGE_URL } from "../../constant/auto-debit";
|
|
8
9
|
import { ESP_PAGE_NAME } from "../../constant/easysafepay";
|
|
9
10
|
import { ComponentSignEnum, ProductSceneEnum } from "../../types";
|
|
10
11
|
import { queryParse, serialize } from "../../util";
|
|
@@ -71,11 +72,8 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
|
|
71
72
|
export var getWebAppV2Url = function getWebAppV2Url(params) {
|
|
72
73
|
var productScene = params.productScene,
|
|
73
74
|
isPreload = params.isPreload,
|
|
74
|
-
mid = params.mid,
|
|
75
|
-
extendInfo = params.extendInfo,
|
|
76
75
|
environment = params.environment;
|
|
77
|
-
var
|
|
78
|
-
var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig, environment);
|
|
76
|
+
var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : defaultCheckoutUrl(productScene, environment);
|
|
79
77
|
var info = getWebAppUrlInfo(_objectSpread(_objectSpread({}, params), {}, {
|
|
80
78
|
v2Url: v2Url
|
|
81
79
|
}));
|
|
@@ -117,15 +115,14 @@ var getAppPath = function getAppPath() {
|
|
|
117
115
|
}
|
|
118
116
|
var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
|
|
119
117
|
var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
|
|
120
|
-
var webAppVersion = sdkMetaData.webAppVersion;
|
|
121
118
|
if (productSceneWithPaymentMethodCategoryType === ComponentSignEnum.AUTO_DEBIT_APM) {
|
|
122
|
-
return "".concat(v2AppMarmotMap[environment]
|
|
119
|
+
return "".concat(v2AppMarmotMap[environment]).concat(AUTO_DEBIT_PAGE_URL.TRUSTLY);
|
|
123
120
|
}
|
|
124
121
|
switch (productScene) {
|
|
125
122
|
case ProductSceneEnum.EASY_PAY:
|
|
126
123
|
return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene, environment);
|
|
127
124
|
default:
|
|
128
|
-
return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.
|
|
125
|
+
return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.html");
|
|
129
126
|
}
|
|
130
127
|
};
|
|
131
128
|
export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo) {
|
|
@@ -290,20 +287,18 @@ export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
|
|
|
290
287
|
|
|
291
288
|
/**
|
|
292
289
|
* V2应用EasySafePay 热更新兜底URL构建规则
|
|
293
|
-
* 1. 兜底URL版本与sdk版本保持一致
|
|
294
|
-
* 2. DEV环境下html新增版本前缀
|
|
295
290
|
**/
|
|
296
291
|
export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(pageName, env) {
|
|
297
292
|
// 生成的URL EXAMPLE:
|
|
298
293
|
// const DEFAULT_DOUBLE_FA_URL_MAPPING = {
|
|
299
|
-
// local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/
|
|
300
|
-
// dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/
|
|
301
|
-
// sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/
|
|
302
|
-
// pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/
|
|
303
|
-
// prod: 'https://checkout.antom.com/easysafepay/
|
|
294
|
+
// local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
|
|
295
|
+
// dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
|
|
296
|
+
// sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
|
|
297
|
+
// pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
|
|
298
|
+
// prod: 'https://checkout.antom.com/easysafepay/pages/double-fa/index.html',
|
|
304
299
|
// };
|
|
305
300
|
var environment = env || 'prod';
|
|
306
|
-
|
|
301
|
+
return "".concat(v2AppMarmotMap[environment], "/easysafepay/pages/").concat(pageName, "/index.html");
|
|
307
302
|
};
|
|
308
303
|
|
|
309
304
|
/**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
|
package/esm/index.d.ts
CHANGED
|
@@ -1,54 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* NPM包入口 产品持续接入热更新中
|
|
3
|
+
*
|
|
4
|
+
* 背景:
|
|
5
|
+
* 通过NPM方式集成SDK,各产品需要持续接入热更新, 接入热更新的产品基类仅导出热更新壳
|
|
6
|
+
* 通过UMD方式集成SDK, 各产品基类直接导出
|
|
7
|
+
*
|
|
8
|
+
* 详见: https://yuque.antfin.com/antom-sdk/dg6hge/lbun86wg2h3f7es7
|
|
9
|
+
*
|
|
10
|
+
* **/
|
|
11
|
+
import { AMSCheckout } from './main';
|
|
12
|
+
export { AMSEasyPayWrapper as AMSEasyPay, AMSElementWrapper as AMSElement } from './loader/index';
|
|
13
|
+
export { AddressElement, AMSAutoDebit, AMSAutoDebitPay, AMSCashierPayment, AMSCheckout, AMSCheckoutPage, AMSVaulting, AntomElement, } from './main';
|
|
6
14
|
export * from './types';
|
|
7
|
-
export declare class AMSCheckout extends AMSComponent {
|
|
8
|
-
constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
|
9
|
-
}
|
|
10
|
-
export declare class AMSAutoDebitPay extends AMSCheckout {
|
|
11
|
-
constructor(options: IoptionsParams);
|
|
12
|
-
static preload(options?: IPreloadOptions): void;
|
|
13
|
-
}
|
|
14
|
-
export declare class AMSCashierPayment extends AMSCheckout {
|
|
15
|
-
constructor(options: IoptionsParams);
|
|
16
|
-
static preload(options?: IPreloadOptions): void;
|
|
17
|
-
/**
|
|
18
|
-
* Form validation function
|
|
19
|
-
* If the form is currently displayed:
|
|
20
|
-
* - Successful validation: isValid is true
|
|
21
|
-
* - Failed validation: isValid is false, and error messages are displayed on the form page
|
|
22
|
-
* If not on the form display page, isValid returns false
|
|
23
|
-
* @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
|
|
24
|
-
*/
|
|
25
|
-
validateFields(): Promise<ValidationResult>;
|
|
26
|
-
}
|
|
27
|
-
export declare class AMSVaulting extends AMSCheckout {
|
|
28
|
-
constructor(options: IoptionsParams);
|
|
29
|
-
static preload(options?: IPreloadOptions): void;
|
|
30
|
-
}
|
|
31
|
-
export declare class AntomElement extends AMSCheckout {
|
|
32
|
-
constructor(options: IoptionsParams);
|
|
33
|
-
}
|
|
34
|
-
export declare class AddressElement extends AddressComponent {
|
|
35
|
-
constructor(options: IoptionsAddressParams);
|
|
36
|
-
}
|
|
37
|
-
export declare class AMSElement extends ElementComponent {
|
|
38
|
-
constructor(options: IElementOptions);
|
|
39
|
-
}
|
|
40
|
-
export declare class AMSEasyPay {
|
|
41
|
-
private core;
|
|
42
|
-
constructor(options: IoptionsParams);
|
|
43
|
-
static preload(options?: IPreloadOptions): void;
|
|
44
|
-
createComponent(params: IcreateComponent): void;
|
|
45
|
-
unmount(): void;
|
|
46
|
-
}
|
|
47
|
-
export declare class AMSAutoDebit {
|
|
48
|
-
private core;
|
|
49
|
-
constructor(options: IoptionsParams);
|
|
50
|
-
createComponent(params: IcreateComponent): Promise<void>;
|
|
51
|
-
unmount(): void;
|
|
52
|
-
static preload(options?: IPreloadOptions): void;
|
|
53
|
-
}
|
|
54
15
|
export default AMSCheckout;
|