@alipay/ams-checkout 0.0.1759909830-dev.1 → 0.0.1760520369-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/popupWindow.style.d.ts +19 -9
- package/esm/component/popupWindow.style.js +26 -13
- package/esm/config/index.d.ts +8 -7
- package/esm/config/index.js +8 -7
- package/esm/constant/index.d.ts +58 -0
- package/esm/constant/index.js +64 -1
- package/esm/core/component/element/EventCenter/index.d.ts +31 -0
- package/esm/core/component/element/EventCenter/index.js +178 -0
- package/esm/core/component/element/elementContainerService/containerService.d.ts +1 -0
- package/esm/core/component/element/elementContainerService/containerService.js +8 -2
- package/esm/core/component/element/elementController/index.d.ts +24 -3
- package/esm/core/component/element/elementController/index.js +533 -189
- package/esm/core/component/element/elementProcessor/addressProcessor.js +5 -6
- package/esm/core/component/element/elementProcessor/authProcessor.js +2 -3
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +2 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +55 -19
- package/esm/core/component/element/index.d.ts +6 -5
- package/esm/core/component/element/index.js +14 -3
- package/esm/core/component/element/mock.js +1 -0
- package/esm/core/component/element/type.d.ts +56 -4
- package/esm/core/component/element/type.js +61 -2
- package/esm/core/component/element/util.d.ts +21 -5
- package/esm/core/component/element/util.js +59 -7
- package/esm/foundation/core/index.js +27 -8
- package/esm/foundation/index.d.ts +1 -0
- package/esm/foundation/product-processor/easysafepay/index.js +4 -2
- package/esm/foundation/product-processor/element/index.js +1 -0
- package/esm/foundation/service/container/popup.d.ts +11 -0
- package/esm/foundation/service/container/popup.js +23 -2
- package/esm/foundation/service/log/keys.js +4 -0
- package/esm/foundation/service/requester/requester.js +2 -3
- package/esm/foundation/utils/payment_context_utils.js +1 -0
- package/esm/index.js +2 -1
- package/esm/plugin/component/cashierApp.d.ts +2 -0
- package/esm/plugin/component/cashierApp.js +2 -2
- package/esm/plugin/component/channel.js +20 -4
- package/esm/plugin/component/component.popup.style.d.ts +1 -0
- package/esm/plugin/component/component.popup.style.js +1 -1
- package/esm/plugin/component/index.d.ts +1 -0
- package/esm/plugin/component/index.js +9 -5
- package/esm/types/index.d.ts +22 -2
- package/esm/types/index.js +2 -1
- package/esm/util/index.js +4 -1
- package/esm/util/spm-map.d.ts +24 -2
- package/esm/util/spm-map.js +14 -1
- package/package.json +1 -1
- package/esm/core/component/oldElement/components/address.d.ts +0 -19
- package/esm/core/component/oldElement/components/address.js +0 -68
- package/esm/core/component/oldElement/components/auth.d.ts +0 -17
- package/esm/core/component/oldElement/components/auth.js +0 -60
- package/esm/core/component/oldElement/components/payment.d.ts +0 -19
- package/esm/core/component/oldElement/components/payment.js +0 -74
- package/esm/core/component/oldElement/index.d.ts +0 -59
- package/esm/core/component/oldElement/index.js +0 -956
- package/esm/core/component/oldElement/mock.d.ts +0 -6
- package/esm/core/component/oldElement/mock.js +0 -567
- package/esm/core/component/oldElement/type.d.ts +0 -354
- package/esm/core/component/oldElement/type.js +0 -81
- package/esm/core/component/oldElement/utils.d.ts +0 -13
- package/esm/core/component/oldElement/utils.js +0 -6
package/esm/types/index.d.ts
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
*/
|
8
8
|
import { IApplePayContactField } from '../plugin/applepay/interface';
|
9
9
|
export type onChange = () => onCnageResult;
|
10
|
-
export { ElementType, PaymentElementLayout, ThemeType
|
10
|
+
export { type IElementOptions, ElementType, PaymentElementLayout, ThemeType } from '../core/component/element/type';
|
11
11
|
interface onCnageResult {
|
12
12
|
complete: boolean;
|
13
13
|
addressValue: AddressItem[];
|
@@ -123,6 +123,7 @@ export interface IcreateComponent {
|
|
123
123
|
};
|
124
124
|
isAppWebview?: boolean;
|
125
125
|
merchantAppointParam?: IMerchantAppointParam;
|
126
|
+
isNativeAppWebview?: boolean;
|
126
127
|
}
|
127
128
|
export interface IappendIframeNodesParams extends IcreateComponent {
|
128
129
|
paymentSessionMetaData: IPaymentSessionMetaData;
|
@@ -425,6 +426,11 @@ export type EventCallbackResult = {
|
|
425
426
|
resultStatus: string;
|
426
427
|
resultMessage: string;
|
427
428
|
};
|
429
|
+
redirectUrls?: {
|
430
|
+
applinkUrl?: string;
|
431
|
+
schemeUrl?: string;
|
432
|
+
normalUrl?: string;
|
433
|
+
};
|
428
434
|
paymentResultCode?: string;
|
429
435
|
paymentResultMessage?: string;
|
430
436
|
paymentStatus?: string;
|
@@ -594,6 +600,11 @@ export interface CashierSdkActionQueryResult {
|
|
594
600
|
channelOrderId?: string;
|
595
601
|
};
|
596
602
|
errorActions?: Record<string, string>;
|
603
|
+
orderAmountView?: IAmountView;
|
604
|
+
paymentAmountView?: IAmountView;
|
605
|
+
paymentMethods?: IPaymentMethod[];
|
606
|
+
savedPaymentMethods?: IPaymentMethod[];
|
607
|
+
traceId?: string;
|
597
608
|
}
|
598
609
|
export interface CashierSdkActionQuerySessionResult extends IPaymentSessionMetaData {
|
599
610
|
success: boolean;
|
@@ -674,7 +685,11 @@ export declare enum eventCodeEnum {
|
|
674
685
|
SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING",
|
675
686
|
SDK_PAYMENT_WARN = "SDK_PAYMENT_WARN",
|
676
687
|
SDK_PAYMENT_SHIPPINGCHANGE = "SDK_PAYMENT_SHIPPINGCHANGE",
|
677
|
-
SDK_PAYMENT_APPROVE = "SDK_PAYMENT_APPROVE"
|
688
|
+
SDK_PAYMENT_APPROVE = "SDK_PAYMENT_APPROVE",
|
689
|
+
/**
|
690
|
+
* ESP createComponent时传参isNativeAppWebview:true,ESP外跳授权时透传此SDK给商户
|
691
|
+
*/
|
692
|
+
SDK_REDIRECT = "SDK_REDIRECT"
|
678
693
|
}
|
679
694
|
export declare enum RedirectType {
|
680
695
|
ApplinkUrl = "ApplinkUrl",
|
@@ -832,3 +847,8 @@ export declare enum EventLoggingEventId {
|
|
832
847
|
LeaveAnyWay = "LeaveAnyWay",
|
833
848
|
ContinuePaying = "ContinuePaying"
|
834
849
|
}
|
850
|
+
export interface ErrorMessage {
|
851
|
+
code: string;
|
852
|
+
message: string;
|
853
|
+
[key: string]: ErrorMessage | string;
|
854
|
+
}
|
package/esm/types/index.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
10
10
|
|
11
|
-
export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/
|
11
|
+
export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/element/type";
|
12
12
|
|
13
13
|
/**
|
14
14
|
* SDK options
|
@@ -194,6 +194,7 @@ export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
|
|
194
194
|
eventCodeEnum["SDK_PAYMENT_WARN"] = "SDK_PAYMENT_WARN";
|
195
195
|
eventCodeEnum["SDK_PAYMENT_SHIPPINGCHANGE"] = "SDK_PAYMENT_SHIPPINGCHANGE";
|
196
196
|
eventCodeEnum["SDK_PAYMENT_APPROVE"] = "SDK_PAYMENT_APPROVE";
|
197
|
+
eventCodeEnum["SDK_REDIRECT"] = "SDK_REDIRECT";
|
197
198
|
return eventCodeEnum;
|
198
199
|
}({});
|
199
200
|
export var RedirectType = /*#__PURE__*/function (RedirectType) {
|
package/esm/util/index.js
CHANGED
@@ -90,7 +90,7 @@ var EventCenter = /*#__PURE__*/function () {
|
|
90
90
|
}
|
91
91
|
}]);
|
92
92
|
return EventCenter;
|
93
|
-
}();
|
93
|
+
}(); // TODO 直接访问 meta.viewPort 可能不正确,标准的meta viewport应该通过name属性查找
|
94
94
|
var getViewPort = function getViewPort(key) {
|
95
95
|
var meta = document.getElementsByTagName('meta');
|
96
96
|
// HTMLMetaElement
|
@@ -150,6 +150,7 @@ var isWindowsNT = /Windows NT/.test(UA);
|
|
150
150
|
var isMobile = function isMobile() {
|
151
151
|
return /Android|iPhone|iPad|iPod|Mobile/.test(UA) || isOpenHarmonyMobile();
|
152
152
|
};
|
153
|
+
// TODO 未导出
|
153
154
|
var isOpenHarmony = function isOpenHarmony() {
|
154
155
|
// 检查是否为鸿蒙操作系统
|
155
156
|
return /OpenHarmony/i.test(navigator.userAgent);
|
@@ -164,6 +165,7 @@ var isOpenHarmonyMobile = function isOpenHarmonyMobile() {
|
|
164
165
|
// 返回是否为鸿蒙手机或平板
|
165
166
|
return isHarmonyOS && (isPhone || isTablet);
|
166
167
|
};
|
168
|
+
// TODO 未导出
|
167
169
|
var isOpenHarmonyPC = function isOpenHarmonyPC() {
|
168
170
|
// 检查是否为鸿蒙操作系统
|
169
171
|
return /OpenHarmony/i.test(navigator.userAgent) && /PC/i.test(navigator.userAgent);
|
@@ -332,6 +334,7 @@ function loadSDKScript(_ref, logger) {
|
|
332
334
|
reject(false);
|
333
335
|
};
|
334
336
|
timer = setTimeout(function () {
|
337
|
+
// TODO 直接使用 logger 参数,而不是 this.logger
|
335
338
|
_this2.logger.logError({
|
336
339
|
title: 'load_item_sdk_timeout'
|
337
340
|
}, {
|
package/esm/util/spm-map.d.ts
CHANGED
@@ -7,6 +7,18 @@ export declare const ELEMENT_SPM_MAP: {
|
|
7
7
|
auto_apple_pay_start: string;
|
8
8
|
auto_apple_pay_failed: string;
|
9
9
|
auto_apple_pay_success: string;
|
10
|
+
sdk_element_handleHeartBeat: string;
|
11
|
+
sdk_element_handleInterAction: string;
|
12
|
+
sdk_element_callback_error: string;
|
13
|
+
sdk_element_missKeyData: string;
|
14
|
+
sdk_event_mount: string;
|
15
|
+
sdk_event_mount_end: string;
|
16
|
+
sdk_event_submitPay: string;
|
17
|
+
sdk_event_payment_end: string;
|
18
|
+
sdk_event_validateFields: string;
|
19
|
+
sdk_event_validateFields_end: string;
|
20
|
+
sdk_event_apiOnDestroy: string;
|
21
|
+
sdk_event_apiOnDestroy_end: string;
|
10
22
|
};
|
11
23
|
export declare const SPM_MAP: {
|
12
24
|
sdk_event_mount_element: string;
|
@@ -17,6 +29,18 @@ export declare const SPM_MAP: {
|
|
17
29
|
auto_apple_pay_start: string;
|
18
30
|
auto_apple_pay_failed: string;
|
19
31
|
auto_apple_pay_success: string;
|
32
|
+
sdk_element_handleHeartBeat: string;
|
33
|
+
sdk_element_handleInterAction: string;
|
34
|
+
sdk_element_callback_error: string;
|
35
|
+
sdk_element_missKeyData: string;
|
36
|
+
sdk_event_mount: string;
|
37
|
+
sdk_event_mount_end: string;
|
38
|
+
sdk_event_submitPay: string;
|
39
|
+
sdk_event_payment_end: string;
|
40
|
+
sdk_event_validateFields: string;
|
41
|
+
sdk_event_validateFields_end: string;
|
42
|
+
sdk_event_apiOnDestroy: string;
|
43
|
+
sdk_event_apiOnDestroy_end: string;
|
20
44
|
sdk_error_runtime_error: string;
|
21
45
|
sdk_event_sdkQuery_failed: string;
|
22
46
|
container_error_error_insert_js: string;
|
@@ -63,7 +87,6 @@ export declare const SPM_MAP: {
|
|
63
87
|
container_event_webViewOnPageFinished: string;
|
64
88
|
container_event_page_load_success: string;
|
65
89
|
sdk_event_pre_init: string;
|
66
|
-
sdk_event_submitPay: string;
|
67
90
|
sdk_event_submitPayEnd: string;
|
68
91
|
container_stop_event_loop: string;
|
69
92
|
iap_net_start: string;
|
@@ -87,7 +110,6 @@ export declare const SPM_MAP: {
|
|
87
110
|
sdk_event_api_onDestroy: string;
|
88
111
|
container_load_failed: string;
|
89
112
|
sdk_event_kycAppPreLoadStart: string;
|
90
|
-
sdk_event_apiOnDestroy: string;
|
91
113
|
sdk_event_getRemoteConfigResult: string;
|
92
114
|
iap_net_result: string;
|
93
115
|
sdk_event_popupWindowCloseButtonClick: string;
|
package/esm/util/spm-map.js
CHANGED
@@ -14,7 +14,20 @@ export var ELEMENT_SPM_MAP = {
|
|
14
14
|
multiple_instance_error: 'a3753.b101271.c403950',
|
15
15
|
auto_apple_pay_start: 'a3753.b107385.c398110',
|
16
16
|
auto_apple_pay_failed: 'a3753.b107385.c398111',
|
17
|
-
auto_apple_pay_success: 'a3753.b107385.c398112'
|
17
|
+
auto_apple_pay_success: 'a3753.b107385.c398112',
|
18
|
+
sdk_element_handleHeartBeat: 'a3753.b101271.c388217.d624449',
|
19
|
+
sdk_element_handleInterAction: 'a3753.b101271.c388217.d630402',
|
20
|
+
sdk_element_callback_error: 'a3753.b101271.c388217.d630403',
|
21
|
+
sdk_element_missKeyData: 'a3753.b101271.c388217.d630404',
|
22
|
+
// 后续移除SPM,SDK埋点没有享受到SPM收益
|
23
|
+
sdk_event_mount: 'a3753.b101271.c388217.d640404',
|
24
|
+
sdk_event_mount_end: 'a3753.b101271.c388217.d640405',
|
25
|
+
sdk_event_submitPay: 'a3753.b101271.c388193.d512422',
|
26
|
+
sdk_event_payment_end: 'a3753.b101271.c388217.d640409',
|
27
|
+
sdk_event_validateFields: 'a3753.b101271.c388217.d640406',
|
28
|
+
sdk_event_validateFields_end: 'a3753.b101271.c388217.d640407',
|
29
|
+
sdk_event_apiOnDestroy: 'a3753.b101271.c388193.d512442',
|
30
|
+
sdk_event_apiOnDestroy_end: 'a3753.b101271.c388217.d640408'
|
18
31
|
};
|
19
32
|
export var SPM_MAP = _objectSpread({
|
20
33
|
sdk_error_runtime_error: 'a3753.b101271.c388188.d512342',
|
package/package.json
CHANGED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { AddressMountComponentsParams } from '../type';
|
2
|
-
interface ElementAddressMountOptions extends Omit<AddressMountComponentsParams, 'type'> {
|
3
|
-
selector: string;
|
4
|
-
}
|
5
|
-
export declare class ElementAddressComponent {
|
6
|
-
private sdk;
|
7
|
-
private elementContainer;
|
8
|
-
private isConnect;
|
9
|
-
constructor();
|
10
|
-
create(options: {
|
11
|
-
environment: string;
|
12
|
-
locale: string;
|
13
|
-
appVersion: string;
|
14
|
-
}, isConnect: boolean): void;
|
15
|
-
mount(options: ElementAddressMountOptions): Promise<HTMLIFrameElement | undefined>;
|
16
|
-
update(): void;
|
17
|
-
unmount(): void;
|
18
|
-
}
|
19
|
-
export {};
|
@@ -1,68 +0,0 @@
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
-
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; }
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
|
-
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); }
|
8
|
-
import { AddressComponent } from "../../address";
|
9
|
-
export var ElementAddressComponent = /*#__PURE__*/function () {
|
10
|
-
function ElementAddressComponent() {
|
11
|
-
_classCallCheck(this, ElementAddressComponent);
|
12
|
-
_defineProperty(this, "sdk", void 0);
|
13
|
-
_defineProperty(this, "elementContainer", void 0);
|
14
|
-
_defineProperty(this, "isConnect", void 0);
|
15
|
-
}
|
16
|
-
_createClass(ElementAddressComponent, [{
|
17
|
-
key: "create",
|
18
|
-
value: function create(options, isConnect) {
|
19
|
-
this.isConnect = isConnect;
|
20
|
-
this.sdk = new AddressComponent(options);
|
21
|
-
}
|
22
|
-
}, {
|
23
|
-
key: "mount",
|
24
|
-
value: function mount(options) {
|
25
|
-
var _this = this;
|
26
|
-
var elementContainer = document.querySelector(options.selector);
|
27
|
-
if (this.isConnect) {
|
28
|
-
elementContainer.style.display = 'none';
|
29
|
-
}
|
30
|
-
return new Promise(function (resolve) {
|
31
|
-
_this.sdk.mountComponent({
|
32
|
-
sessionData: options.sessionData,
|
33
|
-
elementProps: options.elementProps,
|
34
|
-
configParams: options.configParams,
|
35
|
-
appearance: options.appearance,
|
36
|
-
prefillValue: options.prefillValue,
|
37
|
-
appendAliasContainerId: true
|
38
|
-
}, options.selector).then(function () {
|
39
|
-
var _elementContainer$get;
|
40
|
-
_this.elementContainer = elementContainer;
|
41
|
-
var iframes = elementContainer === null || elementContainer === void 0 || (_elementContainer$get = elementContainer.getElementsByTagName) === null || _elementContainer$get === void 0 ? void 0 : _elementContainer$get.call(elementContainer, 'iframe');
|
42
|
-
resolve(iframes === null || iframes === void 0 ? void 0 : iframes[0]);
|
43
|
-
}, function () {
|
44
|
-
resolve(undefined);
|
45
|
-
});
|
46
|
-
});
|
47
|
-
}
|
48
|
-
}, {
|
49
|
-
key: "update",
|
50
|
-
value: function update() {
|
51
|
-
if (this.elementContainer && this.isConnect) {
|
52
|
-
this.elementContainer.style.display = '';
|
53
|
-
}
|
54
|
-
// 下发数据
|
55
|
-
}
|
56
|
-
}, {
|
57
|
-
key: "unmount",
|
58
|
-
value: function unmount() {
|
59
|
-
var _this$elementContaine, _this$elementContaine2;
|
60
|
-
var containers = (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 || (_this$elementContaine2 = _this$elementContaine.getElementsByTagName) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.call(_this$elementContaine, 'div');
|
61
|
-
if (containers !== null && containers !== void 0 && containers[0]) {
|
62
|
-
var _containers$, _containers$$remove;
|
63
|
-
(_containers$ = containers[0]) === null || _containers$ === void 0 || (_containers$$remove = _containers$.remove) === null || _containers$$remove === void 0 || _containers$$remove.call(_containers$);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}]);
|
67
|
-
return ElementAddressComponent;
|
68
|
-
}();
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { LinkAuthMountOptions } from '../type';
|
2
|
-
interface ElementAuthMountOptions extends Omit<LinkAuthMountOptions, 'type' | 'elementProps'> {
|
3
|
-
selector: string;
|
4
|
-
url: string;
|
5
|
-
}
|
6
|
-
export declare class ElementAuthComponent {
|
7
|
-
private elementContainer;
|
8
|
-
constructor();
|
9
|
-
create(options: {
|
10
|
-
environment: string;
|
11
|
-
locale: string;
|
12
|
-
}): void;
|
13
|
-
mount(options: ElementAuthMountOptions): Promise<HTMLIFrameElement | undefined>;
|
14
|
-
update(height?: number): void;
|
15
|
-
unmount(): void;
|
16
|
-
}
|
17
|
-
export {};
|
@@ -1,60 +0,0 @@
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
-
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; }
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
|
-
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); }
|
8
|
-
import { createIframe } from "../../../../foundation/service/container/utils";
|
9
|
-
import { createInlineBaseElement } from "../../../../plugin/component/component.inline.style";
|
10
|
-
export var ElementAuthComponent = /*#__PURE__*/function () {
|
11
|
-
function ElementAuthComponent() {
|
12
|
-
_classCallCheck(this, ElementAuthComponent);
|
13
|
-
_defineProperty(this, "elementContainer", void 0);
|
14
|
-
}
|
15
|
-
_createClass(ElementAuthComponent, [{
|
16
|
-
key: "create",
|
17
|
-
value: function create(options) {}
|
18
|
-
}, {
|
19
|
-
key: "mount",
|
20
|
-
value: function mount(options) {
|
21
|
-
var _this = this;
|
22
|
-
return new Promise(function (resolve) {
|
23
|
-
try {
|
24
|
-
var selector = options.selector,
|
25
|
-
url = options.url;
|
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);
|
28
|
-
var container = createInlineBaseElement(selector);
|
29
|
-
var webApp = createIframe(containerSelector);
|
30
|
-
webApp.src = url;
|
31
|
-
container.appendChild(webApp);
|
32
|
-
_this.elementContainer = container;
|
33
|
-
resolve(webApp);
|
34
|
-
} catch (error) {
|
35
|
-
resolve(undefined);
|
36
|
-
}
|
37
|
-
});
|
38
|
-
}
|
39
|
-
}, {
|
40
|
-
key: "update",
|
41
|
-
value: function update() {
|
42
|
-
var _this$elementContaine, _this$elementContaine2;
|
43
|
-
var height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
44
|
-
var iframes = (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 || (_this$elementContaine2 = _this$elementContaine.getElementsByTagName) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.call(_this$elementContaine, 'iframe');
|
45
|
-
if (iframes !== null && iframes !== void 0 && iframes[0]) {
|
46
|
-
var iframe = iframes[0];
|
47
|
-
iframe.style.opacity = '1';
|
48
|
-
iframe.style.overflow = 'visible';
|
49
|
-
iframe.style.height = "".concat(height, "px");
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}, {
|
53
|
-
key: "unmount",
|
54
|
-
value: function unmount() {
|
55
|
-
var _this$elementContaine3, _this$elementContaine4;
|
56
|
-
(_this$elementContaine3 = this.elementContainer) === null || _this$elementContaine3 === void 0 || (_this$elementContaine4 = _this$elementContaine3.remove) === null || _this$elementContaine4 === void 0 || _this$elementContaine4.call(_this$elementContaine3);
|
57
|
-
}
|
58
|
-
}]);
|
59
|
-
return ElementAuthComponent;
|
60
|
-
}();
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { PaymentMountOptions } from '../type';
|
2
|
-
interface ElementPaymentMountOptions extends Omit<PaymentMountOptions, 'type'> {
|
3
|
-
selector: string;
|
4
|
-
}
|
5
|
-
export declare class ElementPaymentComponent {
|
6
|
-
private sdk;
|
7
|
-
private elementContainer;
|
8
|
-
private isConnect;
|
9
|
-
constructor();
|
10
|
-
create(options: {
|
11
|
-
environment: string;
|
12
|
-
locale: string;
|
13
|
-
appVersion: string;
|
14
|
-
}, isConnect: boolean): void;
|
15
|
-
mount(options: ElementPaymentMountOptions): Promise<HTMLIFrameElement | undefined>;
|
16
|
-
update(): void;
|
17
|
-
unmount(): void;
|
18
|
-
}
|
19
|
-
export {};
|
@@ -1,74 +0,0 @@
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
5
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
7
|
-
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; }
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
9
|
-
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); }
|
10
|
-
import AMSPaymentElement from "../../../../index";
|
11
|
-
export var ElementPaymentComponent = /*#__PURE__*/function () {
|
12
|
-
function ElementPaymentComponent() {
|
13
|
-
_classCallCheck(this, ElementPaymentComponent);
|
14
|
-
_defineProperty(this, "sdk", void 0);
|
15
|
-
_defineProperty(this, "elementContainer", void 0);
|
16
|
-
_defineProperty(this, "isConnect", void 0);
|
17
|
-
}
|
18
|
-
_createClass(ElementPaymentComponent, [{
|
19
|
-
key: "create",
|
20
|
-
value: function create(options, isConnect) {
|
21
|
-
this.isConnect = isConnect;
|
22
|
-
this.sdk = new AMSPaymentElement(_objectSpread(_objectSpread({}, options), {}, {
|
23
|
-
analytics: {
|
24
|
-
enabled: true
|
25
|
-
},
|
26
|
-
onEventCallback: function onEventCallback(state) {}
|
27
|
-
}));
|
28
|
-
}
|
29
|
-
}, {
|
30
|
-
key: "mount",
|
31
|
-
value: function mount(options) {
|
32
|
-
var _this = this;
|
33
|
-
var elementContainer = document.querySelector(options.selector);
|
34
|
-
if (this.isConnect) {
|
35
|
-
elementContainer.style.display = 'none';
|
36
|
-
}
|
37
|
-
return new Promise(function (resolve) {
|
38
|
-
_this.sdk.mountComponent({
|
39
|
-
sessionData: options.sessionData,
|
40
|
-
appearance: options.appearance,
|
41
|
-
elementProps: options.elementProps,
|
42
|
-
notRedirectAfterComplete: true,
|
43
|
-
appendAliasContainerId: true
|
44
|
-
}, options.selector).then(function () {
|
45
|
-
var _elementContainer$get;
|
46
|
-
_this.elementContainer = elementContainer;
|
47
|
-
var iframes = elementContainer === null || elementContainer === void 0 || (_elementContainer$get = elementContainer.getElementsByTagName) === null || _elementContainer$get === void 0 ? void 0 : _elementContainer$get.call(elementContainer, 'iframe');
|
48
|
-
resolve(iframes === null || iframes === void 0 ? void 0 : iframes[0]);
|
49
|
-
}, function () {
|
50
|
-
resolve(undefined);
|
51
|
-
});
|
52
|
-
});
|
53
|
-
}
|
54
|
-
}, {
|
55
|
-
key: "update",
|
56
|
-
value: function update() {
|
57
|
-
if (this.elementContainer && this.isConnect) {
|
58
|
-
this.elementContainer.style.display = 'initial';
|
59
|
-
}
|
60
|
-
// 下发数据
|
61
|
-
}
|
62
|
-
}, {
|
63
|
-
key: "unmount",
|
64
|
-
value: function unmount() {
|
65
|
-
var _this$elementContaine, _this$elementContaine2;
|
66
|
-
var containers = (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 || (_this$elementContaine2 = _this$elementContaine.getElementsByTagName) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.call(_this$elementContaine, 'div');
|
67
|
-
if (containers !== null && containers !== void 0 && containers[0]) {
|
68
|
-
var _containers$, _containers$$remove;
|
69
|
-
(_containers$ = containers[0]) === null || _containers$ === void 0 || (_containers$$remove = _containers$.remove) === null || _containers$$remove === void 0 || _containers$$remove.call(_containers$);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}]);
|
73
|
-
return ElementPaymentComponent;
|
74
|
-
}();
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { IPaymentSessionMetaData } from '../../../types';
|
2
|
-
import type { AddressMountOptions, AddressMountResult, IElementOptions, LinkAuthMountOptions, LinkAuthMountResult, PaymentMountOptions, PaymentMountResult } from './type';
|
3
|
-
export interface IElementProcessorOptions {
|
4
|
-
paymentSessionConfig: IPaymentSessionMetaData['paymentSessionConfig'];
|
5
|
-
sessionData: string;
|
6
|
-
environment: string;
|
7
|
-
locale: string;
|
8
|
-
isConnect: boolean;
|
9
|
-
}
|
10
|
-
export declare class ElementComponent {
|
11
|
-
private parseData;
|
12
|
-
private loading;
|
13
|
-
private sessionData;
|
14
|
-
private elementContainer;
|
15
|
-
private authBase;
|
16
|
-
private addressBase;
|
17
|
-
private paymentBase;
|
18
|
-
private _options;
|
19
|
-
private eventService;
|
20
|
-
private sdkActionRes;
|
21
|
-
private oneAccountRes;
|
22
|
-
private launchSource;
|
23
|
-
private initCompleted;
|
24
|
-
private isConnect;
|
25
|
-
private iframeSrc;
|
26
|
-
private mountOptions;
|
27
|
-
private iframes;
|
28
|
-
private loadingElement;
|
29
|
-
private componentsCount;
|
30
|
-
private eventCallback;
|
31
|
-
private ApplePayService;
|
32
|
-
constructor(options: IElementOptions);
|
33
|
-
private createElement;
|
34
|
-
private beforeMount;
|
35
|
-
private createComponentSdk;
|
36
|
-
private createIframeSrc;
|
37
|
-
private closeLoading;
|
38
|
-
private addListener;
|
39
|
-
private launchFunc;
|
40
|
-
private showIframe;
|
41
|
-
private afterInit;
|
42
|
-
private sendRenderData;
|
43
|
-
private removeListener;
|
44
|
-
private registerEventListener;
|
45
|
-
private mountAuth;
|
46
|
-
private mountAddress;
|
47
|
-
private mountPayment;
|
48
|
-
private initApplePaySdk;
|
49
|
-
mountErrorHandle(): void;
|
50
|
-
mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
|
51
|
-
mount(renderOptions: PaymentMountOptions, sdkSelector: string): PaymentMountResult;
|
52
|
-
mount(renderOptions: LinkAuthMountOptions, sdkSelector: string): LinkAuthMountResult;
|
53
|
-
private resetState;
|
54
|
-
unmount(): void;
|
55
|
-
private onAfterSubmitFunc;
|
56
|
-
private onValidateFunc;
|
57
|
-
private validatePromiseFuncs;
|
58
|
-
submitPayment(): Promise<void>;
|
59
|
-
}
|