@alipay/ams-checkout 0.0.1723203704-dev.2 → 0.0.1724309103-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 (47) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +0 -1
  3. package/esm/config/index.js +0 -8
  4. package/esm/constant/index.d.ts +1 -10
  5. package/esm/constant/index.js +0 -9
  6. package/esm/core/component/ckp/index.d.ts +27 -0
  7. package/esm/core/component/ckp/index.js +152 -0
  8. package/esm/core/component/index.js +6 -14
  9. package/esm/index.d.ts +2 -12
  10. package/esm/index.js +2 -39
  11. package/esm/plugin/applepay/component.js +1 -1
  12. package/esm/plugin/component/cashierApp.d.ts +3 -3
  13. package/esm/plugin/component/cashierApp.js +3 -29
  14. package/esm/plugin/component/component.inline.style.d.ts +9 -8
  15. package/esm/plugin/component/component.inline.style.js +6 -87
  16. package/esm/plugin/component/component.popup.style.d.ts +0 -1
  17. package/esm/plugin/component/component.popup.style.js +0 -3
  18. package/esm/plugin/component/index.js +47 -59
  19. package/esm/plugin/component/popupWindow.style.d.ts +2 -5
  20. package/esm/plugin/component/popupWindow.style.js +7 -55
  21. package/esm/plugin/paypal/index.js +0 -1
  22. package/esm/plugin/type.d.ts +0 -1
  23. package/esm/types/index.d.ts +4 -11
  24. package/esm/types/index.js +2 -10
  25. package/esm/util/security.d.ts +0 -1
  26. package/esm/util/security.js +1 -1
  27. package/package.json +1 -1
  28. package/esm/core/component/address.d.ts +0 -34
  29. package/esm/core/component/address.js +0 -298
  30. package/esm/core/instance/address.d.ts +0 -76
  31. package/esm/core/instance/address.js +0 -283
  32. package/esm/plugin/address/cashierApp.d.ts +0 -34
  33. package/esm/plugin/address/cashierApp.js +0 -218
  34. package/esm/plugin/address/channel.d.ts +0 -20
  35. package/esm/plugin/address/channel.js +0 -52
  36. package/esm/plugin/address/component.inline.style.d.ts +0 -11
  37. package/esm/plugin/address/component.inline.style.js +0 -38
  38. package/esm/plugin/address/component.popup.style.d.ts +0 -16
  39. package/esm/plugin/address/component.popup.style.js +0 -174
  40. package/esm/plugin/address/index.d.ts +0 -108
  41. package/esm/plugin/address/index.js +0 -862
  42. package/esm/plugin/address/popupWindow.style.d.ts +0 -8
  43. package/esm/plugin/address/popupWindow.style.js +0 -65
  44. package/esm/plugin/payment-element/utils.d.ts +0 -2
  45. package/esm/plugin/payment-element/utils.js +0 -6
  46. package/esm/types/address.d.ts +0 -92
  47. package/esm/types/address.js +0 -7
@@ -1,4 +1,3 @@
1
1
  export declare const marmotMap: Record<string, string>;
2
2
  export declare const marmotConfigMap: Record<string, string>;
3
- export declare const elementAppMarmotMap: Record<string, string>;
4
3
  export declare const sdkVersion: string;
@@ -22,12 +22,4 @@ export var marmotConfigMap = {
22
22
  light_sandbox: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
23
23
  prod: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json'
24
24
  };
25
- export var elementAppMarmotMap = {
26
- dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
27
- sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
28
- pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
29
- sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
30
- light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
31
- prod: 'https://ac.alipay.com/page/antom-web-checkout-v2'
32
- };
33
25
  export var sdkVersion = json.version;
@@ -4,7 +4,7 @@
4
4
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
5
5
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
6
6
  */
7
- import { eventCodeEnum } from '../types';
7
+ import { eventCodeEnum } from "../types";
8
8
  export declare const ERRORMESSAGE: {
9
9
  DOMAIN_NOT_IN_WHITE_LIST: {
10
10
  code: eventCodeEnum;
@@ -167,14 +167,6 @@ export declare const EVENT: {
167
167
  appHeartBeat: {
168
168
  name: string;
169
169
  };
170
- onChange: {
171
- name: string;
172
- uniqueKey: string;
173
- };
174
- onGetValue: {
175
- name: string;
176
- uniqueKey: string;
177
- };
178
170
  };
179
171
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
180
172
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -183,7 +175,6 @@ export declare const COMPONENT_CLOSE_BLOCK_ID = "asm-component-close-block";
183
175
  export declare const COMPONENT_RETENTION_ID = "ams-component-retention";
184
176
  export declare const MOCKUP_ID = "ams-component-mockup";
185
177
  export declare const LOADING_ID = "ams-component-loading";
186
- export declare const POPUPLOADING_ID = "ams-component-popup-loading";
187
178
  export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
188
179
  export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
189
180
  export declare const INLINE_IMG_CLASSNAME = "inline-loading";
@@ -166,14 +166,6 @@ export var EVENT = {
166
166
  },
167
167
  appHeartBeat: {
168
168
  name: 'appHeartBeat'
169
- },
170
- onChange: {
171
- name: 'onChange',
172
- uniqueKey: 'userChange'
173
- },
174
- onGetValue: {
175
- name: 'onAddressResult',
176
- uniqueKey: 'userGetValue'
177
169
  }
178
170
  };
179
171
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -183,7 +175,6 @@ export var COMPONENT_CLOSE_BLOCK_ID = 'asm-component-close-block';
183
175
  export var COMPONENT_RETENTION_ID = 'ams-component-retention';
184
176
  export var MOCKUP_ID = 'ams-component-mockup';
185
177
  export var LOADING_ID = 'ams-component-loading';
186
- export var POPUPLOADING_ID = 'ams-component-popup-loading'; // popup弹窗loading
187
178
  export var LISTENER_PREFIX = '_ams_sdk_component_listener';
188
179
  export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
189
180
  export var INLINE_IMG_CLASSNAME = 'inline-loading';
@@ -0,0 +1,27 @@
1
+ import { IcreateComponent, IoptionsParams } from '../../../types';
2
+ import { Logger } from '../../../util/logger';
3
+ type LOCAL_URL = string;
4
+ export type CKPEmbeddedAppEnv = 'dev' | 'sit' | 'pre' | 'prod';
5
+ export type CKPEmbeddedEventType = 'SDK_PAYMENT_SUCCESSFUL' | 'SDK_PAYMENT_FAIL' | 'SDK_PAYMENT_CANCEL' | 'SDK_PAYMENT_CLICK_BACK_TO_MERCHANT';
6
+ export declare const getCKPPageAddress: (env: IoptionsParams['environment'] | LOCAL_URL) => string;
7
+ export declare class AMSCheckoutPage {
8
+ logger: Logger;
9
+ private _instanceId;
10
+ private originOptions;
11
+ private readonly APP_IFRAME_ID;
12
+ private eventListener?;
13
+ constructor(options: Pick<IoptionsParams, 'environment' | 'locale' | 'onEventCallback'>);
14
+ private generateIframeSrc;
15
+ private eventListenerWrapper;
16
+ private addListener;
17
+ private removeListener;
18
+ /**
19
+ * 挂载组件
20
+ */
21
+ mountComponent(params: Pick<IcreateComponent, 'sessionData'>, selector: string): Promise<void>;
22
+ /**
23
+ * 卸载组件
24
+ */
25
+ unmount(): void;
26
+ }
27
+ export {};
@@ -0,0 +1,152 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ import { v4 as uuid } from 'uuid';
9
+ import { environmentEnum } from "../../../types";
10
+ import { LogConfig, Logger } from "../../../util/logger";
11
+ var CKP_PAYMENT_PAGE_HOST = {
12
+ DEV: 'https://dev.page.alipay.net',
13
+ TEST: 'https://test.page.alipay.net',
14
+ PRE: 'https://pre.ac.alipay.com',
15
+ PROD: 'https://ac.alipay.com'
16
+ };
17
+
18
+ // for local development
19
+
20
+ var CKP_PAGE_ADDRESS = '/page/antom-web-checkout-v2/checkout-page/pages/payment/index.html';
21
+ export var getCKPPageAddress = function getCKPPageAddress(env) {
22
+ switch (env) {
23
+ case 'dev':
24
+ return "".concat(CKP_PAYMENT_PAGE_HOST.DEV).concat(CKP_PAGE_ADDRESS);
25
+ case 'sit':
26
+ return "".concat(CKP_PAYMENT_PAGE_HOST.TEST).concat(CKP_PAGE_ADDRESS);
27
+ case 'pre':
28
+ return "".concat(CKP_PAYMENT_PAGE_HOST.PRE).concat(CKP_PAGE_ADDRESS);
29
+ case 'prod':
30
+ case 'sandbox':
31
+ case 'light_sandbox':
32
+ return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(CKP_PAGE_ADDRESS);
33
+ default:
34
+ // for local development, e.g. http://localhost:5173/checkout-page/src/pages/payment/index.html
35
+ return env;
36
+ }
37
+ };
38
+ export var AMSCheckoutPage = /*#__PURE__*/function () {
39
+ function AMSCheckoutPage(options) {
40
+ var _this = this;
41
+ _classCallCheck(this, AMSCheckoutPage);
42
+ _defineProperty(this, "logger", void 0);
43
+ _defineProperty(this, "_instanceId", void 0);
44
+ _defineProperty(this, "originOptions", void 0);
45
+ _defineProperty(this, "APP_IFRAME_ID", 'antom-checkout-page-sub-page-iframe');
46
+ _defineProperty(this, "eventListener", void 0);
47
+ _defineProperty(this, "generateIframeSrc", function (sessionData) {
48
+ var env = _this.originOptions.environment || 'prod';
49
+ var session = sessionData || '';
50
+ var lang = _this.originOptions.locale || 'en_US';
51
+ var ckpPageAddress = getCKPPageAddress(env);
52
+ console.log('[antom-web-sdk] <antom-checkout-page> generateIframeSrc', _this.originOptions, env, session, lang, ckpPageAddress);
53
+ return "".concat(ckpPageAddress, "?sessionData=").concat(encodeURIComponent(session), "&lang=").concat(lang, "&mode=embed");
54
+ });
55
+ _defineProperty(this, "eventListenerWrapper", function (event) {
56
+ var _ref = JSON.parse(event.data) || {},
57
+ code = _ref.code,
58
+ message = _ref.message,
59
+ result = _ref.result;
60
+ if (code && code.startsWith('SDK_PAYMENT')) {
61
+ var _this$eventListener;
62
+ console.log('[antom-web-sdk] <antom-checkout-page> eventListenerWrapper', event, message, result);
63
+ (_this$eventListener = _this.eventListener) === null || _this$eventListener === void 0 || _this$eventListener.call(_this, {
64
+ code: code,
65
+ message: message,
66
+ result: result
67
+ });
68
+ }
69
+ });
70
+ _defineProperty(this, "addListener", function () {
71
+ window.addEventListener('message', _this.eventListenerWrapper);
72
+ });
73
+ _defineProperty(this, "removeListener", function () {
74
+ window.removeEventListener('message', _this.eventListenerWrapper);
75
+ });
76
+ options.environment = options.environment || environmentEnum.prod;
77
+ this._instanceId = uuid();
78
+ this.originOptions = options;
79
+ this.eventListener = options.onEventCallback;
80
+ this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
81
+ Logger.setInstance(this.logger);
82
+ this.logger.setMedta({
83
+ instanceId: this._instanceId
84
+ });
85
+ this.logger.initTracker();
86
+ this.logger.setComponentStartTime(Date.now());
87
+ this.logger.setTrackId(this._instanceId);
88
+ this.logger.logInfo({
89
+ title: 'NEW_AMSSDK_BY_MECHANT',
90
+ msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale)
91
+ }).send();
92
+ }
93
+ _createClass(AMSCheckoutPage, [{
94
+ key: "mountComponent",
95
+ value:
96
+ /**
97
+ * 挂载组件
98
+ */
99
+ function mountComponent(params, selector) {
100
+ if (params.sessionData === undefined || params.sessionData === '' || typeof params.sessionData !== 'string') {
101
+ this.logger.logError({
102
+ title: 'PARAMS_ERROR_INVALID_SESSION_DATA'
103
+ });
104
+ console.error('[antom-web-sdk] <antom-checkout-page> mountComponent: sessionData is required and must be a string');
105
+ throw new Error('PARAMS_ERROR_INVALID_SESSION_DATA');
106
+ }
107
+ if (document.querySelector(this.APP_IFRAME_ID)) {
108
+ this.logger.logError({
109
+ title: 'PARAMS_ERROR_ALREADY_MOUNTED'
110
+ });
111
+ console.error('[antom-web-sdk] <antom-checkout-page> mountComponent: already mounted, please unmount first');
112
+ throw new Error('PARAMS_ERROR_ALREADY_MOUNTED');
113
+ }
114
+ this.addListener();
115
+ var ckpPageAddress = this.generateIframeSrc(params.sessionData);
116
+ var iframe = document.createElement('iframe');
117
+ iframe.id = this.APP_IFRAME_ID;
118
+ iframe.src = ckpPageAddress;
119
+ iframe.width = '100%';
120
+ iframe.height = '100%';
121
+ iframe.style.border = 'none';
122
+ var wrapper = document.querySelector(selector);
123
+ if (wrapper) {
124
+ wrapper.innerHTML = '';
125
+ wrapper.appendChild(iframe);
126
+ } else {
127
+ this.logger.logError({
128
+ title: 'PARAMS_ERROR_INVALID_SELECTOR'
129
+ });
130
+ console.error('[antom-web-sdk] <antom-checkout-page> mountComponent: invalid selector');
131
+ this.removeListener();
132
+ throw new Error('PARAMS_ERROR_INVALID_SELECTOR');
133
+ }
134
+ return Promise.resolve();
135
+ }
136
+
137
+ /**
138
+ * 卸载组件
139
+ */
140
+ }, {
141
+ key: "unmount",
142
+ value: function unmount() {
143
+ this.removeListener();
144
+ var iframe = document.getElementById(this.APP_IFRAME_ID);
145
+ if (iframe) {
146
+ iframe.remove();
147
+ }
148
+ return;
149
+ }
150
+ }]);
151
+ return AMSCheckoutPage;
152
+ }();
@@ -17,10 +17,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
17
17
  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; }
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  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); }
20
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
23
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
24
20
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
21
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
26
22
  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); }
@@ -40,7 +36,7 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
40
36
  import ComponentApp from "../../plugin/component";
41
37
  import { ExtendPlugin } from "../../plugin/const";
42
38
  import { PaypalBusSubscriber } from "../../plugin/paypal";
43
- import { componentSignEnum, ComponentSignEnumV2, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
39
+ import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
44
40
  import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
45
41
  import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
46
42
  import { getSecurityConfigStorageKey } from "../../util/security";
@@ -57,9 +53,7 @@ export var getComponentSign = function getComponentSign(params) {
57
53
  productScene = _params$paymentSessio3 === void 0 ? '' : _params$paymentSessio3,
58
54
  _params$paymentSessio4 = _params$paymentSessio2.paymentMethodCategoryType,
59
55
  paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
60
- if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType);
61
- if (productScene) return "".concat(productScene);
62
- return componentSignEnum.NONE;
56
+ return productScene && paymentMethodCategoryType ? "".concat(productScene, "_").concat(paymentMethodCategoryType) : componentSignEnum.NONE;
63
57
  };
64
58
  export var parseSessionData = function parseSessionData(sessionData) {
65
59
  try {
@@ -101,12 +95,6 @@ var handleParams = function handleParams(params) {
101
95
  parseData = _handleSessionData2[0],
102
96
  sessionData = _handleSessionData2[1];
103
97
  var componentSign = getComponentSign(parseData);
104
- if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === renderDisplayTypeEnum.popup) {
105
- return Promise.reject({
106
- code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
107
- message: "unsupported payment method"
108
- });
109
- }
110
98
  if (componentSign === componentSignEnum.NONE) {
111
99
  // eslint-disable-next-line prefer-promise-reject-errors
112
100
  return Promise.reject({
@@ -237,6 +225,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
237
225
  localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
238
226
  }
239
227
  }
228
+
240
229
  /**
241
230
  * 初始化 Bus总线的能力
242
231
  */
@@ -298,6 +287,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
298
287
  }
299
288
  });
300
289
  }
290
+
301
291
  /**
302
292
  * To determine whether the corresponding payment method is available,
303
293
  * only the channel described in the document will be called, and it will be returned as available by default
@@ -337,6 +327,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
337
327
  }
338
328
  });
339
329
  }
330
+
340
331
  /**
341
332
  * @description Create component application
342
333
  * @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
@@ -476,6 +467,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
476
467
  this.savePreviousChannel(iframeNodesParams);
477
468
  return this.pluginAppendIframe(appendParams);
478
469
  }
470
+
479
471
  /**
480
472
  * @description Execute payment submission process
481
473
  * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
package/esm/index.d.ts CHANGED
@@ -6,9 +6,8 @@
6
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
7
  */
8
8
  import { AMSComponent } from './core/component/index';
9
- import { AddressComponent } from './core/component/address';
10
- import { IoptionsParams, componentSignEnum } from './types';
11
- import { IoptionsAddressParams } from './types/address';
9
+ import { componentSignEnum, IoptionsParams } from './types';
10
+ export { AMSCheckoutPage } from './core/component/ckp';
12
11
  export * from './types';
13
12
  export declare class AMSCheckout extends AMSComponent {
14
13
  constructor(_options: any, channelType?: componentSignEnum[], productSceneVersion?: string);
@@ -28,13 +27,4 @@ export declare class AMSCashierPayment extends AMSCheckout {
28
27
  export declare class AMSVaulting extends AMSCheckout {
29
28
  constructor(options: IoptionsParams);
30
29
  }
31
- export declare class AntomElement extends AMSCheckout {
32
- constructor(options: IoptionsParams);
33
- }
34
- export declare class Address extends AddressComponent {
35
- constructor(_options: any, channelType?: componentSignEnum[], productSceneVersion?: string);
36
- }
37
- export declare class AddressElement extends Address {
38
- constructor(options: IoptionsAddressParams);
39
- }
40
30
  export default AMSCheckout;
package/esm/index.js CHANGED
@@ -19,11 +19,11 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
19
19
  * 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.
20
20
  */
21
21
  import { AMSComponent } from "./core/component/index";
22
- import { AddressComponent } from "./core/component/address";
23
22
  import { componentSignEnum } from "./types";
24
23
  import { productSceneEnum } from "./types/index";
25
- import { Logger, LogConfig } from "./util/logger";
24
+ import { LogConfig, Logger } from "./util/logger";
26
25
  var logger = new Logger(LogConfig, true);
26
+ export { AMSCheckoutPage } from "./core/component/ckp";
27
27
  export * from "./types";
28
28
  export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
29
29
  _inherits(AMSCheckout, _AMSComponent);
@@ -136,41 +136,4 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout5) {
136
136
  }
137
137
  return _createClass(AMSVaulting);
138
138
  }(AMSCheckout);
139
- export var AntomElement = /*#__PURE__*/function (_AMSCheckout6) {
140
- _inherits(AntomElement, _AMSCheckout6);
141
- var _super7 = _createSuper(AntomElement);
142
- function AntomElement(options) {
143
- _classCallCheck(this, AntomElement);
144
- var _options = Object.assign({}, options, {
145
- product: productSceneEnum.ELEMENT_PAYMENT
146
- });
147
- return _super7.call(this, _options, [componentSignEnum.ELEMENT_PAYMENT]);
148
- }
149
- return _createClass(AntomElement);
150
- }(AMSCheckout);
151
- export var Address = /*#__PURE__*/function (_AddressComponent) {
152
- _inherits(Address, _AddressComponent);
153
- var _super8 = _createSuper(Address);
154
- function Address(_options, channelType) {
155
- var _this2;
156
- var productSceneVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1.0';
157
- _classCallCheck(this, Address);
158
- _this2 = _super8.call(this, _options);
159
- _this2.preloadComponent(channelType, productSceneVersion);
160
- return _this2;
161
- }
162
- return _createClass(Address);
163
- }(AddressComponent);
164
- export var AddressElement = /*#__PURE__*/function (_Address) {
165
- _inherits(AddressElement, _Address);
166
- var _super9 = _createSuper(AddressElement);
167
- function AddressElement(options) {
168
- _classCallCheck(this, AddressElement);
169
- var _options = Object.assign({}, options, {
170
- product: productSceneEnum.ELEMENT_ADDRESS
171
- });
172
- return _super9.call(this, _options, [componentSignEnum.ELEMENT_ADDRESS]);
173
- }
174
- return _createClass(AddressElement);
175
- }(Address);
176
139
  export default AMSCheckout;
@@ -84,7 +84,7 @@ var ApplePayComponent = /*#__PURE__*/function () {
84
84
  }, {
85
85
  biz: 'sdk',
86
86
  type: 'funnel',
87
- success: eventCodeEnum.SDK_PAYMENT_SUCCESSFUL === (state === null || state === void 0 ? void 0 : state.code),
87
+ success: eventCodeEnum.SDK_PAYMENT_FAIL === (state === null || state === void 0 ? void 0 : state.code),
88
88
  code: state === null || state === void 0 ? void 0 : state.code,
89
89
  errorCode: state === null || state === void 0 || (_state$result = state.result) === null || _state$result === void 0 ? void 0 : _state$result.errorCode,
90
90
  errorMessage: state === null || state === void 0 || (_state$result2 = state.result) === null || _state$result2 === void 0 ? void 0 : _state$result2.errorMessage,
@@ -16,13 +16,13 @@ export declare const getIframeUrl: (iframeParams: {
16
16
  productSceneVersion: string;
17
17
  environment: string;
18
18
  appVersion: string;
19
- extendInfo?: string;
20
- locale?: string;
19
+ extendInfo: string;
20
+ locale: string;
21
21
  instanceId: string;
22
22
  renderDisplayType: renderDisplayTypeEnum;
23
23
  isPreload?: string;
24
24
  hostSign?: string;
25
- mid?: string;
25
+ mid: string;
26
26
  }) => {
27
27
  path: string;
28
28
  locationSearch: string;
@@ -1,10 +1,4 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- 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); }
5
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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
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; }
9
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
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); }
@@ -15,8 +9,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
15
9
  * 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
10
  * 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
11
  */
18
- import { elementAppMarmotMap, marmotMap, sdkVersion } from "../../config/index";
19
- import { componentSignEnum, ComponentSignEnumV2 } from "../../types";
12
+ import { marmotMap, sdkVersion } from "../../config/index";
13
+ import { componentSignEnum } from "../../types";
20
14
  import { isDebugLog } from "../../util/debug";
21
15
  import { queryParse, serialize } from "../../util/index";
22
16
  import { Logger } from "../../util/logger";
@@ -58,8 +52,7 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
58
52
  }
59
53
  };
60
54
  var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
61
- var _signSupportMap;
62
- var signSupportMap = (_signSupportMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_signSupportMap, 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(_signSupportMap, componentSignEnum.ELEMENT_ADDRESS, ['1.0']));
55
+ var signSupportMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, 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.CHECKOUT_PAYMENT, ['1.0.0']);
63
56
  var supportProductSceneVersion = signSupportMap[componentSign];
64
57
  // 从左到右,从旧到新
65
58
  var isSupport = supportProductSceneVersion.find(function (it) {
@@ -97,23 +90,6 @@ export var getAppPath = function getAppPath() {
97
90
  if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
98
91
  return urlTestHost;
99
92
  }
100
- // element应用特殊处理
101
- if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
102
- // element又分为express_checkout模式和普通模式, express_checkout 模式在扩展参数是返回expressCheckout=true
103
- var isExpressCheckout = false;
104
- try {
105
- // expressCheckout可能出现string(false) JSON.parse再转一次
106
- isExpressCheckout = JSON.parse(JSON.parse(extendInfo).expressCheckout);
107
- } catch (error) {
108
- // 遇到JSON解析错误,默认false
109
- }
110
- if (isExpressCheckout) {
111
- // express_checkout模式走单独映射
112
- return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/express_checkout/index.html");
113
- } else {
114
- return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html");
115
- }
116
- }
117
93
  return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
118
94
  };
119
95
  export var getAppDomain = function getAppDomain(domainParams) {
@@ -213,8 +189,6 @@ export var createIframe = function createIframe(mode, platform) {
213
189
  iframe.style.border = none;
214
190
  iframe.style.opacity = none;
215
191
  iframe.style.overflow = 'hidden';
216
- // iframe设置支持第三方支付
217
- iframe.allow = 'payment';
218
192
  return iframe;
219
193
  };
220
194
  export var createPreloadIframe = function createPreloadIframe(channelType, version) {
@@ -1,10 +1,11 @@
1
- import { componentSignEnum, platformEnum } from '../../types';
2
- interface Options {
3
- componentSign?: componentSignEnum;
4
- type: 'tabs' | 'Accordion';
5
- isExpressCheckout?: boolean;
6
- }
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 { platformEnum } from '../../types';
7
9
  export declare const inlineComponentAddCss: () => void;
8
- export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum, options: Options) => void;
10
+ export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum) => void;
9
11
  export declare const createInlineBaseElement: (selector: string) => HTMLDivElement;
10
- export {};