@alipay/ams-checkout 0.0.1751254427-dev.0 → 0.0.1751254427-dev.2

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 (40) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/component.inline.style.js +1 -1
  3. package/esm/component/component.popup.style.d.ts +1 -0
  4. package/esm/component/component.popup.style.js +1 -1
  5. package/esm/component/popupWindow.style.d.ts +4 -1
  6. package/esm/component/popupWindow.style.js +33 -1
  7. package/esm/config/index.d.ts +8 -7
  8. package/esm/config/index.js +8 -7
  9. package/esm/constant/index.d.ts +21 -0
  10. package/esm/constant/index.js +23 -0
  11. package/esm/core/component/element/elementController/index.js +22 -14
  12. package/esm/core/component/element/type.d.ts +29 -15
  13. package/esm/core/component/element/type.js +20 -12
  14. package/esm/core/component/index.d.ts +5 -2
  15. package/esm/core/component/index.js +105 -2
  16. package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
  17. package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
  18. package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
  19. package/esm/foundation/product-processor/autoDebit/index.js +466 -0
  20. package/esm/foundation/service/container/index.d.ts +2 -0
  21. package/esm/foundation/service/container/index.js +48 -24
  22. package/esm/foundation/service/container/popup.d.ts +9 -6
  23. package/esm/foundation/service/container/popup.js +3 -1
  24. package/esm/foundation/service/requester/requester.js +2 -2
  25. package/esm/foundation/utils/web_app_url_utils.d.ts +3 -3
  26. package/esm/foundation/utils/web_app_url_utils.js +15 -11
  27. package/esm/index.d.ts +18 -6
  28. package/esm/index.js +116 -53
  29. package/esm/plugin/component/cashierApp.js +2 -2
  30. package/esm/plugin/component/index.d.ts +2 -0
  31. package/esm/plugin/component/index.js +44 -8
  32. package/esm/plugin/paypal/index.js +5 -2
  33. package/esm/request/index.js +2 -2
  34. package/esm/types/index.d.ts +17 -6
  35. package/esm/types/index.js +2 -1
  36. package/esm/util/index.d.ts +12 -1
  37. package/esm/util/index.js +39 -3
  38. package/esm/util/spm-map.d.ts +18 -4
  39. package/esm/util/spm-map.js +20 -6
  40. package/package.json +2 -2
@@ -82,7 +82,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
82
82
  }
83
83
  return Promise.resolve(paypalPluginProps);
84
84
  });
85
- // 加载paypal资源
85
+ // 加载paypal资源 TODO
86
86
  _defineProperty(_assertThisInitialized(_this), "loadPaypalResource", function (paypalPluginProps) {
87
87
  return new Promise(function (resolve, reject) {
88
88
  var _paypalPluginProps$ap;
@@ -265,6 +265,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
265
265
  return _ref6.apply(this, arguments);
266
266
  };
267
267
  }());
268
+ // TODO
268
269
  _defineProperty(_assertThisInitialized(_this), "destroyComponent", /*#__PURE__*/function () {
269
270
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(context, message) {
270
271
  var data;
@@ -373,7 +374,9 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
373
374
  }
374
375
  }, {
375
376
  key: "onMessage",
376
- value: function onMessage(context, message) {
377
+ value:
378
+ // TODO
379
+ function onMessage(context, message) {
377
380
  switch (message.getAction()) {
378
381
  case PaypalActionEnum.mountComponent:
379
382
  this.renderPaypalButton(context, message);
@@ -20,7 +20,7 @@ import { sdkVersion } from "../config/index";
20
20
  import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
21
21
  import { errorEnum } from "../types";
22
22
  import { get } from "../util/get";
23
- import { device, isPC, queryParse, safeJson } from "../util";
23
+ import { device, queryParse, safeJson } from "../util";
24
24
  import { fomatGetwayError } from "./utils";
25
25
  var _queryParse = queryParse(),
26
26
  _sandbox = _queryParse._sandbox;
@@ -70,7 +70,7 @@ function _request() {
70
70
  while (1) switch (_context.prev = _context.next) {
71
71
  case 0:
72
72
  envInfo = _objectSpread(_objectSpread({
73
- terminalType: isPC() ? 'WEB' : 'WAP',
73
+ terminalType: device.isMobile ? 'WAP' : 'WEB',
74
74
  browserInfo: {
75
75
  browserJavaScriptEnabled: true,
76
76
  browserLanguage: navigator.language,
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { IApplePayContactField } from '../plugin/applepay/interface';
9
9
  export type onChange = () => onCnageResult;
10
- export { type IElementOptions, ElementType, ThemeType, PaymentElementLayout } from '../core/component/oldElement/type';
10
+ export { ElementType, PaymentElementLayout, ThemeType, type IElementOptions } from '../core/component/oldElement/type';
11
11
  interface onCnageResult {
12
12
  complete: boolean;
13
13
  addressValue: AddressItem[];
@@ -40,6 +40,9 @@ export interface IoptionsParams {
40
40
  mode?: string;
41
41
  securityRegion?: 'US' | 'SG' | 'DE';
42
42
  }
43
+ export interface ValidationResult {
44
+ isValid: boolean;
45
+ }
43
46
  export interface IPreloadOptions {
44
47
  environment?: string;
45
48
  securityRegion?: 'US' | 'SG' | 'DE';
@@ -76,7 +79,8 @@ export declare enum ComponentSignEnum {
76
79
  'VAULTING_CARD' = "VAULTING_CARD",
77
80
  'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT",
78
81
  'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
79
- 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
82
+ 'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL",
83
+ 'AUTO_DEBIT_APM' = "AUTO_DEBIT_APM"
80
84
  }
81
85
  export declare enum ProductSceneEnum {
82
86
  'EASY_PAY' = "EASY_PAY",
@@ -235,6 +239,9 @@ export interface frontModulesToBeLoadedInterface {
235
239
  acquirerName: string;
236
240
  scriptUrl: string;
237
241
  }
242
+ type ActionDeviceInfo = {
243
+ signType?: string;
244
+ };
238
245
  export interface PaymentSessionActionData {
239
246
  amountConfirmRequired?: boolean;
240
247
  autoDebitWithToken: boolean;
@@ -250,6 +257,9 @@ export interface PaymentSessionActionData {
250
257
  version: string;
251
258
  platform: string;
252
259
  };
260
+ web: ActionDeviceInfo;
261
+ wap: ActionDeviceInfo;
262
+ app: ActionDeviceInfo;
253
263
  }
254
264
  export interface IPaymentSessionMetaData {
255
265
  clientId?: string;
@@ -583,6 +593,7 @@ export interface CashierSdkActionQueryResult {
583
593
  extendInfo?: {
584
594
  channelOrderId?: string;
585
595
  };
596
+ errorActions?: Record<string, string>;
586
597
  }
587
598
  export interface CashierSdkActionQuerySessionResult extends IPaymentSessionMetaData {
588
599
  success: boolean;
@@ -642,12 +653,12 @@ export declare enum eventCodeEnum {
642
653
  SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
643
654
  SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
644
655
  /**
645
- * 拉取WEB应用&收银台失败
646
- */
656
+ * 拉取WEB应用&收银台失败
657
+ */
647
658
  SDK_LAUNCH_PAYMENT_APP_ERROR = "SDK_LAUNCH_PAYMENT_APP_ERROR",
648
659
  /**
649
- * 拉取WEB应用&收银台成功
650
- */
660
+ * 拉取WEB应用&收银台成功
661
+ */
651
662
  SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS",
652
663
  /**
653
664
  @deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
@@ -8,7 +8,7 @@
8
8
 
9
9
  /* eslint-disable @typescript-eslint/no-explicit-any */
10
10
 
11
- export { ElementType, ThemeType, PaymentElementLayout } from "../core/component/oldElement/type";
11
+ export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/oldElement/type";
12
12
 
13
13
  /**
14
14
  * SDK options
@@ -37,6 +37,7 @@ export var ComponentSignEnum = /*#__PURE__*/function (ComponentSignEnum) {
37
37
  ComponentSignEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
38
38
  ComponentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
39
39
  ComponentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
40
+ ComponentSignEnum["AUTO_DEBIT_APM"] = "AUTO_DEBIT_APM";
40
41
  return ComponentSignEnum;
41
42
  }({});
42
43
  export var ProductSceneEnum = /*#__PURE__*/function (ProductSceneEnum) {
@@ -26,6 +26,7 @@ declare const device: {
26
26
  macOS: boolean;
27
27
  WindowsNT: boolean;
28
28
  isMobile: boolean;
29
+ isOpenHarmonyMobile: boolean;
29
30
  };
30
31
  declare const safeJson: (data: any, obj: any) => any;
31
32
  declare const isPC: () => boolean;
@@ -47,4 +48,14 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
47
48
  loadCallback?: any;
48
49
  }, logger: any): Promise<unknown>;
49
50
  declare const isEmpty: (value: any) => boolean;
50
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, };
51
+ /**
52
+ * 判断一个值是否为真
53
+ * @param value 要判断的值
54
+ * @returns 如果值为true或者字符串"true"(不区分大小写),则返回true,否则返回false
55
+ */
56
+ declare const isTrue: (value: unknown) => boolean;
57
+ export declare const omit: <T extends {
58
+ [x: string]: any;
59
+ hasOwnProperty: (arg0: any) => any;
60
+ }>(obj: T, keys: Array<keyof T>) => T;
61
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, isTrue, };
package/esm/util/index.js CHANGED
@@ -148,14 +148,33 @@ var isAndroid = /Android/i.test(UA);
148
148
  var isMacOS = /\bMacintosh\b/.test(UA);
149
149
  var isWindowsNT = /Windows NT/.test(UA);
150
150
  var isMobile = function isMobile() {
151
- return /Android|iPhone|iPad|iPod|Mobile/.test(UA);
151
+ return /Android|iPhone|iPad|iPod|Mobile/.test(UA) || isOpenHarmonyMobile();
152
+ };
153
+ var isOpenHarmony = function isOpenHarmony() {
154
+ // 检查是否为鸿蒙操作系统
155
+ return /OpenHarmony/i.test(navigator.userAgent);
156
+ };
157
+ var isOpenHarmonyMobile = function isOpenHarmonyMobile() {
158
+ // 检查是否为鸿蒙操作系统
159
+ var isHarmonyOS = /OpenHarmony/i.test(navigator.userAgent);
160
+ // 检查是否为手机设备
161
+ var isPhone = /Phone/i.test(navigator.userAgent);
162
+ // 检查是否为平板设备
163
+ var isTablet = /Tablet/i.test(navigator.userAgent);
164
+ // 返回是否为鸿蒙手机或平板
165
+ return isHarmonyOS && (isPhone || isTablet);
166
+ };
167
+ var isOpenHarmonyPC = function isOpenHarmonyPC() {
168
+ // 检查是否为鸿蒙操作系统
169
+ return /OpenHarmony/i.test(navigator.userAgent) && /PC/i.test(navigator.userAgent);
152
170
  };
153
171
  var device = {
154
172
  iOS: isIOS,
155
173
  Android: isAndroid,
156
174
  macOS: isMacOS,
157
175
  WindowsNT: isWindowsNT,
158
- isMobile: !!isMobile()
176
+ isMobile: !!isMobile(),
177
+ isOpenHarmonyMobile: !!isOpenHarmonyMobile()
159
178
  };
160
179
  var safeJson = function safeJson(data, obj) {
161
180
  try {
@@ -343,4 +362,21 @@ var isEmpty = function isEmpty(value) {
343
362
  }
344
363
  return false;
345
364
  };
346
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty };
365
+
366
+ /**
367
+ * 判断一个值是否为真
368
+ * @param value 要判断的值
369
+ * @returns 如果值为true或者字符串"true"(不区分大小写),则返回true,否则返回false
370
+ */
371
+ var isTrue = function isTrue(value) {
372
+ return value === true || typeof value === 'string' && value.toLowerCase() === 'true';
373
+ };
374
+ export var omit = function omit(obj, keys) {
375
+ return Object.keys(obj).reduce(function (acc, key) {
376
+ if (!keys.includes(key)) {
377
+ acc[key] = obj[key];
378
+ }
379
+ return acc;
380
+ }, {});
381
+ };
382
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, isTrue };
@@ -1,4 +1,22 @@
1
+ export declare const ELEMENT_SPM_MAP: {
2
+ sdk_event_mount_element: string;
3
+ sdk_element_create: string;
4
+ sdk_element_mount_fail: string;
5
+ sdk_element_mount_start: string;
6
+ multiple_instance_error: string;
7
+ auto_apple_pay_start: string;
8
+ auto_apple_pay_failed: string;
9
+ auto_apple_pay_success: string;
10
+ };
1
11
  export declare const SPM_MAP: {
12
+ sdk_event_mount_element: string;
13
+ sdk_element_create: string;
14
+ sdk_element_mount_fail: string;
15
+ sdk_element_mount_start: string;
16
+ multiple_instance_error: string;
17
+ auto_apple_pay_start: string;
18
+ auto_apple_pay_failed: string;
19
+ auto_apple_pay_success: string;
2
20
  sdk_error_runtime_error: string;
3
21
  sdk_event_sdkQuery_failed: string;
4
22
  container_error_error_insert_js: string;
@@ -28,7 +46,6 @@ export declare const SPM_MAP: {
28
46
  sdk_event_webAppTimeout: string;
29
47
  sdk_error_getGaidFailed: string;
30
48
  sdk_error_securitySdkInitTokenFailed: string;
31
- sdk_event_mount_element: string;
32
49
  container_error_error_invalid_param: string;
33
50
  container_error_error_set_ua_failed: string;
34
51
  sdk_event_onAddressResult: string;
@@ -164,9 +181,6 @@ export declare const SPM_MAP: {
164
181
  load_item_sdk_timeout: string;
165
182
  MerchantValidationError: string;
166
183
  PaymentAuthorizedError: string;
167
- sdk_element_create: string;
168
- sdk_element_mount_fail: string;
169
- sdk_element_mount_start: string;
170
184
  'ApplePaySession is only support in Safari': string;
171
185
  'Abnormal params paymentSessionFactor': string;
172
186
  'Abnormal params recurringInfo': string;
@@ -1,4 +1,22 @@
1
- export var SPM_MAP = {
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 _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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ // 埋点维护地址: https://log.alipay.com/index_v4.htm/home/common?spma=a3753&tabKey=log
8
+
9
+ export var ELEMENT_SPM_MAP = {
10
+ sdk_event_mount_element: 'a3753.b101271.c388193.d513193',
11
+ sdk_element_create: 'a3753.b101271.c386688',
12
+ sdk_element_mount_fail: 'a3753.b101271.c386691',
13
+ sdk_element_mount_start: 'a3753.b101271.c386690',
14
+ multiple_instance_error: 'a3753.b101271.c403950',
15
+ auto_apple_pay_start: 'a3753.b107385.c398110',
16
+ auto_apple_pay_failed: 'a3753.b107385.c398111',
17
+ auto_apple_pay_success: 'a3753.b107385.c398112'
18
+ };
19
+ export var SPM_MAP = _objectSpread({
2
20
  sdk_error_runtime_error: 'a3753.b101271.c388188.d512342',
3
21
  sdk_event_sdkQuery_failed: 'a3753.b101271.c388188.d512343',
4
22
  container_error_error_insert_js: 'a3753.b101271.c388188.d512344',
@@ -28,7 +46,6 @@ export var SPM_MAP = {
28
46
  sdk_event_webAppTimeout: 'a3753.b101271.c388189.d512356',
29
47
  sdk_error_getGaidFailed: 'a3753.b101271.c388193.d513038',
30
48
  sdk_error_securitySdkInitTokenFailed: 'a3753.b101271.c388193.d513044',
31
- sdk_event_mount_element: 'a3753.b101271.c388193.d513193',
32
49
  container_error_error_invalid_param: 'a3753.b101271.c388193.d513220',
33
50
  container_error_error_set_ua_failed: 'a3753.b101271.c388193.d513221',
34
51
  sdk_event_onAddressResult: 'a3753.b101271.c388193.d513194',
@@ -164,12 +181,9 @@ export var SPM_MAP = {
164
181
  load_item_sdk_timeout: 'a3753.b101271.c388188.d512345',
165
182
  MerchantValidationError: 'a3753.b101271.c388189.d518377',
166
183
  PaymentAuthorizedError: 'a3753.b101271.c388189.d518377',
167
- sdk_element_create: 'a3753.b101271.c386688',
168
- sdk_element_mount_fail: 'a3753.b101271.c386691',
169
- sdk_element_mount_start: 'a3753.b101271.c386690',
170
184
  'ApplePaySession is only support in Safari': 'a3753.b101271.c388189.d518377',
171
185
  'Abnormal params paymentSessionFactor': 'a3753.b101271.c388189.d518377',
172
186
  'Abnormal params recurringInfo': 'a3753.b101271.c388189.d518377',
173
187
  'Payment processing but user dismissed the sheet': 'a3753.b101271.c388189.d518377',
174
188
  'User dismissed the sheet': 'a3753.b101271.c388189.d518377'
175
- };
189
+ }, ELEMENT_SPM_MAP);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1751254427-dev.0",
3
+ "version": "0.0.1751254427-dev.2",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",
@@ -21,7 +21,7 @@
21
21
  "dev": "father dev",
22
22
  "format": "prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"",
23
23
  "lint": "eslint ./src",
24
- "test": "jest --silent",
24
+ "test": "jest --coverage --silent",
25
25
  "tsc": "tsc --noEmit"
26
26
  },
27
27
  "commitlint": {