@alipay/ams-checkout 0.0.1720509876-dev.2 → 0.0.1723203704-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.
Files changed (42) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/request.js +3 -3
  3. package/esm/constant/index.d.ts +10 -1
  4. package/esm/constant/index.js +9 -0
  5. package/esm/core/component/address.d.ts +34 -0
  6. package/esm/core/component/address.js +298 -0
  7. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  8. package/esm/core/component/appPreloadProcessing.js +89 -0
  9. package/esm/core/component/index.d.ts +1 -1
  10. package/esm/core/component/index.js +39 -14
  11. package/esm/core/instance/address.d.ts +76 -0
  12. package/esm/core/instance/address.js +283 -0
  13. package/esm/index.d.ts +12 -1
  14. package/esm/index.js +57 -19
  15. package/esm/plugin/address/cashierApp.d.ts +34 -0
  16. package/esm/plugin/address/cashierApp.js +218 -0
  17. package/esm/plugin/address/channel.d.ts +20 -0
  18. package/esm/plugin/address/channel.js +52 -0
  19. package/esm/plugin/address/component.inline.style.d.ts +11 -0
  20. package/esm/plugin/address/component.inline.style.js +38 -0
  21. package/esm/plugin/address/component.popup.style.d.ts +16 -0
  22. package/esm/plugin/address/component.popup.style.js +174 -0
  23. package/esm/plugin/address/index.d.ts +108 -0
  24. package/esm/plugin/address/index.js +860 -0
  25. package/esm/plugin/address/popupWindow.style.d.ts +8 -0
  26. package/esm/plugin/address/popupWindow.style.js +65 -0
  27. package/esm/plugin/component/cashierApp.js +9 -5
  28. package/esm/plugin/component/component.inline.style.d.ts +8 -9
  29. package/esm/plugin/component/component.inline.style.js +87 -6
  30. package/esm/plugin/component/index.js +49 -25
  31. package/esm/plugin/component/popupWindow.style.d.ts +5 -2
  32. package/esm/plugin/component/popupWindow.style.js +55 -7
  33. package/esm/plugin/type.d.ts +1 -0
  34. package/esm/types/address.d.ts +92 -0
  35. package/esm/types/address.js +7 -0
  36. package/esm/types/index.d.ts +13 -3
  37. package/esm/types/index.js +5 -0
  38. package/esm/util/index.d.ts +7 -1
  39. package/esm/util/index.js +67 -1
  40. package/esm/util/upgrade.d.ts +4 -4
  41. package/esm/util/upgrade.js +6 -6
  42. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ import { componentSignEnum } from './index';
2
+ /** 表单地址数据 */
3
+ export interface AddressItem {
4
+ shippingName: {
5
+ firstName: string;
6
+ lastName: string;
7
+ };
8
+ /** 手机号 */
9
+ shippingPhoneNo: string;
10
+ /** 地址 */
11
+ shippingAddress: {
12
+ /** 国家 */
13
+ region: string;
14
+ /** 地址1 */
15
+ address1: string;
16
+ /** 地址2 */
17
+ address2: string;
18
+ /** 省份 */
19
+ province?: string;
20
+ /** 城市 */
21
+ city?: string;
22
+ /** 地址级联 四层 【province,city,district,subDistrict】 */
23
+ district?: string[];
24
+ /** 邮政编码 */
25
+ zipCode: string;
26
+ /** 对应地址级联数据对象 */
27
+ districtValues?: {
28
+ /** 城市 */
29
+ city?: string;
30
+ /** 区/县 */
31
+ district?: string;
32
+ /** 省份 */
33
+ province?: string;
34
+ /** 子区域 */
35
+ subDistrict?: string;
36
+ };
37
+ };
38
+ /** 备注 */
39
+ notes?: string;
40
+ open?: boolean;
41
+ /** 是否默认地址 */
42
+ prefer?: '1' | '0';
43
+ shippingId?: string;
44
+ }
45
+ type addressAutoSuggestDisabledType = 0 | 1;
46
+ export interface addressInitOption {
47
+ mode: string;
48
+ appId?: string;
49
+ configParams?: {
50
+ hideFields?: string[];
51
+ addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
52
+ };
53
+ prefillValue?: AddressItem[];
54
+ appearance?: {
55
+ [x: string]: any;
56
+ themeType: string;
57
+ accentColor: string;
58
+ };
59
+ }
60
+ export declare enum renderDisplayTypeEnum {
61
+ 'popup' = "popup",
62
+ 'inline' = "inline"
63
+ }
64
+ export type Iselector = string;
65
+ export interface IappendAddressIframeNodesParams extends addressInitOption {
66
+ renderDisplayType: renderDisplayTypeEnum;
67
+ selector?: Iselector;
68
+ }
69
+ export type IAppendAddressParams = {
70
+ componentSign: componentSignEnum;
71
+ iframeNodesParams: IappendAddressIframeNodesParams;
72
+ };
73
+ export type callOnSizeChanged = (state: {
74
+ width: number;
75
+ height: number;
76
+ }) => void;
77
+ export type onChange = (val: AddressItem[]) => void;
78
+ export type getValue = (val: AddressItem[]) => void;
79
+ export interface IoptionsAddressParams {
80
+ environment?: string;
81
+ locale?: string;
82
+ onSizeChanged?: callOnSizeChanged;
83
+ onGetValue?: getValue;
84
+ onChange?: onChange;
85
+ networkMode?: string;
86
+ mode?: string;
87
+ analytics?: {
88
+ enabled: boolean;
89
+ };
90
+ product?: string;
91
+ }
92
+ export {};
@@ -0,0 +1,7 @@
1
+ /** 表单地址数据 */
2
+
3
+ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum) {
4
+ renderDisplayTypeEnum["popup"] = "popup";
5
+ renderDisplayTypeEnum["inline"] = "inline";
6
+ return renderDisplayTypeEnum;
7
+ }({});
@@ -41,7 +41,8 @@ export interface IcreatePaymentParams {
41
41
  };
42
42
  }
43
43
  export declare enum ComponentSignEnumV2 {
44
- 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
44
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
45
+ 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
45
46
  }
46
47
  export declare enum componentSignEnum {
47
48
  'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
@@ -50,18 +51,22 @@ export declare enum componentSignEnum {
50
51
  'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
51
52
  'CASHIER_PAYMENT_APM' = "CASHIER_PAYMENT_APM",
52
53
  'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
54
+ 'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
53
55
  'NONE' = "NONE",
54
56
  'VAULTING_CARD' = "VAULTING_CARD",
55
- 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
57
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
58
+ 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
56
59
  }
57
60
  export declare enum productSceneEnum {
58
61
  'EASY_PAY' = "EASY_PAY",
59
62
  'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
60
63
  'AUTO_DEBIT' = "AUTO_DEBIT",
64
+ 'AUTO_DEBIT_PAY' = "AUTO_DEBIT_PAY",
61
65
  'VAULTING' = "VAULTING",
62
66
  'FLASH_BUY' = "FLASH_BUY",
63
67
  'CARD_APPLE_PAY' = "CARD_APPLE_PAY",
64
- 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT"
68
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT",
69
+ 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS"
65
70
  }
66
71
  export declare enum paymentMethodCategoryTypeEnum {
67
72
  'CARD' = "CARD",
@@ -142,6 +147,10 @@ export interface InitSecurityConfig {
142
147
  product: productSceneEnum;
143
148
  region?: string;
144
149
  }
150
+ export interface frontModulesToBeLoadedInterface {
151
+ acquirerName: string;
152
+ scriptUrl: string;
153
+ }
145
154
  export interface IpaymentSessionMetaData {
146
155
  clientId?: string;
147
156
  renderDisplayType?: string;
@@ -229,6 +238,7 @@ export interface IpaymentSessionMetaData {
229
238
  */
230
239
  agreementDescription?: string;
231
240
  };
241
+ frontModulesToBeLoaded?: frontModulesToBeLoadedInterface[];
232
242
  };
233
243
  }
234
244
  export interface IPaymentSessionFactor {
@@ -17,6 +17,7 @@ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum)
17
17
  }({});
18
18
  export var ComponentSignEnumV2 = /*#__PURE__*/function (ComponentSignEnumV2) {
19
19
  ComponentSignEnumV2["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
20
+ ComponentSignEnumV2["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
20
21
  return ComponentSignEnumV2;
21
22
  }({});
22
23
  export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
@@ -26,19 +27,23 @@ export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
26
27
  componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
27
28
  componentSignEnum["CASHIER_PAYMENT_APM"] = "CASHIER_PAYMENT_APM";
28
29
  componentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
30
+ componentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
29
31
  componentSignEnum["NONE"] = "NONE";
30
32
  componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
31
33
  componentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
34
+ componentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
32
35
  return componentSignEnum;
33
36
  }({});
34
37
  export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
35
38
  productSceneEnum["EASY_PAY"] = "EASY_PAY";
36
39
  productSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
37
40
  productSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
41
+ productSceneEnum["AUTO_DEBIT_PAY"] = "AUTO_DEBIT_PAY";
38
42
  productSceneEnum["VAULTING"] = "VAULTING";
39
43
  productSceneEnum["FLASH_BUY"] = "FLASH_BUY";
40
44
  productSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY";
41
45
  productSceneEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT";
46
+ productSceneEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS";
42
47
  return productSceneEnum;
43
48
  }({});
44
49
  export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
@@ -39,4 +39,10 @@ declare const getOrSetStorageId: (key: string, value?: string) => string;
39
39
  declare const checkTimeElapsed: () => boolean;
40
40
  declare const isFunction: (func: any) => boolean;
41
41
  declare function parseBase64ToString(base64: string): string;
42
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, };
42
+ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
43
+ src: any;
44
+ attrOptions?: {};
45
+ timeOut?: number;
46
+ loadCallback?: any;
47
+ }, 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 };
package/esm/util/index.js CHANGED
@@ -261,4 +261,70 @@ function parseBase64ToString(base64) {
261
261
  return null;
262
262
  }
263
263
  }
264
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString };
264
+ function loadSDKScript(_ref, logger) {
265
+ var _this2 = this;
266
+ var src = _ref.src,
267
+ _ref$attrOptions = _ref.attrOptions,
268
+ attrOptions = _ref$attrOptions === void 0 ? {} : _ref$attrOptions,
269
+ _ref$timeOut = _ref.timeOut,
270
+ timeOut = _ref$timeOut === void 0 ? 3 : _ref$timeOut,
271
+ _ref$loadCallback = _ref.loadCallback,
272
+ loadCallback = _ref$loadCallback === void 0 ? null : _ref$loadCallback;
273
+ return new Promise(function (resolve, reject) {
274
+ // 创建 script 标签
275
+ logger.logInfo({
276
+ title: 'load_item_sdk_start'
277
+ }, {
278
+ src: src,
279
+ attrOptions: JSON.stringify(attrOptions)
280
+ });
281
+ console.time();
282
+ var script = document.createElement('script');
283
+ var timer = null;
284
+ script.type = 'text/javascript';
285
+
286
+ // 监听加载完成事件
287
+ script.onload = function () {
288
+ // 当脚本加载完毕时,执行回调函数
289
+ logger.logInfo({
290
+ title: 'load_item_sdk_end'
291
+ }, {
292
+ src: src,
293
+ attrOptions: JSON.stringify(attrOptions)
294
+ });
295
+ console.timeEnd();
296
+ clearTimeout(timer);
297
+ if (loadCallback) loadCallback();
298
+ resolve(true);
299
+ };
300
+
301
+ // 监听加载失败事件
302
+ script.onerror = function () {
303
+ logger.logError({
304
+ title: 'load_item_sdk_error'
305
+ }, {
306
+ src: src,
307
+ attrOptions: JSON.stringify(attrOptions)
308
+ });
309
+ clearTimeout(timer);
310
+ console.error('The script ' + src + ' is not accessible.');
311
+ reject(false);
312
+ };
313
+ timer = setTimeout(function () {
314
+ _this2.logger.logError({
315
+ title: 'load_item_sdk_timeout'
316
+ }, {
317
+ src: src,
318
+ attrOptions: JSON.stringify(attrOptions)
319
+ });
320
+ reject(false);
321
+ }, timeOut * 1000);
322
+ script.src = src;
323
+ attrOptions && Object.keys(attrOptions).forEach(function (key) {
324
+ script.setAttribute(key, attrOptions[key]);
325
+ });
326
+ // 将 script 标签添加到页面中
327
+ document.head.appendChild(script);
328
+ });
329
+ }
330
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
@@ -27,13 +27,13 @@ export declare function isGreyscaleMatch(item: UpgradeItem, randomGreyscale: num
27
27
  export declare const getMatchAppVersion: (_extendInfo: string, sdkInfo: UpgradeSdkInfo) => string;
28
28
  /**
29
29
  * 获取保存的加载版本
30
- * @param productScene
30
+ * @param versionKey
31
31
  * @returns
32
32
  */
33
- export declare const getLastAppVersion: (productScene: string) => string;
33
+ export declare const getLastAppVersion: (versionKey: string) => string;
34
34
  /**
35
35
  * 保存指定场景的加载版本供下次使用
36
- * @param productScene
36
+ * @param versionKey
37
37
  * @returns
38
38
  */
39
- export declare const setLastAppVersion: (productScene: string, appVersion: string) => boolean;
39
+ export declare const setLastAppVersion: (versionKey: string, appVersion: string) => boolean;
@@ -89,12 +89,12 @@ export var getMatchAppVersion = function getMatchAppVersion(_extendInfo, sdkInfo
89
89
 
90
90
  /**
91
91
  * 获取保存的加载版本
92
- * @param productScene
92
+ * @param versionKey
93
93
  * @returns
94
94
  */
95
- export var getLastAppVersion = function getLastAppVersion(productScene) {
95
+ export var getLastAppVersion = function getLastAppVersion(versionKey) {
96
96
  try {
97
- var key = "Antom_".concat(productScene, "_LastAppVersion");
97
+ var key = "Antom_".concat(versionKey, "_LastAppVersion");
98
98
  return getStorageString(key, '');
99
99
  } catch (error) {
100
100
  return '';
@@ -102,12 +102,12 @@ export var getLastAppVersion = function getLastAppVersion(productScene) {
102
102
  };
103
103
  /**
104
104
  * 保存指定场景的加载版本供下次使用
105
- * @param productScene
105
+ * @param versionKey
106
106
  * @returns
107
107
  */
108
- export var setLastAppVersion = function setLastAppVersion(productScene, appVersion) {
108
+ export var setLastAppVersion = function setLastAppVersion(versionKey, appVersion) {
109
109
  try {
110
- var key = "Antom_".concat(productScene, "_LastAppVersion");
110
+ var key = "Antom_".concat(versionKey, "_LastAppVersion");
111
111
  return setStorageString(key, appVersion);
112
112
  } catch (error) {
113
113
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1720509876-dev.2",
3
+ "version": "0.0.1723203704-dev.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",