@alipay/ams-checkout 0.0.1729593469-dev.0 → 0.0.1730107332-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 (126) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/{plugin/component → component}/channel.d.ts +3 -4
  3. package/esm/{plugin/component → component}/channel.js +1 -37
  4. package/esm/component/component.inline.style.d.ts +10 -0
  5. package/esm/{plugin/component → component}/component.inline.style.js +11 -9
  6. package/esm/{plugin/component → component}/component.popup.style.d.ts +15 -6
  7. package/esm/{plugin/component → component}/component.popup.style.js +36 -18
  8. package/esm/{plugin/component → component}/popupWindow.style.js +2 -2
  9. package/esm/config/index.d.ts +7 -7
  10. package/esm/config/index.js +7 -7
  11. package/esm/constant/index.d.ts +7 -6
  12. package/esm/constant/index.js +11 -80
  13. package/esm/foundation/core/index.d.ts +26 -0
  14. package/esm/foundation/core/index.js +335 -0
  15. package/esm/foundation/index.d.ts +71 -0
  16. package/esm/foundation/index.js +42 -0
  17. package/esm/foundation/product-processor/easysafepay/deps.d.ts +17 -0
  18. package/esm/foundation/product-processor/easysafepay/deps.js +11 -0
  19. package/esm/foundation/product-processor/easysafepay/index.d.ts +27 -0
  20. package/esm/foundation/product-processor/easysafepay/index.js +581 -0
  21. package/esm/{core/bus → foundation/service/api-bus}/ability/callback.d.ts +2 -2
  22. package/esm/{core/bus → foundation/service/api-bus}/ability/callback.js +1 -1
  23. package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
  24. package/esm/{core/component/address.js → foundation/service/api-bus/ability/globalData.js} +75 -58
  25. package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
  26. package/esm/foundation/service/api-bus/ability/request.js +151 -0
  27. package/esm/{core/bus → foundation/service/api-bus}/ability/security.d.ts +6 -4
  28. package/esm/{core/bus → foundation/service/api-bus}/ability/security.js +92 -35
  29. package/esm/{core/bus → foundation/service/api-bus}/ability/tracker.d.ts +4 -4
  30. package/esm/{core/bus → foundation/service/api-bus}/ability/tracker.js +6 -3
  31. package/esm/{core/bus/index.d.ts → foundation/service/api-bus/busManager.d.ts} +17 -15
  32. package/esm/{core/bus/index.js → foundation/service/api-bus/busManager.js} +67 -35
  33. package/esm/foundation/service/api-bus/index.d.ts +20 -0
  34. package/esm/foundation/service/api-bus/index.js +88 -0
  35. package/esm/{core/bus → foundation/service/api-bus}/interface.d.ts +12 -0
  36. package/esm/{core/bus → foundation/service/api-bus}/interface.js +16 -2
  37. package/esm/foundation/service/container/index.d.ts +28 -0
  38. package/esm/foundation/service/container/index.js +257 -0
  39. package/esm/foundation/service/container/popup.d.ts +17 -0
  40. package/esm/{core/component/appPreloadProcessing.js → foundation/service/container/popup.js} +97 -83
  41. package/esm/foundation/service/container/utils.d.ts +7 -0
  42. package/esm/foundation/service/container/utils.js +48 -0
  43. package/esm/foundation/service/event-center.d.ts +74 -0
  44. package/esm/foundation/service/event-center.js +213 -0
  45. package/esm/foundation/service/global-data/index.d.ts +11 -0
  46. package/esm/foundation/service/global-data/index.js +68 -0
  47. package/esm/foundation/service/index.d.ts +19 -0
  48. package/esm/foundation/service/index.js +82 -0
  49. package/esm/foundation/service/log/index.d.ts +43 -0
  50. package/esm/foundation/service/log/index.js +235 -0
  51. package/esm/foundation/service/log/types.d.ts +32 -0
  52. package/esm/foundation/service/requester/deps.d.ts +17 -0
  53. package/esm/foundation/service/requester/deps.js +11 -0
  54. package/esm/foundation/service/requester/requester.d.ts +22 -0
  55. package/esm/foundation/service/requester/requester.js +214 -0
  56. package/esm/foundation/service/security/index.d.ts +28 -0
  57. package/esm/foundation/service/security/index.js +285 -0
  58. package/esm/{util → foundation/service/security}/security.d.ts +2 -2
  59. package/esm/{util → foundation/service/security}/security.js +3 -3
  60. package/esm/foundation/types/index.d.ts +4 -0
  61. package/esm/foundation/types/index.js +4 -0
  62. package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
  63. package/esm/foundation/utils/gray_scale_utils.js +40 -0
  64. package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
  65. package/esm/foundation/utils/payment_context_utils.js +57 -0
  66. package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
  67. package/esm/foundation/utils/payment_product_utils.js +38 -0
  68. package/esm/foundation/utils/redirect_utils.d.ts +6 -0
  69. package/esm/foundation/utils/redirect_utils.js +99 -0
  70. package/esm/foundation/utils/system_events.d.ts +4 -0
  71. package/esm/foundation/utils/system_events.js +71 -0
  72. package/esm/foundation/utils/web_app_url_utils.d.ts +46 -0
  73. package/esm/foundation/utils/web_app_url_utils.js +112 -0
  74. package/esm/index.d.ts +5 -28
  75. package/esm/index.js +28 -158
  76. package/esm/types/index.d.ts +66 -38
  77. package/esm/types/index.js +63 -59
  78. package/esm/util/index.d.ts +1 -1
  79. package/esm/util/index.js +3 -4
  80. package/package.json +2 -2
  81. package/esm/core/component/address.d.ts +0 -8
  82. package/esm/core/component/appPreloadProcessing.d.ts +0 -1
  83. package/esm/core/component/ckp/index.d.ts +0 -27
  84. package/esm/core/component/ckp/index.js +0 -166
  85. package/esm/core/component/index.d.ts +0 -51
  86. package/esm/core/component/index.js +0 -531
  87. package/esm/core/drop-in/index.d.ts +0 -22
  88. package/esm/core/drop-in/index.js +0 -104
  89. package/esm/core/instance/index.d.ts +0 -89
  90. package/esm/core/instance/index.js +0 -499
  91. package/esm/plugin/applepay/component.d.ts +0 -50
  92. package/esm/plugin/applepay/component.js +0 -339
  93. package/esm/plugin/applepay/index.d.ts +0 -17
  94. package/esm/plugin/applepay/index.js +0 -117
  95. package/esm/plugin/applepay/interface.d.ts +0 -161
  96. package/esm/plugin/applepay/interface.js +0 -69
  97. package/esm/plugin/applepay/service.d.ts +0 -54
  98. package/esm/plugin/applepay/service.js +0 -289
  99. package/esm/plugin/component/cashierApp.d.ts +0 -34
  100. package/esm/plugin/component/cashierApp.js +0 -237
  101. package/esm/plugin/component/component.inline.style.d.ts +0 -10
  102. package/esm/plugin/component/index.d.ts +0 -126
  103. package/esm/plugin/component/index.js +0 -1839
  104. package/esm/plugin/const.d.ts +0 -2
  105. package/esm/plugin/const.js +0 -33
  106. package/esm/plugin/drop-in/index.d.ts +0 -71
  107. package/esm/plugin/drop-in/index.js +0 -324
  108. package/esm/plugin/payment-element/utils.d.ts +0 -2
  109. package/esm/plugin/payment-element/utils.js +0 -6
  110. package/esm/plugin/paypal/index.d.ts +0 -20
  111. package/esm/plugin/paypal/index.js +0 -390
  112. package/esm/plugin/type.d.ts +0 -34
  113. package/esm/plugin/utils.d.ts +0 -6
  114. package/esm/plugin/utils.js +0 -21
  115. package/esm/util/createIframeNode.d.ts +0 -6
  116. package/esm/util/createIframeNode.js +0 -48
  117. package/esm/util/getBackScheme.d.ts +0 -5
  118. package/esm/util/getBackScheme.js +0 -42
  119. package/esm/util/ua/index.d.ts +0 -2
  120. package/esm/util/ua/index.js +0 -2
  121. package/esm/util/ua/isAndroid.d.ts +0 -4
  122. package/esm/util/ua/isAndroid.js +0 -7
  123. package/esm/util/ua/isIOS.d.ts +0 -4
  124. package/esm/util/ua/isIOS.js +0 -7
  125. /package/esm/{plugin/component → component}/popupWindow.style.d.ts +0 -0
  126. /package/esm/{plugin/type.js → foundation/service/log/types.js} +0 -0
@@ -1,104 +0,0 @@
1
- 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; } } }; }
2
- 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); }
3
- 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; }
4
- /**
5
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
6
- *
7
- * 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:
8
- * 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
9
- * 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.
10
- */
11
- /* eslint-disable @typescript-eslint/no-explicit-any */
12
- import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
13
- import CheckoutApp from "../../plugin/drop-in";
14
- import { messageName, networkModeEnum } from "../../types";
15
- import { createIframeNode } from "../../util/createIframeNode";
16
- export var mixinDropInConstructor = function mixinDropInConstructor(options, context) {
17
- // Instantiate the plug-in and set render
18
- var checkoutPlugin = new CheckoutApp();
19
- checkoutPlugin.setRender(createIframeNode);
20
- // Register Cashier Application Plug in
21
- context._registerPlugin(BASEPLUGINID, checkoutPlugin);
22
- context._subscribeFromCheckoutPlugin();
23
- };
24
-
25
- /**
26
- * @description Create checkout application
27
- * @description drop-in
28
- */
29
- export var createPayment = function createPayment(params) {
30
- var _this = this;
31
- if (this.options.networkMode === networkModeEnum.proxy) {
32
- return new Promise(function (resolve, reject) {
33
- try {
34
- var checkoutApp = _this._getPlugin(BASEPLUGINID);
35
- resolve(checkoutApp.render(params));
36
- } catch (error) {
37
- reject(error);
38
- }
39
- });
40
- } else {
41
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
42
- return Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT);
43
- }
44
- };
45
- /**
46
- * @description Take action on the interface result of payment submission
47
- * @description drop-in
48
- */
49
- export var confirmPayment = function confirmPayment(result) {
50
- var _this2 = this;
51
- return new Promise(function (resolve, reject) {
52
- _this2.eventCenter.once('onRedirect', function (payload) {
53
- _this2._redirect(payload).then(function () {
54
- resolve();
55
- }).catch(function (err) {
56
- reject(err);
57
- });
58
- });
59
- _this2.eventCenter.emit("".concat(BASEPLUGINID, "-handleRequestPayment"), {
60
- name: messageName.SDK_TO_APP,
61
- mode: _this2.options.mode,
62
- appId: BASEPLUGINID,
63
- instanceId: _this2._instanceId,
64
- context: {
65
- event: 'handleRequestPayment',
66
- data: result
67
- }
68
- });
69
- });
70
- };
71
- /**
72
- * @description Subscribe to the message of the cashier application plug-in
73
- */
74
- export var _subscribeFromCheckoutPlugin = function _subscribeFromCheckoutPlugin() {
75
- var _this3 = this;
76
- var eventKeyMap = new Map([[EVENT.error.name, function (payload) {
77
- _this3.eventCenter.emit(EVENT.error.name, payload.context.data);
78
- }], [EVENT.ready.name, function (payload) {
79
- _this3.eventCenter.emit(EVENT.ready.name, payload.context.data);
80
- }], [EVENT.redirect.name, function (payload) {
81
- _this3.eventCenter.emit(EVENT.redirect.name, payload.context.data);
82
- }], [EVENT.paymentMethodSelected.name, function (payload) {
83
- _this3.checkoutState.paymentMethodType = payload.context.data.paymentMethodType;
84
- _this3.eventCenter.emit(EVENT.paymentMethodSelected.name, {
85
- paymentMethodType: payload.context.data.paymentMethodType
86
- });
87
- }], [EVENT.sizeChanged.name, function (payload) {
88
- _this3.eventCenter.emit(EVENT.sizeChanged.name, payload.context.data);
89
- }], [EVENT.log.name, function (payload) {
90
- _this3.eventCenter.emit(EVENT.log.name, payload.context.data);
91
- }]]);
92
- var _iterator = _createForOfIteratorHelper(eventKeyMap.keys()),
93
- _step;
94
- try {
95
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
96
- var key = _step.value;
97
- this.eventCenter.on("".concat(BASEPLUGINID, "-").concat(key), eventKeyMap.get(key));
98
- }
99
- } catch (err) {
100
- _iterator.e(err);
101
- } finally {
102
- _iterator.f();
103
- }
104
- };
@@ -1,89 +0,0 @@
1
- /**
2
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
- *
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:
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.
7
- */
8
- import { ComponentActionNamesType } from 'src/plugin/type';
9
- import ComponentApp from '../../plugin/component';
10
- import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig, IoptionsParams } from '../../types/index';
11
- import { EventCenter } from '../../util/index';
12
- import { Logger } from '../../util/logger';
13
- import { Security } from '../../util/security';
14
- export default class AMSSDK {
15
- options: AMSCheckoutOptions;
16
- originOptions: IoptionsParams;
17
- logger: Logger;
18
- _eventCenter: EventCenter;
19
- _instanceId: string;
20
- _storageId: string;
21
- _appendParams: IAppendParams;
22
- _componentApp: ComponentApp;
23
- protected securitySdkMap: Map<string, Security>;
24
- protected plugins: Map<string, any>;
25
- constructor(options: IoptionsParams);
26
- private preInitSecurity;
27
- /**
28
- * @description Destroy and process some contents of the plug-in
29
- */
30
- unmount(): void;
31
- /**
32
- * @description init security SDK
33
- * @param product Product Scenarios
34
- * @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
35
- */
36
- initSecurity({ product, scene, }: InitSecurityConfig & {
37
- scene?: string;
38
- }): void;
39
- /**
40
- * @description Obtain security SDK through scenario identification
41
- */
42
- _getSecuritySDKByProductScene(securityConfig: InitSecurityConfig): Security;
43
- /**
44
- * @description New security SDK through scenario identification
45
- */
46
- _newSecuritySDKByScene(securityConfig: InitSecurityConfig, successCallback?: () => void, failCallback?: (errMsg?: string) => void): Security;
47
- /**
48
- * @description Obtain risk control configuration in local storage
49
- */
50
- private getSecurityConfigStorage;
51
- /**
52
- * @description Set the sdk basic configuration
53
- */
54
- private _setOptions;
55
- /**
56
- * @description Set environment variables
57
- */
58
- private _setEnv;
59
- /**
60
- * @description Set UI and Network Mode
61
- */
62
- private _setMode;
63
- /**
64
- * @description Initialize event related tasks
65
- */
66
- private _initEvent;
67
- /**
68
- * @description Register plug-in
69
- */
70
- protected _registerPlugin(pluginId: string, plugin: any): void;
71
- /**
72
- * @description Get Plug-in
73
- */
74
- protected _getPlugin(pluginId: string): any;
75
- /**
76
- * @description Execute to open app or jump link
77
- */
78
- _redirect(data: {
79
- normalUrl?: string;
80
- schemeUrl?: string;
81
- applinkUrl?: string;
82
- callAppJudgeTime?: number;
83
- }): Promise<void>;
84
- /**
85
- * @description Overlay Subscription
86
- */
87
- protected _overrideSubscription(name: string, func: any, funcKey: string): void;
88
- protected getBusActionNames(): ComponentActionNamesType;
89
- }