@alipay/ams-checkout 0.0.1763539719-dev.0 → 0.0.1763711027-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 (139) hide show
  1. package/ams-checkout.js +1 -0
  2. package/dist/umd/ams-checkout.min.js +1 -1
  3. package/esm/config/index.js +8 -8
  4. package/esm/constant/auto-debit.js +15 -0
  5. package/esm/constant/element.js +30 -0
  6. package/esm/constant/index.js +3 -0
  7. package/esm/core/component/element/elementProcessor/addressProcessor.js +2 -3
  8. package/esm/core/component/element/elementProcessor/authProcessor.js +2 -3
  9. package/esm/core/component/element/elementProcessor/paymentProcessor.js +30 -28
  10. package/esm/foundation/core/index.js +27 -0
  11. package/esm/foundation/service/container/index.js +33 -2
  12. package/esm/foundation/utils/web_app_url_utils.js +10 -15
  13. package/esm/index.js +19 -339
  14. package/esm/loader/Proxy.js +364 -0
  15. package/esm/loader/constant.js +36 -0
  16. package/esm/loader/index.js +23 -0
  17. package/esm/loader/utils/common.js +63 -0
  18. package/esm/loader/utils/debugger.js +15 -0
  19. package/esm/loader/utils/loadSDK.js +92 -0
  20. package/esm/loader/utils/logger.js +59 -0
  21. package/esm/loader/utils/proxyPerformance.js +66 -0
  22. package/esm/main.js +329 -0
  23. package/esm/plugin/component/cashierApp.js +7 -4
  24. package/esm/util/integrationType.js +48 -0
  25. package/esm/util/logger.js +1 -1
  26. package/package.json +7 -1
  27. package/LEGAL.md +0 -6
  28. package/LICENSE +0 -6
  29. package/README.md +0 -49
  30. package/esm/component/channel.d.ts +0 -21
  31. package/esm/component/component.inline.style.d.ts +0 -10
  32. package/esm/component/component.popup.style.d.ts +0 -26
  33. package/esm/component/popupWindow.style.d.ts +0 -24
  34. package/esm/config/index.d.ts +0 -16
  35. package/esm/config/request.d.ts +0 -21
  36. package/esm/constant/easysafepay.d.ts +0 -16
  37. package/esm/constant/index.d.ts +0 -341
  38. package/esm/core/bus/ability/callback.d.ts +0 -9
  39. package/esm/core/bus/ability/security.d.ts +0 -10
  40. package/esm/core/bus/ability/tracker.d.ts +0 -9
  41. package/esm/core/bus/index.d.ts +0 -125
  42. package/esm/core/bus/interface.d.ts +0 -36
  43. package/esm/core/component/address.d.ts +0 -8
  44. package/esm/core/component/appPreloadProcessing.d.ts +0 -1
  45. package/esm/core/component/ckp/index.d.ts +0 -29
  46. package/esm/core/component/element/EventCenter/index.d.ts +0 -31
  47. package/esm/core/component/element/elementContainerService/containerService.d.ts +0 -34
  48. package/esm/core/component/element/elementContainerService/index.d.ts +0 -20
  49. package/esm/core/component/element/elementController/index.d.ts +0 -48
  50. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +0 -20
  51. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +0 -20
  52. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +0 -41
  53. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +0 -22
  54. package/esm/core/component/element/index.d.ts +0 -13
  55. package/esm/core/component/element/mock.d.ts +0 -10
  56. package/esm/core/component/element/type.d.ts +0 -443
  57. package/esm/core/component/element/util.d.ts +0 -85
  58. package/esm/core/component/index.d.ts +0 -58
  59. package/esm/core/drop-in/index.d.ts +0 -22
  60. package/esm/core/instance/index.d.ts +0 -89
  61. package/esm/foundation/core/index.d.ts +0 -36
  62. package/esm/foundation/index.d.ts +0 -97
  63. package/esm/foundation/product-processor/autoDebit/deps.d.ts +0 -14
  64. package/esm/foundation/product-processor/autoDebit/index.d.ts +0 -48
  65. package/esm/foundation/product-processor/easysafepay/deps.d.ts +0 -20
  66. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -29
  67. package/esm/foundation/product-processor/element/index.d.ts +0 -7
  68. package/esm/foundation/service/api-bus/ability/callback.d.ts +0 -9
  69. package/esm/foundation/service/api-bus/ability/globalData.d.ts +0 -10
  70. package/esm/foundation/service/api-bus/ability/request.d.ts +0 -10
  71. package/esm/foundation/service/api-bus/ability/security.d.ts +0 -12
  72. package/esm/foundation/service/api-bus/ability/tracker.d.ts +0 -9
  73. package/esm/foundation/service/api-bus/busManager.d.ts +0 -127
  74. package/esm/foundation/service/api-bus/index.d.ts +0 -20
  75. package/esm/foundation/service/api-bus/interface.d.ts +0 -48
  76. package/esm/foundation/service/container/index.d.ts +0 -41
  77. package/esm/foundation/service/container/popup.d.ts +0 -31
  78. package/esm/foundation/service/container/utils.d.ts +0 -7
  79. package/esm/foundation/service/event-center.d.ts +0 -82
  80. package/esm/foundation/service/global-data/index.d.ts +0 -11
  81. package/esm/foundation/service/index.d.ts +0 -19
  82. package/esm/foundation/service/log/index.d.ts +0 -43
  83. package/esm/foundation/service/log/keys.d.ts +0 -13
  84. package/esm/foundation/service/log/processor.d.ts +0 -9
  85. package/esm/foundation/service/log/types.d.ts +0 -33
  86. package/esm/foundation/service/requester/deps.d.ts +0 -17
  87. package/esm/foundation/service/requester/requester.d.ts +0 -22
  88. package/esm/foundation/service/security/index.d.ts +0 -28
  89. package/esm/foundation/service/security/security.d.ts +0 -33
  90. package/esm/foundation/utils/gray_scale_utils.d.ts +0 -7
  91. package/esm/foundation/utils/payment_context_utils.d.ts +0 -13
  92. package/esm/foundation/utils/payment_product_utils.d.ts +0 -13
  93. package/esm/foundation/utils/preload_helper.d.ts +0 -21
  94. package/esm/foundation/utils/redirect_utils.d.ts +0 -11
  95. package/esm/foundation/utils/system_events.d.ts +0 -4
  96. package/esm/foundation/utils/web_app_url_utils.d.ts +0 -116
  97. package/esm/index.d.ts +0 -54
  98. package/esm/plugin/applepay/component.d.ts +0 -50
  99. package/esm/plugin/applepay/index.d.ts +0 -17
  100. package/esm/plugin/applepay/interface.d.ts +0 -161
  101. package/esm/plugin/applepay/service.d.ts +0 -54
  102. package/esm/plugin/component/cashierApp.d.ts +0 -38
  103. package/esm/plugin/component/channel.d.ts +0 -57
  104. package/esm/plugin/component/component.inline.style.d.ts +0 -10
  105. package/esm/plugin/component/component.popup.style.d.ts +0 -25
  106. package/esm/plugin/component/index.d.ts +0 -133
  107. package/esm/plugin/component/popupWindow.style.d.ts +0 -11
  108. package/esm/plugin/const.d.ts +0 -2
  109. package/esm/plugin/drop-in/index.d.ts +0 -71
  110. package/esm/plugin/payment-element/utils.d.ts +0 -2
  111. package/esm/plugin/paypal/index.d.ts +0 -20
  112. package/esm/plugin/type.d.ts +0 -34
  113. package/esm/plugin/utils.d.ts +0 -6
  114. package/esm/request/index.d.ts +0 -9
  115. package/esm/request/utils.d.ts +0 -28
  116. package/esm/service/index.d.ts +0 -13
  117. package/esm/types/index.d.ts +0 -854
  118. package/esm/util/createIframeNode.d.ts +0 -6
  119. package/esm/util/debug.d.ts +0 -1
  120. package/esm/util/get.d.ts +0 -25
  121. package/esm/util/getBackScheme.d.ts +0 -5
  122. package/esm/util/index.d.ts +0 -61
  123. package/esm/util/intl-callapp/es/browser.d.ts +0 -21
  124. package/esm/util/intl-callapp/es/evoke.d.ts +0 -13
  125. package/esm/util/intl-callapp/es/generate.d.ts +0 -29
  126. package/esm/util/intl-callapp/es/index.d.ts +0 -43
  127. package/esm/util/intl-callapp/es/main.d.ts +0 -41
  128. package/esm/util/intl-callapp/es/openWallet.d.ts +0 -15
  129. package/esm/util/intl-callapp/es/types.d.ts +0 -46
  130. package/esm/util/intl-callapp/es/utils/config.d.ts +0 -24
  131. package/esm/util/intl-callapp/es/utils/index.d.ts +0 -15
  132. package/esm/util/logger.d.ts +0 -64
  133. package/esm/util/mock.d.ts +0 -1
  134. package/esm/util/redirect.d.ts +0 -6
  135. package/esm/util/security.d.ts +0 -34
  136. package/esm/util/spm-map.d.ts +0 -211
  137. package/esm/util/storage.d.ts +0 -2
  138. package/esm/util/upgrade.d.ts +0 -39
  139. package/esm/util/versionCompare.d.ts +0 -15
@@ -0,0 +1,66 @@
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
+ /**
3
+ * 在window对象上记录商户初始化SDK的StartTime,加载结束时间
4
+ * 后续传递给Web应用,用于进行端到端渲染总耗时计算
5
+ * ***/
6
+
7
+ import { ProductSceneEnum } from "../../types";
8
+
9
+ /*** 扩展 Window 接口,添加 _ANTOM_SDK_PROXY_TIME 属性*/
10
+
11
+ /*** 往window对象上注入全局变量 _ANTOM_SDK_PROXY_TIME */
12
+ function injectAntomSDKProxyStartTime() {
13
+ if (typeof window === 'undefined') {
14
+ return;
15
+ }
16
+ if (_typeof(window._ANTOM_SDK_PROXY_TIME) !== 'object') {
17
+ window._ANTOM_SDK_PROXY_TIME = {};
18
+ }
19
+ return window._ANTOM_SDK_PROXY_TIME;
20
+ }
21
+ export function setProxyStartTime(constructorName, startTime) {
22
+ injectAntomSDKProxyStartTime();
23
+ if (_typeof(window._ANTOM_SDK_PROXY_TIME) !== 'object') return startTime;
24
+ var timeObject = window._ANTOM_SDK_PROXY_TIME[constructorName];
25
+ if (_typeof(timeObject) !== 'object') {
26
+ window._ANTOM_SDK_PROXY_TIME[constructorName] = {
27
+ startTime: startTime,
28
+ endTime: 0
29
+ };
30
+ } else {
31
+ timeObject.startTime = startTime;
32
+ }
33
+ return startTime;
34
+ }
35
+ export function setProxyEndTime(constructorName, endTime) {
36
+ if (_typeof(window._ANTOM_SDK_PROXY_TIME) !== 'object') return endTime;
37
+ var timeObject = window._ANTOM_SDK_PROXY_TIME[constructorName];
38
+ if (_typeof(timeObject) !== 'object') {
39
+ window._ANTOM_SDK_PROXY_TIME[constructorName] = {
40
+ startTime: 0,
41
+ endTime: endTime
42
+ };
43
+ } else {
44
+ timeObject.endTime = endTime;
45
+ }
46
+ return endTime;
47
+ }
48
+ export var getProxyCostTime = function getProxyCostTime(productScene) {
49
+ var _window, _window2, _timeObj, _timeObj2;
50
+ var timeObj;
51
+ switch (productScene) {
52
+ case ProductSceneEnum.ELEMENT_PAYMENT:
53
+ timeObj = (_window = window) === null || _window === void 0 || (_window = _window._ANTOM_SDK_PROXY_TIME) === null || _window === void 0 ? void 0 : _window['AMSElement'];
54
+ break;
55
+ case ProductSceneEnum.EASY_PAY:
56
+ timeObj = (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2._ANTOM_SDK_PROXY_TIME) === null || _window2 === void 0 ? void 0 : _window2['AMSEasyPay'];
57
+ break;
58
+ default:
59
+ timeObj = {
60
+ startTime: 0,
61
+ endTime: 0
62
+ };
63
+ break;
64
+ }
65
+ return ((_timeObj = timeObj) === null || _timeObj === void 0 ? void 0 : _timeObj.endTime) - ((_timeObj2 = timeObj) === null || _timeObj2 === void 0 ? void 0 : _timeObj2.startTime) || 0;
66
+ };
package/esm/main.js ADDED
@@ -0,0 +1,329 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ 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; }
9
+ 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; }
10
+ 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; }
11
+ 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); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ 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); }
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
18
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
23
+ /**
24
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
25
+ *
26
+ * 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:
27
+ * 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
28
+ * 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.
29
+ */
30
+ import { ADDRESSElementAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
31
+ import { EVENT } from "./constant";
32
+ import { AddressComponent } from "./core/component/address";
33
+ import { ElementComponent } from "./core/component/element";
34
+ import { AMSComponent } from "./core/component/index";
35
+ import { AntomSDKCore } from "./foundation/core";
36
+ import { AutoDebitProcessor } from "./foundation/product-processor/autoDebit";
37
+ import { EasySafePayProcessor } from "./foundation/product-processor/easysafepay";
38
+ import PreloadHelper from "./foundation/utils/preload_helper";
39
+ import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, PaymentMethodCategoryTypeEnum } from "./types";
40
+ import { ProductSceneEnum } from "./types/index";
41
+ import { LogConfig, Logger } from "./util/logger";
42
+ var logger = new Logger(LogConfig, true);
43
+
44
+ // 全量类型&常量导出
45
+ export { AMSCheckoutPage } from "./core/component/ckp";
46
+ export * from "./types";
47
+ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
48
+ _inherits(AMSCheckout, _AMSComponent);
49
+ var _super = _createSuper(AMSCheckout);
50
+ function AMSCheckout(_options, channelType) {
51
+ var _this;
52
+ var productSceneVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1.0';
53
+ _classCallCheck(this, AMSCheckout);
54
+ _this = _super.call(this, _objectSpread({
55
+ appVersion: AMSCheckoutAppVersion
56
+ }, _options));
57
+ _this.preloadComponent(channelType, productSceneVersion);
58
+ return _this;
59
+ }
60
+ return _createClass(AMSCheckout);
61
+ }(AMSComponent);
62
+ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout) {
63
+ _inherits(AMSAutoDebitPay, _AMSCheckout);
64
+ var _super2 = _createSuper(AMSAutoDebitPay);
65
+ function AMSAutoDebitPay(options) {
66
+ _classCallCheck(this, AMSAutoDebitPay);
67
+ var _options = Object.assign({}, options, {
68
+ product: ProductSceneEnum.AUTO_DEBIT_PAY
69
+ });
70
+ return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
71
+ }
72
+ _createClass(AMSAutoDebitPay, null, [{
73
+ key: "preload",
74
+ value: function preload() {
75
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
76
+ securityRegion: 'SG',
77
+ environment: 'prod'
78
+ };
79
+ PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
80
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT_PAY, options.securityRegion);
81
+ }
82
+ }]);
83
+ return AMSAutoDebitPay;
84
+ }(AMSCheckout);
85
+ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout2) {
86
+ _inherits(AMSCashierPayment, _AMSCheckout2);
87
+ var _super3 = _createSuper(AMSCashierPayment);
88
+ function AMSCashierPayment(options) {
89
+ _classCallCheck(this, AMSCashierPayment);
90
+ var _options = Object.assign({}, options, {
91
+ product: ProductSceneEnum.CASHIER_PAYMENT,
92
+ appVersion: AMSCashierPaymentAppVersion
93
+ });
94
+ var currentChannelType;
95
+ try {
96
+ var previousChannelStr = localStorage.getItem('antom_checkout_previousChannel');
97
+ var previousChannel = JSON.parse(previousChannelStr) || {};
98
+ var _ref = previousChannel || {},
99
+ _ref$channelType = _ref.channelType,
100
+ channelType = _ref$channelType === void 0 ? '' : _ref$channelType;
101
+ if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM, ComponentSignEnum.CASHIER_PAYMENT_BANK].includes(channelType)) {
102
+ currentChannelType = [channelType];
103
+ } else {
104
+ currentChannelType = [ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM];
105
+ }
106
+ } catch (error) {
107
+ logger.logError({
108
+ title: 'performance_optimization_get_previousChannel_error'
109
+ }, {
110
+ errorMessage: error
111
+ });
112
+ }
113
+ return _super3.call(this, _options, currentChannelType);
114
+ }
115
+ _createClass(AMSCashierPayment, null, [{
116
+ key: "preload",
117
+ value: function preload() {
118
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
119
+ securityRegion: 'SG',
120
+ environment: 'prod'
121
+ };
122
+ try {
123
+ var channelTypes;
124
+ var previousChannelStr = localStorage.getItem('antom_checkout_previousChannel');
125
+ var previousChannel = JSON.parse(previousChannelStr) || {};
126
+ var _ref2 = previousChannel || {},
127
+ _ref2$channelType = _ref2.channelType,
128
+ channelType = _ref2$channelType === void 0 ? '' : _ref2$channelType;
129
+ if (ComponentSignEnum.CASHIER_PAYMENT_CARD === channelType) {
130
+ channelTypes = [PaymentMethodCategoryTypeEnum.CARD];
131
+ } else if (ComponentSignEnum.CASHIER_PAYMENT_APM === channelType) {
132
+ channelTypes = [PaymentMethodCategoryTypeEnum.APM];
133
+ } else if (ComponentSignEnum.CASHIER_PAYMENT_BANK === channelType) {
134
+ channelTypes = [PaymentMethodCategoryTypeEnum.BANK];
135
+ } else {
136
+ channelTypes = [PaymentMethodCategoryTypeEnum.CARD, PaymentMethodCategoryTypeEnum.APM];
137
+ }
138
+ var _iterator = _createForOfIteratorHelper(channelTypes),
139
+ _step;
140
+ try {
141
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
142
+ var _channelType = _step.value;
143
+ PreloadHelper.preloadWebApp(ProductSceneEnum.CASHIER_PAYMENT, _channelType, options.environment);
144
+ }
145
+ } catch (err) {
146
+ _iterator.e(err);
147
+ } finally {
148
+ _iterator.f();
149
+ }
150
+ } catch (error) {
151
+ console.error('[web-sdk] preload web app error', error);
152
+ }
153
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.CASHIER_PAYMENT, options.securityRegion);
154
+ }
155
+ }]);
156
+ return AMSCashierPayment;
157
+ }(AMSCheckout);
158
+ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout3) {
159
+ _inherits(AMSVaulting, _AMSCheckout3);
160
+ var _super4 = _createSuper(AMSVaulting);
161
+ function AMSVaulting(options) {
162
+ _classCallCheck(this, AMSVaulting);
163
+ var _options = Object.assign({}, options, {
164
+ product: ProductSceneEnum.VAULTING,
165
+ appVersion: AMSVaultingAppVersion
166
+ });
167
+ return _super4.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
168
+ }
169
+ _createClass(AMSVaulting, null, [{
170
+ key: "preload",
171
+ value: function preload() {
172
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
173
+ securityRegion: 'SG',
174
+ environment: 'prod'
175
+ };
176
+ PreloadHelper.preloadWebApp(ProductSceneEnum.CASHIER_PAYMENT, PaymentMethodCategoryTypeEnum.CARD, options.environment);
177
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.VAULTING, options.securityRegion);
178
+ }
179
+ }]);
180
+ return AMSVaulting;
181
+ }(AMSCheckout);
182
+ export var AntomElement = /*#__PURE__*/function (_AMSCheckout4) {
183
+ _inherits(AntomElement, _AMSCheckout4);
184
+ var _super5 = _createSuper(AntomElement);
185
+ function AntomElement(options) {
186
+ _classCallCheck(this, AntomElement);
187
+ var _options = Object.assign({}, options, {
188
+ product: ProductSceneEnum.ELEMENT_PAYMENT,
189
+ appVersion: AMSPaymentElementAppVersion
190
+ });
191
+ return _super5.call(this, _options, [ComponentSignEnum.ELEMENT_PAYMENT]);
192
+ }
193
+ return _createClass(AntomElement);
194
+ }(AMSCheckout);
195
+ export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
196
+ _inherits(AddressElement, _AddressComponent);
197
+ var _super6 = _createSuper(AddressElement);
198
+ function AddressElement(options) {
199
+ _classCallCheck(this, AddressElement);
200
+ var _options = Object.assign({}, options, {
201
+ product: ProductSceneEnum.ELEMENT_ADDRESS,
202
+ appVersion: ADDRESSElementAppVersion
203
+ });
204
+ return _super6.call(this, _options);
205
+ }
206
+ return _createClass(AddressElement);
207
+ }(AddressComponent);
208
+ export var AMSElement = /*#__PURE__*/function (_ElementComponent) {
209
+ _inherits(AMSElement, _ElementComponent);
210
+ var _super7 = _createSuper(AMSElement);
211
+ function AMSElement(options) {
212
+ _classCallCheck(this, AMSElement);
213
+ var _options = Object.assign({}, options, {
214
+ product: ProductSceneEnum.ELEMENT_PAYMENT,
215
+ environment: options.environment
216
+ });
217
+ return _super7.call(this, _options);
218
+ }
219
+ return _createClass(AMSElement);
220
+ }(ElementComponent);
221
+ export var AMSEasyPay = /*#__PURE__*/function () {
222
+ function AMSEasyPay(options) {
223
+ _classCallCheck(this, AMSEasyPay);
224
+ _defineProperty(this, "core", void 0);
225
+ this.core = new AntomSDKCore();
226
+ this.core.registerProcessor(ProductSceneEnum.EASY_PAY, '', new EasySafePayProcessor());
227
+ this.core.init(options, ProductSceneEnum.EASY_PAY);
228
+ }
229
+ _createClass(AMSEasyPay, [{
230
+ key: "createComponent",
231
+ value: function createComponent(params) {
232
+ this.core.startBizFlow({
233
+ submitPayRequestExtra: {
234
+ notRedirectAfterComplete: params.notRedirectAfterComplete,
235
+ merchantAppointParam: params.merchantAppointParam
236
+ },
237
+ paymentSession: params.sessionData || params.paymentSessionData,
238
+ displayInfo: {
239
+ type: DisplayTypeEnum.popup
240
+ },
241
+ isAppWebview: params.isAppWebview
242
+ });
243
+ }
244
+ }, {
245
+ key: "unmount",
246
+ value: function unmount() {
247
+ this.core.destroy();
248
+ }
249
+ }], [{
250
+ key: "preload",
251
+ value: function preload() {
252
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
253
+ securityRegion: 'SG',
254
+ environment: 'prod'
255
+ };
256
+ PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, options.environment, true);
257
+ }
258
+ }]);
259
+ return AMSEasyPay;
260
+ }();
261
+ export var AMSAutoDebit = /*#__PURE__*/function () {
262
+ function AMSAutoDebit(options) {
263
+ _classCallCheck(this, AMSAutoDebit);
264
+ _defineProperty(this, "core", void 0);
265
+ this.core = new AntomSDKCore();
266
+ this.core.registerProcessor(ProductSceneEnum.AUTO_DEBIT, '', new AutoDebitProcessor());
267
+ this.core.init(options, ProductSceneEnum.AUTO_DEBIT);
268
+ }
269
+ _createClass(AMSAutoDebit, [{
270
+ key: "createComponent",
271
+ value: function () {
272
+ var _createComponent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
273
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
274
+ while (1) switch (_context.prev = _context.next) {
275
+ case 0:
276
+ _context.prev = 0;
277
+ _context.next = 3;
278
+ return this.core.startBizFlow({
279
+ submitPayRequestExtra: {
280
+ notRedirectAfterComplete: params.notRedirectAfterComplete,
281
+ merchantAppointParam: params.merchantAppointParam
282
+ },
283
+ paymentSession: params.sessionData || params.paymentSessionData,
284
+ displayInfo: {
285
+ type: DisplayTypeEnum.popup
286
+ },
287
+ isAppWebview: params.isAppWebview
288
+ });
289
+ case 3:
290
+ _context.next = 9;
291
+ break;
292
+ case 5:
293
+ _context.prev = 5;
294
+ _context.t0 = _context["catch"](0);
295
+ this.core.getServiceProvider().getService('EventCenter').emit(EVENT.eventCallback.name, {
296
+ code: eventCodeEnum.SDK_CREATEPAYMENT_PARAMETER_ERROR,
297
+ message: (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || 'Initialization parameter exception.'
298
+ });
299
+ this.core.destroy();
300
+ case 9:
301
+ case "end":
302
+ return _context.stop();
303
+ }
304
+ }, _callee, this, [[0, 5]]);
305
+ }));
306
+ function createComponent(_x) {
307
+ return _createComponent.apply(this, arguments);
308
+ }
309
+ return createComponent;
310
+ }()
311
+ }, {
312
+ key: "unmount",
313
+ value: function unmount() {
314
+ this.core.destroy();
315
+ }
316
+ }], [{
317
+ key: "preload",
318
+ value: function preload() {
319
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
320
+ securityRegion: 'SG',
321
+ environment: 'prod'
322
+ };
323
+ PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
324
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT, options.securityRegion);
325
+ }
326
+ }]);
327
+ return AMSAutoDebit;
328
+ }();
329
+ export default AMSCheckout;
@@ -15,6 +15,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
15
15
  * 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
16
16
  * 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.
17
17
  */
18
+ import { getProxyCostTime } from "../../loader/utils/proxyPerformance";
18
19
  import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config/index";
19
20
  import { ComponentSignEnum, ComponentSignEnumV2 } from "../../types";
20
21
  import { isDebugLog } from "../../util/debug";
@@ -95,6 +96,7 @@ export var getAppPath = function getAppPath() {
95
96
  }
96
97
  var finalProductSceneVersion = getFinalProductSceneVersion(componentSign, productSceneVersion);
97
98
  // only for test while testurl?host=https://xxxxx.test.html
99
+ // 目前所有的elementProcessor中都会传入elementLink, 理论上Element场景该函数都会在这里直接返回
98
100
  if (elementLink) {
99
101
  return elementLink;
100
102
  }
@@ -103,7 +105,7 @@ export var getAppPath = function getAppPath() {
103
105
  }
104
106
  // 地址应用特殊处理
105
107
  if (componentSign === ComponentSignEnum.ELEMENT_ADDRESS) {
106
- return "".concat(v2AppMarmotMap[environment], "/element-address/").concat(finalAppVersion, "/pages/address/index.html");
108
+ return "".concat(v2AppMarmotMap[environment], "/element-address/pages/address/index.html");
107
109
  }
108
110
  // element应用特殊处理
109
111
  if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
@@ -117,12 +119,12 @@ export var getAppPath = function getAppPath() {
117
119
  }
118
120
  if (isExpressCheckout) {
119
121
  // express_checkout模式走单独映射
120
- return "".concat(v2AppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/express_checkout/index.html");
122
+ return "".concat(v2AppMarmotMap[environment], "/elements/pages/express_checkout/index.html");
121
123
  } else {
122
- return "".concat(v2AppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html");
124
+ return "".concat(v2AppMarmotMap[environment], "/elements/pages/").concat(productScene.toLowerCase(), "/index.html");
123
125
  }
124
126
  }
125
- return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
127
+ return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.html");
126
128
  };
127
129
  export var getAppDomain = function getAppDomain(domainParams) {
128
130
  var environment = domainParams.environment,
@@ -183,6 +185,7 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
183
185
  sdkVersion: sdkVersion,
184
186
  refUrl: window.location.href,
185
187
  _componentStartTime: "".concat(Date.now()),
188
+ _proxyCostTime: "".concat(getProxyCostTime(productScene)),
186
189
  isPreload: isPreload || '',
187
190
  hostSign: hostSign || ''
188
191
  });
@@ -0,0 +1,48 @@
1
+ /**
2
+ * 该文件用来做两件事
3
+ *
4
+ * 1. 在window对象上注入全局变量 _ANTOM_SDK_INTEGRATION_TYPE,标记商户是NPM集成还是CDN集成
5
+ * 2. 埋点上报integrationType
6
+ *
7
+ * ***/
8
+
9
+ import { LogConfig, Logger } from "./logger";
10
+ var logger = new Logger(LogConfig, true);
11
+
12
+ /*** 扩展 Window 接口,添加 _ANTOM_SDK_INTEGRATION_TYPE 属性*/
13
+
14
+ /*** SDK 集成类型枚举*/
15
+
16
+ /*** 往window对象上注入全局变量 _ANTOM_SDK_INTEGRATION_TYPE */
17
+ export function injectAntomSDKIntegrationType(integrationType) {
18
+ // 参数验证
19
+ var validTypes = ['CDN', 'NPM'];
20
+ if (!validTypes.includes(integrationType)) {
21
+ return;
22
+ }
23
+
24
+ // 检查是否在浏览器环境中
25
+ if (typeof window === 'undefined') {
26
+ return;
27
+ }
28
+
29
+ // 由于使用npm集成已接入热更新的产品 ,会加载cdn资源,导致二次注入type为CDN
30
+ // 如果已经注入过,不进行覆盖
31
+ if (validTypes.includes(window._ANTOM_WEB_SDK_INTEGRATION_TYPE)) return;
32
+
33
+ // 注入全局变量
34
+ window._ANTOM_WEB_SDK_INTEGRATION_TYPE = integrationType;
35
+
36
+ // 埋点上报integrationType
37
+ logger.setMedta({
38
+ integrationType: integrationType
39
+ });
40
+ }
41
+
42
+ /**
43
+ * 获取全局变量 _ANTOM_SDK_INTEGRATION_TYPE
44
+ */
45
+ export function getAntomSDKIntegrationType() {
46
+ var _window;
47
+ return (_window = window) === null || _window === void 0 ? void 0 : _window._ANTOM_WEB_SDK_INTEGRATION_TYPE;
48
+ }
@@ -98,7 +98,7 @@ export var Logger = /*#__PURE__*/function () {
98
98
  })
99
99
  });
100
100
  if (this.debug) {
101
- console.log('[web-sdk] Log error', newInfo, newExtra);
101
+ console.log('[web-sdk] Log info', newInfo, newExtra);
102
102
  }
103
103
  this.send();
104
104
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1763539719-dev.0",
3
+ "version": "0.0.1763711027-dev.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",
@@ -9,12 +9,15 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "esm",
12
+ "ams-checkout.js",
12
13
  "LEGAL.md",
13
14
  "LICENSE",
14
15
  "README.md"
15
16
  ],
16
17
  "scripts": {
17
18
  "build": "father build",
19
+ "build:analyze": "ANALYZE=1 father build",
20
+ "build:type": "dts-bundle-generator -o ./types/antom-web-sdk.d.ts ./src/index.ts --no-banner --silent --no-check",
18
21
  "build:w": "father dev",
19
22
  "ci": "tnpm run cov",
20
23
  "cov": "jest --coverage --silent",
@@ -44,6 +47,7 @@
44
47
  },
45
48
  "dependencies": {
46
49
  "axios": "^1.3.4",
50
+ "proxy-polyfill": "^0.3.2",
47
51
  "uuid": "^9.0.0"
48
52
  },
49
53
  "devDependencies": {
@@ -61,6 +65,7 @@
61
65
  "babel-jest": "^29.3.1",
62
66
  "babel-loader": "^9.1.0",
63
67
  "babel-plugin-import": "^1.13.0",
68
+ "dts-bundle-generator": "^6.13.0",
64
69
  "eslint": "^8.56.0",
65
70
  "eslint-plugin-prettier": "^5.1.3",
66
71
  "father": "^4.2.3",
@@ -69,6 +74,7 @@
69
74
  "prettier": "^2.8.4",
70
75
  "prettier-plugin-organize-imports": "^3.2.3",
71
76
  "prettier-plugin-packagejson": "^2.4.5",
77
+ "serve": "^14.2.5",
72
78
  "ts-jest": "^29.0.3",
73
79
  "ts-node": "^10.9.1",
74
80
  "typescript": "^4.9.5"
package/LEGAL.md DELETED
@@ -1,6 +0,0 @@
1
- Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
2
-
3
- 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:
4
-
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
- 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.
package/LICENSE DELETED
@@ -1,6 +0,0 @@
1
- Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
2
-
3
- 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:
4
-
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
- 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.
package/README.md DELETED
@@ -1,49 +0,0 @@
1
- # AMS CHECKOUT
2
-
3
- Use _AMS CHECKOUT_ as an ES module.
4
-
5
- The front-end cashier sdk can be integrated once to quickly access payment methods around the world
6
-
7
- ---
8
-
9
- ## Badges
10
-
11
- [![TNPM version][tnpm-image]][tnpm-url]
12
- [![TNPM downloads][tnpm-downloads-image]][tnpm-url]
13
- ![install-node 18](https://hitu.alipay.com/badge/tnpm?title=install-node&value=18)
14
- 到海兔查看「@alipay/ams-checkout 的 [包信息][tnpm-url]、[产物预览][tnpm-files-url]、[依赖信息][tnpm-deps-url]、[历史版本][tnpm-versions-url]」
15
-
16
- [tnpm-image]: https://hitutwa.antgroup-inc.cn/badge/v/@alipay/ams-checkout
17
- [tnpm-downloads-image]: https://hitutwa.antgroup-inc.cn/badge/tnpm?package=@alipay/ams-checkout
18
- [tnpm-url]: https://hitu.antgroup-inc.cn/package/@alipay/ams-checkout
19
- [tnpm-files-url]: https://hitu.antgroup-inc.cn/package/@alipay/ams-checkout/files
20
- [tnpm-deps-url]: https://hitu.antgroup-inc.cn/package/@alipay/ams-checkout/deps
21
- [tnpm-versions-url]: https://hitu.antgroup-inc.cn/package/@alipay/ams-checkout/versions
22
-
23
- ---
24
-
25
- ## Features
26
-
27
- - Efficient payment method rendering and high quality UI.
28
- - Written in TypeScript with complete define types.
29
-
30
- ## Installation
31
-
32
- Use `npm` to install the @alipay/ams-checkout module:
33
-
34
- ```sh
35
- npm install @alipay/ams-checkout
36
- ```
37
-
38
- ## Usage
39
-
40
- ### `@alipay/ams-checkout`
41
-
42
- ---
43
-
44
- # Legal Disclaimer
45
-
46
- - 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:
47
-
48
- 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
49
- 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.