@alipay/ams-checkout 0.0.1730706734-dev.1 → 0.0.1730706734-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +10 -10
- package/esm/core/component/ckp/index.js +3 -2
- package/esm/core/component/element/components/auth.js +2 -1
- package/esm/core/component/element/index.js +41 -17
- package/esm/core/component/element/mock.d.ts +1 -0
- package/esm/core/component/element/mock.js +331 -996
- package/esm/core/component/element/type.d.ts +1 -0
- package/esm/core/component/element/type.js +1 -0
- package/esm/plugin/component/index.d.ts +1 -0
- package/esm/plugin/component/index.js +42 -10
- package/package.json +1 -1
package/esm/config/index.d.ts
CHANGED
@@ -5,10 +5,10 @@ export declare const sdkVersion: string;
|
|
5
5
|
/**
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
7
|
*/
|
8
|
-
export declare const AMSCheckoutAppVersion = "1.
|
9
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
10
|
-
export declare const AMSEasyPayAppVersion = "1.
|
11
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
12
|
-
export declare const AMSVaultingAppVersion = "1.
|
13
|
-
export declare const AMSPaymentElementAppVersion = "1.
|
14
|
-
export declare const ADDRESSElementAppVersion = "1.
|
8
|
+
export declare const AMSCheckoutAppVersion = "1.24.0";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.24.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.24.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.24.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.24.0";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.24.0";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.24.0";
|
package/esm/config/index.js
CHANGED
@@ -26,19 +26,19 @@ export var elementAppMarmotMap = {
|
|
26
26
|
dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
|
27
27
|
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
|
28
28
|
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
|
29
|
-
sandbox: 'https://
|
30
|
-
light_sandbox: 'https://
|
31
|
-
prod: 'https://
|
29
|
+
sandbox: 'https://checkout.antom.com',
|
30
|
+
light_sandbox: 'https://checkout.antom.com',
|
31
|
+
prod: 'https://checkout.antom.com'
|
32
32
|
};
|
33
33
|
export var sdkVersion = json.version;
|
34
34
|
|
35
35
|
/**
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
37
|
*/
|
38
|
-
export var AMSCheckoutAppVersion = '1.
|
39
|
-
export var AMSAutoDebitAppVersion = '1.
|
40
|
-
export var AMSEasyPayAppVersion = '1.
|
41
|
-
export var AMSCashierPaymentAppVersion = '1.
|
42
|
-
export var AMSVaultingAppVersion = '1.
|
43
|
-
export var AMSPaymentElementAppVersion = '1.
|
44
|
-
export var ADDRESSElementAppVersion = '1.
|
38
|
+
export var AMSCheckoutAppVersion = '1.24.0'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.24.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.24.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.24.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.24.0'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.24.0'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.24.0'; // address element
|
@@ -13,12 +13,13 @@ var CKP_PAYMENT_PAGE_HOST = {
|
|
13
13
|
DEV: 'https://dev.page.alipay.net',
|
14
14
|
TEST: 'https://test.page.alipay.net',
|
15
15
|
PRE: 'https://pre.ac.alipay.com',
|
16
|
-
PROD: 'https://
|
16
|
+
PROD: 'https://checkout.antom.com'
|
17
17
|
};
|
18
18
|
|
19
19
|
// for local development
|
20
20
|
|
21
21
|
var CKP_PAGE_ADDRESS = '/page/antom-web-checkout-v2/checkout-page/pages/payment/index.html';
|
22
|
+
var CKP_PAGE_NEW_ADDRESS = '/checkout-page/pages/payment/index.html';
|
22
23
|
export var getCKPPageAddress = function getCKPPageAddress(env) {
|
23
24
|
switch (env) {
|
24
25
|
case 'dev':
|
@@ -30,7 +31,7 @@ export var getCKPPageAddress = function getCKPPageAddress(env) {
|
|
30
31
|
case 'prod':
|
31
32
|
case 'sandbox':
|
32
33
|
case 'light_sandbox':
|
33
|
-
return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(
|
34
|
+
return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(CKP_PAGE_NEW_ADDRESS);
|
34
35
|
default:
|
35
36
|
// for local development, e.g. http://localhost:5173/checkout-page/src/pages/payment/index.html
|
36
37
|
return env;
|
@@ -23,7 +23,8 @@ export var ElementAuthComponent = /*#__PURE__*/function () {
|
|
23
23
|
try {
|
24
24
|
var selector = options.selector,
|
25
25
|
url = options.url;
|
26
|
-
var
|
26
|
+
var containerId = (selector === null || selector === void 0 ? void 0 : selector.indexOf('#')) === -1 ? selector : selector.slice(1);
|
27
|
+
var containerSelector = "antom-sdk-web-app-".concat(containerId);
|
27
28
|
var container = createInlineBaseElement(selector);
|
28
29
|
var webApp = createIframe(containerSelector);
|
29
30
|
webApp.src = url;
|
@@ -22,7 +22,8 @@ import { parseSessionData } from "../index";
|
|
22
22
|
import { ElementAddressComponent } from "./components/address";
|
23
23
|
import { ElementAuthComponent } from "./components/auth";
|
24
24
|
import { ElementPaymentComponent } from "./components/payment";
|
25
|
-
|
25
|
+
import { EVENT as ConstantEvent } from "../../../constant";
|
26
|
+
// import { oneAccount, sdkAction, submitResult } from './mock';
|
26
27
|
|
27
28
|
import { addressTheme, ELEMENT_ENVIRONMENT, ThemeType } from "./type";
|
28
29
|
var ElementProcessor = /*#__PURE__*/function () {
|
@@ -317,14 +318,14 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
317
318
|
});
|
318
319
|
});
|
319
320
|
// 发送validate消息
|
320
|
-
_defineProperty(this, "onValidateFunc", function (target) {
|
321
|
+
_defineProperty(this, "onValidateFunc", function (target, params) {
|
321
322
|
return new Promise(function (resolve) {
|
322
323
|
_this4.eventService.emitAndListen({
|
323
324
|
event: ElementPaymentEvent.VALIDATE,
|
324
325
|
data: {
|
325
326
|
target: target,
|
326
327
|
source: ElementPaymentMethod.CONTAINER_ELEMENT,
|
327
|
-
params:
|
328
|
+
params: params
|
328
329
|
}
|
329
330
|
}, function (result) {
|
330
331
|
resolve(result);
|
@@ -372,38 +373,46 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
372
373
|
}
|
373
374
|
return _context.abrupt("return", resolve(undefined));
|
374
375
|
case 17:
|
375
|
-
if (!_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT)) {
|
376
|
-
_context.next =
|
376
|
+
if (!(_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT) || !_this4.isConnect)) {
|
377
|
+
_context.next = 32;
|
377
378
|
break;
|
378
379
|
}
|
379
|
-
_context.
|
380
|
-
|
381
|
-
|
380
|
+
_context.prev = 18;
|
381
|
+
_context.next = 21;
|
382
|
+
return _this4.onValidateFunc(ElementPaymentMethod.PAYMENT_ELEMENT, params);
|
383
|
+
case 21:
|
382
384
|
_result2 = _context.sent;
|
383
|
-
console.log('element submit validate payment---------', _result2);
|
385
|
+
console.log('element submit validate payment---------', _result2, _this4.isConnect);
|
384
386
|
params.paymentFactors = (_result2$data = _result2.data) === null || _result2$data === void 0 || (_result2$data = _result2$data.data) === null || _result2$data === void 0 ? void 0 : _result2$data.paymentFactors;
|
385
387
|
params.paymentMethod = (_result2$data2 = _result2.data) === null || _result2$data2 === void 0 || (_result2$data2 = _result2$data2.data) === null || _result2$data2 === void 0 ? void 0 : _result2$data2.paymentMethod;
|
386
388
|
if (_result2 !== null && _result2 !== void 0 && (_result2$data3 = _result2.data) !== null && _result2$data3 !== void 0 && _result2$data3.success) {
|
387
|
-
_context.next =
|
389
|
+
_context.next = 27;
|
388
390
|
break;
|
389
391
|
}
|
390
392
|
return _context.abrupt("return", resolve(undefined));
|
391
|
-
case
|
393
|
+
case 27:
|
394
|
+
_context.next = 32;
|
395
|
+
break;
|
396
|
+
case 29:
|
397
|
+
_context.prev = 29;
|
398
|
+
_context.t0 = _context["catch"](18);
|
399
|
+
return _context.abrupt("return", resolve(undefined));
|
400
|
+
case 32:
|
392
401
|
// params.paymentFactors = paymentResult.data?.data.paymentFactors;
|
393
402
|
// params.paymentMethod = paymentResult.data?.data.paymentMethod;
|
394
403
|
resolve(params);
|
395
|
-
case
|
404
|
+
case 33:
|
396
405
|
case "end":
|
397
406
|
return _context.stop();
|
398
407
|
}
|
399
|
-
}, _callee);
|
408
|
+
}, _callee, null, [[18, 29]]);
|
400
409
|
}));
|
401
410
|
return function (_x) {
|
402
411
|
return _ref.apply(this, arguments);
|
403
412
|
};
|
404
413
|
}());
|
405
414
|
});
|
406
|
-
var env = options.environment || ELEMENT_ENVIRONMENT.
|
415
|
+
var env = options.environment || ELEMENT_ENVIRONMENT.PROD;
|
407
416
|
this._options = _objectSpread(_objectSpread({}, options), {}, {
|
408
417
|
environment: env.toLocaleLowerCase()
|
409
418
|
});
|
@@ -500,13 +509,20 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
500
509
|
key: "createIframeSrc",
|
501
510
|
value: function createIframeSrc() {
|
502
511
|
var env = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ELEMENT_ENVIRONMENT.DEV;
|
503
|
-
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.24.
|
504
|
-
var baseUrl = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ELEMENT_ENVIRONMENT.DEV, 'http://dev.page.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.TEST, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PRE, 'https://
|
512
|
+
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.24.0';
|
513
|
+
var baseUrl = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ELEMENT_ENVIRONMENT.DEV, 'http://dev.page.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.TEST, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.SIT, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PRE, 'https://pre.ac.alipay.com/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PROD, 'https://ac.alipay.com/page/antom-web-checkout-v2');
|
505
514
|
var _env = (env === null || env === void 0 ? void 0 : env.toLocaleUpperCase()) || ELEMENT_ENVIRONMENT.DEV;
|
515
|
+
var payment = "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/element_payment/index.html");
|
516
|
+
try {
|
517
|
+
var expressCheckout = JSON.parse(JSON.parse(this.parseData.extendInfo).expressCheckout);
|
518
|
+
if (expressCheckout) {
|
519
|
+
payment = "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/express_checkout/index.html");
|
520
|
+
}
|
521
|
+
} catch (error) {}
|
506
522
|
return {
|
507
523
|
auth: "".concat(baseUrl[_env], "/auth-element/").concat(version, "/pages/element_auth/index.html"),
|
508
524
|
address: "".concat(baseUrl[_env], "/element-address/").concat(version, "/pages/address/index.html"),
|
509
|
-
payment:
|
525
|
+
payment: payment
|
510
526
|
};
|
511
527
|
}
|
512
528
|
|
@@ -549,6 +565,12 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
549
565
|
(_this6$eventCallback$ = (_this6$eventCallback$2 = _this6.eventCallback[result.source])[result.event]) === null || _this6$eventCallback$ === void 0 || _this6$eventCallback$.call(_this6$eventCallback$2, result.data);
|
550
566
|
}
|
551
567
|
});
|
568
|
+
this.eventService.listen(ConstantEvent.close.name, function () {
|
569
|
+
_this6.unmount();
|
570
|
+
});
|
571
|
+
this.eventService.listen(ConstantEvent.redirect.name, function (data, res) {
|
572
|
+
data.isDestroy && _this6.unmount();
|
573
|
+
});
|
552
574
|
this.eventService.listen(ElementPaymentEvent.LOG, function (result) {
|
553
575
|
console.log('antom sdk 组件日志回调');
|
554
576
|
});
|
@@ -754,6 +776,8 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
754
776
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
755
777
|
while (1) switch (_context2.prev = _context2.next) {
|
756
778
|
case 0:
|
779
|
+
// this.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, submitResult);
|
780
|
+
// return
|
757
781
|
if ((_this$_options$loadin7 = this._options.loading) !== null && _this$_options$loadin7 !== void 0 && _this$_options$loadin7.onStartLoading) {
|
758
782
|
(_this$_options$loadin8 = this._options.loading) === null || _this$_options$loadin8 === void 0 || (_this$_options$loadin9 = _this$_options$loadin8.onStartLoading) === null || _this$_options$loadin9 === void 0 || _this$_options$loadin9.call(_this$_options$loadin8);
|
759
783
|
}
|