@alipay/ams-checkout 0.0.1737621505-dev.3 → 0.0.1739763028-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/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/core/component/element/index.d.ts +0 -2
- package/esm/core/component/element/index.js +10 -76
- package/esm/plugin/component/channel.d.ts +26 -20
- package/esm/plugin/component/channel.js +428 -392
- package/esm/plugin/component/index.js +13 -31
- package/esm/types/index.d.ts +1 -5
- package/esm/types/index.js +0 -2
- package/esm/util/index.d.ts +1 -2
- package/esm/util/index.js +1 -16
- package/esm/util/versionCompare.d.ts +1 -1
- 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.29.0";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.29.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.29.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.29.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.29.0";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.29.0";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.29.0";
|
package/esm/config/index.js
CHANGED
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
|
|
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.29.0'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.29.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.29.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.29.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.29.0'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.29.0'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.29.0'; // address element
|
@@ -20,7 +20,6 @@ export declare class ElementComponent {
|
|
20
20
|
private iframes;
|
21
21
|
private componentsCount;
|
22
22
|
private eventCallback;
|
23
|
-
private ApplePayService;
|
24
23
|
constructor(options: IElementOptions);
|
25
24
|
private createElement;
|
26
25
|
private createIframeSrc;
|
@@ -34,7 +33,6 @@ export declare class ElementComponent {
|
|
34
33
|
private mountAuth;
|
35
34
|
private mountAddress;
|
36
35
|
private mountPayment;
|
37
|
-
private initApplePaySdk;
|
38
36
|
mountErrorHandle(): void;
|
39
37
|
mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
|
40
38
|
mount(renderOptions: PaymentMountOptions, sdkSelector: string): PaymentMountResult;
|
@@ -25,10 +25,9 @@ import { ElementAddressComponent } from "./components/address";
|
|
25
25
|
import { ElementAuthComponent } from "./components/auth";
|
26
26
|
import { ElementPaymentComponent } from "./components/payment";
|
27
27
|
// import { oneAccount, sdkAction, submitResult } from './mock';
|
28
|
-
import { ApplePaySdk, isSkipRenderPaymentMethod } from "../../../plugin/component/channel";
|
29
28
|
import { v4 as uuid } from 'uuid';
|
30
|
-
import { LogConfig, Logger } from "../../../util/logger";
|
31
29
|
import { addressTheme, ELEMENT_ENVIRONMENT, ThemeType } from "./type";
|
30
|
+
import { LogConfig, Logger } from "../../../util/logger";
|
32
31
|
var logger = new Logger(LogConfig, true);
|
33
32
|
var ElementProcessor = /*#__PURE__*/function () {
|
34
33
|
function ElementProcessor(options) {
|
@@ -150,6 +149,8 @@ var ElementProcessor = /*#__PURE__*/function () {
|
|
150
149
|
return ElementProcessor;
|
151
150
|
}();
|
152
151
|
export var ElementComponent = /*#__PURE__*/function () {
|
152
|
+
// address事件回调
|
153
|
+
|
153
154
|
function ElementComponent(options) {
|
154
155
|
var _this4 = this;
|
155
156
|
_classCallCheck(this, ElementComponent);
|
@@ -190,9 +191,6 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
190
191
|
_defineProperty(this, "componentsCount", void 0);
|
191
192
|
// mount 渲染了多少个element
|
192
193
|
_defineProperty(this, "eventCallback", void 0);
|
193
|
-
// address事件回调
|
194
|
-
// apple pay
|
195
|
-
_defineProperty(this, "ApplePayService", void 0);
|
196
194
|
// 渲染地址组件
|
197
195
|
_defineProperty(this, "mountAddress", function (renderOptions, sdkSelector) {
|
198
196
|
var _renderOptions$appear, _this4$_options;
|
@@ -234,7 +232,6 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
234
232
|
}
|
235
233
|
};
|
236
234
|
_this4.mountOptions[ElementPaymentMethod.PAYMENT_ELEMENT] = _mountParams;
|
237
|
-
_this4.initApplePaySdk();
|
238
235
|
_this4.paymentBase.mount(_this4._options.sessionData, _objectSpread({
|
239
236
|
selector: sdkSelector,
|
240
237
|
elementProps: renderOptions.elementProps
|
@@ -593,23 +590,6 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
593
590
|
this.eventService.listen(ElementPaymentEvent.LOG, function (result) {
|
594
591
|
console.log('antom sdk 组件日志回调');
|
595
592
|
});
|
596
|
-
this.eventService.listen(ElementPaymentEvent.HANDLE_PAYMENT, function (result) {
|
597
|
-
if ((result === null || result === void 0 ? void 0 : result.paymentMethodType) === 'APPLEPAY') {
|
598
|
-
_this6.ApplePayService.begin().then(function (res) {
|
599
|
-
_this6.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, {
|
600
|
-
submitPayData: res
|
601
|
-
});
|
602
|
-
}).catch(function (e) {
|
603
|
-
_this6.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, {
|
604
|
-
submitPayData: {},
|
605
|
-
errorInfo: {
|
606
|
-
hasError: true,
|
607
|
-
errorCode: e === null || e === void 0 ? void 0 : e.errorCode
|
608
|
-
}
|
609
|
-
});
|
610
|
-
});
|
611
|
-
}
|
612
|
-
});
|
613
593
|
}
|
614
594
|
|
615
595
|
// launch消息处理
|
@@ -689,7 +669,6 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
689
669
|
this.eventService.unlisten(ElementPaymentEvent.CAPTURE_ASSET);
|
690
670
|
this.eventService.unlisten(ElementPaymentEvent.LAUNCH);
|
691
671
|
this.eventService.unlisten(ElementPaymentEvent.SIZE_CHANGE);
|
692
|
-
this.eventService.unlisten(ElementPaymentEvent.HANDLE_PAYMENT);
|
693
672
|
}
|
694
673
|
|
695
674
|
// 注册组件事件监听
|
@@ -728,51 +707,6 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
728
707
|
});
|
729
708
|
return {};
|
730
709
|
}
|
731
|
-
}, {
|
732
|
-
key: "initApplePaySdk",
|
733
|
-
value: function () {
|
734
|
-
var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
735
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
736
|
-
while (1) switch (_context2.prev = _context2.next) {
|
737
|
-
case 0:
|
738
|
-
if (!isSkipRenderPaymentMethod(this.parseData)) {
|
739
|
-
_context2.next = 12;
|
740
|
-
break;
|
741
|
-
}
|
742
|
-
this.ApplePayService = new ApplePaySdk({
|
743
|
-
paymentSessionData: this.sessionData,
|
744
|
-
parseData: this.parseData,
|
745
|
-
logger: logger
|
746
|
-
});
|
747
|
-
_context2.prev = 2;
|
748
|
-
logger.logInfo({
|
749
|
-
title: 'a3753.b107385.c398110'
|
750
|
-
});
|
751
|
-
_context2.next = 6;
|
752
|
-
return this.ApplePayService.initApplePaySession();
|
753
|
-
case 6:
|
754
|
-
logger.logInfo({
|
755
|
-
title: 'a3753.b107385.c398112'
|
756
|
-
});
|
757
|
-
_context2.next = 12;
|
758
|
-
break;
|
759
|
-
case 9:
|
760
|
-
_context2.prev = 9;
|
761
|
-
_context2.t0 = _context2["catch"](2);
|
762
|
-
logger.logError({
|
763
|
-
title: 'a3753.b107385.c398111'
|
764
|
-
});
|
765
|
-
case 12:
|
766
|
-
case "end":
|
767
|
-
return _context2.stop();
|
768
|
-
}
|
769
|
-
}, _callee2, this, [[2, 9]]);
|
770
|
-
}));
|
771
|
-
function initApplePaySdk() {
|
772
|
-
return _initApplePaySdk.apply(this, arguments);
|
773
|
-
}
|
774
|
-
return initApplePaySdk;
|
775
|
-
}()
|
776
710
|
}, {
|
777
711
|
key: "mountErrorHandle",
|
778
712
|
value: function mountErrorHandle() {
|
@@ -857,29 +791,29 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
857
791
|
key: "submitPayment",
|
858
792
|
value: // 暴露出去的submit方法
|
859
793
|
function () {
|
860
|
-
var _submitPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
794
|
+
var _submitPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
861
795
|
var _this$_options$loadin7, _this$_options$loadin10;
|
862
796
|
var _this$_options$loadin8, _this$_options$loadin9, _this$_options$loadin11, _this$_options$loadin12;
|
863
|
-
return _regeneratorRuntime().wrap(function
|
864
|
-
while (1) switch (
|
797
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
798
|
+
while (1) switch (_context2.prev = _context2.next) {
|
865
799
|
case 0:
|
866
800
|
// this.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, submitResult);
|
867
801
|
// return
|
868
802
|
if ((_this$_options$loadin7 = this._options.loading) !== null && _this$_options$loadin7 !== void 0 && _this$_options$loadin7.onStartLoading) {
|
869
803
|
(_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);
|
870
804
|
}
|
871
|
-
|
805
|
+
_context2.next = 3;
|
872
806
|
return this.validatePromiseFuncs();
|
873
807
|
case 3:
|
874
808
|
if ((_this$_options$loadin10 = this._options.loading) !== null && _this$_options$loadin10 !== void 0 && _this$_options$loadin10.onEndLoading) {
|
875
809
|
(_this$_options$loadin11 = this._options.loading) === null || _this$_options$loadin11 === void 0 || (_this$_options$loadin12 = _this$_options$loadin11.onEndLoading) === null || _this$_options$loadin12 === void 0 || _this$_options$loadin12.call(_this$_options$loadin11);
|
876
810
|
}
|
877
|
-
return
|
811
|
+
return _context2.abrupt("return");
|
878
812
|
case 5:
|
879
813
|
case "end":
|
880
|
-
return
|
814
|
+
return _context2.stop();
|
881
815
|
}
|
882
|
-
},
|
816
|
+
}, _callee2, this);
|
883
817
|
}));
|
884
818
|
function submitPayment() {
|
885
819
|
return _submitPayment.apply(this, arguments);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type EventPayload, type IPaymentSessionMetaData } from '../../types';
|
1
|
+
import { EventPayloadContext, type EventPayload, type IPaymentMethod, type IPaymentSessionMetaData } from '../../types';
|
2
2
|
import { Logger } from '../../util/logger';
|
3
3
|
export type IChannelBehavior = {
|
4
4
|
usePaymentSessionAsQueryResult: boolean;
|
@@ -19,37 +19,43 @@ type GetDoubleFaParams = {
|
|
19
19
|
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
|
20
20
|
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
21
21
|
export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
|
22
|
-
export declare class
|
22
|
+
export declare class ApplePayService {
|
23
23
|
private APPLESDKURL;
|
24
|
-
private
|
24
|
+
private applePaySession;
|
25
25
|
private paymentSessionData;
|
26
|
-
private
|
26
|
+
private sessionResult;
|
27
27
|
/**
|
28
28
|
* @description 支付状态,pending:支付中,normal:正常
|
29
29
|
*/
|
30
30
|
private paymentStatus;
|
31
|
+
/**
|
32
|
+
* @description paymentRequest
|
33
|
+
*/
|
34
|
+
private paymentRequest;
|
31
35
|
private logger;
|
32
|
-
|
33
|
-
|
34
|
-
|
36
|
+
private dispatchToApp;
|
37
|
+
private paymentMethod;
|
38
|
+
constructor({ sessionData, paymentSessionMetaData, paymentMethod, logger, dispatchToApp, }: {
|
39
|
+
sessionData: string;
|
40
|
+
paymentSessionMetaData: IPaymentSessionMetaData;
|
41
|
+
paymentMethod: IPaymentMethod;
|
35
42
|
logger: Logger;
|
43
|
+
dispatchToApp: (payload: {
|
44
|
+
context: EventPayloadContext;
|
45
|
+
}) => void;
|
36
46
|
});
|
37
|
-
startPay
|
38
|
-
|
47
|
+
private startPay;
|
48
|
+
private setApplePayStatus;
|
39
49
|
private submitPay;
|
40
|
-
|
41
|
-
|
42
|
-
private
|
43
|
-
private get initSessionParams();
|
44
|
-
private get isRequiredParameters();
|
50
|
+
submit(): Promise<void>;
|
51
|
+
private getDeviceId;
|
52
|
+
private initApplePaySession;
|
45
53
|
private isCanMakePayments;
|
46
54
|
private loadApplePaySdk;
|
47
|
-
private
|
48
|
-
/**
|
49
|
-
* @description 非标方案,sdk目前无法直接监听国内不支持弹窗的关闭操作
|
50
|
-
*/
|
55
|
+
private abortPaySession;
|
51
56
|
private addEventListener;
|
52
|
-
private
|
57
|
+
private get initSessionParams();
|
58
|
+
private get isRequiredParameters();
|
59
|
+
private get checkScriptIsLoaded();
|
53
60
|
}
|
54
|
-
export declare const isSkipRenderPaymentMethod: (parseData: IPaymentSessionMetaData) => boolean;
|
55
61
|
export {};
|