@alipay/ams-checkout 0.0.1697942541-dev.6 → 0.0.1697942541-dev.7

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.
@@ -38,6 +38,13 @@ var AMSSDK = /*#__PURE__*/function () {
38
38
  _defineProperty(this, "logger", void 0);
39
39
  this._instanceId = uuid();
40
40
  this._storageId = this.getStorageId(this._instanceId);
41
+ this.options = {};
42
+ this._eventCenter = new EventCenter();
43
+ this._initEvent(options);
44
+ this._setOptions(options);
45
+ this.plugins = new Map();
46
+ this.securityConfig = null;
47
+
41
48
  // TODO Consumption data analysis control parameters
42
49
  this.logger = new Logger(LogConfig, (options === null || options === void 0 ? void 0 : options.environment) !== environmentEnum.prod);
43
50
  this.logger.setMedta({
@@ -47,16 +54,10 @@ var AMSSDK = /*#__PURE__*/function () {
47
54
  this.logger.logInfo({
48
55
  title: 'NEW_AMSSDK_BY_MECHANT',
49
56
  msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale, "}")
50
- });
51
-
52
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
53
- this.options = {};
54
- this._eventCenter = new EventCenter();
55
- this._initEvent(options);
56
- this._setOptions(options);
57
- this.plugins = new Map();
58
- this.securityConfig = null;
59
- this.logger.send();
57
+ }).send();
58
+ if (options !== null && options !== void 0 && options.securityConfig) {
59
+ this.initSecurity(options === null || options === void 0 ? void 0 : options.securityConfig);
60
+ }
60
61
  }
61
62
  /**
62
63
  * @description Destroy and process some contents of the plug-in
@@ -125,6 +126,9 @@ var AMSSDK = /*#__PURE__*/function () {
125
126
  title: 'sdk_event_securitySdkPreInit'
126
127
  }).send();
127
128
  } catch (e) {
129
+ this.logger.logError({
130
+ title: 'sdk_error_securitySdkInitFailed'
131
+ }).send();
128
132
  console.log("-----------Risk control project test: \u4E3B\u52A8\u521D\u59CB\u5316\u5B89\u5168sdk\u5931\u8D25");
129
133
  }
130
134
  }
@@ -131,7 +131,7 @@ var ComponentApp = /*#__PURE__*/function () {
131
131
 
132
132
  // if merchant have init securitySDK and same as service paymentSessionMetaData, no need init again
133
133
  if (this.AMSSDK.securityConfig) {
134
- if (appName === getAppname(this.AMSSDK.securityConfig.sence) && h5gateway === getSecurityHost(this.AMSSDK.securityConfig.region)) {
134
+ if (appName === getAppname(this.AMSSDK.securityConfig.scene) && h5gateway === getSecurityHost(this.AMSSDK.securityConfig.region)) {
135
135
  console.log("-----------Risk control project test: \u5DF2\u7ECF\u4E3B\u52A8\u521D\u59CB\u5316\uFF0C\u4E14\u914D\u7F6E\u4E0EsecurityConfig\u4E00\u81F4");
136
136
  return;
137
137
  }
@@ -22,6 +22,7 @@ export interface IoptionsParams {
22
22
  analytics?: {
23
23
  enabled: boolean;
24
24
  };
25
+ securityConfig?: IsecurityConfig;
25
26
  }
26
27
  export type Iselector = string;
27
28
  export declare enum renderDisplayTypeEnum {
@@ -300,7 +301,7 @@ export declare enum SecuritySceneEnum {
300
301
  EASYPAY = "EASYPAY"
301
302
  }
302
303
  export interface IsecurityConfig {
303
- sence: string;
304
+ scene: string;
304
305
  region: string;
305
306
  }
306
307
  declare global {
@@ -16,13 +16,13 @@ export var appName = {
16
16
  EASYPAY: 'EasyPay'
17
17
  };
18
18
  export var initAPSecurity = function initAPSecurity(securityConfig, successCallback, failCallback) {
19
- if (!securityConfig || !(securityConfig !== null && securityConfig !== void 0 && securityConfig.sence) || !(securityConfig !== null && securityConfig !== void 0 && securityConfig.region)) {
19
+ if (!securityConfig || !(securityConfig !== null && securityConfig !== void 0 && securityConfig.scene) || !(securityConfig !== null && securityConfig !== void 0 && securityConfig.region)) {
20
20
  throw new Error('securityConfig parameter error');
21
21
  }
22
- var curAppName = getAppname(securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.sence);
22
+ var curAppName = getAppname(securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.scene);
23
23
  var h5gateway = getSecurityHost(securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.region);
24
24
  if (!curAppName || !h5gateway) {
25
- throw new Error("appName:".concat(securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.sence, " or region:").concat(securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.region, " do not supported"));
25
+ throw new Error("appName:".concat(securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.scene, " or region:").concat(securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.region, " do not supported"));
26
26
  }
27
27
  initSecuritySDK(curAppName, h5gateway, successCallback, failCallback);
28
28
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@alipay/ams-checkout","version":"0.0.1697942541-dev.6","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@alipay/jshield-apdid":"^2.0.3","@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
1
+ {"name":"@alipay/ams-checkout","version":"0.0.1697942541-dev.7","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@alipay/jshield-apdid":"^2.0.3","@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}