@alipay/ams-checkout 1.20.0 → 1.21.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.
Files changed (36) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +11 -0
  3. package/esm/config/index.js +20 -1
  4. package/esm/constant/index.d.ts +14 -1
  5. package/esm/constant/index.js +13 -0
  6. package/esm/core/component/address.d.ts +8 -0
  7. package/esm/core/component/address.js +72 -0
  8. package/esm/core/component/index.d.ts +5 -2
  9. package/esm/core/component/index.js +70 -56
  10. package/esm/core/instance/index.d.ts +2 -0
  11. package/esm/core/instance/index.js +65 -2
  12. package/esm/index.d.ts +9 -9
  13. package/esm/index.js +44 -8
  14. package/esm/plugin/applepay/component.js +1 -1
  15. package/esm/plugin/component/cashierApp.d.ts +3 -3
  16. package/esm/plugin/component/cashierApp.js +33 -3
  17. package/esm/plugin/component/channel.js +1 -0
  18. package/esm/plugin/component/component.inline.style.d.ts +8 -9
  19. package/esm/plugin/component/component.inline.style.js +87 -6
  20. package/esm/plugin/component/component.popup.style.d.ts +1 -0
  21. package/esm/plugin/component/component.popup.style.js +3 -0
  22. package/esm/plugin/component/index.d.ts +3 -1
  23. package/esm/plugin/component/index.js +143 -88
  24. package/esm/plugin/component/popupWindow.style.d.ts +5 -2
  25. package/esm/plugin/component/popupWindow.style.js +70 -14
  26. package/esm/plugin/payment-element/utils.d.ts +2 -0
  27. package/esm/plugin/payment-element/utils.js +6 -0
  28. package/esm/plugin/paypal/index.js +1 -0
  29. package/esm/plugin/type.d.ts +1 -0
  30. package/esm/types/index.d.ts +100 -4
  31. package/esm/types/index.js +14 -0
  32. package/esm/util/index.d.ts +2 -1
  33. package/esm/util/index.js +5 -0
  34. package/esm/util/security.d.ts +1 -0
  35. package/esm/util/security.js +1 -1
  36. package/package.json +1 -1
@@ -1,41 +1,92 @@
1
- import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant";
1
+ import { AMSPOPUP_PREFIX, ANIMATION_TIME, MOCKUP_ID, POPUPLOADING_ID } from "../../constant";
2
+ import { getDesignFontSize } from "../../util";
2
3
 
3
4
  // CSS样式字符串
4
- var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n");
5
-
5
+ var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n .").concat(AMSPOPUP_PREFIX, "modal-mobile{\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n bottom: 0;\n left: 0%;\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "-drawer-enter {\n animation: slideIn ").concat(ANIMATION_TIME, "ms forwards;\n }\n \n @keyframes slideIn {\n from {\n transform: translateY(100%); /* \u6ED1\u5165\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 0 */\n }\n to {\n transform: translateY(0); /* \u6ED1\u5165\u7ED3\u675F\u65F6\u5728\u539F\u4F4D\u7F6E */\n opacity: 1; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 1 */\n }\n }\n\n /* \u62BD\u5C49\u4ECE\u5E95\u90E8\u6ED1\u51FA */\n .").concat(AMSPOPUP_PREFIX, "-drawer-exit {\n animation: slideOut ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideOut {\n from {\n transform: translateY(0); /* \u6ED1\u51FA\u65F6\u4ECE\u5F53\u524D\u4F4D\u7F6E\u5F00\u59CB */\n opacity: 1; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 1 */\n }\n to {\n transform: translateY(100%); /* \u6ED1\u51FA\u7ED3\u675F\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 0 */\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n\n.ams-component-popup-loading {\n width: 0.8em;\n height:0.8em;\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-popup-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-popup-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-popup-loading .line div:before,\n.ams-component-popup-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: black;\n border-radius: 5.3px;\n}\n.ams-component-popup-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-popup-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-popup-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-popup-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n");
6
+ var getCurrentTheme = function getCurrentTheme() {
7
+ var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
8
+ var theme = {
9
+ night: 'dark',
10
+ gamingPurple: 'dark',
11
+ agateGreen: 'dark',
12
+ default: 'light',
13
+ nostalgicGray: 'light',
14
+ cherryBlossomPink: 'light'
15
+ };
16
+ return theme[curTheme];
17
+ };
18
+ export var createCustomSheet = function createCustomSheet() {
19
+ var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
20
+ var sheet = "\n .ams-component-popup-loading .line div:before,\n .ams-component-popup-loading .line div:after {\n background: ".concat(curTheme === 'light' ? '#000000' : '#ffffff', " !important;\n }");
21
+ var style = document.createElement('style');
22
+ style.innerHTML = sheet;
23
+ document.head.appendChild(style);
24
+ };
25
+ export var renderPopupLoading = function renderPopupLoading(container, curTheme) {
26
+ createCustomSheet(curTheme);
27
+ var loading = document.createElement('div');
28
+ loading === null || loading === void 0 || loading.classList.add(POPUPLOADING_ID);
29
+ loading.id = POPUPLOADING_ID;
30
+ loading.innerHTML = '<div class="line"><div></div><div></div><div></div><div></div></div>';
31
+ loading.style.fontSize = "".concat(getDesignFontSize(), "px");
32
+ container.appendChild(loading);
33
+ };
34
+ export var removePopupLoading = function removePopupLoading() {
35
+ var _document$getElementB;
36
+ var isShowMockup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
37
+ var mockup = document.getElementById(MOCKUP_ID);
38
+ if (mockup) {
39
+ mockup.style.background = 'rgb(0, 0, 0, 0.6)';
40
+ mockup.style.display = isShowMockup ? 'block' : 'none';
41
+ }
42
+ (_document$getElementB = document.getElementById(POPUPLOADING_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove();
43
+ };
6
44
  // 创建和插入样式表
7
45
  export var insertStyleSheet = function insertStyleSheet() {
8
46
  var style = document.createElement('style');
9
47
  style.innerHTML = modalStyles;
10
48
  document.head.appendChild(style);
11
49
  };
12
-
50
+ var modalDevice = 'desktop';
13
51
  // 插入弹窗
52
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
53
  export var createModal = function createModal(_ref) {
15
54
  var device = _ref.device,
16
55
  url = _ref.url,
17
56
  widthPadding = _ref.widthPadding,
18
- heightPadding = _ref.heightPadding;
57
+ loadingConfig = _ref.loadingConfig;
19
58
  return new Promise(function (resolve, reject) {
20
59
  try {
60
+ modalDevice = device;
21
61
  var overlay = document.createElement('div');
22
62
  overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
23
63
  var modal = document.createElement('div');
24
- modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
25
64
  if (device === 'desktop') {
26
- modal.style.width = '600px';
27
- modal.style.height = '464px';
65
+ modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
66
+ modal.style.width = '656px';
67
+ modal.style.height = '620px';
28
68
  modal.style.borderRadius = '12px';
29
69
  } else {
30
- modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
31
- modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
32
- modal.style.borderRadius = '8px';
70
+ modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal-mobile"), "".concat(AMSPOPUP_PREFIX, "-drawer-enter"));
71
+ modal.style.width = '100%';
72
+ modal.style.height = '80vh';
73
+ modal.style.borderRadius = '12px 12px 0 0';
33
74
  }
34
75
  var iframe = document.createElement('iframe');
35
76
  iframe.src = url; // 替换为实际的 URL 地址
36
77
  iframe.style.border = 'none';
37
78
  iframe.style.width = '100%';
38
79
  iframe.style.height = '100%';
80
+ if (loadingConfig && Object.keys(loadingConfig).length) {
81
+ var _loadingConfig$theme = loadingConfig.theme,
82
+ theme = _loadingConfig$theme === void 0 ? 'default' : _loadingConfig$theme,
83
+ _loadingConfig$backgr = loadingConfig.backgroundPrimary,
84
+ backgroundPrimary = _loadingConfig$backgr === void 0 ? '#ffffff' : _loadingConfig$backgr;
85
+ var mode = getCurrentTheme(theme);
86
+ renderPopupLoading(modal, mode);
87
+ modal.style.backgroundColor = backgroundPrimary;
88
+ iframe.style.backgroundColor = backgroundPrimary;
89
+ }
39
90
  modal.appendChild(iframe);
40
91
  var body = document.getElementsByTagName('body')[0];
41
92
  body.appendChild(overlay);
@@ -53,11 +104,16 @@ export var createModal = function createModal(_ref) {
53
104
  // 销毁弹窗
54
105
  export var destroyModal = function destroyModal() {
55
106
  var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
56
- var modal = document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal"));
107
+ var modal = modalDevice === 'desktop' ? document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal")) : document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal-mobile"));
57
108
  overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
58
109
  overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
59
- modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
60
- modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
110
+ if (modalDevice === 'desktop') {
111
+ modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
112
+ modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
113
+ } else {
114
+ modal.classList.remove("".concat(AMSPOPUP_PREFIX, "-drawer-enter"));
115
+ modal.classList.add("".concat(AMSPOPUP_PREFIX, "-drawer-exit"));
116
+ }
61
117
  setTimeout(function () {
62
118
  overlay.parentNode.removeChild(overlay);
63
119
  modal.parentNode.removeChild(modal);
@@ -0,0 +1,2 @@
1
+ import type { IpaymentSessionConfig } from '../../types';
2
+ export declare const handlePaymentSessionConfig: (config: IpaymentSessionConfig) => Pick<IpaymentSessionConfig, 'productScene' | 'productSceneVersion'>;
@@ -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
  }
@@ -8,6 +8,7 @@ export interface ComponentActionNamesType {
8
8
  mountComponent?: string;
9
9
  submit?: string;
10
10
  destroyComponent?: string;
11
+ getValue?: string;
11
12
  }
12
13
  export type IExtendPluginItem = {
13
14
  /**
@@ -5,6 +5,17 @@
5
5
  * 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
6
6
  * 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.
7
7
  */
8
+ export type onChange = () => onCnageResult;
9
+ interface onCnageResult {
10
+ complete: boolean;
11
+ addressValue: AddressItem[];
12
+ selectIndex: number | string;
13
+ }
14
+ export type getValue = (hasValidate: boolean) => Promise<AddressValueResult>;
15
+ interface AddressValueResult {
16
+ complete: boolean;
17
+ value: AddressItem;
18
+ }
8
19
  /**
9
20
  * SDK options
10
21
  */
@@ -17,12 +28,14 @@ export interface IoptionsParams {
17
28
  onLog?: callOnLog;
18
29
  onEventCallback?: callOnEventCallback;
19
30
  onClose?: callOnClose;
31
+ onChange?: onChange;
20
32
  networkMode?: string;
21
33
  mode?: string;
22
34
  analytics?: {
23
35
  enabled: boolean;
24
36
  };
25
37
  product?: string;
38
+ onBeforeSubmit?: callOnBeforeSubmit;
26
39
  }
27
40
  export interface IApplePayOptionsParams extends Pick<IoptionsParams, 'locale' | 'environment' | 'onEventCallback' | 'analytics'> {
28
41
  }
@@ -40,6 +53,10 @@ export interface IcreatePaymentParams {
40
53
  backgroundColor?: string;
41
54
  };
42
55
  }
56
+ export declare enum ComponentSignEnumV2 {
57
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
58
+ 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
59
+ }
43
60
  export declare enum componentSignEnum {
44
61
  'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
45
62
  'EASY_PAY_APM' = "EASY_PAY_APM",
@@ -50,6 +67,8 @@ export declare enum componentSignEnum {
50
67
  'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
51
68
  'NONE' = "NONE",
52
69
  'VAULTING_CARD' = "VAULTING_CARD",
70
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
71
+ 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL",
53
72
  'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT"
54
73
  }
55
74
  export declare enum productSceneEnum {
@@ -60,13 +79,16 @@ export declare enum productSceneEnum {
60
79
  'VAULTING' = "VAULTING",
61
80
  'FLASH_BUY' = "FLASH_BUY",
62
81
  'CARD_APPLE_PAY' = "CARD_APPLE_PAY",
82
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT",
83
+ 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS",
63
84
  'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT"
64
85
  }
65
86
  export declare enum paymentMethodCategoryTypeEnum {
66
87
  'CARD' = "CARD",
67
88
  'WALLET' = "WALLET",
68
89
  'BANK' = "BANK",
69
- 'APM' = "APM"
90
+ 'APM' = "APM",
91
+ 'ALL' = "ALL"
70
92
  }
71
93
  export interface DeviceIdParameter {
72
94
  scene?: string;
@@ -79,7 +101,11 @@ export interface IcreateComponent {
79
101
  sessionData: string;
80
102
  paymentSessionData?: string;
81
103
  notRedirectAfterComplete?: boolean;
82
- appearance?: Record<string, any>;
104
+ appearance?: {
105
+ [x: string]: any;
106
+ themeType?: string;
107
+ accentColor?: string;
108
+ };
83
109
  merchantAppointParam?: IMerchantAppointParam;
84
110
  }
85
111
  export interface IappendIframeNodesParams extends IcreateComponent {
@@ -87,7 +113,59 @@ export interface IappendIframeNodesParams extends IcreateComponent {
87
113
  renderDisplayType: renderDisplayTypeEnum;
88
114
  selector?: Iselector;
89
115
  paypalConfiguration?: IPaypalConfiguration;
90
- }
116
+ /** 将address-element参数定义合入原参数定义 */
117
+ configParams?: {
118
+ hideFields?: string[];
119
+ addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
120
+ };
121
+ prefillValue?: AddressItem[];
122
+ componentSession?: string;
123
+ loca?: string;
124
+ }
125
+ /** 表单地址数据 */
126
+ export interface AddressItem {
127
+ shippingName: {
128
+ firstName: string;
129
+ lastName: string;
130
+ };
131
+ /** 手机号 */
132
+ shippingPhoneNo: string;
133
+ /** 地址 */
134
+ shippingAddress: {
135
+ /** 国家 */
136
+ region: string;
137
+ /** 地址1 */
138
+ address1: string;
139
+ /** 地址2 */
140
+ address2: string;
141
+ /** 省份 */
142
+ province?: string;
143
+ /** 城市 */
144
+ city?: string;
145
+ /** 地址级联 四层 【province,city,district,subDistrict】 */
146
+ district?: string[];
147
+ /** 邮政编码 */
148
+ zipCode: string;
149
+ /** 对应地址级联数据对象 */
150
+ districtValues?: {
151
+ /** 城市 */
152
+ city?: string;
153
+ /** 区/县 */
154
+ district?: string;
155
+ /** 省份 */
156
+ province?: string;
157
+ /** 子区域 */
158
+ subDistrict?: string;
159
+ };
160
+ };
161
+ /** 备注 */
162
+ notes?: string;
163
+ open?: boolean;
164
+ /** 是否默认地址 */
165
+ prefer?: '1' | '0';
166
+ shippingId?: string;
167
+ }
168
+ type addressAutoSuggestDisabledType = 0 | 1;
91
169
  export interface IPaypalConfiguration {
92
170
  style?: object;
93
171
  blockPayPalCreditButton?: boolean;
@@ -119,7 +197,7 @@ export interface Isubmit {
119
197
  }
120
198
  export interface IpaymentSessionConfig {
121
199
  productScene: productSceneEnum;
122
- paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
200
+ paymentMethodCategoryType?: paymentMethodCategoryTypeEnum;
123
201
  productSceneVersion: string;
124
202
  }
125
203
  export interface IpaymentSecurityConfig {
@@ -172,6 +250,7 @@ export interface IpaymentSessionMetaData {
172
250
  authUrl?: string;
173
251
  };
174
252
  paymentSessionFactor?: {
253
+ externalRiskTimeout?: number;
175
254
  extendInfo?: {
176
255
  merchantCapabilities?: string[];
177
256
  supportedNetworks?: string[];
@@ -344,6 +423,12 @@ export type callOnSizeChanged = (state: {
344
423
  width: number;
345
424
  height: number;
346
425
  }) => void;
426
+ export type onBeforeSubmitResult = {
427
+ result: 'CANCEL' | 'CONTINUE' | 'ERROR' | 'IGNORE' | 'TIMEOUT';
428
+ processType: string;
429
+ submitRequestData: Record<string, any>;
430
+ };
431
+ export type callOnBeforeSubmit = (state?: Record<string, any>) => Promise<onBeforeSubmitResult> | onBeforeSubmitResult;
347
432
  /**
348
433
  * @description Create an event handler, In pop-up layer mode, the user clicks the semi floating layer close button and is called.
349
434
  */
@@ -564,3 +649,14 @@ export type IAppendParams = {
564
649
  componentSign: componentSignEnum;
565
650
  iframeNodesParams: IappendIframeNodesParams;
566
651
  };
652
+ export interface IoptionsAddressParams {
653
+ environment?: string;
654
+ locale?: string;
655
+ onSizeChanged?: callOnSizeChanged;
656
+ onChange?: onChange;
657
+ analytics?: {
658
+ enabled: boolean;
659
+ };
660
+ product?: string;
661
+ }
662
+ export {};
@@ -6,6 +6,7 @@
6
6
  * 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.
7
7
  */
8
8
  /* eslint-disable @typescript-eslint/no-explicit-any */
9
+
9
10
  /**
10
11
  * SDK options
11
12
  */
@@ -15,6 +16,11 @@ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum)
15
16
  renderDisplayTypeEnum["inline"] = "inline";
16
17
  return renderDisplayTypeEnum;
17
18
  }({});
19
+ export var ComponentSignEnumV2 = /*#__PURE__*/function (ComponentSignEnumV2) {
20
+ ComponentSignEnumV2["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
21
+ ComponentSignEnumV2["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
22
+ return ComponentSignEnumV2;
23
+ }({});
18
24
  export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
19
25
  componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
20
26
  componentSignEnum["EASY_PAY_APM"] = "EASY_PAY_APM";
@@ -25,6 +31,8 @@ export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
25
31
  componentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
26
32
  componentSignEnum["NONE"] = "NONE";
27
33
  componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
34
+ componentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
35
+ componentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
28
36
  componentSignEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
29
37
  return componentSignEnum;
30
38
  }({});
@@ -36,6 +44,8 @@ export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
36
44
  productSceneEnum["VAULTING"] = "VAULTING";
37
45
  productSceneEnum["FLASH_BUY"] = "FLASH_BUY";
38
46
  productSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY";
47
+ productSceneEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT";
48
+ productSceneEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS";
39
49
  productSceneEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
40
50
  return productSceneEnum;
41
51
  }({});
@@ -44,8 +54,12 @@ export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodC
44
54
  paymentMethodCategoryTypeEnum["WALLET"] = "WALLET";
45
55
  paymentMethodCategoryTypeEnum["BANK"] = "BANK";
46
56
  paymentMethodCategoryTypeEnum["APM"] = "APM";
57
+ paymentMethodCategoryTypeEnum["ALL"] = "ALL";
47
58
  return paymentMethodCategoryTypeEnum;
48
59
  }({});
60
+
61
+ /** 表单地址数据 */
62
+
49
63
  export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
50
64
  payPalConfigurationIntentEnum["intent"] = "intent";
51
65
  payPalConfigurationIntentEnum["capture"] = "capture";
@@ -13,6 +13,7 @@ declare class EventCenter {
13
13
  off(name: string, func: any, key?: string): void;
14
14
  emit(name: string, ...rest: any): void;
15
15
  once(name: string, func: any, key?: string): void;
16
+ isExist(name: string): boolean;
16
17
  }
17
18
  declare const getViewPort: (key: string) => any;
18
19
  declare const getOrigin: () => string;
@@ -45,4 +46,4 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
45
46
  timeOut?: number;
46
47
  loadCallback?: any;
47
48
  }, logger: any): Promise<unknown>;
48
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
49
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
package/esm/util/index.js CHANGED
@@ -83,6 +83,11 @@ var EventCenter = /*#__PURE__*/function () {
83
83
  };
84
84
  this.on(name, onceF, key);
85
85
  }
86
+ }, {
87
+ key: "isExist",
88
+ value: function isExist(name) {
89
+ return this.events.has(name);
90
+ }
86
91
  }]);
87
92
  return EventCenter;
88
93
  }();
@@ -18,6 +18,7 @@ export declare const sceneMap: {
18
18
  EASYPAY: string;
19
19
  EASY_PAY: string;
20
20
  FLASH_BUY: string;
21
+ ELEMENT_PAYMENT: string;
21
22
  };
22
23
  export declare const getSecurityHost: (region: string) => string;
23
24
  export declare const getSecurityScene: (product: string) => string;
@@ -24,7 +24,7 @@ export var securityHost = {
24
24
  US: 'https://open-na-global.alipay.com/api/open/risk_client',
25
25
  DE: 'https://open-de-global.alipay.com/api/open/risk_client'
26
26
  };
27
- export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount');
27
+ export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount'), productSceneEnum.ELEMENT_PAYMENT, 'Acquirer');
28
28
  export var getSecurityHost = function getSecurityHost(region) {
29
29
  return securityHost[region] || securityHost[SecurityRegionEnum.SG];
30
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",