Socket
Socket
Sign inDemoInstall

@alipay/ams-checkout

Package Overview
Dependencies
Maintainers
2
Versions
345
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alipay/ams-checkout - npm Package Compare versions

Comparing version 0.0.1691743027-dev.3 to 0.0.1691743027-dev.4

39

esm/constant/index.d.ts

@@ -7,19 +7,20 @@ /**

*/
import { eventCodeEnum } from "../types";
export declare const ERRORMESSAGE: {
DOMAIN_NOT_IN_WHITE_LIST: {
code: string;
code: eventCodeEnum;
message: string;
};
NOT_JSON_FORMAT: {
code: string;
code: eventCodeEnum;
message: string;
};
SDK_COMPATIBILITY_ISSUES: {
code: string;
code: eventCodeEnum;
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
code: string;
code: eventCodeEnum;
message: string;
};
FAILED_TO_CREATE_IFRAME: {
code: string;
code: eventCodeEnum;
message: string;

@@ -29,25 +30,25 @@ };

INIT_PARAMETER_ERROR: {
code: string;
code: eventCodeEnum;
UI_MODE_NOT_SUPPORTED: {
code: string;
code: eventCodeEnum;
message: string;
};
ENVIRONMENT_ERROR: {
code: string;
code: eventCodeEnum;
message: string;
};
MODE_ERROR: {
code: string;
code: eventCodeEnum;
message: string;
};
LOCALE_ERROR: {
code: string;
code: eventCodeEnum;
message: string;
};
NET_MODE_NOT_SUPPORT: {
code: string;
code: eventCodeEnum;
message: string;
};
EVENT_ERROR: {
code: string;
code: eventCodeEnum;
message: string;

@@ -57,3 +58,3 @@ };

CREATEPAYMENT_PARAMETER_ERROR: {
code: string;
code: eventCodeEnum;
};

@@ -64,10 +65,10 @@ CONFIRMPAYMENT_PARAMETER_ERROR: {

CREATECOMPONENT_ERROR: {
code: string;
code: eventCodeEnum;
message: string;
SINGLETON_COMPONENT_ERROR: {
code: string;
code: eventCodeEnum;
message: string;
};
LOAD_APP_TIMEOUT: {
code: string;
code: eventCodeEnum;
message: string;

@@ -77,5 +78,5 @@ };

SDK_CALL_URL_ERROR: {
code: string;
code: eventCodeEnum;
REDIRECT_ERROR: {
code: string;
code: eventCodeEnum;
message: string;

@@ -85,3 +86,3 @@ };

SDK_SUBMIT_ERROR: {
code: string;
code: eventCodeEnum;
message: string;

@@ -88,0 +89,0 @@ };

@@ -7,19 +7,20 @@ /**

*/
import { eventCodeEnum } from "../types";
export var ERRORMESSAGE = {
DOMAIN_NOT_IN_WHITE_LIST: {
code: 'SDK_INTERNAL_ERROR',
code: eventCodeEnum.SDK_INTERNAL_ERROR,
message: 'Origin of the message is not in the white list'
},
NOT_JSON_FORMAT: {
code: 'SDK_INTERNAL_ERROR',
code: eventCodeEnum.SDK_INTERNAL_ERROR,
message: 'The message string should conform to the json format'
},
SDK_COMPATIBILITY_ISSUES: {
code: 'SDK_INTERNAL_ERROR',
code: eventCodeEnum.SDK_INTERNAL_ERROR,
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
code: 'SDK_INTERNAL_ERROR',
code: eventCodeEnum.SDK_INTERNAL_ERROR,
message: 'The browser does not support the postmessage communication mode'
},
FAILED_TO_CREATE_IFRAME: {
code: 'SDK_INTERNAL_ERROR',
code: eventCodeEnum.SDK_INTERNAL_ERROR,
message: 'Failed to create iframe'

@@ -29,25 +30,25 @@ }

INIT_PARAMETER_ERROR: {
code: 'SDK_INIT_PARAMETER_ERROR',
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
UI_MODE_NOT_SUPPORTED: {
code: 'SDK_INIT_PARAMETER_ERROR',
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
message: 'This UI mode is not supported'
},
ENVIRONMENT_ERROR: {
code: 'SDK_INIT_PARAMETER_ERROR',
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
message: 'The current input environment does not support or is not in the standard enumeration'
},
MODE_ERROR: {
code: 'SDK_INIT_PARAMETER_ERROR',
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
message: 'mode value not in enum'
},
LOCALE_ERROR: {
code: 'SDK_INIT_PARAMETER_ERROR',
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
message: 'The current input language does not support or is not in the standard enumeration'
},
NET_MODE_NOT_SUPPORT: {
code: 'SDK_INIT_PARAMETER_ERROR',
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
message: 'The network mode is not supported'
},
EVENT_ERROR: {
code: 'SDK_INIT_PARAMETER_ERROR',
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
message: 'Parameter type should be function'

@@ -57,3 +58,3 @@ }

CREATEPAYMENT_PARAMETER_ERROR: {
code: 'SDK_CREATEPAYMENT_PARAMETER_ERROR'
code: eventCodeEnum.SDK_CREATEPAYMENT_PARAMETER_ERROR
},

@@ -64,10 +65,10 @@ CONFIRMPAYMENT_PARAMETER_ERROR: {

CREATECOMPONENT_ERROR: {
code: 'SDK_CREATECOMPONENT_ERROR',
code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
message: 'Failed to create component',
SINGLETON_COMPONENT_ERROR: {
code: 'SDK_CREATECOMPONENT_ERROR',
code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
message: 'Only one component can be rendered simultaneously'
},
LOAD_APP_TIMEOUT: {
code: 'SDK_CREATECOMPONENT_ERROR',
code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
message: 'Load resource timeout'

@@ -77,5 +78,5 @@ }

SDK_CALL_URL_ERROR: {
code: 'SDK_CALL_URL_ERROR',
code: eventCodeEnum.SDK_CALL_URL_ERROR,
REDIRECT_ERROR: {
code: 'SDK_CALL_URL_ERROR',
code: eventCodeEnum.SDK_CALL_URL_ERROR,
message: 'Redirect data exception'

@@ -85,3 +86,3 @@ }

SDK_SUBMIT_ERROR: {
code: 'SDK_SUBMIT_ERROR',
code: eventCodeEnum.SDK_CALL_URL_ERROR,
message: 'Component not created or current browser compatibility issue, not supported'

@@ -88,0 +89,0 @@ }

@@ -82,3 +82,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject("".concat(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code, "\uFF1AAbnormal response data, interface failure, or unsupported payment method"));
return Promise.reject({
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
message: "Abnormal response data, interface failure, or unsupported payment method"
});
}

@@ -121,3 +124,3 @@ _params.paymentSessionData = paymentSessionData;

if (_params && !_params.paymentSessionData) {
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR);
return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
}

@@ -134,5 +137,3 @@ if (this.options.networkMode === networkModeEnum.proxy) {

try {
this.componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams).then(function () {
return Promise.resolve();
});
return this.componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams);
} catch (error) {

@@ -157,5 +158,3 @@ return Promise.reject(error);

}).catch(function (error) {
_this2._eventCenter.emit(EVENT.error.name, {
code: ERRORMESSAGE.CREATECOMPONENT_ERROR
});
_this2._eventCenter.emit(EVENT.error.name, error);
return Promise.reject(error);

@@ -181,5 +180,3 @@ }).then(function (appendParams) {

}).catch(function (error) {
_this3._eventCenter.emit(EVENT.error.name, {
code: ERRORMESSAGE.CREATECOMPONENT_ERROR
});
_this3._eventCenter.emit(EVENT.error.name, error);
return Promise.reject(error);

@@ -186,0 +183,0 @@ }).then(function (appendParams) {

import type AMSCheckout from '../../core/instance';
import type { IappendIframeNodesParams, Iselector } from '../../types';
import { CashierSdkActionQueryResult, componentSignEnum, platformEnum, renderDisplayTypeEnum } from '../../types';
import { componentSignEnum, platformEnum, renderDisplayTypeEnum } from '../../types';
type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;

@@ -38,3 +38,3 @@ export default class ComponentApp {

*/
appendIframeNodes(componentSign: componentSignEnum, renderParams: IappendIframeNodesParams): Promise<[CashierSdkActionQueryResult, void, unknown]>;
appendIframeNodes(componentSign: componentSignEnum, renderParams: IappendIframeNodesParams): Promise<void>;
private renderPopupLoading;

@@ -73,3 +73,8 @@ private createLoadAppPromise;

*/
private dispatchToApp;
dispatchToApp(payload: {
context: {
event: string;
data: any;
};
}): any;
/**

@@ -76,0 +81,0 @@ * @description Subscribe to messages from SDK

@@ -20,3 +20,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

import { queryPaymentInfo } from "../../service";
import { componentSignEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum } from "../../types";
import { componentSignEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum, eventCodeEnum } from "../../types";
import { addSetFontSizeEvent, amsSetSize, getDesignFontSize, getType, isJsonString, isPC } from "../../util";

@@ -120,2 +120,5 @@ import { isLocalMock } from "../../util/mock";

});
this.dispatchToSDK(EVENT.eventCallback.name, {
code: eventCodeEnum.SDK_START_OF_LOADING
});
if (this._renderDisplayType === renderDisplayTypeEnum.inline) {

@@ -132,3 +135,5 @@ this.createInlineBaseElement(renderParams);

this.createApp(renderParams);
return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this.createLoadAppPromise()]).catch(function (error) {
return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this.createLoadAppPromise()]).then(function () {
return Promise.resolve();
}).catch(function (error) {
_this._isInitComponent = false;

@@ -507,3 +512,3 @@ _this.cleanContainer();

_this4.dispatchToSDK(EVENT.eventCallback.name, {
code: 'SDK_CALL_URL_SUCCESS',
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
message: "Successfully opened the app,".concat(type, ": ").concat(url)

@@ -514,3 +519,3 @@ });

_this4.dispatchToSDK(EVENT.eventCallback.name, {
code: 'SDK_CALL_URL_ERROR',
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)

@@ -517,0 +522,0 @@ });

@@ -238,2 +238,12 @@ /**

}
export declare enum eventCodeEnum {
SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
SDK_INTERNAL_ERROR = "SDK_INTERNAL_ERROR",
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
}
declare global {

@@ -240,0 +250,0 @@ interface Window {

@@ -123,2 +123,13 @@ /**

return errorEnum;
}({});
export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
eventCodeEnum["SDK_START_OF_LOADING"] = "SDK_START_OF_LOADING";
eventCodeEnum["SDK_END_OF_LOADING"] = "SDK_END_OF_LOADING";
eventCodeEnum["SDK_INTERNAL_ERROR"] = "SDK_INTERNAL_ERROR";
eventCodeEnum["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
eventCodeEnum["SDK_INIT_PARAMETER_ERROR"] = "SDK_INIT_PARAMETER_ERROR";
eventCodeEnum["SDK_CREATECOMPONENT_ERROR"] = "SDK_CREATECOMPONENT_ERROR";
eventCodeEnum["SDK_CALL_URL_ERROR"] = "SDK_CALL_URL_ERROR";
eventCodeEnum["SDK_CALL_URL_SUCCESS"] = "SDK_CALL_URL_SUCCESS";
return eventCodeEnum;
}({});

@@ -1,1 +0,1 @@

{"name":"@alipay/ams-checkout","version":"0.0.1691743027-dev.3","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":{"@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/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","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"}}
{"name":"@alipay/ams-checkout","version":"0.0.1691743027-dev.4","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":{"@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/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","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"}}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc