@alipay/ams-checkout 0.0.1730107332-dev.1 → 0.0.1730107332-dev.11

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.
@@ -106,25 +106,8 @@ export interface IcreateComponent {
106
106
  accentColor?: string;
107
107
  };
108
108
  merchantAppointParam?: IMerchantAppointParam;
109
+ isAppWebview?: boolean;
109
110
  }
110
- export interface IappendIframeNodesParams extends IcreateComponent {
111
- paymentSessionMetaData: IPaymentSessionMetaData;
112
- renderDisplayType: DisplayTypeEnum;
113
- selector?: Iselector;
114
- paypalConfiguration?: IPaypalConfiguration;
115
- connectFactor?: {
116
- enableConnect: boolean;
117
- };
118
- /** 将address-element参数定义合入原参数定义 */
119
- configParams?: {
120
- hideFields?: string[];
121
- addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
122
- };
123
- prefillValue?: AddressItem[];
124
- componentSession?: string;
125
- loca?: string;
126
- }
127
- /** 表单地址数据 */
128
111
  export interface AddressItem {
129
112
  shippingName: {
130
113
  firstName: string;
@@ -167,7 +150,6 @@ export interface AddressItem {
167
150
  prefer?: '1' | '0';
168
151
  shippingId?: string;
169
152
  }
170
- type addressAutoSuggestDisabledType = 0 | 1;
171
153
  export interface IPaypalConfiguration {
172
154
  style?: object;
173
155
  blockPayPalCreditButton?: boolean;
@@ -231,6 +213,7 @@ export interface PaymentSessionActionData {
231
213
  skipSdkQuery: boolean;
232
214
  requireFastSdk: boolean;
233
215
  nonCompliant?: boolean;
216
+ nonInitSecuritySdk?: boolean;
234
217
  skipSdkQueryForm?: {
235
218
  value: boolean;
236
219
  version: string;
@@ -245,6 +228,7 @@ export interface IPaymentSessionMetaData {
245
228
  moneyView?: any;
246
229
  extendInfo?: string;
247
230
  paymentMethodInfoView?: any;
231
+ paymentView?: any;
248
232
  action?: PaymentSessionActionData;
249
233
  authUrlInfo?: {
250
234
  appIdentifier?: string;
@@ -655,10 +639,6 @@ export declare enum ProductSceneVersion {
655
639
  V1 = "1.0",
656
640
  V2 = "2.0"
657
641
  }
658
- export type IAppendParams = {
659
- componentSign: ComponentSignEnum;
660
- iframeNodesParams: IappendIframeNodesParams;
661
- };
662
642
  export declare enum EventCallbackCode {
663
643
  Failed = "Failed",
664
644
  Completed = "Completed"
@@ -56,9 +56,6 @@ export var PaymentMethodCategoryTypeEnum = /*#__PURE__*/function (PaymentMethodC
56
56
  PaymentMethodCategoryTypeEnum["ALL"] = "ALL";
57
57
  return PaymentMethodCategoryTypeEnum;
58
58
  }({});
59
-
60
- /** 表单地址数据 */
61
-
62
59
  export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
63
60
  payPalConfigurationIntentEnum["intent"] = "intent";
64
61
  payPalConfigurationIntentEnum["capture"] = "capture";
@@ -0,0 +1,5 @@
1
+ import { LogService } from "../foundation/service/log";
2
+ /**
3
+ * 通过配置规则检测 UA 和获得回跳 scheme
4
+ */
5
+ export declare function getBackScheme(mockUa?: string, logger?: LogService): any;
@@ -0,0 +1,134 @@
1
+ var RULES = [{
2
+ matchRule: 'AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z]+) Safari\\/([0-9\\._]+)$',
3
+ iosScheme: 'https',
4
+ andScheme: ''
5
+ }, {
6
+ matchRule: 'HeyTapBrowser',
7
+ iosScheme: '',
8
+ andScheme: ''
9
+ }, {
10
+ matchRule: 'HuaweiBrowser',
11
+ iosScheme: '',
12
+ andScheme: ''
13
+ }, {
14
+ matchRule: 'Kwai',
15
+ iosScheme: 'kwai',
16
+ andScheme: ''
17
+ }, {
18
+ matchRule: 'MQQBrowser',
19
+ iosScheme: 'mttbrowser',
20
+ andScheme: ''
21
+ }, {
22
+ matchRule: 'MicroMessenger',
23
+ iosScheme: '',
24
+ andScheme: ''
25
+ }, {
26
+ matchRule: 'MiuiBrowser',
27
+ iosScheme: '',
28
+ andScheme: ''
29
+ }, {
30
+ matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* CriOS\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z\\._a-z]+) Safari\\/([0-9\\._]+)$',
31
+ iosScheme: 'googlechrome',
32
+ andScheme: ''
33
+ }, {
34
+ matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile Safari\\/([0-9\\._]+)$',
35
+ iosScheme: 'googlechrome',
36
+ andScheme: ''
37
+ }, {
38
+ matchRule: 'NewsArticle',
39
+ iosScheme: 'snssdk141',
40
+ andScheme: ''
41
+ }, {
42
+ matchRule: 'UCBrowser',
43
+ iosScheme: 'ucbrowser',
44
+ andScheme: ''
45
+ }, {
46
+ matchRule: 'VideoArticle',
47
+ iosScheme: 'snssdk32',
48
+ andScheme: ''
49
+ }, {
50
+ matchRule: 'VivoBrowser',
51
+ iosScheme: '',
52
+ andScheme: ''
53
+ }, {
54
+ matchRule: 'ZhongAnWebView',
55
+ iosScheme: 'zaapp',
56
+ andScheme: ''
57
+ }, {
58
+ matchRule: 'aweme',
59
+ iosScheme: 'snssdk1128',
60
+ andScheme: ''
61
+ }, {
62
+ matchRule: 'aweme_lite',
63
+ iosScheme: 'snssdk2329',
64
+ andScheme: ''
65
+ }, {
66
+ matchRule: 'com.xs.fm',
67
+ iosScheme: 'novelfm3040',
68
+ andScheme: ''
69
+ }, {
70
+ matchRule: 'netdisk',
71
+ iosScheme: '',
72
+ andScheme: ''
73
+ }, {
74
+ matchRule: 'qqnews',
75
+ iosScheme: 'qqnews',
76
+ andScheme: ''
77
+ }];
78
+
79
+ /**
80
+ * 通过配置规则检测 UA 和获得回跳 scheme
81
+ */
82
+ export function getBackScheme(mockUa, logger) {
83
+ var ua = mockUa || window.navigator.userAgent || '';
84
+ // 获取规则
85
+ var uaMatchedRule = RULES;
86
+ var matchedRule;
87
+ var matched = null;
88
+ for (var i = 0; i < uaMatchedRule.length; i++) {
89
+ var rule = uaMatchedRule[i];
90
+ matched = ua.match(rule.matchRule);
91
+ if (matched) {
92
+ matchedRule = rule;
93
+ break;
94
+ }
95
+ }
96
+ if (!matchedRule) {
97
+ logBackScheme(logger, ua, '');
98
+ return;
99
+ }
100
+ if (isAndroid(ua)) {
101
+ logBackScheme(logger, ua, matchedRule.andScheme);
102
+ return matchedRule.andScheme;
103
+ }
104
+ if (isIOS(ua)) {
105
+ logBackScheme(logger, ua, matchedRule.iosScheme);
106
+ return matchedRule.iosScheme;
107
+ }
108
+ }
109
+ function logBackScheme(logger, userAgent, scheme) {
110
+ if (logger) {
111
+ logger.logInfo({
112
+ title: 'a3753.b101271.c377460'
113
+ }, {
114
+ userAgent: userAgent,
115
+ backScheme: scheme
116
+ });
117
+ }
118
+ }
119
+
120
+ /**
121
+ * 当前运行环境是否 Android
122
+ */
123
+ function isAndroid(mockUA) {
124
+ var ua = (mockUA || navigator.userAgent).toLowerCase();
125
+ return /android|adr|linux/.test(ua);
126
+ }
127
+
128
+ /**
129
+ * 当前运行环境是否 IOS
130
+ */
131
+ function isIOS(mockUA) {
132
+ var ua = (mockUA || navigator.userAgent).toLowerCase();
133
+ return /iphone|ipad|ipod|ios|macintosh/.test(ua);
134
+ }
@@ -4,16 +4,6 @@
4
4
  * 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
5
5
  * 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.
6
6
  */
7
- declare class EventCenter {
8
- private events;
9
- private eventsKey;
10
- constructor();
11
- on(name: string, func: any, key?: string): void;
12
- off(name: string, func: any, key?: string): void;
13
- emit(name: string, ...rest: any): void;
14
- once(name: string, func: any, key?: string): void;
15
- isExist(name: string): boolean;
16
- }
17
7
  declare const getType: (target: any) => string;
18
8
  declare const getViewPort: (key: string) => any;
19
9
  declare const getOrigin: () => string;
@@ -46,4 +36,5 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
46
36
  timeOut?: number;
47
37
  loadCallback?: any;
48
38
  }, logger: any): Promise<unknown>;
49
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
39
+ declare const isEmpty: (value: any) => boolean;
40
+ export { getType, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, isEmpty, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
package/esm/util/index.js CHANGED
@@ -1,10 +1,4 @@
1
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
2
  /**
9
3
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
10
4
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -12,81 +6,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
12
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.
13
7
  */
14
8
  /* eslint-disable @typescript-eslint/no-explicit-any */
15
- var EventCenter = /*#__PURE__*/function () {
16
- function EventCenter() {
17
- _classCallCheck(this, EventCenter);
18
- _defineProperty(this, "events", void 0);
19
- _defineProperty(this, "eventsKey", void 0);
20
- this.events = new Map();
21
- this.eventsKey = new Map();
22
- }
23
- _createClass(EventCenter, [{
24
- key: "on",
25
- value: function on(name, func) {
26
- var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
27
- if (key) {
28
- if (this.eventsKey.has("".concat(name, "-").concat(key))) {
29
- // eslint-disable-next-line no-console
30
- console.warn("".concat(key, "\uFF1AHas been registered. Please use another key or do not pass the key"));
31
- return;
32
- }
33
- this.eventsKey.set("".concat(name, "-").concat(key), true);
34
- }
35
- var eventList = this.events.get(name) || [];
36
- eventList.push({
37
- func: func,
38
- key: key || ''
39
- });
40
- this.events.set(name, eventList);
41
- }
42
- }, {
43
- key: "off",
44
- value: function off(name, func) {
45
- var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
46
- if (key && this.eventsKey.has("".concat(name, "-").concat(key))) {
47
- this.eventsKey.delete("".concat(name, "-").concat(key));
48
- }
49
- if (this.events.has(name)) {
50
- var eventList = this.events.get(name);
51
- eventList = eventList.filter(function (item) {
52
- if (func === item.func && item.key === key) return false;
53
- if (item.key && item.key === key) return false;
54
- return true;
55
- });
56
- this.events.set(name, eventList);
57
- }
58
- }
59
- }, {
60
- key: "emit",
61
- value: function emit(name) {
62
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
63
- rest[_key - 1] = arguments[_key];
64
- }
65
- if (this.events.has(name)) {
66
- var eventList = this.events.get(name);
67
- eventList.forEach(function (item) {
68
- item.func.apply(item, rest);
69
- });
70
- }
71
- }
72
- }, {
73
- key: "once",
74
- value: function once(name, func, key) {
75
- var _this = this;
76
- var onceF = function onceF() {
77
- func.apply(void 0, arguments);
78
- _this.off(name, onceF, key);
79
- };
80
- this.on(name, onceF, key);
81
- }
82
- }, {
83
- key: "isExist",
84
- value: function isExist(name) {
85
- return this.events.has(name);
86
- }
87
- }]);
88
- return EventCenter;
89
- }();
9
+
90
10
  var getType = function getType(target) {
91
11
  return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
92
12
  };
@@ -266,7 +186,7 @@ function parseBase64ToString(base64) {
266
186
  }
267
187
  }
268
188
  function loadSDKScript(_ref, logger) {
269
- var _this2 = this;
189
+ var _this = this;
270
190
  var src = _ref.src,
271
191
  _ref$attrOptions = _ref.attrOptions,
272
192
  attrOptions = _ref$attrOptions === void 0 ? {} : _ref$attrOptions,
@@ -315,7 +235,7 @@ function loadSDKScript(_ref, logger) {
315
235
  reject(false);
316
236
  };
317
237
  timer = setTimeout(function () {
318
- _this2.logger.logError({
238
+ _this.logger.logError({
319
239
  title: 'load_item_sdk_timeout'
320
240
  }, {
321
241
  src: src,
@@ -331,4 +251,17 @@ function loadSDKScript(_ref, logger) {
331
251
  document.head.appendChild(script);
332
252
  });
333
253
  }
334
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
254
+ var isEmpty = function isEmpty(value) {
255
+ if (value == null) {
256
+ // Checks for null and undefined
257
+ return true;
258
+ }
259
+ if (typeof value === 'string' || Array.isArray(value)) {
260
+ return value.length === 0;
261
+ }
262
+ if (_typeof(value) === 'object') {
263
+ return Object.keys(value).length === 0;
264
+ }
265
+ return false; // For other types (like numbers, functions, etc.)
266
+ };
267
+ export { getType, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, isEmpty, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
@@ -138,6 +138,7 @@ var CallApp = /*#__PURE__*/function () {
138
138
  fallback = _this$options.fallback;
139
139
  if (!scheme && !link && !intent) {
140
140
  console.error('请至少填一个链接');
141
+ if (fallback) fallback();
141
142
  return;
142
143
  }
143
144
  if (link && checkIsHttpUrl(link)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1730107332-dev.1",
3
+ "version": "0.0.1730107332-dev.11",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",