@alipay/ams-checkout 0.0.1730107332-dev.4 → 0.0.1730441340-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 (127) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +7 -7
  3. package/esm/config/index.js +7 -7
  4. package/esm/constant/index.d.ts +6 -7
  5. package/esm/constant/index.js +80 -11
  6. package/esm/{foundation/service/api-bus → core/bus}/ability/callback.d.ts +2 -2
  7. package/esm/{foundation/service/api-bus → core/bus}/ability/callback.js +1 -1
  8. package/esm/{foundation/service/api-bus → core/bus}/ability/security.d.ts +4 -6
  9. package/esm/{foundation/service/api-bus → core/bus}/ability/security.js +35 -92
  10. package/esm/{foundation/service/api-bus → core/bus}/ability/tracker.d.ts +4 -4
  11. package/esm/{foundation/service/api-bus → core/bus}/ability/tracker.js +3 -6
  12. package/esm/{foundation/service/api-bus/busManager.d.ts → core/bus/index.d.ts} +15 -17
  13. package/esm/{foundation/service/api-bus/busManager.js → core/bus/index.js} +35 -67
  14. package/esm/{foundation/service/api-bus → core/bus}/interface.d.ts +0 -12
  15. package/esm/{foundation/service/api-bus → core/bus}/interface.js +2 -16
  16. package/esm/core/component/address.d.ts +8 -0
  17. package/esm/{foundation/service/api-bus/ability/globalData.js → core/component/address.js} +58 -75
  18. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  19. package/esm/{foundation/service/container/popup.js → core/component/appPreloadProcessing.js} +83 -97
  20. package/esm/core/component/ckp/index.d.ts +27 -0
  21. package/esm/core/component/ckp/index.js +166 -0
  22. package/esm/core/component/index.d.ts +51 -0
  23. package/esm/core/component/index.js +531 -0
  24. package/esm/core/drop-in/index.d.ts +22 -0
  25. package/esm/core/drop-in/index.js +104 -0
  26. package/esm/core/instance/index.d.ts +89 -0
  27. package/esm/core/instance/index.js +499 -0
  28. package/esm/index.d.ts +28 -5
  29. package/esm/index.js +158 -29
  30. package/esm/plugin/applepay/component.d.ts +50 -0
  31. package/esm/plugin/applepay/component.js +339 -0
  32. package/esm/plugin/applepay/index.d.ts +17 -0
  33. package/esm/plugin/applepay/index.js +117 -0
  34. package/esm/plugin/applepay/interface.d.ts +161 -0
  35. package/esm/plugin/applepay/interface.js +69 -0
  36. package/esm/plugin/applepay/service.d.ts +54 -0
  37. package/esm/plugin/applepay/service.js +289 -0
  38. package/esm/plugin/component/cashierApp.d.ts +34 -0
  39. package/esm/plugin/component/cashierApp.js +237 -0
  40. package/esm/{component → plugin/component}/channel.d.ts +4 -3
  41. package/esm/{component → plugin/component}/channel.js +37 -1
  42. package/esm/plugin/component/component.inline.style.d.ts +10 -0
  43. package/esm/{component → plugin/component}/component.inline.style.js +9 -11
  44. package/esm/{component → plugin/component}/component.popup.style.d.ts +6 -15
  45. package/esm/{component → plugin/component}/component.popup.style.js +18 -36
  46. package/esm/plugin/component/index.d.ts +126 -0
  47. package/esm/plugin/component/index.js +1839 -0
  48. package/esm/{component → plugin/component}/popupWindow.style.js +2 -2
  49. package/esm/plugin/const.d.ts +2 -0
  50. package/esm/plugin/const.js +33 -0
  51. package/esm/plugin/drop-in/index.d.ts +71 -0
  52. package/esm/plugin/drop-in/index.js +324 -0
  53. package/esm/plugin/payment-element/utils.d.ts +2 -0
  54. package/esm/plugin/payment-element/utils.js +6 -0
  55. package/esm/plugin/paypal/index.d.ts +20 -0
  56. package/esm/plugin/paypal/index.js +390 -0
  57. package/esm/plugin/type.d.ts +34 -0
  58. package/esm/plugin/utils.d.ts +6 -0
  59. package/esm/plugin/utils.js +21 -0
  60. package/esm/types/index.d.ts +55 -61
  61. package/esm/types/index.js +62 -63
  62. package/esm/util/createIframeNode.d.ts +6 -0
  63. package/esm/util/createIframeNode.js +48 -0
  64. package/esm/util/getBackScheme.d.ts +2 -2
  65. package/esm/util/getBackScheme.js +2 -94
  66. package/esm/util/index.d.ts +11 -1
  67. package/esm/util/index.js +84 -3
  68. package/esm/util/intl-callapp/es/index.js +0 -1
  69. package/esm/{foundation/service/security → util}/security.d.ts +2 -2
  70. package/esm/{foundation/service/security → util}/security.js +3 -3
  71. package/esm/util/ua/index.d.ts +2 -0
  72. package/esm/util/ua/index.js +2 -0
  73. package/esm/util/ua/isAndroid.d.ts +4 -0
  74. package/esm/util/ua/isAndroid.js +7 -0
  75. package/esm/util/ua/isIOS.d.ts +4 -0
  76. package/esm/util/ua/isIOS.js +7 -0
  77. package/package.json +2 -2
  78. package/esm/component/component.inline.style.d.ts +0 -10
  79. package/esm/foundation/core/index.d.ts +0 -26
  80. package/esm/foundation/core/index.js +0 -364
  81. package/esm/foundation/index.d.ts +0 -74
  82. package/esm/foundation/index.js +0 -42
  83. package/esm/foundation/product-processor/easysafepay/deps.d.ts +0 -18
  84. package/esm/foundation/product-processor/easysafepay/deps.js +0 -12
  85. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -27
  86. package/esm/foundation/product-processor/easysafepay/index.js +0 -596
  87. package/esm/foundation/service/api-bus/ability/globalData.d.ts +0 -10
  88. package/esm/foundation/service/api-bus/ability/request.d.ts +0 -10
  89. package/esm/foundation/service/api-bus/ability/request.js +0 -151
  90. package/esm/foundation/service/api-bus/index.d.ts +0 -20
  91. package/esm/foundation/service/api-bus/index.js +0 -88
  92. package/esm/foundation/service/container/index.d.ts +0 -28
  93. package/esm/foundation/service/container/index.js +0 -256
  94. package/esm/foundation/service/container/popup.d.ts +0 -17
  95. package/esm/foundation/service/container/utils.d.ts +0 -7
  96. package/esm/foundation/service/container/utils.js +0 -48
  97. package/esm/foundation/service/event-center.d.ts +0 -74
  98. package/esm/foundation/service/event-center.js +0 -213
  99. package/esm/foundation/service/global-data/index.d.ts +0 -11
  100. package/esm/foundation/service/global-data/index.js +0 -68
  101. package/esm/foundation/service/index.d.ts +0 -19
  102. package/esm/foundation/service/index.js +0 -82
  103. package/esm/foundation/service/log/index.d.ts +0 -43
  104. package/esm/foundation/service/log/index.js +0 -235
  105. package/esm/foundation/service/log/types.d.ts +0 -32
  106. package/esm/foundation/service/requester/deps.d.ts +0 -17
  107. package/esm/foundation/service/requester/deps.js +0 -11
  108. package/esm/foundation/service/requester/requester.d.ts +0 -22
  109. package/esm/foundation/service/requester/requester.js +0 -214
  110. package/esm/foundation/service/security/index.d.ts +0 -28
  111. package/esm/foundation/service/security/index.js +0 -285
  112. package/esm/foundation/types/index.d.ts +0 -4
  113. package/esm/foundation/types/index.js +0 -4
  114. package/esm/foundation/utils/gray_scale_utils.d.ts +0 -7
  115. package/esm/foundation/utils/gray_scale_utils.js +0 -40
  116. package/esm/foundation/utils/payment_context_utils.d.ts +0 -13
  117. package/esm/foundation/utils/payment_context_utils.js +0 -57
  118. package/esm/foundation/utils/payment_product_utils.d.ts +0 -13
  119. package/esm/foundation/utils/payment_product_utils.js +0 -38
  120. package/esm/foundation/utils/redirect_utils.d.ts +0 -6
  121. package/esm/foundation/utils/redirect_utils.js +0 -115
  122. package/esm/foundation/utils/system_events.d.ts +0 -4
  123. package/esm/foundation/utils/system_events.js +0 -71
  124. package/esm/foundation/utils/web_app_url_utils.d.ts +0 -46
  125. package/esm/foundation/utils/web_app_url_utils.js +0 -112
  126. /package/esm/{component → plugin/component}/popupWindow.style.d.ts +0 -0
  127. /package/esm/{foundation/service/log/types.js → plugin/type.js} +0 -0
@@ -1,71 +0,0 @@
1
- import { EVENT } from "../../constant";
2
- import { v4 as uuid } from 'uuid';
3
- export var registerSystemEvents = function registerSystemEvents(eventCenter) {
4
- var handleSubmitForm = function handleSubmitForm(data) {
5
- var attributes = data.attributes;
6
- var _document = document,
7
- body = _document.body;
8
- var form = document.createElement('form');
9
- form.setAttribute('height', '1');
10
- form.setAttribute('width', '1');
11
- Object.keys(attributes.data).forEach(function (key) {
12
- var input = document.createElement('input');
13
- input.setAttribute('type', 'hidden');
14
- input.setAttribute('name', key);
15
- input.setAttribute('value', attributes.data[key]);
16
- form.appendChild(input);
17
- });
18
- form.setAttribute('action', attributes.action);
19
- form.setAttribute('method', 'post');
20
- body.appendChild(form);
21
- setTimeout(function () {
22
- form.submit();
23
- }, 0);
24
- };
25
- var handleHeartBeat = function handleHeartBeat(data) {
26
- // TODO:
27
- };
28
- var handleBeforeSubmit = function handleBeforeSubmit(data) {
29
- if (eventCenter.isExist(EVENT.beforeSubmit.name)) {
30
- eventCenter.emit(EVENT.beforeSubmit.name, data);
31
- return;
32
- }
33
- var eventCallbackId = uuid();
34
- eventCenter.dispatchToApp({
35
- event: EVENT.beforeSubmitDone.name,
36
- eventCallbackId: eventCallbackId,
37
- data: {
38
- result: 'IGNORE'
39
- }
40
- });
41
- };
42
- var handleSendBroadcast = function handleSendBroadcast(data) {
43
- eventCenter.dispatchToApp({
44
- event: EVENT.receiveBroadcast.name,
45
- data: data
46
- });
47
- };
48
- var handleSendMultiAppEventToSdk = function handleSendMultiAppEventToSdk(data) {
49
- eventCenter.dispatchToApp({
50
- event: EVENT.receiveMuitiAppFromSdk.name,
51
- data: data
52
- });
53
- };
54
- eventCenter.listen(EVENT.submitForm.name, handleSubmitForm);
55
- eventCenter.listen(EVENT.appHeartBeat.name, handleHeartBeat);
56
- eventCenter.listen(EVENT.beforeSubmit.name, handleBeforeSubmit);
57
- eventCenter.listen(EVENT.sendBroadcast.name, handleSendBroadcast);
58
- // deprecated
59
- eventCenter.listen(EVENT.sendMuitiAppEventToSdk.name, handleSendMultiAppEventToSdk);
60
- };
61
- export var unRegisterSystemEvents = function unRegisterSystemEvents(eventCenter) {
62
- eventCenter.unlisten(EVENT.submitForm.name);
63
- eventCenter.unlisten(EVENT.appHeartBeat.name);
64
- eventCenter.unlisten(EVENT.beforeSubmit.name);
65
- eventCenter.unlisten(EVENT.sendBroadcast.name);
66
- eventCenter.unlisten(EVENT.sendMuitiAppEventToSdk.name);
67
- };
68
- export var getIframeOrigin = function getIframeOrigin(iframe) {
69
- var url = new URL(iframe.src);
70
- return url.origin;
71
- };
@@ -1,46 +0,0 @@
1
- import { DisplayTypeEnum, PaymentMethodCategoryTypeEnum } from '../../types';
2
- import { SDKMetaData } from '../index';
3
- /**
4
- * Tell the SDK which version of the Web App to load.
5
- * Sent by server inside paymentSession.
6
- */
7
- export interface WebAppMatchConfig {
8
- /**
9
- * SDK support version range, '{minVer}|{maxVer}', such as '1.0.0' or '1.0.0|2.0.0' or '2.0.0'
10
- * If SDK version < maxVer and > minVer, then will use this config entry.
11
- */
12
- v: string;
13
- appVersion: string;
14
- productScene?: string;
15
- platform?: string;
16
- mid?: string;
17
- greyscale?: string;
18
- }
19
- export interface QueryParams {
20
- displayType: DisplayTypeEnum;
21
- locale: string;
22
- instanceId: string;
23
- analyticsEnabled: boolean;
24
- isPreload?: string;
25
- hostSign?: string;
26
- }
27
- export declare const getWebAppUrlInfo: (params: {
28
- environment: string;
29
- sdkMetaData: SDKMetaData;
30
- productSceneVersion: string;
31
- paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
32
- isPreload?: boolean;
33
- query: QueryParams;
34
- }) => {
35
- path: string;
36
- locationSearch: string;
37
- };
38
- export declare const getWebAppUrl: (params: {
39
- environment: string;
40
- sdkMetaData: SDKMetaData;
41
- productSceneVersion: string;
42
- paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
43
- isPreload?: boolean;
44
- query: QueryParams;
45
- }) => string;
46
- export declare const parseWebAppMatchConfig: (extendInfo: string) => WebAppMatchConfig[];
@@ -1,112 +0,0 @@
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 _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; }
3
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
- 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); }
5
- import { ComponentSignEnum } from "../../types";
6
- import { marmotMap } from "../../config";
7
- import { queryParse, serialize } from "../../util";
8
- import { isDebugLog } from "../../util/debug";
9
-
10
- /**
11
- * Tell the SDK which version of the Web App to load.
12
- * Sent by server inside paymentSession.
13
- */
14
-
15
- export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
16
- var environment = params.environment,
17
- sdkMetaData = params.sdkMetaData,
18
- productSceneVersion = params.productSceneVersion,
19
- paymentMethodCategoryType = params.paymentMethodCategoryType,
20
- query = params.query,
21
- isPreload = params.isPreload;
22
- var path = getAppPath(environment, sdkMetaData, productSceneVersion, paymentMethodCategoryType);
23
- var _queryParse = queryParse(),
24
- _sandbox = _queryParse._sandbox,
25
- _light_sandbox = _queryParse._light_sandbox,
26
- _queryParse$requestHo = _queryParse.requestHost,
27
- requestHost = _queryParse$requestHo === void 0 ? '' : _queryParse$requestHo,
28
- _queryParse$groupId = _queryParse.groupId,
29
- groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
30
- LOCAL_MOCK = _queryParse.LOCAL_MOCK,
31
- _displayType = _queryParse._displayType;
32
- var urlParams = {};
33
- for (var key in query) {
34
- urlParams[key] = '' + query[key];
35
- }
36
- // 如果是preload模式,添加一个preload的query参数
37
- if (isPreload) {
38
- urlParams['isPreload'] = 'true';
39
- }
40
- urlParams.appMatched = sdkMetaData.webAppVersion ? 'true' : 'false';
41
- urlParams.sdkVersion = sdkMetaData.sdkVersion;
42
- urlParams.refUrl = window.location.href;
43
- urlParams._componentStartTime = "".concat(Date.now());
44
- if (LOCAL_MOCK) urlParams.LOCAL_MOCK = LOCAL_MOCK;
45
- if (requestHost) urlParams.requestHost = requestHost;
46
- if (groupId) urlParams.groupId = groupId;
47
- if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
48
- if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
49
- if (_displayType) urlParams.displayType = _displayType;
50
- var locationSearch = serialize(urlParams);
51
- if (isDebugLog()) {
52
- console.log('appUpgrade#getIframeUrl#appMatched', urlParams.appMatched);
53
- console.log('appUpgrade#getIframeUrl#url', path, locationSearch);
54
- }
55
- return {
56
- path: path,
57
- locationSearch: locationSearch
58
- };
59
- };
60
- export var getWebAppUrl = function getWebAppUrl(params) {
61
- var info = getWebAppUrlInfo(params);
62
- var webAppUrl;
63
- if (info.path.indexOf('?') !== -1) {
64
- webAppUrl = "".concat(info.path, "&").concat(info.locationSearch);
65
- } else {
66
- webAppUrl = "".concat(info.path, "?").concat(info.locationSearch);
67
- }
68
- return webAppUrl;
69
- };
70
- var getAppPath = function getAppPath() {
71
- var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'prod';
72
- var sdkMetaData = arguments.length > 1 ? arguments[1] : undefined;
73
- var productSceneVersion = arguments.length > 2 ? arguments[2] : undefined;
74
- var paymentMethodCategoryType = arguments.length > 3 ? arguments[3] : undefined;
75
- var _ref = queryParse() || {},
76
- urlTestHost = _ref.host;
77
- // only for test while testurl?host=https://xxxxx.test.html
78
- if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
79
- return urlTestHost;
80
- }
81
- var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
82
- var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
83
- var webAppVersion = sdkMetaData.webAppVersion;
84
- return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.").concat(webAppVersion, ".html");
85
- };
86
- export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo) {
87
- if (!extendInfo) {
88
- return [];
89
- }
90
- try {
91
- var _extendInfoJson$sdkUp;
92
- var extendInfoJson = JSON.parse(extendInfo);
93
- return extendInfoJson === null || extendInfoJson === void 0 || (_extendInfoJson$sdkUp = extendInfoJson.sdkUpgradeInfo) === null || _extendInfoJson$sdkUp === void 0 ? void 0 : _extendInfoJson$sdkUp.versions;
94
- } catch (error) {
95
- console.error('Parse the config for Web app failed#', error);
96
- return [];
97
- }
98
- };
99
- var getValidProductSceneVersion = function getValidProductSceneVersion(productScene, productSceneVer, paymentMethodCategoryType) {
100
- var _supportMapping;
101
- var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']));
102
- var targetVersions = supportMapping[productScene + '_' + paymentMethodCategoryType];
103
- if (!targetVersions) {
104
- return '';
105
- }
106
- // 从左到右,从旧到新
107
- var isSupport = targetVersions.find(function (it) {
108
- return it === productSceneVer;
109
- });
110
- var latestVersion = targetVersions[targetVersions.length - 1];
111
- return isSupport ? productSceneVer : latestVersion;
112
- };