@alipay/ams-checkout 0.0.1763539719-dev.0 → 0.0.1763711027-dev.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 (48) hide show
  1. package/README.md +1 -1
  2. package/ams-checkout.js +1 -0
  3. package/dist/umd/ams-checkout.min.js +1 -1
  4. package/esm/config/index.d.ts +8 -8
  5. package/esm/config/index.js +8 -8
  6. package/esm/constant/auto-debit.d.ts +12 -0
  7. package/esm/constant/auto-debit.js +15 -0
  8. package/esm/constant/element.d.ts +26 -0
  9. package/esm/constant/element.js +30 -0
  10. package/esm/constant/index.d.ts +3 -0
  11. package/esm/constant/index.js +3 -0
  12. package/esm/core/component/element/elementProcessor/addressProcessor.js +2 -3
  13. package/esm/core/component/element/elementProcessor/authProcessor.js +2 -3
  14. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +1 -1
  15. package/esm/core/component/element/elementProcessor/paymentProcessor.js +30 -28
  16. package/esm/core/component/element/type.d.ts +3 -0
  17. package/esm/foundation/core/index.js +27 -0
  18. package/esm/foundation/service/container/index.d.ts +1 -0
  19. package/esm/foundation/service/container/index.js +33 -2
  20. package/esm/foundation/utils/web_app_url_utils.d.ts +0 -2
  21. package/esm/foundation/utils/web_app_url_utils.js +10 -15
  22. package/esm/index.d.ts +13 -52
  23. package/esm/index.js +19 -339
  24. package/esm/loader/Proxy.d.ts +5 -0
  25. package/esm/loader/Proxy.js +364 -0
  26. package/esm/loader/constant.d.ts +36 -0
  27. package/esm/loader/constant.js +36 -0
  28. package/esm/loader/index.d.ts +20 -0
  29. package/esm/loader/index.js +23 -0
  30. package/esm/loader/utils/common.d.ts +13 -0
  31. package/esm/loader/utils/common.js +63 -0
  32. package/esm/loader/utils/debugger.d.ts +7 -0
  33. package/esm/loader/utils/debugger.js +15 -0
  34. package/esm/loader/utils/loadSDK.d.ts +8 -0
  35. package/esm/loader/utils/loadSDK.js +92 -0
  36. package/esm/loader/utils/logger.d.ts +10 -0
  37. package/esm/loader/utils/logger.js +59 -0
  38. package/esm/loader/utils/proxyPerformance.d.ts +20 -0
  39. package/esm/loader/utils/proxyPerformance.js +66 -0
  40. package/esm/main.d.ts +45 -0
  41. package/esm/main.js +329 -0
  42. package/esm/plugin/component/cashierApp.js +7 -4
  43. package/esm/util/integrationType.d.ts +21 -0
  44. package/esm/util/integrationType.js +48 -0
  45. package/esm/util/logger.d.ts +2 -0
  46. package/esm/util/logger.js +1 -1
  47. package/esm/util/versionCompare.d.ts +1 -1
  48. package/package.json +7 -1
@@ -6,11 +6,11 @@ export declare const sdkVersion: string;
6
6
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
7
7
  * TODO 这里考虑直接换成packagejson.version
8
8
  */
9
- export declare const AMSCheckoutAppVersion = "1.47.0";
10
- export declare const AMSAutoDebitAppVersion = "1.47.0";
11
- export declare const AMSEasyPayAppVersion = "1.47.0";
12
- export declare const AMSCashierPaymentAppVersion = "1.47.0";
13
- export declare const AMSVaultingAppVersion = "1.47.0";
14
- export declare const AMSPaymentElementAppVersion = "1.47.0";
15
- export declare const ADDRESSElementAppVersion = "1.47.0";
16
- export declare const AUTHElementAppVersion = "1.47.0";
9
+ export declare const AMSCheckoutAppVersion = "1.47.1";
10
+ export declare const AMSAutoDebitAppVersion = "1.47.1";
11
+ export declare const AMSEasyPayAppVersion = "1.47.1";
12
+ export declare const AMSCashierPaymentAppVersion = "1.47.1";
13
+ export declare const AMSVaultingAppVersion = "1.47.1";
14
+ export declare const AMSPaymentElementAppVersion = "1.47.1";
15
+ export declare const ADDRESSElementAppVersion = "1.47.1";
16
+ export declare const AUTHElementAppVersion = "1.47.1";
@@ -36,11 +36,11 @@ export var sdkVersion = json.version;
36
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
37
37
  * TODO 这里考虑直接换成packagejson.version
38
38
  */
39
- export var AMSCheckoutAppVersion = '1.47.0'; // 兜底版本号
40
- export var AMSAutoDebitAppVersion = '1.47.0'; // 代扣
41
- export var AMSEasyPayAppVersion = '1.47.0'; // easypay
42
- export var AMSCashierPaymentAppVersion = '1.47.0'; // 收银台(卡、apm)
43
- export var AMSVaultingAppVersion = '1.47.0'; // 绑卡
44
- export var AMSPaymentElementAppVersion = '1.47.0'; // payment element
45
- export var ADDRESSElementAppVersion = '1.47.0'; // address element
46
- export var AUTHElementAppVersion = '1.47.0'; // auth element
39
+ export var AMSCheckoutAppVersion = '1.47.1'; // 兜底版本号
40
+ export var AMSAutoDebitAppVersion = '1.47.1'; // 代扣
41
+ export var AMSEasyPayAppVersion = '1.47.1'; // easypay
42
+ export var AMSCashierPaymentAppVersion = '1.47.1'; // 收银台(卡、apm)
43
+ export var AMSVaultingAppVersion = '1.47.1'; // 绑卡
44
+ export var AMSPaymentElementAppVersion = '1.47.1'; // payment element
45
+ export var ADDRESSElementAppVersion = '1.47.1'; // address element
46
+ export var AUTHElementAppVersion = '1.47.1'; // auth element
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Auto-Debit V2构建产物page名称
3
+ */
4
+ export declare enum AUTO_DEBIT_PAGE_NAME {
5
+ TRUSTLY = "trustly"
6
+ }
7
+ /**
8
+ * Auto-Debit V2(不带域名)
9
+ */
10
+ export declare enum AUTO_DEBIT_PAGE_URL {
11
+ TRUSTLY = "/auto-debit/pages/trustly/index.html"
12
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Auto-Debit V2构建产物page名称
3
+ */
4
+ export var AUTO_DEBIT_PAGE_NAME = /*#__PURE__*/function (AUTO_DEBIT_PAGE_NAME) {
5
+ AUTO_DEBIT_PAGE_NAME["TRUSTLY"] = "trustly";
6
+ return AUTO_DEBIT_PAGE_NAME;
7
+ }({});
8
+
9
+ /**
10
+ * Auto-Debit V2(不带域名)
11
+ */
12
+ export var AUTO_DEBIT_PAGE_URL = /*#__PURE__*/function (AUTO_DEBIT_PAGE_URL) {
13
+ AUTO_DEBIT_PAGE_URL["TRUSTLY"] = "/auto-debit/pages/trustly/index.html";
14
+ return AUTO_DEBIT_PAGE_URL;
15
+ }({});
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Element 构建产物page名称
3
+ */
4
+ export declare const ELEMENT_PAGE_NAME: {
5
+ CODE_VIEW: string;
6
+ ELEMENT_PAYMENT: string;
7
+ EXPRESS_CHECKOUT: string;
8
+ IFRAME_ELEMENT: string;
9
+ INSTRUCTION_GUIDE: string;
10
+ THREED_PAGE: string;
11
+ ELEMENT_AUTH: string;
12
+ ADDRESS: string;
13
+ };
14
+ /**
15
+ * Element 各页面URL(不带域名)
16
+ */
17
+ export declare enum ELEMENT_PAGE_URL {
18
+ CODE_VIEW = "/elements/pages/code-view/index.html",
19
+ ELEMENT_PAYMENT = "/elements/pages/element-payment/index.html",
20
+ EXPRESS_CHECKOUT = "/elements/pages/express_checkout/index.html",
21
+ IFRAME_ELEMENT = "/elements/pages/iframe-element/index.html",
22
+ INSTRUCTION_GUIDE = "/elements/pages/instruction-guide/index.html",
23
+ THREED_PAGE = "/elements/pages/threed-page/index.html",
24
+ ELEMENT_AUTH = "/auth-element/pages/element_auth/index.html",
25
+ ADDRESS = "/element-address/pages/address/index.html"
26
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Element 构建产物page名称
3
+ */
4
+ export var ELEMENT_PAGE_NAME = {
5
+ CODE_VIEW: 'code-view',
6
+ ELEMENT_PAYMENT: 'element-payment',
7
+ EXPRESS_CHECKOUT: 'express_checkout',
8
+ IFRAME_ELEMENT: 'iframe-element',
9
+ INSTRUCTION_GUIDE: 'instruction-guide',
10
+ THREED_PAGE: 'threed-page',
11
+ // AuthElement
12
+ ELEMENT_AUTH: 'element_auth',
13
+ // AdressElement
14
+ ADDRESS: 'address'
15
+ };
16
+
17
+ /**
18
+ * Element 各页面URL(不带域名)
19
+ */
20
+ export var ELEMENT_PAGE_URL = /*#__PURE__*/function (ELEMENT_PAGE_URL) {
21
+ ELEMENT_PAGE_URL["CODE_VIEW"] = "/elements/pages/code-view/index.html";
22
+ ELEMENT_PAGE_URL["ELEMENT_PAYMENT"] = "/elements/pages/element-payment/index.html";
23
+ ELEMENT_PAGE_URL["EXPRESS_CHECKOUT"] = "/elements/pages/express_checkout/index.html";
24
+ ELEMENT_PAGE_URL["IFRAME_ELEMENT"] = "/elements/pages/iframe-element/index.html";
25
+ ELEMENT_PAGE_URL["INSTRUCTION_GUIDE"] = "/elements/pages/instruction-guide/index.html";
26
+ ELEMENT_PAGE_URL["THREED_PAGE"] = "/elements/pages/threed-page/index.html";
27
+ ELEMENT_PAGE_URL["ELEMENT_AUTH"] = "/auth-element/pages/element_auth/index.html";
28
+ ELEMENT_PAGE_URL["ADDRESS"] = "/element-address/pages/address/index.html";
29
+ return ELEMENT_PAGE_URL;
30
+ }({});
@@ -288,6 +288,9 @@ export declare const EVENT: {
288
288
  forwardName: string;
289
289
  uniqueKey: string;
290
290
  };
291
+ canIUse: {
292
+ name: string;
293
+ };
291
294
  };
292
295
  export declare const SENDEVENT: {
293
296
  validateFields: {
@@ -293,6 +293,9 @@ export var EVENT = {
293
293
  name: 'validateFieldsResult',
294
294
  forwardName: 'validateFieldsResultForward',
295
295
  uniqueKey: 'uservalidateFieldsResult'
296
+ },
297
+ canIUse: {
298
+ name: 'canIUse'
296
299
  }
297
300
  };
298
301
 
@@ -20,8 +20,8 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
20
20
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
21
21
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
22
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
23
+ import { ELEMENT_PAGE_URL } from "../../../../constant/element";
23
24
  import { parseSessionData } from "../..";
24
- import { ADDRESSElementAppVersion } from "../../../../config";
25
25
  import { ProductSceneEnum } from "../../../../types";
26
26
  import { generateIframeSrc as _generateIframeSrc } from "../util";
27
27
  import BaseElementProcessor from "./baseElementProcessor";
@@ -95,7 +95,6 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
95
95
  environment = _this$options.env.environment,
96
96
  analytics = _this$options.analytics,
97
97
  locale = _this$options.locale;
98
- var pageUrl = "/element-address/".concat(ADDRESSElementAppVersion, "/pages/address/index.html");
99
98
  return _generateIframeSrc({
100
99
  paymentSession: paymentSession,
101
100
  paymentSessionObj: paymentSessionObj,
@@ -104,7 +103,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
104
103
  locale: locale,
105
104
  link: link,
106
105
  appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
107
- pageUrl: pageUrl,
106
+ pageUrl: ELEMENT_PAGE_URL.ADDRESS,
108
107
  instanceId: instanceId
109
108
  });
110
109
  }
@@ -17,7 +17,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
17
17
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
18
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
19
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20
- import { AUTHElementAppVersion } from "../../../../config";
20
+ import { ELEMENT_PAGE_URL } from "../../../../constant/element";
21
21
  import { parseSessionData } from "../../index";
22
22
  import { generateIframeSrc as _generateIframeSrc } from "../util";
23
23
  import BaseElementProcessor from "./baseElementProcessor";
@@ -69,7 +69,6 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
69
69
  environment = _this$options.env.environment,
70
70
  analytics = _this$options.analytics,
71
71
  locale = _this$options.locale;
72
- var pageUrl = "/auth-element/".concat(AUTHElementAppVersion, "/pages/element_auth/index.html");
73
72
  return _generateIframeSrc({
74
73
  paymentSession: paymentSession,
75
74
  paymentSessionObj: paymentSessionObj,
@@ -78,7 +77,7 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
78
77
  locale: locale,
79
78
  link: link,
80
79
  appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
81
- pageUrl: pageUrl,
80
+ pageUrl: ELEMENT_PAGE_URL.ELEMENT_AUTH,
82
81
  instanceId: instanceId
83
82
  });
84
83
  }
@@ -1,4 +1,4 @@
1
- import { LogService } from "../../../../foundation/service/log";
1
+ import { LogService } from '../../../../foundation/service/log';
2
2
  import BaseElementProcessor from './baseElementProcessor';
3
3
  declare class PaymentProcessor extends BaseElementProcessor {
4
4
  private ApplePayService;
@@ -23,6 +23,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
23
23
  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; }
24
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
25
25
  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); }
26
+ import { ELEMENT_PAGE_URL } from "../../../../constant/element";
26
27
  import { EVENT } from "../../../../constant";
27
28
  import { ServiceProvider } from "../../../../foundation/service";
28
29
  import { ApplePaySdk, handleGooglePay, isSkipRenderPaymentMethod } from "../../../../plugin/component/channel";
@@ -32,8 +33,16 @@ import { parseSessionData } from "../../index";
32
33
  import { oneAccount, sdkAction } from "../mock";
33
34
  import { generateIframeSrc as _generateIframeSrc, isElementPad, isElementPC, safeStringify } from "../util";
34
35
  import BaseElementProcessor from "./baseElementProcessor";
35
- import { AMSPaymentElementAppVersion } from "../../../../config";
36
36
  var logger = new Logger(LogConfig, true);
37
+ var isExpressCheckout = function isExpressCheckout(extendInfo) {
38
+ try {
39
+ var _JSON$parse;
40
+ var expressCheckout = JSON.parse((_JSON$parse = JSON.parse(extendInfo)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.expressCheckout);
41
+ return !!expressCheckout;
42
+ } catch (_) {
43
+ return false;
44
+ }
45
+ };
37
46
  var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
38
47
  _inherits(PaymentProcessor, _BaseElementProcessor);
39
48
  var _super = _createSuper(PaymentProcessor);
@@ -119,6 +128,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
119
128
  });
120
129
  });
121
130
  });
131
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
122
132
  this.eventCenter.listen(EVENT.getApplePayToken.name, function (data) {
123
133
  var _this2$elementContain = _this2.elementContainer.getPaymentContext(),
124
134
  paymentSessionId = _this2$elementContain.paymentSessionId,
@@ -151,12 +161,12 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
151
161
  key: "initApplePaySdk",
152
162
  value: function () {
153
163
  var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
154
- var _this$elementContaine7;
155
- var _this$elementContaine6, paymentSessionObj, paymentSessionId;
164
+ var _this$elementContaine6;
165
+ var _ref, paymentSessionObj, paymentSessionId;
156
166
  return _regeneratorRuntime().wrap(function _callee$(_context) {
157
167
  while (1) switch (_context.prev = _context.next) {
158
168
  case 0:
159
- _this$elementContaine6 = (_this$elementContaine7 = this.elementContainer) === null || _this$elementContaine7 === void 0 ? void 0 : _this$elementContaine7.getPaymentContext(), paymentSessionObj = _this$elementContaine6.paymentSessionObj, paymentSessionId = _this$elementContaine6.paymentSessionId;
169
+ _ref = ((_this$elementContaine6 = this.elementContainer) === null || _this$elementContaine6 === void 0 ? void 0 : _this$elementContaine6.getPaymentContext()) || {}, paymentSessionObj = _ref.paymentSessionObj, paymentSessionId = _ref.paymentSessionId;
160
170
  if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
161
171
  _context.next = 13;
162
172
  break;
@@ -209,28 +219,20 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
209
219
  }
210
220
  }, {
211
221
  key: "generateIframeSrc",
212
- value: function generateIframeSrc(_ref) {
213
- var link = _ref.link,
214
- instanceId = _ref.instanceId;
222
+ value: function generateIframeSrc(_ref2) {
223
+ var link = _ref2.link,
224
+ instanceId = _ref2.instanceId;
215
225
  this.instanceId = instanceId;
216
- var _ref2 = this.elementContainer.getPaymentContext() || {},
217
- paymentSession = _ref2.paymentSession,
218
- paymentSessionObj = _ref2.paymentSessionObj,
219
- sdkMetaData = _ref2.sdkMetaData;
226
+ var _ref3 = this.elementContainer.getPaymentContext() || {},
227
+ paymentSession = _ref3.paymentSession,
228
+ paymentSessionObj = _ref3.paymentSessionObj,
229
+ sdkMetaData = _ref3.sdkMetaData;
220
230
  var _this$options = this.options,
221
231
  environment = _this$options.env.environment,
222
232
  analytics = _this$options.analytics,
223
233
  locale = _this$options.locale;
224
- var _ref3 = paymentSessionObj || {},
225
- extendInfo = _ref3.extendInfo;
226
- var pageUrl = "/elements/".concat(AMSPaymentElementAppVersion, "/pages/element_payment/index.html");
227
- try {
228
- var _JSON$parse;
229
- var expressCheckout = JSON.parse((_JSON$parse = JSON.parse(extendInfo)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.expressCheckout);
230
- if (expressCheckout) {
231
- pageUrl = "/elements/".concat(AMSPaymentElementAppVersion, "/pages/express_checkout/index.html");
232
- }
233
- } catch (error) {}
234
+ var _ref4 = paymentSessionObj || {},
235
+ extendInfo = _ref4.extendInfo;
234
236
  var url = _generateIframeSrc({
235
237
  paymentSession: paymentSession,
236
238
  paymentSessionObj: paymentSessionObj,
@@ -239,7 +241,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
239
241
  locale: locale,
240
242
  link: link,
241
243
  appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
242
- pageUrl: pageUrl,
244
+ pageUrl: isExpressCheckout(extendInfo) ? ELEMENT_PAGE_URL.EXPRESS_CHECKOUT : ELEMENT_PAGE_URL.ELEMENT_PAYMENT,
243
245
  instanceId: instanceId
244
246
  });
245
247
  this.setElementUrl(url);
@@ -251,16 +253,16 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
251
253
  var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
252
254
  var _paymentSessionObj$co,
253
255
  _this3 = this;
254
- var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref4, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
256
+ var requestService, _this$elementContaine7, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref5, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
255
257
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
256
258
  while (1) switch (_context2.prev = _context2.next) {
257
259
  case 0:
258
260
  requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
259
- _this$elementContaine8 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine8.paymentSession, paymentSessionObj = _this$elementContaine8.paymentSessionObj, displayInfo = _this$elementContaine8.displayInfo;
261
+ _this$elementContaine7 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine7.paymentSession, paymentSessionObj = _this$elementContaine7.paymentSessionObj, displayInfo = _this$elementContaine7.displayInfo;
260
262
  _displayInfo = displayInfo;
261
263
  debugProps = _displayInfo.debugProps;
262
264
  _this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
263
- _ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
265
+ _ref5 = paymentSessionObj || {}, paymentSessionConfig = _ref5.paymentSessionConfig;
264
266
  hostSign = paymentSession.split('&&')[1] || '';
265
267
  isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
266
268
  LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
@@ -392,9 +394,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
392
394
  }
393
395
  }, {
394
396
  key: "update",
395
- value: function update(_ref5) {
396
- var data = _ref5.data,
397
- paymentSessionData = _ref5.paymentSessionData;
397
+ value: function update(_ref6) {
398
+ var data = _ref6.data,
399
+ paymentSessionData = _ref6.paymentSessionData;
398
400
  var _parseSessionData = parseSessionData(paymentSessionData),
399
401
  _parseSessionData2 = _slicedToArray(_parseSessionData, 2),
400
402
  parseData = _parseSessionData2[0],
@@ -180,6 +180,9 @@ export interface PaymentMountOptions extends BaseMountOptions {
180
180
  'radius-button': string;
181
181
  'warpper-padding': string;
182
182
  }>>;
183
+ card?: {
184
+ showBrandIcon?: boolean;
185
+ };
183
186
  };
184
187
  notRedirectAfterComplete?: boolean;
185
188
  merchantAppointParam?: IMerchantAppointParam;
@@ -22,6 +22,7 @@ import { getGrayscaleId } from "../utils/gray_scale_utils";
22
22
  import { convertPaymentSession, getWebAppVersion, saveWebAppVersion } from "../utils/payment_context_utils";
23
23
  import { redirect } from "../utils/redirect_utils";
24
24
  import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
25
+
25
26
  /**
26
27
  * @author 谦彧 <zhangmian.zm@alipay.com>
27
28
  * @date 2024/9/17
@@ -231,6 +232,32 @@ export var AntomSDKCore = /*#__PURE__*/function () {
231
232
  _this.eventLogging = data.popWindowEventInfo.eventLogging;
232
233
  }
233
234
  });
235
+ eventCenter.listen(EVENT.canIUse.name, function (data, payload) {
236
+ var _payload$context5;
237
+ // 前置校验
238
+ var funcName = data === null || data === void 0 ? void 0 : data.funcName;
239
+ if (!funcName || typeof funcName !== 'string') {
240
+ var _payload$context4;
241
+ eventCenter.dispatchToApp({
242
+ event: 'appEventCallback',
243
+ eventCallbackId: (_payload$context4 = payload.context) === null || _payload$context4 === void 0 ? void 0 : _payload$context4.eventCallbackId,
244
+ data: {
245
+ exist: false,
246
+ success: false
247
+ }
248
+ });
249
+ return;
250
+ }
251
+ var exist = eventCenter.isExist(funcName);
252
+ eventCenter.dispatchToApp({
253
+ event: 'appEventCallback',
254
+ eventCallbackId: (_payload$context5 = payload.context) === null || _payload$context5 === void 0 ? void 0 : _payload$context5.eventCallbackId,
255
+ data: {
256
+ exist: exist,
257
+ success: true
258
+ }
259
+ });
260
+ });
234
261
 
235
262
  // execute additional logic from specified product
236
263
  if (this.productProcessors[sdkMetaData.productScene]) {
@@ -37,5 +37,6 @@ export declare class ContainerService implements Service {
37
37
  private handleCloseButtonTheme;
38
38
  private handlePopupWindow;
39
39
  private handlePopWindow;
40
+ private handleCanIUse;
40
41
  getWebApp(): HTMLIFrameElement;
41
42
  }
@@ -7,12 +7,12 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
7
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
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
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 { isEmpty } from "../../../util";
11
10
  import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
12
11
  import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
13
12
  import { insertStyleSheet } from "../../../component/popupWindow.style";
14
- import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT, closeImg, closeImgLight } from "../../../constant";
13
+ import { closeImg, closeImgLight, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../../constant";
15
14
  import { DisplayTypeEnum, ProductSceneEnum } from "../../../types";
15
+ import { isEmpty } from "../../../util";
16
16
  import { ServiceProvider } from "../index";
17
17
  import { PopupManager } from "./popup";
18
18
  import { createIframe, startSizeChangeAnim } from "./utils";
@@ -217,6 +217,9 @@ export var ContainerService = /*#__PURE__*/function () {
217
217
  this.eventCenter.listen(EVENT.appHeartBeat.name, function () {
218
218
  _this.handleAppHeartBeat();
219
219
  });
220
+ this.eventCenter.listen(EVENT.canIUse.name, function (data, payload) {
221
+ _this.handleCanIUse(data, payload);
222
+ });
220
223
  /**
221
224
  * 目前仅用于ESP V2的 web sdk
222
225
  * 原因: 在账户输入页和OTP页面的h5场景下键盘弹起页面会有问题,iframe有固定高度,键盘弹起时应用层不会触发大小变化
@@ -446,6 +449,34 @@ export var ContainerService = /*#__PURE__*/function () {
446
449
  data: data
447
450
  });
448
451
  }
452
+ }, {
453
+ key: "handleCanIUse",
454
+ value: function handleCanIUse(data, payload) {
455
+ var _payload$context3;
456
+ // 前置校验
457
+ var funcName = data === null || data === void 0 ? void 0 : data.funcName;
458
+ if (!funcName || typeof funcName !== 'string') {
459
+ var _payload$context2;
460
+ this.eventCenter.dispatchToApp({
461
+ event: 'appEventCallback',
462
+ eventCallbackId: (_payload$context2 = payload.context) === null || _payload$context2 === void 0 ? void 0 : _payload$context2.eventCallbackId,
463
+ data: {
464
+ exist: false,
465
+ success: false
466
+ }
467
+ });
468
+ return;
469
+ }
470
+ var exist = this.eventCenter.isExist(funcName);
471
+ this.eventCenter.dispatchToApp({
472
+ event: 'appEventCallback',
473
+ eventCallbackId: (_payload$context3 = payload.context) === null || _payload$context3 === void 0 ? void 0 : _payload$context3.eventCallbackId,
474
+ data: {
475
+ exist: exist,
476
+ success: true
477
+ }
478
+ });
479
+ }
449
480
  }, {
450
481
  key: "getWebApp",
451
482
  value: function getWebApp() {
@@ -108,8 +108,6 @@ export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum, envir
108
108
  export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum, environment?: string) => string;
109
109
  /**
110
110
  * V2应用EasySafePay 热更新兜底URL构建规则
111
- * 1. 兜底URL版本与sdk版本保持一致
112
- * 2. DEV环境下html新增版本前缀
113
111
  **/
114
112
  export declare const getDefaultEasySafePayPageUrl: (pageName: ESP_PAGE_NAME, env: string) => string;
115
113
  /**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
@@ -5,6 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
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
7
  import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config";
8
+ import { AUTO_DEBIT_PAGE_URL } from "../../constant/auto-debit";
8
9
  import { ESP_PAGE_NAME } from "../../constant/easysafepay";
9
10
  import { ComponentSignEnum, ProductSceneEnum } from "../../types";
10
11
  import { queryParse, serialize } from "../../util";
@@ -71,11 +72,8 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
71
72
  export var getWebAppV2Url = function getWebAppV2Url(params) {
72
73
  var productScene = params.productScene,
73
74
  isPreload = params.isPreload,
74
- mid = params.mid,
75
- extendInfo = params.extendInfo,
76
75
  environment = params.environment;
77
- var webAppUrlMatchConfig = parseWebAppUrlMatchConfig(extendInfo);
78
- var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig, environment);
76
+ var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : defaultCheckoutUrl(productScene, environment);
79
77
  var info = getWebAppUrlInfo(_objectSpread(_objectSpread({}, params), {}, {
80
78
  v2Url: v2Url
81
79
  }));
@@ -117,15 +115,14 @@ var getAppPath = function getAppPath() {
117
115
  }
118
116
  var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
119
117
  var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
120
- var webAppVersion = sdkMetaData.webAppVersion;
121
118
  if (productSceneWithPaymentMethodCategoryType === ComponentSignEnum.AUTO_DEBIT_APM) {
122
- return "".concat(v2AppMarmotMap[environment], "/auto-debit/").concat(webAppVersion, "/pages/trustly/index.html");
119
+ return "".concat(v2AppMarmotMap[environment]).concat(AUTO_DEBIT_PAGE_URL.TRUSTLY);
123
120
  }
124
121
  switch (productScene) {
125
122
  case ProductSceneEnum.EASY_PAY:
126
123
  return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene, environment);
127
124
  default:
128
- return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.").concat(webAppVersion, ".html");
125
+ return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.html");
129
126
  }
130
127
  };
131
128
  export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo) {
@@ -290,20 +287,18 @@ export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
290
287
 
291
288
  /**
292
289
  * V2应用EasySafePay 热更新兜底URL构建规则
293
- * 1. 兜底URL版本与sdk版本保持一致
294
- * 2. DEV环境下html新增版本前缀
295
290
  **/
296
291
  export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(pageName, env) {
297
292
  // 生成的URL EXAMPLE:
298
293
  // const DEFAULT_DOUBLE_FA_URL_MAPPING = {
299
- // local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index-1.36.0.html',
300
- // dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index-1.36.0.html',
301
- // sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
302
- // pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
303
- // prod: 'https://checkout.antom.com/easysafepay/1.36.0/pages/double-fa/index.html',
294
+ // local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
295
+ // dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
296
+ // sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
297
+ // pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
298
+ // prod: 'https://checkout.antom.com/easysafepay/pages/double-fa/index.html',
304
299
  // };
305
300
  var environment = env || 'prod';
306
- if (environment === 'dev') return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index-").concat(sdkVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index.html");
301
+ return "".concat(v2AppMarmotMap[environment], "/easysafepay/pages/").concat(pageName, "/index.html");
307
302
  };
308
303
 
309
304
  /**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
package/esm/index.d.ts CHANGED
@@ -1,54 +1,15 @@
1
- import { AddressComponent } from './core/component/address';
2
- import { ElementComponent } from './core/component/element';
3
- import { AMSComponent } from './core/component/index';
4
- import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions, ValidationResult } from './types';
5
- export { AMSCheckoutPage } from './core/component/ckp';
1
+ /**
2
+ * NPM包入口 产品持续接入热更新中
3
+ *
4
+ * 背景:
5
+ * 通过NPM方式集成SDK,各产品需要持续接入热更新, 接入热更新的产品基类仅导出热更新壳
6
+ * 通过UMD方式集成SDK, 各产品基类直接导出
7
+ *
8
+ * 详见: https://yuque.antfin.com/antom-sdk/dg6hge/lbun86wg2h3f7es7
9
+ *
10
+ * **/
11
+ import { AMSCheckout } from './main';
12
+ export { AMSEasyPayWrapper as AMSEasyPay, AMSElementWrapper as AMSElement } from './loader/index';
13
+ export { AddressElement, AMSAutoDebit, AMSAutoDebitPay, AMSCashierPayment, AMSCheckout, AMSCheckoutPage, AMSVaulting, AntomElement, } from './main';
6
14
  export * from './types';
7
- export declare class AMSCheckout extends AMSComponent {
8
- constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
9
- }
10
- export declare class AMSAutoDebitPay extends AMSCheckout {
11
- constructor(options: IoptionsParams);
12
- static preload(options?: IPreloadOptions): void;
13
- }
14
- export declare class AMSCashierPayment extends AMSCheckout {
15
- constructor(options: IoptionsParams);
16
- static preload(options?: IPreloadOptions): void;
17
- /**
18
- * Form validation function
19
- * If the form is currently displayed:
20
- * - Successful validation: isValid is true
21
- * - Failed validation: isValid is false, and error messages are displayed on the form page
22
- * If not on the form display page, isValid returns false
23
- * @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
24
- */
25
- validateFields(): Promise<ValidationResult>;
26
- }
27
- export declare class AMSVaulting extends AMSCheckout {
28
- constructor(options: IoptionsParams);
29
- static preload(options?: IPreloadOptions): void;
30
- }
31
- export declare class AntomElement extends AMSCheckout {
32
- constructor(options: IoptionsParams);
33
- }
34
- export declare class AddressElement extends AddressComponent {
35
- constructor(options: IoptionsAddressParams);
36
- }
37
- export declare class AMSElement extends ElementComponent {
38
- constructor(options: IElementOptions);
39
- }
40
- export declare class AMSEasyPay {
41
- private core;
42
- constructor(options: IoptionsParams);
43
- static preload(options?: IPreloadOptions): void;
44
- createComponent(params: IcreateComponent): void;
45
- unmount(): void;
46
- }
47
- export declare class AMSAutoDebit {
48
- private core;
49
- constructor(options: IoptionsParams);
50
- createComponent(params: IcreateComponent): Promise<void>;
51
- unmount(): void;
52
- static preload(options?: IPreloadOptions): void;
53
- }
54
15
  export default AMSCheckout;