@alipay/ams-checkout
Advanced tools
Comparing version 1.20.1 to 1.21.0
export declare const marmotMap: Record<string, string>; | ||
export declare const marmotConfigMap: Record<string, string>; | ||
export declare const elementAppMarmotMap: Record<string, string>; | ||
export declare const sdkVersion: string; | ||
/** | ||
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。 | ||
*/ | ||
export declare const AMSCheckoutAppVersion = "1.21.0"; | ||
export declare const AMSAutoDebitAppVersion = "1.21.0"; | ||
export declare const AMSEasyPayAppVersion = "1.21.0"; | ||
export declare const AMSCashierPaymentAppVersion = "1.21.0"; | ||
export declare const AMSVaultingAppVersion = "1.21.0"; | ||
export declare const AMSPaymentElementAppVersion = "1.21.0"; | ||
export declare const ADDRESSElementAppVersion = "1.21.0"; |
@@ -25,2 +25,21 @@ /** | ||
}; | ||
export var sdkVersion = json.version; | ||
export var elementAppMarmotMap = { | ||
dev: 'http://page.alipay.net/page/antom-web-checkout-v2', | ||
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2', | ||
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2', | ||
sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2', | ||
light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2', | ||
prod: 'https://ac.alipay.com/page/antom-web-checkout-v2' | ||
}; | ||
export var sdkVersion = json.version; | ||
/** | ||
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。 | ||
*/ | ||
export var AMSCheckoutAppVersion = '1.21.0'; // 兜底版本号 | ||
export var AMSAutoDebitAppVersion = '1.21.0'; // 代扣 | ||
export var AMSEasyPayAppVersion = '1.21.0'; // easypay | ||
export var AMSCashierPaymentAppVersion = '1.21.0'; // 收银台(卡、apm) | ||
export var AMSVaultingAppVersion = '1.21.0'; // 绑卡 | ||
export var AMSPaymentElementAppVersion = '1.21.0'; // payment element | ||
export var ADDRESSElementAppVersion = '1.21.0'; // address element |
@@ -178,2 +178,6 @@ /** | ||
}; | ||
onChange: { | ||
name: string; | ||
uniqueKey: string; | ||
}; | ||
}; | ||
@@ -187,2 +191,3 @@ export declare const COMPONENT_CONTAINER_ID = "ams-component-container"; | ||
export declare const LOADING_ID = "ams-component-loading"; | ||
export declare const POPUPLOADING_ID = "ams-component-popup-loading"; | ||
export declare const LISTENER_PREFIX = "_ams_sdk_component_listener"; | ||
@@ -189,0 +194,0 @@ export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style"; |
@@ -177,2 +177,6 @@ /** | ||
uniqueKey: 'userBeforeSubmitDone' | ||
}, | ||
onChange: { | ||
name: 'onChange', | ||
uniqueKey: 'userChange' | ||
} | ||
@@ -187,2 +191,3 @@ }; | ||
export var LOADING_ID = 'ams-component-loading'; | ||
export var POPUPLOADING_ID = 'ams-component-popup-loading'; // popup弹窗loading | ||
export var LISTENER_PREFIX = '_ams_sdk_component_listener'; | ||
@@ -189,0 +194,0 @@ export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style'; |
@@ -6,2 +6,5 @@ import ComponentApp from '../../plugin/component'; | ||
export declare const parseSessionData: (sessionData: string) => [IpaymentSessionMetaData, string]; | ||
export type IAMSComponentOptions = IoptionsParams & { | ||
appVersion: string; | ||
}; | ||
export declare class AMSComponent extends CoreInstance { | ||
@@ -12,3 +15,3 @@ _componentApp: ComponentApp; | ||
timer: any; | ||
constructor(options: IoptionsParams); | ||
constructor(options: IAMSComponentOptions); | ||
private parameterInitAndCheck; | ||
@@ -36,3 +39,3 @@ private pluginAppendIframe; | ||
preloadComponent(channelType: any, productSceneVersion: any): void; | ||
clearPreloadIframe(isTimeOut?: boolean): void; | ||
private clearPreloadIframe; | ||
/** | ||
@@ -39,0 +42,0 @@ * @description Create and render components in the specified element area |
@@ -20,2 +20,6 @@ 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); } | ||
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); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
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."); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
@@ -40,3 +44,3 @@ 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."); } | ||
import { PaypalBusSubscriber } from "../../plugin/paypal"; | ||
import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types"; | ||
import { componentSignEnum, ComponentSignEnumV2, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types"; | ||
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util"; | ||
@@ -58,3 +62,5 @@ import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode"; | ||
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4; | ||
return productScene && paymentMethodCategoryType ? "".concat(productScene, "_").concat(paymentMethodCategoryType) : componentSignEnum.NONE; | ||
if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType); | ||
if (productScene) return "".concat(productScene); | ||
return componentSignEnum.NONE; | ||
}; | ||
@@ -91,3 +97,3 @@ export var parseSessionData = function parseSessionData(sessionData) { | ||
}; | ||
var handleParams = function handleParams(params) { | ||
var handleParams = function handleParams(params, _this) { | ||
var _params = Object.assign({ | ||
@@ -102,2 +108,11 @@ paymentSessionMetaData: {}, | ||
var componentSign = getComponentSign(parseData); | ||
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === renderDisplayTypeEnum.popup) { | ||
return Promise.reject({ | ||
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code, | ||
message: "unsupported payment method" | ||
}); | ||
} | ||
if (_this.options.product === productSceneEnum.ELEMENT_ADDRESS) { | ||
componentSign = componentSignEnum.ELEMENT_ADDRESS; | ||
} | ||
if (componentSign === componentSignEnum.NONE) { | ||
@@ -126,17 +141,19 @@ // eslint-disable-next-line prefer-promise-reject-errors | ||
function AMSComponent(options) { | ||
var _this; | ||
var _this2; | ||
_classCallCheck(this, AMSComponent); | ||
_this = _super.call(this, options); | ||
_this2 = _super.call(this, options); | ||
// Instantiate the plug-in and set render | ||
_defineProperty(_assertThisInitialized(_this), "channelType", void 0); | ||
_defineProperty(_assertThisInitialized(_this), "productSceneVersion", void 0); | ||
_defineProperty(_assertThisInitialized(_this), "timer", void 0); | ||
var ComponentPlugin = new ComponentApp(); | ||
_defineProperty(_assertThisInitialized(_this2), "channelType", void 0); | ||
_defineProperty(_assertThisInitialized(_this2), "productSceneVersion", void 0); | ||
_defineProperty(_assertThisInitialized(_this2), "timer", void 0); | ||
var ComponentPlugin = new ComponentApp({ | ||
appVersion: options.appVersion | ||
}); | ||
ComponentPlugin.setRender(createIframeNode); | ||
ComponentPlugin.setPreloadRender(createPreloadIframeNode); | ||
// Register Cashier Application Plug in | ||
_this._registerPlugin(COMPONENTPLUGINID, ComponentPlugin); | ||
_this._componentApp = _this._getPlugin(COMPONENTPLUGINID); | ||
_this.registerBusAbility(); | ||
return _this; | ||
_this2._registerPlugin(COMPONENTPLUGINID, ComponentPlugin); | ||
_this2._componentApp = _this2._getPlugin(COMPONENTPLUGINID); | ||
_this2.registerBusAbility(); | ||
return _this2; | ||
} | ||
@@ -155,3 +172,3 @@ _createClass(AMSComponent, [{ | ||
}, params); | ||
if (_params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) { | ||
if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS && _params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) { | ||
return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR); | ||
@@ -234,3 +251,2 @@ } | ||
} | ||
/** | ||
@@ -243,3 +259,3 @@ * 初始化 Bus总线的能力 | ||
var _this$originOptions, | ||
_this2 = this; | ||
_this3 = this; | ||
BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod, this.logger); | ||
@@ -249,3 +265,3 @@ BusManager.clear(); | ||
onPublishException: function onPublishException(message, e) { | ||
_this2.logger.logError({ | ||
_this3.logger.logError({ | ||
title: 'onBusPublishException' | ||
@@ -259,8 +275,8 @@ }, _objectSpread(_objectSpread({}, message), {}, { | ||
BusManager.subscribe(new SDKCallbackBusSubscriber(function (state) { | ||
var _this2$_componentApp; | ||
(_this2$_componentApp = _this2._componentApp) === null || _this2$_componentApp === void 0 || (_this2$_componentApp = _this2$_componentApp.AMSSDK) === null || _this2$_componentApp === void 0 || _this2$_componentApp._eventCenter.emit(EVENT.eventCallback.name, state); | ||
var _this3$_componentApp; | ||
(_this3$_componentApp = _this3._componentApp) === null || _this3$_componentApp === void 0 || (_this3$_componentApp = _this3$_componentApp.AMSSDK) === null || _this3$_componentApp === void 0 || _this3$_componentApp._eventCenter.emit(EVENT.eventCallback.name, state); | ||
})); | ||
BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) { | ||
var _this2$_componentApp2; | ||
return (_this2$_componentApp2 = _this2._componentApp) === null || _this2$_componentApp2 === void 0 ? void 0 : _this2$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling); | ||
var _this3$_componentApp2; | ||
return (_this3$_componentApp2 = _this3._componentApp) === null || _this3$_componentApp2 === void 0 ? void 0 : _this3$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling); | ||
})); | ||
@@ -280,3 +296,3 @@ BusManager.subscribe(new TrackerBusSubscriber(this.logger)); | ||
if (paymentChannelMatcher) { | ||
_this2._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames); | ||
_this3._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames); | ||
} | ||
@@ -289,6 +305,6 @@ var sessionMatcher = item.sessionMatcher; | ||
var subPluginKey = pluginKey + paymentMethodType; | ||
_this2._registerPlugin(subPluginKey, item.busActionNames); | ||
_this3._registerPlugin(subPluginKey, item.busActionNames); | ||
}); | ||
} else { | ||
_this2._registerPlugin(pluginKey, item.busActionNames); | ||
_this3._registerPlugin(pluginKey, item.busActionNames); | ||
} | ||
@@ -298,7 +314,6 @@ } | ||
if (optInit) { | ||
BusManager.publish(new BusMessage(optInit, JSON.stringify(_this2.originOptions))); | ||
BusManager.publish(new BusMessage(optInit, JSON.stringify(_this3.originOptions))); | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -314,10 +329,10 @@ * To determine whether the corresponding payment method is available, | ||
value: function canMakePayments(paymentMethod, subPaymentMethod) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
// 判断支付方式是否可用 | ||
return new Promise(function (resolve) { | ||
var _this3$_getPlugin; | ||
var _this4$_getPlugin; | ||
if (!paymentMethod) { | ||
return resolve(true); | ||
} | ||
var actionName = (_this3$_getPlugin = _this3._getPlugin(paymentMethod)) === null || _this3$_getPlugin === void 0 ? void 0 : _this3$_getPlugin.canMakePayments; | ||
var actionName = (_this4$_getPlugin = _this4._getPlugin(paymentMethod)) === null || _this4$_getPlugin === void 0 ? void 0 : _this4$_getPlugin.canMakePayments; | ||
if (actionName && BusManager.isSubscribed(actionName)) { | ||
@@ -332,3 +347,3 @@ BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({ | ||
}).catch(function (e) { | ||
_this3.logger.logInfo({ | ||
_this4.logger.logInfo({ | ||
title: 'canMakePayments_error' | ||
@@ -345,3 +360,2 @@ }, { | ||
} | ||
/** | ||
@@ -354,3 +368,3 @@ * @description Create component application | ||
value: function createComponent(params) { | ||
var _this4 = this; | ||
var _this5 = this; | ||
this.clearPreloadIframe(); | ||
@@ -362,5 +376,5 @@ this.logger.setComponentStartTime(Date.now()); | ||
}).then(function (_params) { | ||
return handleParams(_params); | ||
return handleParams(_params, _this5); | ||
}).catch(function (error) { | ||
_this4.logger.logError({ | ||
_this5.logger.logError({ | ||
title: 'sdk_error_parameter' | ||
@@ -370,8 +384,8 @@ }, { | ||
}).send(); | ||
_this4._eventCenter.emit(EVENT.error.name, error); | ||
_this5._eventCenter.emit(EVENT.error.name, error); | ||
return Promise.reject(error); | ||
}).then(function (appendParams) { | ||
var iframeNodesParams = appendParams.iframeNodesParams; | ||
_this4.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData); | ||
return _this4.createComponentProcess(appendParams); | ||
_this5.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData); | ||
return _this5.createComponentProcess(appendParams); | ||
}); | ||
@@ -400,3 +414,3 @@ } | ||
value: function preloadComponent(channelType, productSceneVersion) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
this.channelType = channelType; | ||
@@ -417,3 +431,3 @@ this.productSceneVersion = productSceneVersion; | ||
this.timer = setTimeout(function () { | ||
_this5.clearPreloadIframe(true); | ||
_this6.clearPreloadIframe(true); | ||
}, MAX_CLEAR_TIME); | ||
@@ -450,3 +464,3 @@ } | ||
value: function mountComponent(params, selector) { | ||
var _this6 = this; | ||
var _this7 = this; | ||
this.clearPreloadIframe(); | ||
@@ -459,5 +473,5 @@ this.logger.setComponentStartTime(Date.now()); | ||
}).then(function (_params) { | ||
return handleParams(_params); | ||
return handleParams(_params, _this7); | ||
}).catch(function (error) { | ||
_this6.logger.logError({ | ||
_this7.logger.logError({ | ||
title: 'sdk_error_parameter' | ||
@@ -467,8 +481,8 @@ }, { | ||
}).send(); | ||
_this6._eventCenter.emit(EVENT.error.name, error); | ||
_this7._eventCenter.emit(EVENT.error.name, error); | ||
return Promise.reject(error); | ||
}).then(function (appendParams) { | ||
var iframeNodesParams = appendParams.iframeNodesParams; | ||
_this6.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData); | ||
return _this6.mountComponentProcess(appendParams); | ||
_this7.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData); | ||
return _this7.mountComponentProcess(appendParams); | ||
}); | ||
@@ -491,6 +505,7 @@ } | ||
var iframeNodesParams = appendParams.iframeNodesParams; | ||
this.savePreviousChannel(iframeNodesParams); | ||
if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS) { | ||
this.savePreviousChannel(iframeNodesParams); | ||
} | ||
return this.pluginAppendIframe(appendParams); | ||
} | ||
/** | ||
@@ -504,16 +519,16 @@ * @description Execute payment submission process | ||
value: function submit(data) { | ||
var _this7 = this; | ||
var _this8 = this; | ||
return new Promise(function (resolve, reject) { | ||
try { | ||
var _this7$getBusActionNa; | ||
var _this8$getBusActionNa; | ||
var eventCallbackId = uuid(); | ||
_this7.logger.logInfo({ | ||
_this8.logger.logInfo({ | ||
title: 'sdk_event_apiSubmit' | ||
}); | ||
var actionName = (_this7$getBusActionNa = _this7.getBusActionNames()) === null || _this7$getBusActionNa === void 0 ? void 0 : _this7$getBusActionNa.submit; | ||
var actionName = (_this8$getBusActionNa = _this8.getBusActionNames()) === null || _this8$getBusActionNa === void 0 ? void 0 : _this8$getBusActionNa.submit; | ||
if (actionName && BusManager.isSubscribed(actionName)) { | ||
// 执行出错了,在通用拦截器返回 | ||
BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({ | ||
appendParams: _this7._appendParams, | ||
options: _this7.originOptions, | ||
appendParams: _this8._appendParams, | ||
options: _this8.originOptions, | ||
data: data | ||
@@ -525,6 +540,6 @@ }))).then(function (busMessage) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
_this7._eventCenter.once(eventCallbackId, function (_data) { | ||
_this8._eventCenter.once(eventCallbackId, function (_data) { | ||
resolve(_data); | ||
}); | ||
_this7._componentApp.dispatchToApp({ | ||
_this8._componentApp.dispatchToApp({ | ||
context: { | ||
@@ -531,0 +546,0 @@ event: 'submitPay', |
@@ -323,3 +323,3 @@ 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); } | ||
if (options !== null && options !== void 0 && options.onBeforeSubmit) { | ||
if (getType(options.onBeforeSubmit) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message); | ||
if (typeof (options === null || options === void 0 ? void 0 : options.onBeforeSubmit) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message); | ||
this._overrideSubscription(EVENT.beforeSubmit.name, /*#__PURE__*/function () { | ||
@@ -373,2 +373,7 @@ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) { | ||
} | ||
/** 地址监听 */ | ||
if (options !== null && options !== void 0 && options.onChange) { | ||
if (getType(options.onChange) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message); | ||
this._overrideSubscription(EVENT.onChange.name, options.onChange, EVENT.onChange.uniqueKey); | ||
} | ||
} | ||
@@ -484,2 +489,5 @@ /** | ||
} | ||
if (this.options.product === productSceneEnum.ELEMENT_ADDRESS) { | ||
actionNames = this._getPlugin(productSceneEnum.ELEMENT_ADDRESS); | ||
} | ||
return actionNames; | ||
@@ -486,0 +494,0 @@ } |
@@ -1,10 +0,4 @@ | ||
/** | ||
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved. | ||
* | ||
* 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: | ||
* 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 | ||
* 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. | ||
*/ | ||
import { AMSComponent } from './core/component/index'; | ||
import { componentSignEnum, IoptionsParams } from './types'; | ||
import { AddressComponent } from './core/component/address'; | ||
import { IoptionsParams, componentSignEnum, IoptionsAddressParams } from './types'; | ||
export { AMSCheckoutPage } from './core/component/ckp'; | ||
@@ -30,2 +24,8 @@ export * from './types'; | ||
} | ||
export declare class AntomElement extends AMSCheckout { | ||
constructor(options: IoptionsParams); | ||
} | ||
export declare class AddressElement extends AddressComponent { | ||
constructor(options: IoptionsAddressParams); | ||
} | ||
export default AMSCheckout; |
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); } | ||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } | ||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } | ||
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; } | ||
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); } } | ||
@@ -21,6 +24,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
*/ | ||
import { AMSAutoDebitAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSEasyPayAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion, ADDRESSElementAppVersion } from "./config/index"; | ||
import { AMSComponent } from "./core/component/index"; | ||
import { componentSignEnum } from "./types"; | ||
import { productSceneEnum } from "./types/index"; | ||
import { LogConfig, Logger } from "./util/logger"; | ||
import { AddressComponent } from "./core/component/address"; | ||
import { componentSignEnum, productSceneEnum } from "./types"; | ||
import { Logger, LogConfig } from "./util/logger"; | ||
var logger = new Logger(LogConfig, true); | ||
@@ -36,3 +40,5 @@ export { AMSCheckoutPage } from "./core/component/ckp"; | ||
_classCallCheck(this, AMSCheckout); | ||
_this = _super.call(this, _options); | ||
_this = _super.call(this, _objectSpread({ | ||
appVersion: AMSCheckoutAppVersion | ||
}, _options)); | ||
_this.preloadComponent(channelType, productSceneVersion); | ||
@@ -49,3 +55,4 @@ return _this; | ||
var _options = Object.assign({}, options, { | ||
product: productSceneEnum.AUTO_DEBIT | ||
product: productSceneEnum.AUTO_DEBIT, | ||
appVersion: AMSAutoDebitAppVersion | ||
}); | ||
@@ -74,3 +81,4 @@ return _super2.call(this, _options, [componentSignEnum.AUTO_DEBIT_WALLET]); | ||
var _options = Object.assign({}, options, { | ||
product: productSceneEnum.EASY_PAY | ||
product: productSceneEnum.EASY_PAY, | ||
appVersion: AMSEasyPayAppVersion | ||
}); | ||
@@ -106,3 +114,4 @@ var currentProductSceneVersion = '1.0'; | ||
var _options = Object.assign({}, options, { | ||
product: productSceneEnum.CASHIER_PAYMENT | ||
product: productSceneEnum.CASHIER_PAYMENT, | ||
appVersion: AMSCashierPaymentAppVersion | ||
}); | ||
@@ -138,3 +147,4 @@ var currentChannelType; | ||
var _options = Object.assign({}, options, { | ||
product: productSceneEnum.VAULTING | ||
product: productSceneEnum.VAULTING, | ||
appVersion: AMSVaultingAppVersion | ||
}); | ||
@@ -145,2 +155,28 @@ return _super6.call(this, _options, [componentSignEnum.CASHIER_PAYMENT_CARD]); | ||
}(AMSCheckout); | ||
export var AntomElement = /*#__PURE__*/function (_AMSCheckout6) { | ||
_inherits(AntomElement, _AMSCheckout6); | ||
var _super7 = _createSuper(AntomElement); | ||
function AntomElement(options) { | ||
_classCallCheck(this, AntomElement); | ||
var _options = Object.assign({}, options, { | ||
product: productSceneEnum.ELEMENT_PAYMENT, | ||
appVersion: AMSPaymentElementAppVersion | ||
}); | ||
return _super7.call(this, _options, [componentSignEnum.ELEMENT_PAYMENT]); | ||
} | ||
return _createClass(AntomElement); | ||
}(AMSCheckout); | ||
export var AddressElement = /*#__PURE__*/function (_AddressComponent) { | ||
_inherits(AddressElement, _AddressComponent); | ||
var _super8 = _createSuper(AddressElement); | ||
function AddressElement(options) { | ||
_classCallCheck(this, AddressElement); | ||
var _options = Object.assign({}, options, { | ||
product: productSceneEnum.ELEMENT_ADDRESS, | ||
appVersion: ADDRESSElementAppVersion | ||
}); | ||
return _super8.call(this, _options); | ||
} | ||
return _createClass(AddressElement); | ||
}(AddressComponent); | ||
export default AMSCheckout; |
@@ -87,3 +87,3 @@ 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); } | ||
type: 'funnel', | ||
success: eventCodeEnum.SDK_PAYMENT_FAIL === (state === null || state === void 0 ? void 0 : state.code), | ||
success: eventCodeEnum.SDK_PAYMENT_SUCCESSFUL === (state === null || state === void 0 ? void 0 : state.code), | ||
code: state === null || state === void 0 ? void 0 : state.code, | ||
@@ -90,0 +90,0 @@ errorCode: state === null || state === void 0 || (_state$result = state.result) === null || _state$result === void 0 ? void 0 : _state$result.errorCode, |
@@ -19,4 +19,4 @@ import { componentSignEnum, Ianalytics, renderDisplayTypeEnum } from '../../types'; | ||
appVersion: string; | ||
extendInfo: string; | ||
locale: string; | ||
extendInfo?: string; | ||
locale?: string; | ||
instanceId: string; | ||
@@ -26,3 +26,3 @@ renderDisplayType: renderDisplayTypeEnum; | ||
hostSign?: string; | ||
mid: string; | ||
mid?: string; | ||
}) => { | ||
@@ -29,0 +29,0 @@ path: string; |
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); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
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."); } | ||
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); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
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; } | ||
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; } | ||
@@ -12,4 +18,4 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); } | ||
*/ | ||
import { marmotMap, sdkVersion } from "../../config/index"; | ||
import { componentSignEnum } from "../../types"; | ||
import { elementAppMarmotMap, marmotMap, sdkVersion } from "../../config/index"; | ||
import { componentSignEnum, ComponentSignEnumV2 } from "../../types"; | ||
import { isDebugLog } from "../../util/debug"; | ||
@@ -56,3 +62,4 @@ import { queryParse, serialize } from "../../util/index"; | ||
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) { | ||
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']); | ||
var _signSupportMap; | ||
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(_defineProperty(_signSupportMap, componentSignEnum.ELEMENT_ADDRESS, ['1.0']), componentSignEnum.CHECKOUT_PAYMENT, ['1.0.0'])); | ||
var supportProductSceneVersion = signSupportMap[componentSign]; | ||
@@ -95,2 +102,23 @@ // 从左到右,从旧到新 | ||
} | ||
// 地址应用特殊处理 | ||
if (componentSign === componentSignEnum.ELEMENT_ADDRESS) { | ||
return "".concat(elementAppMarmotMap[environment], "/element-address/").concat(finalAppVersion, "/pages/address/index.html"); | ||
} | ||
// element应用特殊处理 | ||
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) { | ||
// element又分为express_checkout模式和普通模式, express_checkout 模式在扩展参数是返回expressCheckout=true | ||
var isExpressCheckout = false; | ||
try { | ||
// expressCheckout可能出现string(false) JSON.parse再转一次 | ||
isExpressCheckout = JSON.parse(JSON.parse(extendInfo).expressCheckout); | ||
} catch (error) { | ||
// 遇到JSON解析错误,默认false | ||
} | ||
if (isExpressCheckout) { | ||
// express_checkout模式走单独映射 | ||
return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/express_checkout/index.html"); | ||
} else { | ||
return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html"); | ||
} | ||
} | ||
return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html"); | ||
@@ -195,2 +223,4 @@ }; | ||
iframe.style.overflow = 'hidden'; | ||
// iframe设置支持第三方支付 | ||
iframe.allow = 'payment'; | ||
return iframe; | ||
@@ -197,0 +227,0 @@ }; |
@@ -27,2 +27,3 @@ export function getChannelBehavior(paymentSessionMetaData) { | ||
allowClickOutsideClose: false, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
buildSubmitPayExtParams: function buildSubmitPayExtParams(params) { | ||
@@ -29,0 +30,0 @@ return {}; |
@@ -1,11 +0,10 @@ | ||
/** | ||
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved. | ||
* | ||
* 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: | ||
* 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 | ||
* 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. | ||
*/ | ||
import { platformEnum } from '../../types'; | ||
import { componentSignEnum, platformEnum } from '../../types'; | ||
interface Options { | ||
componentSign?: componentSignEnum; | ||
type: 'tabs' | 'Accordion'; | ||
isExpressCheckout?: boolean; | ||
} | ||
export declare const inlineComponentAddCss: () => void; | ||
export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum) => void; | ||
export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum, options: Options) => void; | ||
export declare const createInlineBaseElement: (selector: string) => HTMLDivElement; | ||
export {}; |
@@ -8,6 +8,7 @@ /** | ||
*/ | ||
import { platformEnum } from "../../types"; | ||
import { INLINE_BASE_STYLE_ID, LOADING_ID, INLINE_IMG_CLASSNAME, COMPONENT_CONTAINER_ID, COMPONENT_IFRAME_TAG_ID } from "../../constant"; | ||
import { COMPONENT_CONTAINER_ID, COMPONENT_IFRAME_TAG_ID, INLINE_BASE_STYLE_ID, INLINE_IMG_CLASSNAME, LOADING_ID } from "../../constant"; | ||
import { componentSignEnum, platformEnum } from "../../types"; | ||
import { amsSetSize } from "../../util"; | ||
var inlineComponentCss = "#".concat(COMPONENT_IFRAME_TAG_ID, "-desktop{\n border-radius: 8px;\n position: absolute;\n top: 0;\n left: 0;\n}\n#").concat(COMPONENT_IFRAME_TAG_ID, "-mobile{\n position: absolute;\n top: 0;\n left: 0;\n}\n.").concat(COMPONENT_CONTAINER_ID, "-inline{\n width: 100%;\n height: auto;\n position: relative;\n line-height: 0;\n display: flex;\n}\n#").concat(LOADING_ID, "{\n width: 100%;\n flex: 1;\n}\n.").concat(INLINE_IMG_CLASSNAME, "{\n width: 100%;\n height: auto;\n object-fit: contain;\n box-sizing: border-box;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-mobile{\n padding: 0 0.16em;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-desktop{}\n"); | ||
// border-radius: 8px; | ||
var inlineComponentCss = "#".concat(COMPONENT_IFRAME_TAG_ID, "-desktop{\n position: absolute;\n top: 0;\n left: 0;\n}\n#").concat(COMPONENT_IFRAME_TAG_ID, "-mobile{\n position: absolute;\n top: 0;\n left: 0;\n}\n.").concat(COMPONENT_CONTAINER_ID, "-inline{\n width: 100%;\n height: auto;\n position: relative;\n line-height: 0;\n display: flex;\n}\n#").concat(LOADING_ID, "{\n width: 100%;\n flex: 1;\n}\n.").concat(INLINE_IMG_CLASSNAME, "{\n width: 100%;\n height: auto;\n object-fit: contain;\n box-sizing: border-box;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-mobile{\n padding: 0 0.16em;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-desktop{}\n"); | ||
export var inlineComponentAddCss = function inlineComponentAddCss() { | ||
@@ -20,7 +21,87 @@ var style = document.createElement('style'); | ||
}; | ||
export var addInlineLoading = function addInlineLoading(_selector, platform) { | ||
/** | ||
* @description componentSignEnum.ELEMENT_PAYMENT特殊处理 | ||
* @param {Options['type']} type | ||
*/ | ||
var renderElementPayment = function renderElementPayment(type) { | ||
var spliceStr = function spliceStr() { | ||
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
return arr.reduce(function (pre, cur) { | ||
return pre += cur; | ||
}, ''); | ||
}; | ||
var commonDom = function commonDom(children) { | ||
var viewBox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0 0 560 256'; | ||
var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 256; | ||
return "<svg id=\"".concat(INLINE_IMG_CLASSNAME, "-").concat(type, "\" width=\"100%\" height=\"").concat(height, "\" viewBox=\"").concat(viewBox, "\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"none\">\n ").concat(spliceStr(children), "\n <animate xlink:href=\"#").concat(INLINE_IMG_CLASSNAME, "-").concat(type, "\" attributeName=\"opacity\" values=\"0.5; 1; 0.5\" begin=\"0s\" dur=\"1s\" repeatCount=\"indefinite\"></animate>\n </svg>"); | ||
}; | ||
var creatRect = function creatRect(_ref) { | ||
var _ref$x = _ref.x, | ||
x = _ref$x === void 0 ? 0 : _ref$x, | ||
_ref$y = _ref.y, | ||
y = _ref$y === void 0 ? 0 : _ref$y, | ||
_ref$fill = _ref.fill, | ||
fill = _ref$fill === void 0 ? 'black' : _ref$fill, | ||
_ref$width = _ref.width, | ||
width = _ref$width === void 0 ? 560 : _ref$width, | ||
_ref$height = _ref.height, | ||
height = _ref$height === void 0 ? 32 : _ref$height, | ||
_ref$rx = _ref.rx, | ||
rx = _ref$rx === void 0 ? 4 : _ref$rx; | ||
return "<rect fill-opacity=\"0.04\" x=\"".concat(x, "\" y=\"").concat(y, "\" width=\"").concat(width, "\" height=\"").concat(height, "\" rx=\"").concat(rx, "\" fill=\"").concat(fill, "\"/>"); | ||
}; | ||
var result = [creatRect({ | ||
fill: 'white' | ||
}), creatRect({ | ||
y: 4 | ||
}), creatRect({ | ||
y: 48, | ||
height: 64 | ||
}), creatRect({ | ||
y: 128 | ||
}), creatRect({ | ||
y: 176 | ||
}), creatRect({ | ||
y: 224 | ||
})]; | ||
if (type === 'tabs') { | ||
result = [creatRect({ | ||
fill: 'white', | ||
width: 358, | ||
height: 305 | ||
}), creatRect({ | ||
y: 4, | ||
width: '50%', | ||
height: 73 | ||
}), creatRect({ | ||
x: '51%', | ||
y: 4, | ||
height: 73 | ||
}), creatRect({ | ||
y: 96, | ||
height: 64 | ||
}), creatRect({ | ||
y: 178 | ||
}), creatRect({ | ||
y: 228 | ||
}), creatRect({ | ||
y: 276 | ||
})]; | ||
} | ||
var viewBox = { | ||
view: type === 'tabs' ? '0 0 358 305' : '0 0 560 256', | ||
height: type === 'tabs' ? 305 : 256 | ||
}; | ||
return commonDom(result, viewBox.view, viewBox.height); | ||
}; | ||
export var addInlineLoading = function addInlineLoading(_selector, platform, options) { | ||
var loading = document.createElement('div'); | ||
loading.id = LOADING_ID; | ||
if (platform === platformEnum.desktop) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"740\" height=\"360\" viewBox=\"0 0 740 360\" fill=\"none\" xmlns=\"\">\n <rect width=\"740\" height=\"360\" rx=\"12\" fill=\"#F6F6F6\"/>\n <rect opacity=\"0.7\" x=\"44\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"94\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"144\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M136 100H48C43.5817 100 40 103.582 40 108C40 112.418 43.5817 116 48 116H136C140.418 116 144 112.418 144 108C144 103.582 140.418 100 136 100Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 126H58C48.0589 126 40 134.059 40 144C40 153.941 48.0589 162 58 162H682C691.941 162 700 153.941 700 144C700 134.059 691.941 126 682 126Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 182H58C48.0589 182 40 190.059 40 200C40 209.941 48.0589 218 58 218H682C691.941 218 700 209.941 700 200C700 190.059 691.941 182 682 182Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M504 274H64C52.9543 274 44 282.954 44 294C44 305.046 52.9543 314 64 314H504C515.046 314 524 305.046 524 294C524 282.954 515.046 274 504 274Z\" fill=\"#E1E6ED\"/>\n </g>\n </svg>"); | ||
if (platform === platformEnum.mobile) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"358\" height=\"186\" viewBox=\"0 0 358 186\" fill=\"none\" xmlns=\"\">\n <g clip-path=\"url(#clip0_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <g clip-path=\"url(#clip1_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <rect width=\"358\" height=\"40\" fill=\"white\"/>\n <rect opacity=\"0.7\" x=\"4\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"54\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"104\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g clip-path=\"url(#clip2_2543_91192)\">\n <rect width=\"358\" height=\"120\" transform=\"translate(0 66)\" fill=\"white\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M95 66H9C4.02944 66 0 70.0294 0 75C0 79.9706 4.02943 84 9 84H95C99.9706 84 104 79.9706 104 75C104 70.0294 99.9706 66 95 66Z\" fill=\"#E1E6ED\"/>\n </g>\n <g clip-path=\"url(#clip3_2543_91192)\">\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 94H18C8.05888 94 0 102.059 0 112C0 121.941 8.05887 130 18 130H340C349.941 130 358 121.941 358 112C358 102.059 349.941 94 340 94Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 150H18C8.05888 150 0 158.059 0 168C0 177.941 8.05887 186 18 186H340C349.941 186 358 177.941 358 168C358 158.059 349.941 150 340 150Z\" fill=\"#E1E6ED\"/>\n </g>\n </g>\n </g>\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip1_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip2_2543_91192\">\n <rect width=\"358\" height=\"120\" fill=\"white\" transform=\"translate(0 66)\"/>\n </clipPath>\n <clipPath id=\"clip3_2543_91192\">\n <rect width=\"358\" height=\"92\" fill=\"white\" transform=\"translate(0 94)\"/>\n </clipPath>\n </defs>\n </svg>\n "); | ||
if (options.componentSign === componentSignEnum.ELEMENT_PAYMENT) { | ||
if (options.isExpressCheckout) { | ||
loading.innerHTML = ''; | ||
} else { | ||
loading.innerHTML = renderElementPayment(options === null || options === void 0 ? void 0 : options.type); | ||
} | ||
} else if (platform === platformEnum.desktop) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"740\" height=\"360\" viewBox=\"0 0 740 360\" fill=\"none\" xmlns=\"\">\n <rect width=\"740\" height=\"360\" rx=\"12\" fill=\"#F6F6F6\"/>\n <rect opacity=\"0.7\" x=\"44\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"94\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"144\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M136 100H48C43.5817 100 40 103.582 40 108C40 112.418 43.5817 116 48 116H136C140.418 116 144 112.418 144 108C144 103.582 140.418 100 136 100Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 126H58C48.0589 126 40 134.059 40 144C40 153.941 48.0589 162 58 162H682C691.941 162 700 153.941 700 144C700 134.059 691.941 126 682 126Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 182H58C48.0589 182 40 190.059 40 200C40 209.941 48.0589 218 58 218H682C691.941 218 700 209.941 700 200C700 190.059 691.941 182 682 182Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M504 274H64C52.9543 274 44 282.954 44 294C44 305.046 52.9543 314 64 314H504C515.046 314 524 305.046 524 294C524 282.954 515.046 274 504 274Z\" fill=\"#E1E6ED\"/>\n </g>\n </svg>");else if (platform === platformEnum.mobile) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"358\" height=\"186\" viewBox=\"0 0 358 186\" fill=\"none\" xmlns=\"\">\n <g clip-path=\"url(#clip0_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <g clip-path=\"url(#clip1_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <rect width=\"358\" height=\"40\" fill=\"white\"/>\n <rect opacity=\"0.7\" x=\"4\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"54\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"104\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g clip-path=\"url(#clip2_2543_91192)\">\n <rect width=\"358\" height=\"120\" transform=\"translate(0 66)\" fill=\"white\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M95 66H9C4.02944 66 0 70.0294 0 75C0 79.9706 4.02943 84 9 84H95C99.9706 84 104 79.9706 104 75C104 70.0294 99.9706 66 95 66Z\" fill=\"#E1E6ED\"/>\n </g>\n <g clip-path=\"url(#clip3_2543_91192)\">\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 94H18C8.05888 94 0 102.059 0 112C0 121.941 8.05887 130 18 130H340C349.941 130 358 121.941 358 112C358 102.059 349.941 94 340 94Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 150H18C8.05888 150 0 158.059 0 168C0 177.941 8.05887 186 18 186H340C349.941 186 358 177.941 358 168C358 158.059 349.941 150 340 150Z\" fill=\"#E1E6ED\"/>\n </g>\n </g>\n </g>\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip1_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip2_2543_91192\">\n <rect width=\"358\" height=\"120\" fill=\"white\" transform=\"translate(0 66)\"/>\n </clipPath>\n <clipPath id=\"clip3_2543_91192\">\n <rect width=\"358\" height=\"92\" fill=\"white\" transform=\"translate(0 94)\"/>\n </clipPath>\n </defs>\n </svg>\n "); | ||
if (_selector) _selector.appendChild(loading); | ||
@@ -27,0 +108,0 @@ var loadingDom = document.getElementById(LOADING_ID); |
@@ -16,1 +16,2 @@ import { platformEnum } from '../../types'; | ||
}) => void; | ||
export declare const slideInAndOutKeyframes: (id: any, height: any) => string; |
@@ -171,2 +171,5 @@ /** | ||
} | ||
}; | ||
export var slideInAndOutKeyframes = function slideInAndOutKeyframes(id, height) { | ||
return "@keyframes ".concat(id, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(height, "px;\n }\n }\n @keyframes ").concat(id, "-slide-out {\n 0% {\n height: ").concat(height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }"); | ||
}; |
@@ -30,3 +30,5 @@ import type AMSCheckout from '../../core/instance'; | ||
private _webAppHeartBeatTimeoutFn; | ||
constructor(); | ||
constructor(componentOption?: { | ||
appVersion?: string; | ||
}); | ||
/** | ||
@@ -33,0 +35,0 @@ * @description Cancel listening and destroy the dom |
@@ -0,8 +1,11 @@ | ||
export declare const createCustomSheet: (curTheme?: 'dark' | 'light') => void; | ||
export declare const renderPopupLoading: (container: HTMLDivElement, curTheme: 'dark' | 'light') => void; | ||
export declare const removePopupLoading: (isShowMockup?: boolean) => void; | ||
export declare const insertStyleSheet: () => void; | ||
export declare const createModal: ({ device, url, widthPadding, heightPadding }: { | ||
export declare const createModal: ({ device, url, widthPadding, loadingConfig }: { | ||
device: any; | ||
url: any; | ||
widthPadding: any; | ||
heightPadding: any; | ||
loadingConfig: any; | ||
}) => Promise<HTMLIFrameElement>; | ||
export declare const destroyModal: () => void; |
@@ -1,6 +0,44 @@ | ||
import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant"; | ||
import { AMSPOPUP_PREFIX, ANIMATION_TIME, MOCKUP_ID, POPUPLOADING_ID } from "../../constant"; | ||
import { getDesignFontSize } from "../../util"; | ||
// CSS样式字符串 | ||
var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n"); | ||
var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n .").concat(AMSPOPUP_PREFIX, "modal-mobile{\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n bottom: 0;\n left: 0%;\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "-drawer-enter {\n animation: slideIn ").concat(ANIMATION_TIME, "ms forwards;\n }\n \n @keyframes slideIn {\n from {\n transform: translateY(100%); /* \u6ED1\u5165\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 0 */\n }\n to {\n transform: translateY(0); /* \u6ED1\u5165\u7ED3\u675F\u65F6\u5728\u539F\u4F4D\u7F6E */\n opacity: 1; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 1 */\n }\n }\n\n /* \u62BD\u5C49\u4ECE\u5E95\u90E8\u6ED1\u51FA */\n .").concat(AMSPOPUP_PREFIX, "-drawer-exit {\n animation: slideOut ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideOut {\n from {\n transform: translateY(0); /* \u6ED1\u51FA\u65F6\u4ECE\u5F53\u524D\u4F4D\u7F6E\u5F00\u59CB */\n opacity: 1; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 1 */\n }\n to {\n transform: translateY(100%); /* \u6ED1\u51FA\u7ED3\u675F\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 0 */\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n\n.ams-component-popup-loading {\n width: 0.8em;\n height:0.8em;\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-popup-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-popup-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-popup-loading .line div:before,\n.ams-component-popup-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: black;\n border-radius: 5.3px;\n}\n.ams-component-popup-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-popup-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-popup-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-popup-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n"); | ||
var getCurrentTheme = function getCurrentTheme() { | ||
var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default'; | ||
var theme = { | ||
night: 'dark', | ||
gamingPurple: 'dark', | ||
agateGreen: 'dark', | ||
default: 'light', | ||
nostalgicGray: 'light', | ||
cherryBlossomPink: 'light' | ||
}; | ||
return theme[curTheme]; | ||
}; | ||
export var createCustomSheet = function createCustomSheet() { | ||
var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light'; | ||
var sheet = "\n .ams-component-popup-loading .line div:before,\n .ams-component-popup-loading .line div:after {\n background: ".concat(curTheme === 'light' ? '#000000' : '#ffffff', " !important;\n }"); | ||
var style = document.createElement('style'); | ||
style.innerHTML = sheet; | ||
document.head.appendChild(style); | ||
}; | ||
export var renderPopupLoading = function renderPopupLoading(container, curTheme) { | ||
createCustomSheet(curTheme); | ||
var loading = document.createElement('div'); | ||
loading === null || loading === void 0 || loading.classList.add(POPUPLOADING_ID); | ||
loading.id = POPUPLOADING_ID; | ||
loading.innerHTML = '<div class="line"><div></div><div></div><div></div><div></div></div>'; | ||
loading.style.fontSize = "".concat(getDesignFontSize(), "px"); | ||
container.appendChild(loading); | ||
}; | ||
export var removePopupLoading = function removePopupLoading() { | ||
var _document$getElementB; | ||
var isShowMockup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
var mockup = document.getElementById(MOCKUP_ID); | ||
if (mockup) { | ||
mockup.style.background = 'rgb(0, 0, 0, 0.6)'; | ||
mockup.style.display = isShowMockup ? 'block' : 'none'; | ||
} | ||
(_document$getElementB = document.getElementById(POPUPLOADING_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove(); | ||
}; | ||
// 创建和插入样式表 | ||
@@ -12,4 +50,5 @@ export var insertStyleSheet = function insertStyleSheet() { | ||
}; | ||
var modalDevice = 'desktop'; | ||
// 插入弹窗 | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export var createModal = function createModal(_ref) { | ||
@@ -19,17 +58,19 @@ var device = _ref.device, | ||
widthPadding = _ref.widthPadding, | ||
heightPadding = _ref.heightPadding; | ||
loadingConfig = _ref.loadingConfig; | ||
return new Promise(function (resolve, reject) { | ||
try { | ||
modalDevice = device; | ||
var overlay = document.createElement('div'); | ||
overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn")); | ||
var modal = document.createElement('div'); | ||
modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn")); | ||
if (device === 'desktop') { | ||
modal.style.width = '600px'; | ||
modal.style.height = '464px'; | ||
modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn")); | ||
modal.style.width = '656px'; | ||
modal.style.height = '620px'; | ||
modal.style.borderRadius = '12px'; | ||
} else { | ||
modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)"); | ||
modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)"); | ||
modal.style.borderRadius = '8px'; | ||
modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal-mobile"), "".concat(AMSPOPUP_PREFIX, "-drawer-enter")); | ||
modal.style.width = '100%'; | ||
modal.style.height = '80vh'; | ||
modal.style.borderRadius = '12px 12px 0 0'; | ||
} | ||
@@ -41,2 +82,12 @@ var iframe = document.createElement('iframe'); | ||
iframe.style.height = '100%'; | ||
if (loadingConfig && Object.keys(loadingConfig).length) { | ||
var _loadingConfig$theme = loadingConfig.theme, | ||
theme = _loadingConfig$theme === void 0 ? 'default' : _loadingConfig$theme, | ||
_loadingConfig$backgr = loadingConfig.backgroundPrimary, | ||
backgroundPrimary = _loadingConfig$backgr === void 0 ? '#ffffff' : _loadingConfig$backgr; | ||
var mode = getCurrentTheme(theme); | ||
renderPopupLoading(modal, mode); | ||
modal.style.backgroundColor = backgroundPrimary; | ||
iframe.style.backgroundColor = backgroundPrimary; | ||
} | ||
modal.appendChild(iframe); | ||
@@ -59,7 +110,12 @@ var body = document.getElementsByTagName('body')[0]; | ||
var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay")); | ||
var modal = document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal")); | ||
var modal = modalDevice === 'desktop' ? document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal")) : document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal-mobile")); | ||
overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn")); | ||
overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut")); | ||
modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn")); | ||
modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut")); | ||
if (modalDevice === 'desktop') { | ||
modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn")); | ||
modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut")); | ||
} else { | ||
modal.classList.remove("".concat(AMSPOPUP_PREFIX, "-drawer-enter")); | ||
modal.classList.add("".concat(AMSPOPUP_PREFIX, "-drawer-exit")); | ||
} | ||
setTimeout(function () { | ||
@@ -66,0 +122,0 @@ overlay.parentNode.removeChild(overlay); |
@@ -383,2 +383,3 @@ 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); } | ||
this.destroyComponent(context, message); | ||
break; | ||
default: | ||
@@ -385,0 +386,0 @@ console.log('Unknown action: ' + message.getAction()); |
@@ -11,2 +11,3 @@ import { BusSubscriber } from 'src/core/bus'; | ||
destroyComponent?: string; | ||
getValue?: string; | ||
} | ||
@@ -13,0 +14,0 @@ export type IExtendPluginItem = { |
@@ -8,2 +8,13 @@ /** | ||
*/ | ||
export type onChange = () => onCnageResult; | ||
interface onCnageResult { | ||
complete: boolean; | ||
addressValue: AddressItem[]; | ||
selectIndex: number | string; | ||
} | ||
export type getValue = (hasValidate: boolean) => Promise<AddressValueResult>; | ||
interface AddressValueResult { | ||
complete: boolean; | ||
value: AddressItem; | ||
} | ||
/** | ||
@@ -21,2 +32,3 @@ * SDK options | ||
onClose?: callOnClose; | ||
onChange?: onChange; | ||
networkMode?: string; | ||
@@ -46,2 +58,6 @@ mode?: string; | ||
} | ||
export declare enum ComponentSignEnumV2 { | ||
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL", | ||
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL" | ||
} | ||
export declare enum componentSignEnum { | ||
@@ -57,2 +73,4 @@ 'EASY_PAY_WALLET' = "EASY_PAY_WALLET", | ||
'VAULTING_CARD' = "VAULTING_CARD", | ||
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL", | ||
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL", | ||
'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT" | ||
@@ -68,2 +86,4 @@ } | ||
'CARD_APPLE_PAY' = "CARD_APPLE_PAY", | ||
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT", | ||
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS", | ||
'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT" | ||
@@ -75,3 +95,4 @@ } | ||
'BANK' = "BANK", | ||
'APM' = "APM" | ||
'APM' = "APM", | ||
'ALL' = "ALL" | ||
} | ||
@@ -89,3 +110,7 @@ export interface DeviceIdParameter { | ||
notRedirectAfterComplete?: boolean; | ||
appearance?: Record<string, any>; | ||
appearance?: { | ||
[x: string]: any; | ||
themeType?: string; | ||
accentColor?: string; | ||
}; | ||
merchantAppointParam?: IMerchantAppointParam; | ||
@@ -98,3 +123,55 @@ } | ||
paypalConfiguration?: IPaypalConfiguration; | ||
/** 将address-element参数定义合入原参数定义 */ | ||
configParams?: { | ||
hideFields?: string[]; | ||
addressAutoSuggestDisabled?: addressAutoSuggestDisabledType; | ||
}; | ||
prefillValue?: AddressItem[]; | ||
componentSession?: string; | ||
loca?: string; | ||
} | ||
/** 表单地址数据 */ | ||
export interface AddressItem { | ||
shippingName: { | ||
firstName: string; | ||
lastName: string; | ||
}; | ||
/** 手机号 */ | ||
shippingPhoneNo: string; | ||
/** 地址 */ | ||
shippingAddress: { | ||
/** 国家 */ | ||
region: string; | ||
/** 地址1 */ | ||
address1: string; | ||
/** 地址2 */ | ||
address2: string; | ||
/** 省份 */ | ||
province?: string; | ||
/** 城市 */ | ||
city?: string; | ||
/** 地址级联 四层 【province,city,district,subDistrict】 */ | ||
district?: string[]; | ||
/** 邮政编码 */ | ||
zipCode: string; | ||
/** 对应地址级联数据对象 */ | ||
districtValues?: { | ||
/** 城市 */ | ||
city?: string; | ||
/** 区/县 */ | ||
district?: string; | ||
/** 省份 */ | ||
province?: string; | ||
/** 子区域 */ | ||
subDistrict?: string; | ||
}; | ||
}; | ||
/** 备注 */ | ||
notes?: string; | ||
open?: boolean; | ||
/** 是否默认地址 */ | ||
prefer?: '1' | '0'; | ||
shippingId?: string; | ||
} | ||
type addressAutoSuggestDisabledType = 0 | 1; | ||
export interface IPaypalConfiguration { | ||
@@ -131,3 +208,3 @@ style?: object; | ||
productScene: productSceneEnum; | ||
paymentMethodCategoryType: paymentMethodCategoryTypeEnum; | ||
paymentMethodCategoryType?: paymentMethodCategoryTypeEnum; | ||
productSceneVersion: string; | ||
@@ -584,1 +661,12 @@ } | ||
}; | ||
export interface IoptionsAddressParams { | ||
environment?: string; | ||
locale?: string; | ||
onSizeChanged?: callOnSizeChanged; | ||
onChange?: onChange; | ||
analytics?: { | ||
enabled: boolean; | ||
}; | ||
product?: string; | ||
} | ||
export {}; |
@@ -9,2 +9,3 @@ /** | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/** | ||
@@ -19,2 +20,7 @@ * SDK options | ||
}({}); | ||
export var ComponentSignEnumV2 = /*#__PURE__*/function (ComponentSignEnumV2) { | ||
ComponentSignEnumV2["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL"; | ||
ComponentSignEnumV2["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL"; | ||
return ComponentSignEnumV2; | ||
}({}); | ||
export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) { | ||
@@ -30,2 +36,4 @@ componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET"; | ||
componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD"; | ||
componentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL"; | ||
componentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL"; | ||
componentSignEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT"; | ||
@@ -42,2 +50,4 @@ return componentSignEnum; | ||
productSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY"; | ||
productSceneEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT"; | ||
productSceneEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS"; | ||
productSceneEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT"; | ||
@@ -51,4 +61,8 @@ return productSceneEnum; | ||
paymentMethodCategoryTypeEnum["APM"] = "APM"; | ||
paymentMethodCategoryTypeEnum["ALL"] = "ALL"; | ||
return paymentMethodCategoryTypeEnum; | ||
}({}); | ||
/** 表单地址数据 */ | ||
export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) { | ||
@@ -55,0 +69,0 @@ payPalConfigurationIntentEnum["intent"] = "intent"; |
@@ -21,2 +21,3 @@ import { IsecurityConfig, productSceneEnum, DeviceIdParameter } from '../types'; | ||
FLASH_BUY: string; | ||
ELEMENT_PAYMENT: string; | ||
}; | ||
@@ -23,0 +24,0 @@ export declare const getSecurityHost: (region: string) => string; |
@@ -27,3 +27,3 @@ 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); } | ||
}; | ||
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount'); | ||
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount'), productSceneEnum.ELEMENT_PAYMENT, 'Acquirer'); | ||
export var getSecurityHost = function getSecurityHost(region) { | ||
@@ -30,0 +30,0 @@ return securityHost[region] || securityHost[SecurityRegionEnum.SG]; |
{ | ||
"name": "@alipay/ams-checkout", | ||
"version": "1.20.1", | ||
"version": "1.21.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2806171
116
12546
6