@alipay/ams-checkout 1.3.2 → 1.5.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 (40) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +1 -15
  3. package/esm/config/index.js +9 -62
  4. package/esm/config/request.d.ts +21 -0
  5. package/esm/config/request.js +67 -0
  6. package/esm/constant/index.d.ts +54 -32
  7. package/esm/constant/index.js +54 -32
  8. package/esm/core/component/index.d.ts +23 -9
  9. package/esm/core/component/index.js +161 -98
  10. package/esm/core/drop-in/index.d.ts +4 -4
  11. package/esm/core/drop-in/index.js +3 -3
  12. package/esm/core/instance/index.d.ts +6 -23
  13. package/esm/core/instance/index.js +31 -75
  14. package/esm/image/skeleton.svg +18 -0
  15. package/esm/index.d.ts +4 -10
  16. package/esm/index.js +8 -30
  17. package/esm/plugin/component/cashierApp.d.ts +5 -6
  18. package/esm/plugin/component/cashierApp.js +48 -64
  19. package/esm/plugin/component/{component.style.d.ts → component.inline.style.d.ts} +4 -1
  20. package/esm/plugin/component/component.inline.style.js +38 -0
  21. package/esm/plugin/component/component.popup.style.d.ts +12 -0
  22. package/esm/plugin/component/component.popup.style.js +163 -0
  23. package/esm/plugin/component/index.d.ts +30 -33
  24. package/esm/plugin/component/index.js +248 -349
  25. package/esm/plugin/drop-in/index.d.ts +3 -5
  26. package/esm/plugin/drop-in/index.js +3 -3
  27. package/esm/request/index.d.ts +2 -2
  28. package/esm/request/index.js +8 -7
  29. package/esm/request/utils.d.ts +3 -3
  30. package/esm/request/utils.js +4 -4
  31. package/esm/service/index.d.ts +2 -2
  32. package/esm/types/index.d.ts +96 -37
  33. package/esm/types/index.js +92 -52
  34. package/esm/util/createIframeNode.d.ts +3 -3
  35. package/esm/util/createIframeNode.js +8 -8
  36. package/esm/util/index.d.ts +6 -4
  37. package/esm/util/index.js +22 -5
  38. package/esm/util/mock.js +1 -2
  39. package/package.json +1 -1
  40. package/esm/plugin/component/component.style.js +0 -15
@@ -1,5 +1,5 @@
1
1
  import type AMSCheckout from '../../core/instance';
2
- import type { createPaymentParams, eventPlayload } from '../../types';
2
+ import type { IcreatePaymentParams, eventPlayload } from '../../types';
3
3
  export default class CheckoutApp {
4
4
  app: any;
5
5
  paymentMethodsResult: any;
@@ -16,13 +16,11 @@ export default class CheckoutApp {
16
16
  /**
17
17
  * @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
18
18
  */
19
- setRender(createIframeNode: (context: CheckoutApp, renderParams: {
20
- selector: string | HTMLElement;
21
- }) => Promise<void>): void;
19
+ setRender(createIframeNode: any): void;
22
20
  /**
23
21
  * @description High order function of rendering capability
24
22
  */
25
- render(renderParams: createPaymentParams): Promise<void>;
23
+ render(renderParams: IcreatePaymentParams): Promise<void>;
26
24
  /**
27
25
  * @description Cancel listening and destroy the dom
28
26
  */
@@ -185,7 +185,7 @@ var CheckoutApp = /*#__PURE__*/function () {
185
185
  id = 'checkout-dropin';
186
186
  break;
187
187
  case 'COMPONENT':
188
- id = 'checkout-component';
188
+ id = 'ams-checkout-component';
189
189
  break;
190
190
  }
191
191
  return id;
@@ -264,7 +264,7 @@ var CheckoutApp = /*#__PURE__*/function () {
264
264
  appId: BASEPLUGINID,
265
265
  instanceId: this.AMSSDK._instanceId
266
266
  }, data);
267
- this.AMSSDK.eventCenter.emit("".concat(BASEPLUGINID, "-").concat(data.context.event), _data);
267
+ this.AMSSDK._eventCenter.emit("".concat(BASEPLUGINID, "-").concat(data.context.event), _data);
268
268
  }
269
269
  /**
270
270
  * @description Send message to iframe
@@ -288,7 +288,7 @@ var CheckoutApp = /*#__PURE__*/function () {
288
288
  for (var key in eventKeyMap) {
289
289
  // eslint-disable-next-line no-prototype-builtins
290
290
  if (eventKeyMap.hasOwnProperty(key)) {
291
- this.AMSSDK.eventCenter.on("".concat(BASEPLUGINID, "-").concat(key), eventKeyMap[key].bind(this));
291
+ this.AMSSDK._eventCenter.on("".concat(BASEPLUGINID, "-").concat(key), eventKeyMap[key].bind(this));
292
292
  }
293
293
  }
294
294
  }
@@ -5,11 +5,11 @@
5
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
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
- import { RequestConfig } from '../types';
8
+ import { IrequestConfig } from '../types';
9
9
  /**
10
10
  *
11
11
  * @param requestData 请求参数
12
12
  * @param options 请求配置
13
13
  * @example request({ name: 'test' }, { operation-type: 'xxx.xxx.xxx' })
14
14
  */
15
- export declare function request(requestData: Record<string, any> | undefined, options: RequestConfig): Promise<any>;
15
+ export declare function request<T>(requestData: Record<string, any> | undefined, options: IrequestConfig): Promise<T>;
@@ -15,8 +15,9 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
15
15
  * 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.
16
16
  */
17
17
 
18
- import { appId, hostSignMap, lightSandboxMap, requestHost, sdkVersion, sofaId, tntInstId } from "../config";
19
- import { ERROR } from "../types";
18
+ import { sdkVersion } from "../config/index";
19
+ import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
20
+ import { errorEnum } from "../types";
20
21
  import { get } from "../util/get";
21
22
  import axios from 'axios';
22
23
  import { device, fomatGetwayError, isPC, queryParse, safeJson } from "../util";
@@ -76,7 +77,7 @@ function _request() {
76
77
  browserUserAgent: navigator.userAgent,
77
78
  browserColorDepth: screen.colorDepth
78
79
  },
79
- locale: window._amsSdkLanguage || 'en_US',
80
+ locale: options.locale || 'en_US',
80
81
  deviceLanguage: navigator.language,
81
82
  screenWidth: screen.width,
82
83
  screenHeight: screen.height,
@@ -124,16 +125,16 @@ function _request() {
124
125
  console.log('request error', _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message);
125
126
  _error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
126
127
  success: false,
127
- errorCode: ERROR.SYSTEM,
128
+ errorCode: errorEnum.SYSTEM,
128
129
  errorMessage: ''
129
130
  });
130
- timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? ERROR.TIMEOUT : '';
131
+ timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
131
132
  errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
132
- return _context.abrupt("return", {
133
+ return _context.abrupt("return", Promise.reject({
133
134
  success: false,
134
135
  errorCode: errorCode,
135
136
  errorMessage: ''
136
- });
137
+ }));
137
138
  case 28:
138
139
  case "end":
139
140
  return _context.stop();
@@ -5,19 +5,19 @@
5
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
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
- import { ERROR } from '../types';
8
+ import { errorEnum } from '../types';
9
9
  export declare const safeJson: (data: any, obj: any) => any;
10
10
  export declare const fomatGetwayError: (headers: Record<string, any>, traceId: string) => {
11
11
  success: boolean;
12
12
  traceId: string;
13
- errorCode: ERROR;
13
+ errorCode: errorEnum;
14
14
  resultStatus: any;
15
15
  errorMessage?: undefined;
16
16
  result?: undefined;
17
17
  } | {
18
18
  success: boolean;
19
19
  traceId: string;
20
- errorCode: ERROR;
20
+ errorCode: errorEnum;
21
21
  errorMessage: string;
22
22
  result: {
23
23
  resultStatus: any;
@@ -6,7 +6,7 @@
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
 
9
- import { ERROR } from "../types";
9
+ import { errorEnum } from "../types";
10
10
  import { get } from "../util/get";
11
11
  export var safeJson = function safeJson(data, obj) {
12
12
  try {
@@ -26,7 +26,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
26
26
  return {
27
27
  success: false,
28
28
  traceId: traceId,
29
- errorCode: ERROR.LOGIN,
29
+ errorCode: errorEnum.LOGIN,
30
30
  resultStatus: resultStatus
31
31
  };
32
32
  }
@@ -35,7 +35,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
35
35
  return {
36
36
  success: false,
37
37
  traceId: traceId,
38
- errorCode: ERROR.TIMEOUT,
38
+ errorCode: errorEnum.TIMEOUT,
39
39
  resultStatus: resultStatus
40
40
  };
41
41
  }
@@ -45,7 +45,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
45
45
  return {
46
46
  success: false,
47
47
  traceId: traceId,
48
- errorCode: ERROR.GATEWAY,
48
+ errorCode: errorEnum.GATEWAY,
49
49
  errorMessage: decodeURIComponent(tips || ''),
50
50
  result: {
51
51
  resultStatus: resultStatus || '',
@@ -1,2 +1,2 @@
1
- import { CashierSdkActionQueryRequest, RequestConfig } from '../types';
2
- export declare function queryPaymentInfo(params?: CashierSdkActionQueryRequest, options?: RequestConfig): Promise<any>;
1
+ import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, IrequestConfig } from '../types';
2
+ export declare function queryPaymentInfo(params?: CashierSdkActionQueryRequest, options?: IrequestConfig): Promise<CashierSdkActionQueryResult>;
@@ -8,35 +8,41 @@
8
8
  /**
9
9
  * SDK options
10
10
  */
11
- export interface optionsParams {
11
+ export interface IoptionsParams {
12
12
  environment?: string;
13
13
  locale?: string;
14
- onReady?: any;
15
14
  onError?: callOnError;
16
15
  onSizeChanged?: callOnSizeChanged;
17
16
  onPaymentMethodSelected?: callonPaymentMethodSelected;
18
17
  onLog?: callOnLog;
19
- onEventCallback?: (state: any) => void;
20
- onClose?: () => void;
18
+ onEventCallback?: callOnEventCallback;
19
+ onClose?: callOnClose;
21
20
  networkMode?: string;
22
21
  mode?: string;
23
22
  analytics?: {
24
23
  enabled: boolean;
25
24
  };
26
25
  }
27
- export interface createPaymentParams {
26
+ export type Iselector = string;
27
+ export declare enum renderDisplayTypeEnum {
28
+ 'popup' = "popup",
29
+ 'inline' = "inline"
30
+ }
31
+ export interface IcreatePaymentParams {
28
32
  paymentMethodsResult?: any;
29
33
  paymentSessionData?: string;
30
- selector: string | HTMLElement;
34
+ selector: Iselector;
31
35
  appearance?: {
32
- displayType?: checkoutDisplay;
36
+ displayType?: checkoutDisplayEnum;
33
37
  backgroundColor?: string;
34
38
  };
35
39
  }
36
- export declare enum componentNameEnum {
37
- 'card' = "card",
38
- 'easyPay' = "easyPay",
39
- 'autoDebit' = "autoDebit"
40
+ export declare enum componentSignEnum {
41
+ 'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
42
+ 'CASHIER_PAYMENT_CARD' = "CASHIER_PAYMENT_CARD",
43
+ 'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
44
+ 'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
45
+ 'NONE' = "NONE"
40
46
  }
41
47
  export declare enum productSceneEnum {
42
48
  'EASY_PAY' = "EASY_PAY",
@@ -45,15 +51,17 @@ export declare enum productSceneEnum {
45
51
  }
46
52
  export declare enum paymentMethodCategoryTypeEnum {
47
53
  'CARD' = "CARD",
48
- 'WALLET' = "WALLET"
54
+ 'WALLET' = "WALLET",
55
+ 'BANK' = "BANK"
49
56
  }
50
57
  export interface IcreateComponent {
51
58
  paymentSessionData: string;
52
- selector?: string | HTMLElement;
53
59
  appearance?: Record<string, any>;
54
60
  }
55
61
  export interface IappendIframeNodesParams extends IcreateComponent {
56
- paymentSessionMetaData?: IpaymentSessionMetaData;
62
+ paymentSessionMetaData: IpaymentSessionMetaData;
63
+ renderDisplayType: renderDisplayTypeEnum;
64
+ selector?: Iselector;
57
65
  }
58
66
  interface IpaymentSessionConfig {
59
67
  productScene: productSceneEnum;
@@ -72,55 +80,79 @@ export interface IpaymentSessionMetaData {
72
80
  export declare enum localeEnum {
73
81
  'en-US' = "en-US"
74
82
  }
75
- export declare enum checkoutDisplay {
83
+ export declare enum checkoutDisplayEnum {
76
84
  horizon = "horizon",
77
85
  vertical = "vertical"
78
86
  }
79
- export declare enum mode {
87
+ export declare enum modeEnum {
80
88
  dropin = "dropin",
81
89
  component = "component"
82
90
  }
83
- export declare enum networkMode {
91
+ export declare enum networkModeEnum {
84
92
  proxy = "proxy",
85
93
  session = "session"
86
94
  }
87
- export interface checkoutState {
88
- paymentMethodType: string;
95
+ export interface IcheckoutState {
96
+ paymentMethodType?: string;
89
97
  }
90
- export declare enum environment {
98
+ export declare enum environmentEnum {
91
99
  sandbox = "sandbox",
92
100
  prod = "prod",
93
101
  light_sandbox = "light_sandbox"
94
102
  }
95
- export declare enum osType {
103
+ export declare enum osTypeEnum {
96
104
  IOS = "IOS",
97
105
  ANDROID = "ANDROID",
98
106
  ELSE = "ELSE"
99
107
  }
100
- export declare enum terminalType {
108
+ export declare enum terminalTypeEnum {
101
109
  WEB = "WEB",
102
110
  WAP = "WAP",
103
111
  APP = "APP",
104
112
  MINI_APP = "MINI_APP"
105
113
  }
106
- export interface env {
107
- osType?: osType;
108
- terminalType: terminalType;
114
+ export interface Ienv {
115
+ osType?: osTypeEnum;
116
+ terminalType: terminalTypeEnum;
109
117
  environment: string;
110
118
  }
119
+ export declare enum platformEnum {
120
+ desktop = "desktop",
121
+ mobile = "mobile"
122
+ }
123
+ /**
124
+ * @description Create an event handler, called when an error occurs in AMSCheckout.
125
+ */
111
126
  export type callOnError = (state: {
112
- errorMessage: string;
113
- errorCode: string;
127
+ code: string;
128
+ message: string;
114
129
  stack?: any;
115
130
  }) => void;
131
+ /**
132
+ * @description Create an event handler, called when the general log triggers during the SDK runtime.
133
+ */
134
+ export type callOnLog = (state: {
135
+ code: string;
136
+ message: string;
137
+ }) => void;
138
+ /**
139
+ * @description Create an event handler, during the running of the sdk, some events are called after execution, and the specific event code is returned.
140
+ */
141
+ export type callOnEventCallback = (state: {
142
+ code: string;
143
+ message: string;
144
+ }) => void;
116
145
  export type callonPaymentMethodSelected = (state: {
117
146
  paymentMethodType: string;
118
147
  }) => void;
119
148
  export type callOnSizeChanged = (state: {
120
- width: string;
121
- height: string;
149
+ width: number;
150
+ height: number;
122
151
  }) => void;
123
- export type callOnLog = (msg: string) => void;
152
+ /**
153
+ * @description Create an event handler, In pop-up layer mode, the user clicks the semi floating layer close button and is called.
154
+ */
155
+ export type callOnClose = () => void;
124
156
  export declare enum messageName {
125
157
  SDK_TO_APP = "SDK_TO_APP",
126
158
  APP_TO_SDK = "APP_TO_SDK",
@@ -137,7 +169,7 @@ export interface eventPlayload {
137
169
  };
138
170
  }
139
171
  export interface AMSCheckoutOptions {
140
- env: env;
172
+ env: Ienv;
141
173
  locale: string;
142
174
  networkMode: string;
143
175
  mode: string;
@@ -146,7 +178,11 @@ export interface AMSCheckoutOptions {
146
178
  export interface Ianalytics {
147
179
  enabled: boolean;
148
180
  }
149
- export declare enum ERROR {
181
+ export declare enum targetEnum {
182
+ BLANK = "_blank",
183
+ SELF = "_self"
184
+ }
185
+ export declare enum errorEnum {
150
186
  PARAMS = "PARAMS",
151
187
  TIMEOUT = "TIMEOUT",
152
188
  NETWORK = "NETWORK",
@@ -161,7 +197,7 @@ export declare enum ERROR {
161
197
  SIGNIN = "SIGNIN",
162
198
  GETSIGNPARAMSERROR = "GETSIGNPARAMSERROR"
163
199
  }
164
- export interface RequestConfig {
200
+ export interface IrequestConfig {
165
201
  env?: string;
166
202
  baseURL?: string;
167
203
  timeout?: number;
@@ -182,13 +218,36 @@ export interface CashierSdkActionQueryRequest {
182
218
  paymentMethodType?: string;
183
219
  extParams?: any;
184
220
  }
221
+ export interface CashierSdkActionQueryResult {
222
+ supportedLanguages?: any[];
223
+ amountConfirmRequired?: boolean;
224
+ orderAmount?: Record<string, string>;
225
+ paymentMethodView?: Record<string, string>;
226
+ autoDebitWithToken?: boolean;
227
+ success: boolean;
228
+ errorCode?: string;
229
+ errorMessage?: string;
230
+ message?: string;
231
+ errorStatus?: string;
232
+ redirectUrl?: string;
233
+ normalUrl?: string;
234
+ applinkUrl?: string;
235
+ schemeUrl?: string;
236
+ authUrl?: string;
237
+ }
238
+ export declare enum eventCodeEnum {
239
+ SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
240
+ SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
241
+ SDK_INTERNAL_ERROR = "SDK_INTERNAL_ERROR",
242
+ SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
243
+ SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
244
+ SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
245
+ SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
246
+ SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
247
+ }
185
248
  declare global {
186
249
  interface Window {
187
250
  [key: string]: any;
188
251
  }
189
252
  }
190
- export declare enum Target {
191
- BLANK = "_blank",
192
- SELF = "_self"
193
- }
194
253
  export {};
@@ -10,11 +10,18 @@
10
10
  * SDK options
11
11
  */
12
12
 
13
- export var componentNameEnum = /*#__PURE__*/function (componentNameEnum) {
14
- componentNameEnum["card"] = "card";
15
- componentNameEnum["easyPay"] = "easyPay";
16
- componentNameEnum["autoDebit"] = "autoDebit";
17
- return componentNameEnum;
13
+ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum) {
14
+ renderDisplayTypeEnum["popup"] = "popup";
15
+ renderDisplayTypeEnum["inline"] = "inline";
16
+ return renderDisplayTypeEnum;
17
+ }({});
18
+ export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
19
+ componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
20
+ componentSignEnum["CASHIER_PAYMENT_CARD"] = "CASHIER_PAYMENT_CARD";
21
+ componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
22
+ componentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
23
+ componentSignEnum["NONE"] = "NONE";
24
+ return componentSignEnum;
18
25
  }({});
19
26
  export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
20
27
  productSceneEnum["EASY_PAY"] = "EASY_PAY";
@@ -25,70 +32,103 @@ export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
25
32
  export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
26
33
  paymentMethodCategoryTypeEnum["CARD"] = "CARD";
27
34
  paymentMethodCategoryTypeEnum["WALLET"] = "WALLET";
35
+ paymentMethodCategoryTypeEnum["BANK"] = "BANK";
28
36
  return paymentMethodCategoryTypeEnum;
29
37
  }({});
30
38
  export var localeEnum = /*#__PURE__*/function (localeEnum) {
31
39
  localeEnum["en-US"] = "en-US";
32
40
  return localeEnum;
33
41
  }({});
34
- export var checkoutDisplay = /*#__PURE__*/function (checkoutDisplay) {
35
- checkoutDisplay["horizon"] = "horizon";
36
- checkoutDisplay["vertical"] = "vertical";
37
- return checkoutDisplay;
42
+ export var checkoutDisplayEnum = /*#__PURE__*/function (checkoutDisplayEnum) {
43
+ checkoutDisplayEnum["horizon"] = "horizon";
44
+ checkoutDisplayEnum["vertical"] = "vertical";
45
+ return checkoutDisplayEnum;
46
+ }({});
47
+ export var modeEnum = /*#__PURE__*/function (modeEnum) {
48
+ modeEnum["dropin"] = "dropin";
49
+ modeEnum["component"] = "component";
50
+ return modeEnum;
38
51
  }({});
39
- export var mode = /*#__PURE__*/function (mode) {
40
- mode["dropin"] = "dropin";
41
- mode["component"] = "component";
42
- return mode;
52
+ export var networkModeEnum = /*#__PURE__*/function (networkModeEnum) {
53
+ networkModeEnum["proxy"] = "proxy";
54
+ networkModeEnum["session"] = "session";
55
+ return networkModeEnum;
43
56
  }({});
44
- export var networkMode = /*#__PURE__*/function (networkMode) {
45
- networkMode["proxy"] = "proxy";
46
- networkMode["session"] = "session";
47
- return networkMode;
57
+ export var environmentEnum = /*#__PURE__*/function (environmentEnum) {
58
+ environmentEnum["sandbox"] = "sandbox";
59
+ environmentEnum["prod"] = "prod";
60
+ environmentEnum["light_sandbox"] = "light_sandbox";
61
+ return environmentEnum;
48
62
  }({});
49
- export var environment = /*#__PURE__*/function (environment) {
50
- environment["sandbox"] = "sandbox";
51
- environment["prod"] = "prod";
52
- environment["light_sandbox"] = "light_sandbox";
53
- return environment;
63
+ export var osTypeEnum = /*#__PURE__*/function (osTypeEnum) {
64
+ osTypeEnum["IOS"] = "IOS";
65
+ osTypeEnum["ANDROID"] = "ANDROID";
66
+ osTypeEnum["ELSE"] = "ELSE";
67
+ return osTypeEnum;
54
68
  }({});
55
- export var osType = /*#__PURE__*/function (osType) {
56
- osType["IOS"] = "IOS";
57
- osType["ANDROID"] = "ANDROID";
58
- osType["ELSE"] = "ELSE";
59
- return osType;
69
+ export var terminalTypeEnum = /*#__PURE__*/function (terminalTypeEnum) {
70
+ terminalTypeEnum["WEB"] = "WEB";
71
+ terminalTypeEnum["WAP"] = "WAP";
72
+ terminalTypeEnum["APP"] = "APP";
73
+ terminalTypeEnum["MINI_APP"] = "MINI_APP";
74
+ return terminalTypeEnum;
60
75
  }({});
61
- export var terminalType = /*#__PURE__*/function (terminalType) {
62
- terminalType["WEB"] = "WEB";
63
- terminalType["WAP"] = "WAP";
64
- terminalType["APP"] = "APP";
65
- terminalType["MINI_APP"] = "MINI_APP";
66
- return terminalType;
76
+ export var platformEnum = /*#__PURE__*/function (platformEnum) {
77
+ platformEnum["desktop"] = "desktop";
78
+ platformEnum["mobile"] = "mobile";
79
+ return platformEnum;
67
80
  }({});
81
+ /**
82
+ * @description Create an event handler, called when an error occurs in AMSCheckout.
83
+ */
84
+
85
+ /**
86
+ * @description Create an event handler, called when the general log triggers during the SDK runtime.
87
+ */
88
+
89
+ /**
90
+ * @description Create an event handler, during the running of the sdk, some events are called after execution, and the specific event code is returned.
91
+ */
92
+
93
+ /**
94
+ * @description Create an event handler, In pop-up layer mode, the user clicks the semi floating layer close button and is called.
95
+ */
96
+
68
97
  export var messageName = /*#__PURE__*/function (messageName) {
69
98
  messageName["SDK_TO_APP"] = "SDK_TO_APP";
70
99
  messageName["APP_TO_SDK"] = "APP_TO_SDK";
71
100
  messageName["APP_TO_APP"] = "APP_TO_APP";
72
101
  return messageName;
73
102
  }({});
74
- export var ERROR = /*#__PURE__*/function (ERROR) {
75
- ERROR["PARAMS"] = "PARAMS";
76
- ERROR["TIMEOUT"] = "TIMEOUT";
77
- ERROR["NETWORK"] = "NETWORK";
78
- ERROR["SYSTEM"] = "SYSTEM";
79
- ERROR["LOGIN"] = "LOGIN";
80
- ERROR["GATEWAY"] = "GATEWAY";
81
- ERROR["VALIDATION"] = "VALIDATION";
82
- ERROR["TAOBAOBINDALIPAY"] = "TAOBAOBINDALIPAY";
83
- ERROR["REGISTERWALLET"] = "REGISTERWALLET";
84
- ERROR["NOALIPAYID"] = "NOALIPAYID";
85
- ERROR["TRUSTLOGINERROR"] = "TRUSTLOGINERROR";
86
- ERROR["SIGNIN"] = "SIGNIN";
87
- ERROR["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
88
- return ERROR;
103
+ export var targetEnum = /*#__PURE__*/function (targetEnum) {
104
+ targetEnum["BLANK"] = "_blank";
105
+ targetEnum["SELF"] = "_self";
106
+ return targetEnum;
107
+ }({});
108
+ export var errorEnum = /*#__PURE__*/function (errorEnum) {
109
+ errorEnum["PARAMS"] = "PARAMS";
110
+ errorEnum["TIMEOUT"] = "TIMEOUT";
111
+ errorEnum["NETWORK"] = "NETWORK";
112
+ errorEnum["SYSTEM"] = "SYSTEM";
113
+ errorEnum["LOGIN"] = "LOGIN";
114
+ errorEnum["GATEWAY"] = "GATEWAY";
115
+ errorEnum["VALIDATION"] = "VALIDATION";
116
+ errorEnum["TAOBAOBINDALIPAY"] = "TAOBAOBINDALIPAY";
117
+ errorEnum["REGISTERWALLET"] = "REGISTERWALLET";
118
+ errorEnum["NOALIPAYID"] = "NOALIPAYID";
119
+ errorEnum["TRUSTLOGINERROR"] = "TRUSTLOGINERROR";
120
+ errorEnum["SIGNIN"] = "SIGNIN";
121
+ errorEnum["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
122
+ return errorEnum;
89
123
  }({});
90
- export var Target = /*#__PURE__*/function (Target) {
91
- Target["BLANK"] = "_blank";
92
- Target["SELF"] = "_self";
93
- return Target;
124
+ export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
125
+ eventCodeEnum["SDK_START_OF_LOADING"] = "SDK_START_OF_LOADING";
126
+ eventCodeEnum["SDK_END_OF_LOADING"] = "SDK_END_OF_LOADING";
127
+ eventCodeEnum["SDK_INTERNAL_ERROR"] = "SDK_INTERNAL_ERROR";
128
+ eventCodeEnum["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
129
+ eventCodeEnum["SDK_INIT_PARAMETER_ERROR"] = "SDK_INIT_PARAMETER_ERROR";
130
+ eventCodeEnum["SDK_CREATECOMPONENT_ERROR"] = "SDK_CREATECOMPONENT_ERROR";
131
+ eventCodeEnum["SDK_CALL_URL_ERROR"] = "SDK_CALL_URL_ERROR";
132
+ eventCodeEnum["SDK_CALL_URL_SUCCESS"] = "SDK_CALL_URL_SUCCESS";
133
+ return eventCodeEnum;
94
134
  }({});
@@ -1,5 +1,5 @@
1
- import { createPaymentParams, IcreateComponent } from '../types';
1
+ import { Iselector, renderDisplayTypeEnum } from '../types';
2
2
  /**
3
- * @description context中需要包含app节点,用于插入params.selector中
3
+ * @description context中需要包含app节点,用于插入selector中
4
4
  */
5
- export declare const createIframeNode: (context: any, params: createPaymentParams | IcreateComponent) => Promise<void>;
5
+ export declare const createIframeNode: (context: any, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;
@@ -1,19 +1,19 @@
1
1
  import { getType } from '.';
2
2
  import { ERRORMESSAGE, EVENT } from "../constant";
3
- import { messageName } from "../types";
3
+ import { messageName, renderDisplayTypeEnum } from "../types";
4
4
  /**
5
- * @description context中需要包含app节点,用于插入params.selector中
5
+ * @description context中需要包含app节点,用于插入selector中
6
6
  */
7
- export var createIframeNode = function createIframeNode(context, params) {
7
+ export var createIframeNode = function createIframeNode(context, selector, renderDisplayType) {
8
8
  return new Promise(function (resolve, reject) {
9
9
  var dorpinDom = null;
10
- if (getType(params.selector) === 'string') {
11
- dorpinDom = document.querySelector(params.selector);
10
+ if (getType(selector) === 'string') {
11
+ dorpinDom = document.querySelector(selector);
12
12
  }
13
13
  if (dorpinDom === null) {
14
14
  var error = {
15
- errorCode: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.errorCode,
16
- errorMessage: "Failed to execute 'querySelector' on 'Document': ".concat(params.selector, " is not a valid selector")
15
+ code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
16
+ message: "Failed to execute 'querySelector' on 'Document': ".concat(selector, " is not a valid selector")
17
17
  };
18
18
  reject(error);
19
19
  context._dispatchToSDK({
@@ -26,7 +26,7 @@ export var createIframeNode = function createIframeNode(context, params) {
26
26
  });
27
27
  return;
28
28
  }
29
- dorpinDom.innerHTML = '';
29
+ if (renderDisplayType === renderDisplayTypeEnum.popup) dorpinDom.innerHTML = '';
30
30
  if (context.app) {
31
31
  dorpinDom.appendChild(context.app);
32
32
  }