@alipay/ams-checkout 0.0.1732700846-dev.1 → 0.0.1732700846-dev.11
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/component/channel.js +1 -1
- package/esm/component/component.popup.style.d.ts +2 -0
- package/esm/component/component.popup.style.js +15 -2
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +17 -0
- package/esm/constant/index.js +18 -0
- package/esm/core/bus/index.d.ts +3 -3
- package/esm/core/bus/index.js +14 -14
- package/esm/core/component/appPreloadProcessing.js +2 -2
- package/esm/core/component/ckp/index.js +6 -3
- package/esm/core/component/element/index.d.ts +1 -0
- package/esm/core/component/element/index.js +79 -70
- package/esm/core/component/element/mock.d.ts +2 -0
- package/esm/core/component/element/mock.js +129 -53
- package/esm/core/component/element/type.d.ts +5 -4
- package/esm/core/component/element/type.js +3 -2
- package/esm/core/component/index.js +8 -12
- package/esm/core/instance/index.js +3 -3
- package/esm/foundation/core/index.d.ts +2 -0
- package/esm/foundation/core/index.js +50 -20
- package/esm/foundation/product-processor/easysafepay/index.js +17 -16
- package/esm/foundation/service/api-bus/busManager.d.ts +3 -3
- package/esm/foundation/service/api-bus/busManager.js +14 -14
- package/esm/foundation/service/container/index.d.ts +2 -0
- package/esm/foundation/service/container/index.js +33 -1
- package/esm/foundation/service/event-center.d.ts +9 -3
- package/esm/foundation/service/event-center.js +41 -10
- package/esm/foundation/service/log/index.d.ts +2 -2
- package/esm/foundation/service/log/index.js +23 -8
- package/esm/foundation/service/log/keys.d.ts +13 -0
- package/esm/foundation/service/log/keys.js +103 -0
- package/esm/foundation/service/log/processor.d.ts +9 -0
- package/esm/foundation/service/log/processor.js +148 -0
- package/esm/foundation/service/log/types.d.ts +1 -1
- package/esm/foundation/service/requester/requester.js +3 -0
- package/esm/foundation/service/security/index.js +6 -8
- package/esm/foundation/utils/redirect_utils.js +1 -2
- package/esm/index.d.ts +1 -0
- package/esm/index.js +6 -1
- package/esm/plugin/applepay/component.js +10 -8
- package/esm/plugin/applepay/index.js +10 -6
- package/esm/plugin/applepay/interface.d.ts +2 -2
- package/esm/plugin/applepay/service.js +24 -16
- package/esm/plugin/component/cashierApp.js +3 -3
- package/esm/plugin/component/channel.d.ts +41 -1
- package/esm/plugin/component/channel.js +590 -2
- package/esm/plugin/component/component.popup.style.d.ts +8 -0
- package/esm/plugin/component/component.popup.style.js +22 -2
- package/esm/plugin/component/index.d.ts +3 -1
- package/esm/plugin/component/index.js +136 -68
- package/esm/plugin/paypal/index.js +1 -1
- package/esm/service/index.js +4 -2
- package/esm/types/index.d.ts +32 -2
- package/esm/types/index.js +3 -2
- package/esm/util/getBackScheme.js +1 -2
- package/esm/util/index.js +4 -8
- package/esm/util/logger.d.ts +3 -3
- package/esm/util/logger.js +49 -13
- package/esm/util/spm-map.d.ts +172 -0
- package/esm/util/spm-map.js +172 -0
- package/package.json +1 -1
@@ -40,7 +40,7 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
|
40
40
|
import ComponentApp from "../../plugin/component";
|
41
41
|
import { ExtendPlugin } from "../../plugin/const";
|
42
42
|
import { PaypalBusSubscriber } from "../../plugin/paypal";
|
43
|
-
import { ComponentSignEnum, ComponentSignEnumV2, EnvironmentEnum, modeEnum, networkModeEnum, ProductSceneEnum
|
43
|
+
import { ComponentSignEnum, ComponentSignEnumV2, DisplayTypeEnum, EnvironmentEnum, modeEnum, networkModeEnum, ProductSceneEnum } from "../../types";
|
44
44
|
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
45
45
|
import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
|
46
46
|
import { getSecurityConfigStorageKey } from "../../util/security";
|
@@ -101,7 +101,7 @@ var handleParams = function handleParams(params, _this) {
|
|
101
101
|
parseData = _handleSessionData2[0],
|
102
102
|
sessionData = _handleSessionData2[1];
|
103
103
|
var componentSign = getComponentSign(parseData);
|
104
|
-
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup) {
|
104
|
+
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup && window.location.href.indexOf('popup=true') === -1) {
|
105
105
|
return Promise.reject({
|
106
106
|
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
107
107
|
message: "unsupported payment method"
|
@@ -219,19 +219,15 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
219
219
|
this.logger.logInfo({
|
220
220
|
title: 'preload_match'
|
221
221
|
}, {
|
222
|
-
|
223
|
-
|
224
|
-
sessionDataChannel: channelType,
|
225
|
-
sessionDataVersion: productSceneVersion
|
222
|
+
eventMessage: channelType,
|
223
|
+
productSceneVersion: productSceneVersion
|
226
224
|
});
|
227
225
|
} else {
|
228
226
|
this.logger.logInfo({
|
229
227
|
title: 'preload_no_match'
|
230
228
|
}, {
|
231
|
-
|
232
|
-
|
233
|
-
sessionDataChannel: channelType,
|
234
|
-
sessionDataVersion: productSceneVersion
|
229
|
+
eventMessage: channelType,
|
230
|
+
productSceneVersion: productSceneVersion
|
235
231
|
});
|
236
232
|
}
|
237
233
|
var previousChannel = {
|
@@ -332,7 +328,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
332
328
|
_this4.logger.logInfo({
|
333
329
|
title: 'canMakePayments_error'
|
334
330
|
}, {
|
335
|
-
|
331
|
+
errorMessage: JSON.stringify(e)
|
336
332
|
});
|
337
333
|
resolve(false);
|
338
334
|
});
|
@@ -403,7 +399,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
403
399
|
this.logger.logError({
|
404
400
|
title: 'performance_optimization_channelType_error'
|
405
401
|
}, {
|
406
|
-
|
402
|
+
eventMessage: channelType
|
407
403
|
});
|
408
404
|
}
|
409
405
|
this.timer = setTimeout(function () {
|
@@ -163,7 +163,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
163
163
|
this.logger.logInfo({
|
164
164
|
title: 'sdk_event_securitySdkPreInit'
|
165
165
|
}, {
|
166
|
-
|
166
|
+
productScene: product
|
167
167
|
}).send();
|
168
168
|
var sdk = this._getSecuritySDKByProductScene({
|
169
169
|
product: product || scene
|
@@ -176,14 +176,14 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
176
176
|
_this.logger.logInfo({
|
177
177
|
title: 'sdk_event_securitySdkPreInitSuccess'
|
178
178
|
}, {
|
179
|
-
|
179
|
+
productScene: product
|
180
180
|
}).send();
|
181
181
|
}, function (msg) {
|
182
182
|
_this.logger.logError({
|
183
183
|
title: 'sdk_error_securitySdkInitFailed',
|
184
184
|
msg: msg
|
185
185
|
}, {
|
186
|
-
|
186
|
+
productScene: product,
|
187
187
|
sign: 'Active initialization'
|
188
188
|
}).send();
|
189
189
|
});
|
@@ -12,6 +12,7 @@ export declare class AntomSDKCore {
|
|
12
12
|
private instanceId;
|
13
13
|
private sdkMetaData;
|
14
14
|
private productProcessors;
|
15
|
+
private enablePopWindowEventCallback;
|
15
16
|
constructor();
|
16
17
|
registerProcessor(productScene: string, paymentMethod: string, processor: ProductProcessor): void;
|
17
18
|
init(options: IoptionsParams, productScene: ProductSceneEnum): void;
|
@@ -22,5 +23,6 @@ export declare class AntomSDKCore {
|
|
22
23
|
getPaymentContext(): PaymentContext;
|
23
24
|
destroy(): void;
|
24
25
|
private handleBehaviorRender;
|
26
|
+
private handleClose;
|
25
27
|
private cleanRender;
|
26
28
|
}
|
@@ -10,7 +10,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
10
10
|
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; }
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
12
12
|
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); }
|
13
|
-
import { DisplayTypeEnum } from "../../types";
|
13
|
+
import { DisplayTypeEnum, eventCodeEnum } from "../../types";
|
14
14
|
import { DisplayInfo } from "../index";
|
15
15
|
import { v4 as uuid } from 'uuid';
|
16
16
|
import { ServiceProvider } from "../service";
|
@@ -21,7 +21,7 @@ import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
|
|
21
21
|
import { redirect } from "../utils/redirect_utils";
|
22
22
|
import { insertStyleSheet } from "../../component/popupWindow.style";
|
23
23
|
import { hideMockup, createMockup, createRetentionPopup, hideRetentionPopup, showRetentionPopup, cleanMockup, removeRetentionPopup, handleDeclareInfo } from "../../component/component.popup.style";
|
24
|
-
import { EVENT, LOADING_ID } from "../../constant";
|
24
|
+
import { COMPONENT_CLOSE_MASK_BLOCK_ID, EVENT, LOADING_ID } from "../../constant";
|
25
25
|
/**
|
26
26
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
27
27
|
* @date 2024/9/17
|
@@ -35,6 +35,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
35
35
|
_defineProperty(this, "instanceId", void 0);
|
36
36
|
_defineProperty(this, "sdkMetaData", void 0);
|
37
37
|
_defineProperty(this, "productProcessors", {});
|
38
|
+
_defineProperty(this, "enablePopWindowEventCallback", false);
|
38
39
|
}
|
39
40
|
_createClass(AntomSDKCore, [{
|
40
41
|
key: "registerProcessor",
|
@@ -150,6 +151,23 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
150
151
|
return _ref2.apply(this, arguments);
|
151
152
|
};
|
152
153
|
}());
|
154
|
+
eventCenter.listen(EVENT.closeCallback.name, function () {
|
155
|
+
var _options$onClose;
|
156
|
+
(_options$onClose = options.onClose) === null || _options$onClose === void 0 || _options$onClose.call(options);
|
157
|
+
});
|
158
|
+
eventCenter.listen(EVENT.eventCallback.name, function (data) {
|
159
|
+
var _options$onEventCallb;
|
160
|
+
(_options$onEventCallb = options.onEventCallback) === null || _options$onEventCallb === void 0 || _options$onEventCallb.call(options, data);
|
161
|
+
});
|
162
|
+
eventCenter.listen(EVENT.error.name, function (data) {
|
163
|
+
var _options$onError;
|
164
|
+
(_options$onError = options.onError) === null || _options$onError === void 0 || _options$onError.call(options, data);
|
165
|
+
});
|
166
|
+
eventCenter.listen(EVENT.declareEventCallbackInfo.name, function (data) {
|
167
|
+
if (data !== null && data !== void 0 && data.popWindowEventInfo) {
|
168
|
+
_this.enablePopWindowEventCallback = data.popWindowEventInfo.enableCallback;
|
169
|
+
}
|
170
|
+
});
|
153
171
|
|
154
172
|
// execute additional logic from specified product
|
155
173
|
if (this.productProcessors[sdkMetaData.productScene]) {
|
@@ -160,7 +178,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
160
178
|
key: "startBizFlow",
|
161
179
|
value: function () {
|
162
180
|
var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
|
163
|
-
var _this$paymentContext$, _this$paymentContext$2;
|
181
|
+
var _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3;
|
164
182
|
var paymentSession, displayInfo, _convertPaymentSessio, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
|
165
183
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
166
184
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -183,7 +201,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
183
201
|
sdkMetaData: this.sdkMetaData
|
184
202
|
};
|
185
203
|
// upgrade WebApp version
|
186
|
-
mid = this.paymentContext.paymentSessionObj
|
204
|
+
mid = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.clientId;
|
187
205
|
webAppMatchConfig = parseWebAppMatchConfig(this.paymentContext.paymentSessionObj.extendInfo);
|
188
206
|
webAppVersion = getWebAppVersion(this.sdkMetaData, mid, webAppMatchConfig);
|
189
207
|
this.sdkMetaData.webAppVersion = webAppVersion;
|
@@ -193,8 +211,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
193
211
|
ServiceProvider.getInstance(this.instanceId).update(this.paymentContext);
|
194
212
|
|
195
213
|
// Invoke processor
|
196
|
-
productScene = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext
|
197
|
-
paymentMethod = (_this$paymentContext$
|
214
|
+
productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
|
215
|
+
paymentMethod = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentMethodInfoView) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.paymentMethodType;
|
198
216
|
_context3.prev = 13;
|
199
217
|
if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
|
200
218
|
_context3.next = 20;
|
@@ -284,6 +302,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
284
302
|
var platform = this.paymentContext.displayInfo.platform;
|
285
303
|
var payload = this.bizFlowStartBehavior.payload;
|
286
304
|
var closeBtnCallbackForPopup = function closeBtnCallbackForPopup() {
|
305
|
+
var isOnCloseEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
287
306
|
if (displayType === DisplayTypeEnum.inline) {
|
288
307
|
return;
|
289
308
|
}
|
@@ -291,17 +310,13 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
291
310
|
showRetentionPopup();
|
292
311
|
return;
|
293
312
|
} else {
|
294
|
-
_this2.
|
295
|
-
eventCenter.dispatchToApp({
|
296
|
-
event: EVENT.close.name,
|
297
|
-
data: {}
|
298
|
-
});
|
313
|
+
_this2.handleClose(isOnCloseEvent);
|
299
314
|
}
|
300
315
|
};
|
301
316
|
|
302
317
|
// TODO 感觉有死循环
|
303
318
|
eventCenter.listen(EVENT.close.name, function () {
|
304
|
-
closeBtnCallbackForPopup();
|
319
|
+
closeBtnCallbackForPopup(true);
|
305
320
|
});
|
306
321
|
eventCenter.listen(EVENT.setAllowRetention.name, function (data) {
|
307
322
|
if (data === undefined || typeof data !== 'boolean') {
|
@@ -322,26 +337,40 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
322
337
|
createRetentionPopup(platform, function () {
|
323
338
|
hideRetentionPopup();
|
324
339
|
}, function () {
|
325
|
-
eventCenter.dispatchToApp({
|
326
|
-
event: EVENT.close.name,
|
327
|
-
data: {}
|
328
|
-
});
|
329
340
|
hideRetentionPopup();
|
330
|
-
_this2.
|
341
|
+
_this2.handleClose();
|
331
342
|
});
|
332
343
|
createMockup({
|
333
344
|
platform: platform,
|
334
|
-
onClickOutside: payload.allowClickPopupOutsideClose ? closeBtnCallbackForPopup : undefined
|
345
|
+
onClickOutside: payload.allowClickPopupOutsideClose ? closeBtnCallbackForPopup : undefined,
|
346
|
+
closeBtnFunc: closeBtnCallbackForPopup
|
335
347
|
});
|
336
348
|
containerService.showLoading(container, this.paymentContext.displayInfo);
|
337
349
|
return;
|
338
350
|
}
|
339
351
|
}
|
352
|
+
}, {
|
353
|
+
key: "handleClose",
|
354
|
+
value: function handleClose() {
|
355
|
+
var isOnCloseEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
356
|
+
var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
357
|
+
eventCenter.emit(EVENT.closeCallback.name, {});
|
358
|
+
if (this.enablePopWindowEventCallback && !isOnCloseEvent) {
|
359
|
+
eventCenter.emit(EVENT.eventCallback.name, {
|
360
|
+
code: eventCodeEnum.SDK_PAYMENT_CANCEL,
|
361
|
+
result: {
|
362
|
+
result: {}
|
363
|
+
}
|
364
|
+
});
|
365
|
+
}
|
366
|
+
this.cleanRender();
|
367
|
+
}
|
340
368
|
}, {
|
341
369
|
key: "cleanRender",
|
342
370
|
value: function cleanRender() {
|
343
371
|
var _this3 = this,
|
344
|
-
_document$getElementB
|
372
|
+
_document$getElementB,
|
373
|
+
_document$getElementB2;
|
345
374
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
346
375
|
var containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
|
347
376
|
var cleanElement = function cleanElement() {
|
@@ -350,7 +379,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
350
379
|
removeRetentionPopup();
|
351
380
|
// TODO @/component this.removeEventListener();
|
352
381
|
};
|
353
|
-
(_document$getElementB = document.getElementById(
|
382
|
+
(_document$getElementB = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
383
|
+
(_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.remove();
|
354
384
|
containerService.startHideAnim();
|
355
385
|
hideMockup();
|
356
386
|
if (immediately) {
|
@@ -116,13 +116,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
116
116
|
}, {
|
117
117
|
key: "buildWebAppPreloadUrl",
|
118
118
|
value: function buildWebAppPreloadUrl(initConfig, instanceId, sdkMetaData) {
|
119
|
-
var _this = this
|
120
|
-
|
121
|
-
|
119
|
+
var _this = this,
|
120
|
+
_initConfig$analytics;
|
121
|
+
var previousProductInfo = ProductInfoCacheUtil.getPreviousProductInfo(ProductSceneEnum.EASY_PAY, function (errorMsg) {
|
122
|
+
if (errorMsg) {
|
122
123
|
_this.logger.logError({
|
123
124
|
title: 'performance_optimization_get_previousChannel_error'
|
124
125
|
}, {
|
125
|
-
|
126
|
+
errorMessage: errorMsg
|
126
127
|
});
|
127
128
|
}
|
128
129
|
});
|
@@ -137,7 +138,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
137
138
|
isPreload: true,
|
138
139
|
productSceneVersion: productSceneVersion,
|
139
140
|
query: {
|
140
|
-
analyticsEnabled: initConfig.analytics.enabled,
|
141
|
+
analyticsEnabled: (_initConfig$analytics = initConfig.analytics) === null || _initConfig$analytics === void 0 ? void 0 : _initConfig$analytics.enabled,
|
141
142
|
displayType: DisplayTypeEnum.popup,
|
142
143
|
instanceId: instanceId,
|
143
144
|
locale: initConfig.locale,
|
@@ -152,7 +153,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
152
153
|
}, {
|
153
154
|
key: "buildWebAppUrl",
|
154
155
|
value: function buildWebAppUrl() {
|
155
|
-
var _paymentContext$payme3, _paymentContext$payme4;
|
156
|
+
var _paymentContext$payme3, _paymentContext$payme4, _this$initConfig$anal;
|
156
157
|
var paymentContext = this.paymentContext;
|
157
158
|
var paymentMethodCategoryType = (_paymentContext$payme3 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme3 === void 0 ? void 0 : _paymentContext$payme3.paymentMethodCategoryType;
|
158
159
|
var productSceneVersion = (_paymentContext$payme4 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme4 === void 0 ? void 0 : _paymentContext$payme4.productSceneVersion;
|
@@ -164,7 +165,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
164
165
|
productSceneVersion: productSceneVersion,
|
165
166
|
isPreload: false,
|
166
167
|
query: {
|
167
|
-
analyticsEnabled: this.initConfig.analytics.enabled,
|
168
|
+
analyticsEnabled: (_this$initConfig$anal = this.initConfig.analytics) === null || _this$initConfig$anal === void 0 ? void 0 : _this$initConfig$anal.enabled,
|
168
169
|
displayType: DisplayTypeEnum.popup,
|
169
170
|
instanceId: this.instanceId,
|
170
171
|
locale: this.initConfig.locale,
|
@@ -294,8 +295,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
294
295
|
this.logger.logInfo({
|
295
296
|
title: 'sdk_event_submitPay'
|
296
297
|
}, {
|
297
|
-
|
298
|
-
|
298
|
+
config: JSON.stringify(submitParams.paymentSessionConfig),
|
299
|
+
requestId: requestBizId
|
299
300
|
});
|
300
301
|
// 由渠道定制点来构建额外参数
|
301
302
|
extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
|
@@ -336,9 +337,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
336
337
|
this.logger.logInfo({
|
337
338
|
title: 'sdk_event_submitPayEnd'
|
338
339
|
}, {
|
339
|
-
|
340
|
-
|
341
|
-
|
340
|
+
config: JSON.stringify(submitParams.paymentSessionConfig),
|
341
|
+
requestId: requestBizId,
|
342
|
+
rpcTraceId: res.traceId
|
342
343
|
});
|
343
344
|
return _context2.abrupt("return", res);
|
344
345
|
case 30:
|
@@ -347,10 +348,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
347
348
|
this.logger.logError({
|
348
349
|
title: 'sdk_event_submitPay_failed'
|
349
350
|
}, {
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
351
|
+
config: JSON.stringify(submitParams.paymentSessionConfig),
|
352
|
+
errorMessage: _context2.t7,
|
353
|
+
requestId: requestBizId,
|
354
|
+
rpcTraceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
|
354
355
|
});
|
355
356
|
throw _context2.t7;
|
356
357
|
case 34:
|
@@ -15,17 +15,17 @@ export declare enum BusLogEventEnum {
|
|
15
15
|
/**
|
16
16
|
* 查询是否订阅
|
17
17
|
* action:string
|
18
|
-
* sub: bool
|
18
|
+
* sub (processResult): bool
|
19
19
|
*/
|
20
20
|
sdk_event_busIsSubscribe = "sdk_event_busIsSubscribe",
|
21
21
|
/**
|
22
22
|
* 订阅协议
|
23
|
-
* actions: string[] , 用逗号拼接
|
23
|
+
* actions (actionNames): string[] , 用逗号拼接
|
24
24
|
*/
|
25
25
|
sdk_event_busSubscribe = "sdk_event_busSubscribe",
|
26
26
|
/**
|
27
27
|
* 退订协议
|
28
|
-
* actions: string[] , 用逗号拼接
|
28
|
+
* actions (actionNames): string[] , 用逗号拼接
|
29
29
|
*/
|
30
30
|
sdk_event_busUnsubscribe = "sdk_event_busUnsubscribe",
|
31
31
|
/**
|
@@ -147,7 +147,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
147
147
|
this.logger.logInfo({
|
148
148
|
title: title
|
149
149
|
}, _objectSpread({
|
150
|
-
|
150
|
+
eventSource: 'sdk'
|
151
151
|
}, optionalParams)).send();
|
152
152
|
}
|
153
153
|
}
|
@@ -161,7 +161,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
161
161
|
this.logger.logError({
|
162
162
|
title: title
|
163
163
|
}, _objectSpread({
|
164
|
-
|
164
|
+
eventSource: 'sdk'
|
165
165
|
}, optionalParams)).send();
|
166
166
|
}
|
167
167
|
}
|
@@ -194,7 +194,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
194
194
|
setTimeout(function () {
|
195
195
|
if (failed) {
|
196
196
|
_this.traceError(BusLogEventEnum.sdk_error_busPublishNoResult, {
|
197
|
-
|
197
|
+
actionName: message.getAction()
|
198
198
|
});
|
199
199
|
if ((config === null || config === void 0 ? void 0 : config.fallback) !== null) {
|
200
200
|
resolve(message.result(config === null || config === void 0 ? void 0 : config.fallback));
|
@@ -211,7 +211,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
211
211
|
var _this2 = this;
|
212
212
|
var _callBack = function _callBack(result) {
|
213
213
|
_this2.traceLog(BusLogEventEnum.sdk_event_busPublishCallback, {
|
214
|
-
|
214
|
+
actionName: message.getAction(),
|
215
215
|
instanceId: _this2.instanceId
|
216
216
|
});
|
217
217
|
if (callback) {
|
@@ -222,7 +222,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
222
222
|
var actionName = this.instanceId ? BusManager.getInstanceActionName(message.getAction(), this.instanceId) : message.getAction();
|
223
223
|
var subscribers = BusManager.subscribersMap.get(actionName);
|
224
224
|
this.traceLog(BusLogEventEnum.sdk_event_busPublishMessage, {
|
225
|
-
|
225
|
+
actionName: message.getAction(),
|
226
226
|
instanceId: this.instanceId
|
227
227
|
});
|
228
228
|
if (!subscribers && this.instanceId) {
|
@@ -239,9 +239,9 @@ export var BusManager = /*#__PURE__*/function () {
|
|
239
239
|
subscriber.onMessage(context, message);
|
240
240
|
} catch (e) {
|
241
241
|
this.traceError(BusLogEventEnum.sdk_error_busPublishError, {
|
242
|
-
|
242
|
+
actionName: message.getAction(),
|
243
243
|
instanceId: this.instanceId,
|
244
|
-
|
244
|
+
errorMessage: e
|
245
245
|
});
|
246
246
|
var _iterator2 = _createForOfIteratorHelper(BusManager.interceptors),
|
247
247
|
_step2;
|
@@ -280,7 +280,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
280
280
|
this.publish(message, callback); // Re-publish the message
|
281
281
|
} else {
|
282
282
|
this.traceError(BusLogEventEnum.sdk_error_busPublishUnsubscribeError, {
|
283
|
-
|
283
|
+
actionName: message.getAction(),
|
284
284
|
instanceId: this.instanceId
|
285
285
|
});
|
286
286
|
}
|
@@ -290,7 +290,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
290
290
|
key: "subscribe",
|
291
291
|
value: function subscribe(subscriber) {
|
292
292
|
this.traceLog(BusLogEventEnum.sdk_event_busSubscribe, {
|
293
|
-
|
293
|
+
actionNames: subscriber.actionNames(),
|
294
294
|
instanceId: this.instanceId
|
295
295
|
});
|
296
296
|
var _iterator4 = _createForOfIteratorHelper(subscriber.actionNames()),
|
@@ -317,7 +317,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
317
317
|
key: "unsubscribe",
|
318
318
|
value: function unsubscribe(subscriber) {
|
319
319
|
this.traceLog(BusLogEventEnum.sdk_event_busUnsubscribe, {
|
320
|
-
|
320
|
+
actionNames: subscriber.actionNames(),
|
321
321
|
instanceId: this.instanceId
|
322
322
|
});
|
323
323
|
var _iterator5 = _createForOfIteratorHelper(subscriber.actionNames()),
|
@@ -354,9 +354,9 @@ export var BusManager = /*#__PURE__*/function () {
|
|
354
354
|
}
|
355
355
|
if (subscribers && subscribers.length > 0) {
|
356
356
|
this.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
|
357
|
-
|
357
|
+
actionName: actionName,
|
358
358
|
instanceId: this.instanceId,
|
359
|
-
|
359
|
+
processResult: true
|
360
360
|
});
|
361
361
|
return true;
|
362
362
|
}
|
@@ -377,9 +377,9 @@ export var BusManager = /*#__PURE__*/function () {
|
|
377
377
|
return BusManager.subscribersMap.has(key);
|
378
378
|
}
|
379
379
|
this.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
|
380
|
-
|
380
|
+
actionName: actionName,
|
381
381
|
instanceId: this.instanceId,
|
382
|
-
|
382
|
+
processResult: false
|
383
383
|
});
|
384
384
|
return false;
|
385
385
|
}
|
@@ -24,7 +24,9 @@ export declare class ContainerService implements Service {
|
|
24
24
|
startHideAnim(): void;
|
25
25
|
private addCapabilityToEventCenter;
|
26
26
|
private addCapabilityToApiBusManager;
|
27
|
+
private updateMaskCloseBtn;
|
27
28
|
private handleSizeChanged;
|
28
29
|
private handleAppHeartBeat;
|
29
30
|
private changeCloseBtnVisibility;
|
31
|
+
private handleMaskCloseBtnShow;
|
30
32
|
}
|
@@ -11,7 +11,7 @@ import { DisplayTypeEnum } from "../../../types";
|
|
11
11
|
import { createIframe, createPreloadIframe, startSizeChangeAnim } from "./utils";
|
12
12
|
import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
|
13
13
|
import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
|
14
|
-
import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, LOADING_ID, MOCKUP_ID } from "../../../constant";
|
14
|
+
import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, LOADING_ID, MOCKUP_ID } from "../../../constant";
|
15
15
|
import { ServiceProvider } from "../index";
|
16
16
|
import { EVENT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../../constant";
|
17
17
|
import { PopupManager } from "./popup";
|
@@ -82,6 +82,8 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
82
82
|
}
|
83
83
|
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
84
84
|
if (container) container === null || container === void 0 || container.remove();
|
85
|
+
this.webApp = null;
|
86
|
+
this.eventCenter.cleanIFrames();
|
85
87
|
|
86
88
|
// animation
|
87
89
|
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(displayInfo.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
@@ -204,6 +206,9 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
204
206
|
this.eventCenter.listen(EVENT.hideCloseButton.name, function () {
|
205
207
|
_this2.changeCloseBtnVisibility(false);
|
206
208
|
});
|
209
|
+
this.eventCenter.listen(EVENT.setMaskCloseButton.name, function (data) {
|
210
|
+
_this2.handleMaskCloseBtnShow(data);
|
211
|
+
});
|
207
212
|
this.eventCenter.listen(EVENT.appHeartBeat.name, function () {
|
208
213
|
_this2.handleAppHeartBeat();
|
209
214
|
});
|
@@ -211,6 +216,21 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
211
216
|
}, {
|
212
217
|
key: "addCapabilityToApiBusManager",
|
213
218
|
value: function addCapabilityToApiBusManager() {}
|
219
|
+
}, {
|
220
|
+
key: "updateMaskCloseBtn",
|
221
|
+
value: function updateMaskCloseBtn(data) {
|
222
|
+
var maskCloseBtn = document.getElementById("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID));
|
223
|
+
if (maskCloseBtn) {
|
224
|
+
if (this.displayInfo.platform === 'desktop') {
|
225
|
+
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
226
|
+
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
227
|
+
maskCloseBtn.style.top = "".concat((windowHeight - data.height) / 2 - 42, "px");
|
228
|
+
maskCloseBtn.style.right = "".concat((windowWidth - data.width) / 2 + 18, "px");
|
229
|
+
} else {
|
230
|
+
maskCloseBtn.style.bottom = "".concat(data.height + 2, "px");
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
214
234
|
}, {
|
215
235
|
key: "handleSizeChanged",
|
216
236
|
value: function handleSizeChanged(data) {
|
@@ -239,6 +259,8 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
239
259
|
}
|
240
260
|
// 关闭loading,保留蒙层
|
241
261
|
this.dismissLoading();
|
262
|
+
// 更新弹窗关闭按钮位置
|
263
|
+
this.updateMaskCloseBtn(data);
|
242
264
|
}
|
243
265
|
if (this.displayInfo.type === DisplayTypeEnum.inline) {
|
244
266
|
var _document$getElementB3;
|
@@ -293,6 +315,16 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
293
315
|
closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
|
294
316
|
}
|
295
317
|
}
|
318
|
+
}, {
|
319
|
+
key: "handleMaskCloseBtnShow",
|
320
|
+
value: function handleMaskCloseBtnShow(data) {
|
321
|
+
var closeBlock = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
|
322
|
+
if ((data === null || data === void 0 ? void 0 : data.status) === 'show') {
|
323
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
|
324
|
+
} else {
|
325
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
|
326
|
+
}
|
327
|
+
}
|
296
328
|
}]);
|
297
329
|
return ContainerService;
|
298
330
|
}();
|
@@ -27,12 +27,17 @@ export declare class EventCenter implements Service {
|
|
27
27
|
* @param domain - The domain of the app.
|
28
28
|
*/
|
29
29
|
addIFrame(iframe: HTMLIFrameElement): void;
|
30
|
+
/**
|
31
|
+
* Cleans iframes when web app close
|
32
|
+
*/
|
33
|
+
cleanIFrames(): void;
|
30
34
|
removeIFrame(iframe: HTMLIFrameElement): void;
|
31
35
|
/**
|
32
36
|
* Handles messages received from the app.
|
33
37
|
* @param e - The message event.
|
34
38
|
*/
|
35
39
|
private handleAppMessage;
|
40
|
+
private checkEventCompliant;
|
36
41
|
/**
|
37
42
|
* Processes the application message and emits the associated event.
|
38
43
|
* @param data - Parsed EventPayload from the app.
|
@@ -42,8 +47,9 @@ export declare class EventCenter implements Service {
|
|
42
47
|
* Listens to an event by adding a callback function.
|
43
48
|
* @param name - The name of the event to listen for.
|
44
49
|
* @param func - The callback function to execute when the event is emitted.
|
50
|
+
* @param isAppend - Append to event handlers as chain, default value is false
|
45
51
|
*/
|
46
|
-
listen(name: string, func: IListener): void;
|
52
|
+
listen(name: string, func: IListener, isAppend?: boolean): void;
|
47
53
|
/**
|
48
54
|
* Unsubscribes from an event. If a function is provided, only that function is removed.
|
49
55
|
* @param name - The name of the event to unlisten to.
|
@@ -55,7 +61,7 @@ export declare class EventCenter implements Service {
|
|
55
61
|
* @param name - The name of the event to emit.
|
56
62
|
* @param data - The event data to pass to the event listeners.
|
57
63
|
*/
|
58
|
-
emit(name: string, data: any,
|
64
|
+
emit(name: string, data: any, eventPayload?: EventPayload): void;
|
59
65
|
/**
|
60
66
|
* Registers a callback for an event and immediately dispatches the event to the app.
|
61
67
|
* @param payloadContext - The context containing event information and callback ID.
|
@@ -71,6 +77,6 @@ export declare class EventCenter implements Service {
|
|
71
77
|
isExist(name: string): boolean;
|
72
78
|
}
|
73
79
|
interface IListener {
|
74
|
-
(data: any,
|
80
|
+
(data: any, eventPayload?: EventPayload): void;
|
75
81
|
}
|
76
82
|
export {};
|