@alipay/ams-checkout 0.0.1711691167-dev.9 → 0.0.1712728793-dev.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.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/request.js +3 -3
- package/esm/core/bus/index.d.ts +1 -1
- package/esm/core/bus/interface.d.ts +1 -5
- package/esm/core/bus/interface.js +1 -6
- package/esm/core/component/index.d.ts +1 -0
- package/esm/core/component/index.js +8 -12
- package/esm/core/instance/index.d.ts +1 -8
- package/esm/core/instance/index.js +14 -19
- package/esm/plugin/applepay/component.d.ts +1 -1
- package/esm/plugin/applepay/component.js +5 -5
- package/esm/plugin/applepay/index.d.ts +1 -1
- package/esm/plugin/applepay/index.js +6 -6
- package/esm/plugin/component/component.popup.style.js +1 -1
- package/esm/plugin/component/index.d.ts +1 -2
- package/esm/plugin/component/index.js +115 -105
- package/esm/plugin/const.js +4 -18
- package/esm/plugin/type.d.ts +2 -2
- package/esm/request/index.js +8 -14
- package/esm/types/index.d.ts +6 -49
- package/esm/types/index.js +0 -18
- package/esm/util/index.d.ts +1 -2
- package/esm/util/index.js +2 -4
- package/esm/util/logger.d.ts +0 -4
- package/esm/util/logger.js +3 -23
- package/esm/util/versionCompare.d.ts +3 -1
- package/esm/util/versionCompare.js +75 -0
- package/package.json +1 -1
- package/esm/plugin/paypal/index.d.ts +0 -20
- package/esm/plugin/paypal/index.js +0 -380
- package/esm/plugin/utils.d.ts +0 -6
- package/esm/plugin/utils.js +0 -21
package/esm/config/request.js
CHANGED
@@ -12,8 +12,8 @@ var _queryParse = queryParse(),
|
|
12
12
|
groupId = _queryParse.groupId,
|
13
13
|
host = _queryParse.requestHost;
|
14
14
|
export var requestHost = {
|
15
|
-
local: 'http://imgs-
|
16
|
-
dev: host || 'http://imgs-
|
15
|
+
local: 'http://imgs-8452.sggz00b.dev.alipay.net/mgw.htm',
|
16
|
+
dev: host || 'http://imgs-8452.sggz00b.dev.alipay.net/mgw.htm',
|
17
17
|
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
18
18
|
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
19
19
|
prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -22,7 +22,7 @@ export var requestHost = {
|
|
22
22
|
export var clientId = '5J5Y8X4E2Y25GR00690';
|
23
23
|
export var tntInstId = 'ALIPW3SG';
|
24
24
|
export var appId = 'ANTOM_PAYMENT_WEB';
|
25
|
-
export var sofaId = groupId || '
|
25
|
+
export var sofaId = groupId || 'GROUP_20240304204929';
|
26
26
|
export var hostSignMap = function hostSignMap(hostSign, env) {
|
27
27
|
var map = {
|
28
28
|
SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
package/esm/core/bus/index.d.ts
CHANGED
@@ -4,11 +4,7 @@ export declare enum PaymentActionEnum {
|
|
4
4
|
export declare enum ApplePayActionEnum {
|
5
5
|
canMakePayments = "plugin_CARD_APPLE_PAY_available",
|
6
6
|
createComponent = "plugin_CARD_APPLE_PAY_createComponent",
|
7
|
-
|
8
|
-
}
|
9
|
-
export declare enum PaypalActionEnum {
|
10
|
-
mountComponent = "plugin_Paypal_mountComponent",
|
11
|
-
destroyComponent = "plugin_Paypal_destroyComponent"
|
7
|
+
destoryComponent = "plugin_CARD_APPLE_PAY_destoryComponent"
|
12
8
|
}
|
13
9
|
export declare enum SDKCallbackActionEnum {
|
14
10
|
onEventCallback = "onEventCallback"
|
@@ -5,14 +5,9 @@ export var PaymentActionEnum = /*#__PURE__*/function (PaymentActionEnum) {
|
|
5
5
|
export var ApplePayActionEnum = /*#__PURE__*/function (ApplePayActionEnum) {
|
6
6
|
ApplePayActionEnum["canMakePayments"] = "plugin_CARD_APPLE_PAY_available";
|
7
7
|
ApplePayActionEnum["createComponent"] = "plugin_CARD_APPLE_PAY_createComponent";
|
8
|
-
ApplePayActionEnum["
|
8
|
+
ApplePayActionEnum["destoryComponent"] = "plugin_CARD_APPLE_PAY_destoryComponent";
|
9
9
|
return ApplePayActionEnum;
|
10
10
|
}({});
|
11
|
-
export var PaypalActionEnum = /*#__PURE__*/function (PaypalActionEnum) {
|
12
|
-
PaypalActionEnum["mountComponent"] = "plugin_Paypal_mountComponent";
|
13
|
-
PaypalActionEnum["destroyComponent"] = "plugin_Paypal_destroyComponent";
|
14
|
-
return PaypalActionEnum;
|
15
|
-
}({});
|
16
11
|
export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum) {
|
17
12
|
SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
|
18
13
|
return SDKCallbackActionEnum;
|
@@ -7,6 +7,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
7
7
|
_componentApp: ComponentApp;
|
8
8
|
channelType: componentSignEnum[];
|
9
9
|
productSceneVersion: string;
|
10
|
+
timer: any;
|
10
11
|
constructor(options: IoptionsParams);
|
11
12
|
private parameterInitAndCheck;
|
12
13
|
private pluginAppendIframe;
|
@@ -29,19 +29,18 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
29
|
*/
|
30
30
|
import { v4 as uuid } from 'uuid';
|
31
31
|
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
32
|
-
import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
33
32
|
import ComponentApp from "../../plugin/component";
|
34
|
-
import { ExtendPlugin } from "../../plugin/const";
|
35
|
-
import { PaypalBusSubscriber } from "../../plugin/paypal";
|
36
33
|
import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
37
34
|
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
38
35
|
import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
|
39
36
|
import { getSecurityConfigStorageKey } from "../../util/security";
|
37
|
+
import CoreInstance from "../instance/index";
|
40
38
|
import { BusManager, BusMessage } from "../bus";
|
41
39
|
import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
|
40
|
+
import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
42
41
|
import { SecurityBusSubscriber } from "../bus/ability/security";
|
43
42
|
import { TrackerBusSubscriber } from "../bus/ability/tracker";
|
44
|
-
import
|
43
|
+
import { ExtendPlugin } from "../../plugin/const";
|
45
44
|
export var getComponentSign = function getComponentSign(params) {
|
46
45
|
var _params$paymentSessio = params.paymentSessionConfig,
|
47
46
|
_params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
|
@@ -75,7 +74,7 @@ var handleSessionData = function handleSessionData(originSessionData) {
|
|
75
74
|
parseData = _parseSessionData2[0],
|
76
75
|
sessionData = _parseSessionData2[1];
|
77
76
|
resetEasyPaySceneVersion(parseData);
|
78
|
-
return [parseData, sessionData];
|
77
|
+
return [parseData !== null && parseData !== void 0 ? parseData : {}, sessionData];
|
79
78
|
};
|
80
79
|
var handleParams = function handleParams(params) {
|
81
80
|
var _params = Object.assign({
|
@@ -117,6 +116,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
117
116
|
_defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
|
118
117
|
_defineProperty(_assertThisInitialized(_this), "channelType", void 0);
|
119
118
|
_defineProperty(_assertThisInitialized(_this), "productSceneVersion", void 0);
|
119
|
+
_defineProperty(_assertThisInitialized(_this), "timer", void 0);
|
120
120
|
var ComponentPlugin = new ComponentApp();
|
121
121
|
ComponentPlugin.setRender(createIframeNode);
|
122
122
|
ComponentPlugin.setPreloadRender(createPreloadIframeNode);
|
@@ -230,7 +230,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
230
230
|
BusManager.subscribe(new TrackerBusSubscriber(this.logger));
|
231
231
|
// subscribe plugin
|
232
232
|
BusManager.subscribe(new ApplePayBusSubscriber(this.logger));
|
233
|
-
BusManager.subscribe(new PaypalBusSubscriber(this.logger));
|
234
233
|
|
235
234
|
// register bus plugin
|
236
235
|
ExtendPlugin.forEach(function (item) {
|
@@ -266,7 +265,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
266
265
|
* only the channel described in the document will be called, and it will be returned as available by default
|
267
266
|
* @param paymentMethod - described in the document
|
268
267
|
* @param subPaymentMethod - described in the document
|
269
|
-
* @returns
|
268
|
+
* @returns
|
270
269
|
*/
|
271
270
|
}, {
|
272
271
|
key: "canMakePayments",
|
@@ -324,8 +323,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
324
323
|
_this4._eventCenter.emit(EVENT.error.name, error);
|
325
324
|
return Promise.reject(error);
|
326
325
|
}).then(function (appendParams) {
|
327
|
-
var iframeNodesParams = appendParams.iframeNodesParams;
|
328
|
-
_this4.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
|
329
326
|
return _this4.createComponentProcess(appendParams);
|
330
327
|
});
|
331
328
|
}
|
@@ -365,7 +362,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
365
362
|
channelType: channelType
|
366
363
|
});
|
367
364
|
}
|
368
|
-
setTimeout(function () {
|
365
|
+
this.timer = setTimeout(function () {
|
369
366
|
_this5.clearPreloadIframe(true);
|
370
367
|
}, MAX_CLEAR_TIME);
|
371
368
|
}
|
@@ -373,6 +370,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
373
370
|
key: "clearPreloadIframe",
|
374
371
|
value: function clearPreloadIframe() {
|
375
372
|
var isTimeOut = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
373
|
+
!isTimeOut && clearTimeout(this.timer);
|
376
374
|
if (Array.isArray(this.channelType)) {
|
377
375
|
for (var i = 0; i < this.channelType.length; i++) {
|
378
376
|
var iframe = document.getElementById("ams-checkout-component-".concat(this.channelType[i], "-").concat(this.productSceneVersion));
|
@@ -414,8 +412,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
414
412
|
_this6._eventCenter.emit(EVENT.error.name, error);
|
415
413
|
return Promise.reject(error);
|
416
414
|
}).then(function (appendParams) {
|
417
|
-
var iframeNodesParams = appendParams.iframeNodesParams;
|
418
|
-
_this6.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
|
419
415
|
return _this6.mountComponentProcess(appendParams);
|
420
416
|
});
|
421
417
|
}
|
@@ -1,15 +1,8 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
-
*
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
-
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
6
|
-
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
7
|
-
*/
|
8
|
-
import { ComponentActionNamesType } from 'src/plugin/type';
|
9
1
|
import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig, IoptionsParams } from '../../types/index';
|
10
2
|
import { EventCenter } from '../../util/index';
|
11
3
|
import { Logger } from '../../util/logger';
|
12
4
|
import { Security } from '../../util/security';
|
5
|
+
import { ComponentActionNamesType } from 'src/plugin/type';
|
13
6
|
export default class AMSSDK {
|
14
7
|
options: AMSCheckoutOptions;
|
15
8
|
originOptions: IoptionsParams;
|
@@ -16,7 +16,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
16
16
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
17
17
|
*/
|
18
18
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
19
|
-
|
20
19
|
import { v4 as uuid } from 'uuid';
|
21
20
|
import { sdkVersion } from "../../config/index";
|
22
21
|
import { ERRORMESSAGE, EVENT } from "../../constant";
|
@@ -25,8 +24,8 @@ import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, productSceneEnu
|
|
25
24
|
import { checkTimeElapsed, device, EventCenter, getOrSetStorageId, getType, queryParse, safeJson } from "../../util/index";
|
26
25
|
import CallApp from "../../util/intl-callapp/es/main";
|
27
26
|
import { LogConfig, Logger } from "../../util/logger";
|
28
|
-
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
|
29
27
|
import { compareVersion } from "../../util/versionCompare";
|
28
|
+
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
|
30
29
|
import { BusManager, BusMessage } from "../bus";
|
31
30
|
var AMSSDK = /*#__PURE__*/function () {
|
32
31
|
function AMSSDK(options) {
|
@@ -57,25 +56,24 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
57
56
|
this._storageId = _storageId;
|
58
57
|
|
59
58
|
// TODO Consumption data analysis control parameters
|
60
|
-
this.logger = new Logger(LogConfig, (options === null || options === void 0 ? void 0 : options.environment)
|
59
|
+
this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
61
60
|
this.logger.setMedta({
|
62
61
|
instanceId: this._instanceId
|
63
62
|
});
|
64
63
|
this.logger.initTracker();
|
65
|
-
this.logger.setComponentStartTime(Date.now());
|
66
|
-
this.logger.setTrackId(this._instanceId);
|
67
64
|
this.logger.logInfo({
|
68
65
|
title: 'NEW_AMSSDK_BY_MECHANT',
|
69
|
-
msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale)
|
66
|
+
msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale, "}")
|
70
67
|
}).send();
|
71
|
-
this.preInitSecurity();
|
68
|
+
this.preInitSecurity(options);
|
72
69
|
}
|
73
70
|
_createClass(AMSSDK, [{
|
74
71
|
key: "preInitSecurity",
|
75
|
-
value: function preInitSecurity() {
|
72
|
+
value: function preInitSecurity(options) {
|
76
73
|
var _this$options;
|
77
74
|
var antomSDKConfigKey = 'antomSDKConfigKey';
|
78
75
|
var config = safeJson(getOrSetStorageId(antomSDKConfigKey), {});
|
76
|
+
if (![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment)) return;
|
79
77
|
if (checkTimeElapsed()) {
|
80
78
|
antomConfig({
|
81
79
|
env: this.options.env.environment
|
@@ -112,13 +110,11 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
112
110
|
this.logger.logInfo({
|
113
111
|
title: 'sdk_event_apiOnDestroy'
|
114
112
|
}).send();
|
115
|
-
var actionName = (_this$getBusActionNam = this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.
|
113
|
+
var actionName = (_this$getBusActionNam = this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.destoryComponent;
|
116
114
|
if (actionName && BusManager.isSubscribed(actionName)) {
|
117
|
-
var _this$_appendParams;
|
118
115
|
// 执行出错了,在通用拦截器返回
|
119
116
|
BusManager.publish(new BusMessage(actionName, JSON.stringify({
|
120
|
-
options: this.originOptions
|
121
|
-
selector: (_this$_appendParams = this._appendParams) === null || _this$_appendParams === void 0 || (_this$_appendParams = _this$_appendParams.iframeNodesParams) === null || _this$_appendParams === void 0 ? void 0 : _this$_appendParams.selector
|
117
|
+
options: this.originOptions
|
122
118
|
})));
|
123
119
|
}
|
124
120
|
var _iterator = _createForOfIteratorHelper(this.plugins.values()),
|
@@ -320,14 +316,14 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
320
316
|
key: "_registerPlugin",
|
321
317
|
value: function _registerPlugin(pluginId, plugin) {
|
322
318
|
this.plugins.set(pluginId, plugin);
|
323
|
-
|
324
|
-
|
319
|
+
try {
|
320
|
+
if (plugin.applyPlugin) {
|
325
321
|
plugin.applyPlugin(this);
|
326
|
-
} catch (error) {
|
327
|
-
this.plugins.delete(pluginId);
|
328
|
-
if (getType(error) === 'error') throw error;
|
329
|
-
throw new Error("Failed to register plug-in\uFF1A".concat(pluginId, " Exception in the apply function of the plug-in"));
|
330
322
|
}
|
323
|
+
} catch (error) {
|
324
|
+
this.plugins.delete(pluginId);
|
325
|
+
if (getType(error) === 'error') throw error;
|
326
|
+
throw new Error("Failed to register plug-in\uFF1A".concat(pluginId, " Exception in the apply function of the plug-in"));
|
331
327
|
}
|
332
328
|
}
|
333
329
|
/**
|
@@ -342,7 +338,6 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
342
338
|
}
|
343
339
|
return this.plugins.get(pluginId);
|
344
340
|
}
|
345
|
-
|
346
341
|
/**
|
347
342
|
* @description Execute to open app or jump link
|
348
343
|
*/
|
@@ -14,7 +14,7 @@ export declare enum ApplePayComponentEvent {
|
|
14
14
|
sdk_event_appleOnvalidatemerchant = "sdk_event_appleOnvalidatemerchant",
|
15
15
|
sdk_event_appleSubmitToken = "sdk_event_appleSubmitToken",
|
16
16
|
sdk_event_applePaymentResult = "sdk_event_applePaymentResult",
|
17
|
-
|
17
|
+
sdk_event_appleDestoryComponent = "sdk_event_appleDestoryComponent"
|
18
18
|
}
|
19
19
|
/**
|
20
20
|
* Apple pay Component
|
@@ -27,7 +27,7 @@ export var ApplePayComponentEvent = /*#__PURE__*/function (ApplePayComponentEven
|
|
27
27
|
ApplePayComponentEvent["sdk_event_appleOnvalidatemerchant"] = "sdk_event_appleOnvalidatemerchant";
|
28
28
|
ApplePayComponentEvent["sdk_event_appleSubmitToken"] = "sdk_event_appleSubmitToken";
|
29
29
|
ApplePayComponentEvent["sdk_event_applePaymentResult"] = "sdk_event_applePaymentResult";
|
30
|
-
ApplePayComponentEvent["
|
30
|
+
ApplePayComponentEvent["sdk_event_appleDestoryComponent"] = "sdk_event_appleDestoryComponent";
|
31
31
|
return ApplePayComponentEvent;
|
32
32
|
}({});
|
33
33
|
|
@@ -55,8 +55,8 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
55
55
|
|
56
56
|
/**
|
57
57
|
* Is Apple Pay Enabled
|
58
|
-
* @param subTypeEnum
|
59
|
-
* @returns
|
58
|
+
* @param subTypeEnum
|
59
|
+
* @returns
|
60
60
|
*/
|
61
61
|
_createClass(ApplePayComponent, [{
|
62
62
|
key: "canMakePayments",
|
@@ -66,8 +66,8 @@ var ApplePayComponent = /*#__PURE__*/function () {
|
|
66
66
|
|
67
67
|
/**
|
68
68
|
* Is Apple Pay Enabled
|
69
|
-
* @param subTypeEnum
|
70
|
-
* @returns
|
69
|
+
* @param subTypeEnum
|
70
|
+
* @returns
|
71
71
|
*/
|
72
72
|
}, {
|
73
73
|
key: "isAppPayEnabled",
|
@@ -12,6 +12,6 @@ export declare class ApplePayBusSubscriber extends BusSubscriber {
|
|
12
12
|
protected onOptionalInit(context: BusContext, message: BusMessage): void;
|
13
13
|
protected onCanMakePayments(context: BusContext, message: BusMessage): void;
|
14
14
|
protected onCreateComponent(context: BusContext, message: BusMessage): void;
|
15
|
-
protected
|
15
|
+
protected onDestoryComponent(context: BusContext, message: BusMessage): void;
|
16
16
|
onMessage(context: BusContext, message: BusMessage): void;
|
17
17
|
}
|
@@ -80,13 +80,13 @@ export var ApplePayBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
80
80
|
this.applePay.submitPay(appendParams);
|
81
81
|
}
|
82
82
|
}, {
|
83
|
-
key: "
|
84
|
-
value: function
|
83
|
+
key: "onDestoryComponent",
|
84
|
+
value: function onDestoryComponent(context, message) {
|
85
85
|
this.applePay = null;
|
86
|
-
console.log('
|
86
|
+
console.log('onDestoryComponent', context, message);
|
87
87
|
this.logger.logInfo({
|
88
88
|
name: 'APPLE_PAY',
|
89
|
-
title: ApplePayComponentEvent.
|
89
|
+
title: ApplePayComponentEvent.sdk_event_appleDestoryComponent
|
90
90
|
}, {
|
91
91
|
biz: 'sdk',
|
92
92
|
type: 'funnel'
|
@@ -105,8 +105,8 @@ export var ApplePayBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
105
105
|
case ApplePayActionEnum.createComponent:
|
106
106
|
this.onCreateComponent(context, message);
|
107
107
|
break;
|
108
|
-
case ApplePayActionEnum.
|
109
|
-
this.
|
108
|
+
case ApplePayActionEnum.destoryComponent:
|
109
|
+
this.onDestoryComponent(context, message);
|
110
110
|
break;
|
111
111
|
default:
|
112
112
|
console.log("Unknown action: " + message.getAction());
|
@@ -8,7 +8,7 @@
|
|
8
8
|
import { ANIMATION_TIME, closeImg, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, LOADING_ID, MOCKUP_ID } from "../../constant";
|
9
9
|
import { platformEnum } from "../../types";
|
10
10
|
import { addSetFontSizeEvent, amsSetSize, getDesignFontSize } from "../../util";
|
11
|
-
var componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n \n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n
|
11
|
+
var componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n \n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n.ams-component-container-hidden-desktop {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 8px;\n overflow: hidden;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n width: 0.8em;\n height:0.8em;\n background: rgba(0, 0, 0, 0.5);\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-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-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-loading .line div:before,\n.ams-component-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: #fcfcfc;\n border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-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-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-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\n.asm-component-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 0;\n top: 0;\n cursor: pointer;\n}\n.asm-component-close-block-btn-desktop {\n width: 11px;\n height: 11px;\n object-fit: fill;\n position: absolute;\n right: 18.7px;\n top: 26.7px;\n}\n.asm-component-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n.asm-component-close-block-mobile {\n position: absolute;\n width: 0.4em;\n height: 0.4em;\n right: 0;\n top: 0;\n cursor: pointer;\n z-index: 1009;\n}\n\n.asm-component-close-block-btn-mobile {\n width: 0.11em;\n height: 0.11em;\n object-fit: fill;\n position: absolute;\n right: 0.147em;\n top: 0.167em;\n}\n\n\n.ams-component-container-opacity{\n opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n content: \"\";\n z-index: 1010;\n background-color: rgba(0, 0, 0, 0.35);\n border-radius: 12px 12px 0 0;\n}\n\n#ams-component-retention {\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: 50%;\n height: auto;\n display: none;\n z-index: 1009;\n}\n\n.ams-component-retention-show {\n display: flex !important;\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n display: flex !important;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n -webkit-animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n -webkit-animation-fill-mode: forwards;\n}\n\n.ams-component-retention-mobile {\n width: 294px;\n border-radius: 12px;\n padding: 24px 0;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n width: 544px;\n border-radius: 12px;\n padding: 32px;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n .ams-component-retention-mobile {\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n.ams-component-retention-title-mobile {\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n text-align: left;\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 8px;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n text-align: left;\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n margin-top: 24px;\n padding: 0 24px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n width: 100%;\n margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n background: #0079FF;\n border-radius: 100px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n color: #FFFFFF;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-remain-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n padding: 0 6px;\n}\n\n.ams-component-retention-remain-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n display: inline-block;\n padding: 0 24px;\n float: right;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 159px;\n}\n\n#ams-component-retention-leave {\n border-radius: 100px;\n border: 1px solid #0079FF;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-leave-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n margin-top: 12px;\n padding: 0 6px;\n}\n\n.ams-component-retention-leave-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n display: inline-block;\n padding: 0 24px;\n float: right;\n margin-right: 16px;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 144px;\n}\n.".concat(MOCKUP_ID, "-hidden{\nanimation: ").concat(MOCKUP_ID, "-opacity 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes ").concat(MOCKUP_ID, "-opacity {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n}\n");
|
12
12
|
export var componentAddCSS = function componentAddCSS() {
|
13
13
|
var style = document.createElement('style');
|
14
14
|
style.type = 'text/css';
|
@@ -25,7 +25,6 @@ export default class ComponentApp {
|
|
25
25
|
private _renderDisplayType;
|
26
26
|
private _multipleCallbackEvents;
|
27
27
|
_merchantAppointParam: IMerchantAppointParam;
|
28
|
-
private _webAppHeartBeatTimeoutId;
|
29
28
|
private _webAppHeartBeatTimeoutFn;
|
30
29
|
constructor();
|
31
30
|
/**
|
@@ -98,7 +97,7 @@ export default class ComponentApp {
|
|
98
97
|
*/
|
99
98
|
dispatchToApp(payload: {
|
100
99
|
context: eventPayloadContext;
|
101
|
-
}, targetElement?: any): any;
|
100
|
+
}, targetElement?: any, sendLog?: boolean): any;
|
102
101
|
/**
|
103
102
|
* @description Subscribe to messages from SDK
|
104
103
|
*/
|