@alipay/ams-checkout 0.0.1702608619-dev.0 → 0.0.1703483942-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/common/applepay/index.d.ts +48 -0
- package/esm/common/applepay/index.js +171 -0
- package/esm/common/applepay/interface.d.ts +102 -0
- package/esm/common/applepay/interface.js +1 -0
- package/esm/constant/index.d.ts +2 -4
- package/esm/constant/index.js +3 -5
- package/esm/core/applepay/index.d.ts +31 -0
- package/esm/core/applepay/index.js +369 -0
- package/esm/core/component/index.d.ts +3 -1
- package/esm/core/component/index.js +17 -4
- package/esm/core/instance/index.js +3 -3
- package/esm/index.d.ts +3 -0
- package/esm/index.js +20 -10
- package/esm/plugin/component/cashierApp.js +3 -4
- package/esm/plugin/component/index.d.ts +1 -0
- package/esm/plugin/component/index.js +153 -79
- package/esm/plugin/component/popupWindow.style.d.ts +1 -1
- package/esm/plugin/component/popupWindow.style.js +32 -23
- package/esm/plugin/drop-in/index.js +2 -2
- package/esm/request/index.js +19 -13
- package/esm/service/index.d.ts +9 -1
- package/esm/service/index.js +33 -2
- package/esm/types/index.d.ts +50 -4
- package/esm/types/index.js +16 -0
- package/esm/util/index.js +2 -2
- package/esm/util/logger.js +5 -2
- package/esm/util/security.d.ts +1 -0
- package/esm/util/security.js +4 -5
- package/package.json +56 -1
@@ -6,8 +6,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
6
6
|
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); } }
|
7
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; }
|
8
8
|
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; }
|
9
|
-
function _toPropertyKey(
|
10
|
-
function _toPrimitive(
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
10
|
+
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); }
|
11
11
|
/**
|
12
12
|
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
13
13
|
* 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:
|
@@ -15,7 +15,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
15
15
|
* 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.
|
16
16
|
*/
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
18
|
-
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID } from "../../constant";
|
18
|
+
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT } from "../../constant";
|
19
19
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
20
20
|
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
|
21
21
|
import { getType, isJsonString, isPC } from "../../util";
|
@@ -49,7 +49,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
49
49
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
50
50
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
51
51
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
52
|
-
this._appVersion = '1.
|
52
|
+
this._appVersion = '1.9.0';
|
53
53
|
this._isInitComponent = false;
|
54
54
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
55
55
|
this.createIframeNode = function () {
|
@@ -367,7 +367,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
367
367
|
}));
|
368
368
|
case 4:
|
369
369
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
370
|
-
_context2.next =
|
370
|
+
_context2.next = 10;
|
371
371
|
break;
|
372
372
|
}
|
373
373
|
params.paymentMethodType = 'CARD';
|
@@ -375,55 +375,60 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
375
375
|
return _this5.getDeviceIdAndLog();
|
376
376
|
case 8:
|
377
377
|
envInfo.deviceId = _context2.sent;
|
378
|
-
|
378
|
+
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
379
|
+
envInfo.extendInfo = {
|
380
|
+
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
381
|
+
};
|
382
|
+
}
|
383
|
+
case 10:
|
379
384
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
380
|
-
_context2.next =
|
385
|
+
_context2.next = 18;
|
381
386
|
break;
|
382
387
|
}
|
383
388
|
_ref3 = params.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer, _ref3$productScene = _ref3.productScene, productScene = _ref3$productScene === void 0 ? '' : _ref3$productScene;
|
384
389
|
_ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.paymentSessionMetaData) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
|
385
390
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
386
|
-
_context2.next =
|
391
|
+
_context2.next = 15;
|
387
392
|
break;
|
388
393
|
}
|
389
394
|
return _context2.abrupt("return", resolve({
|
390
395
|
message: 'sdk no need to make query request',
|
391
396
|
success: true
|
392
397
|
}));
|
393
|
-
case
|
394
|
-
_context2.next =
|
398
|
+
case 15:
|
399
|
+
_context2.next = 17;
|
395
400
|
return _this5.getDeviceIdAndLog();
|
396
|
-
case 16:
|
397
|
-
envInfo.deviceId = _context2.sent;
|
398
401
|
case 17:
|
402
|
+
envInfo.deviceId = _context2.sent;
|
403
|
+
case 18:
|
399
404
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
400
|
-
_context2.next =
|
405
|
+
_context2.next = 28;
|
401
406
|
break;
|
402
407
|
}
|
403
408
|
action = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 || (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.action) || {};
|
404
409
|
signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
405
410
|
if (!(signType === 'SMS')) {
|
406
|
-
_context2.next =
|
411
|
+
_context2.next = 23;
|
407
412
|
break;
|
408
413
|
}
|
409
414
|
return _context2.abrupt("return", resolve({
|
410
415
|
message: 'sdk no need to make query request',
|
411
416
|
success: true
|
412
417
|
}));
|
413
|
-
case
|
418
|
+
case 23:
|
414
419
|
if (!(!signType || signType !== 'REDIRECT')) {
|
415
|
-
_context2.next =
|
420
|
+
_context2.next = 25;
|
416
421
|
break;
|
417
422
|
}
|
418
423
|
return _context2.abrupt("return", resolve({
|
419
424
|
success: false
|
420
425
|
}));
|
421
|
-
case
|
422
|
-
_context2.next =
|
426
|
+
case 25:
|
427
|
+
_context2.next = 27;
|
423
428
|
return _this5.getDeviceIdAndLog();
|
424
|
-
case 26:
|
425
|
-
envInfo.deviceId = _context2.sent;
|
426
429
|
case 27:
|
430
|
+
envInfo.deviceId = _context2.sent;
|
431
|
+
case 28:
|
427
432
|
_this5.AMSSDK.logger.logInfo({
|
428
433
|
title: 'sdk_event_sdkQuery'
|
429
434
|
}, {
|
@@ -459,7 +464,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
459
464
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
460
465
|
}).send();
|
461
466
|
});
|
462
|
-
case
|
467
|
+
case 30:
|
463
468
|
case "end":
|
464
469
|
return _context2.stop();
|
465
470
|
}
|
@@ -633,6 +638,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
633
638
|
// Subscribe to messages from iframe
|
634
639
|
this.addEventListener();
|
635
640
|
} catch (error) {
|
641
|
+
this.AMSSDK.logger.logError({
|
642
|
+
title: 'sdk_error_created_app_failed'
|
643
|
+
}).send();
|
636
644
|
this.dispatchToSDK(EVENT.error.name, Object.assign({}, ERRORMESSAGE.SDK_COMPATIBILITY_ISSUES.FAILED_TO_CREATE_IFRAME, {
|
637
645
|
stack: error
|
638
646
|
}));
|
@@ -670,31 +678,80 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
670
678
|
}
|
671
679
|
}, {
|
672
680
|
key: "createDialog",
|
673
|
-
value: function
|
674
|
-
var
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
681
|
+
value: function () {
|
682
|
+
var _createDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
|
683
|
+
var pageUrl, isLoad, timeout, logTimeout;
|
684
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
685
|
+
while (1) switch (_context4.prev = _context4.next) {
|
686
|
+
case 0:
|
687
|
+
pageUrl = data.url.includes('?') ? "".concat(data.url, "&").concat(this._appLocationSearch) : "".concat(data.url, "?").concat(this._appLocationSearch);
|
688
|
+
_context4.prev = 1;
|
689
|
+
isLoad = false;
|
690
|
+
_context4.next = 5;
|
691
|
+
return createModal({
|
692
|
+
widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
|
693
|
+
heightPadding: data === null || data === void 0 ? void 0 : data.heightPadding,
|
694
|
+
device: this.platform,
|
695
|
+
url: pageUrl
|
696
|
+
});
|
697
|
+
case 5:
|
698
|
+
this.popupApp = _context4.sent;
|
699
|
+
timeout = setTimeout(function () {
|
700
|
+
if (isLoad) return;
|
701
|
+
throw {
|
702
|
+
title: 'sdk_error_create_pop_up'
|
703
|
+
};
|
704
|
+
}, LOADTIME_LIMIT);
|
705
|
+
logTimeout = setTimeout(function () {
|
706
|
+
if (isLoad) return;
|
707
|
+
throw {
|
708
|
+
title: 'sdk_error_pop_up_time_out'
|
709
|
+
};
|
710
|
+
}, POPUP_LOADTIME_LOG_LIMIT);
|
711
|
+
this.popupApp.onload = function () {
|
712
|
+
isLoad = true;
|
713
|
+
clearTimeout(timeout);
|
714
|
+
clearTimeout(logTimeout);
|
715
|
+
};
|
716
|
+
_context4.next = 15;
|
717
|
+
break;
|
718
|
+
case 11:
|
719
|
+
_context4.prev = 11;
|
720
|
+
_context4.t0 = _context4["catch"](1);
|
721
|
+
this.AMSSDK.logger.logError({
|
722
|
+
title: (_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.title) || 'sdk_error_create_pop_up'
|
723
|
+
}, {
|
724
|
+
message: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message,
|
725
|
+
url: pageUrl
|
726
|
+
});
|
727
|
+
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
|
728
|
+
case 15:
|
729
|
+
case "end":
|
730
|
+
return _context4.stop();
|
731
|
+
}
|
732
|
+
}, _callee4, this, [[1, 11]]);
|
733
|
+
}));
|
734
|
+
function createDialog(_x4) {
|
735
|
+
return _createDialog.apply(this, arguments);
|
736
|
+
}
|
737
|
+
return createDialog;
|
738
|
+
}()
|
682
739
|
}, {
|
683
740
|
key: "getDeviceIdAndCallback",
|
684
741
|
value: function () {
|
685
|
-
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
742
|
+
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventContext) {
|
686
743
|
var deviceId;
|
687
|
-
return _regeneratorRuntime().wrap(function
|
688
|
-
while (1) switch (
|
744
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
745
|
+
while (1) switch (_context5.prev = _context5.next) {
|
689
746
|
case 0:
|
690
747
|
if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
|
691
|
-
|
748
|
+
_context5.next = 5;
|
692
749
|
break;
|
693
750
|
}
|
694
|
-
|
751
|
+
_context5.next = 3;
|
695
752
|
return this.getDeviceIdAndLog(eventContext === null || eventContext === void 0 ? void 0 : eventContext.data, true);
|
696
753
|
case 3:
|
697
|
-
deviceId =
|
754
|
+
deviceId = _context5.sent;
|
698
755
|
this.dispatchToApp({
|
699
756
|
context: {
|
700
757
|
event: 'appEventCallback',
|
@@ -706,11 +763,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
706
763
|
});
|
707
764
|
case 5:
|
708
765
|
case "end":
|
709
|
-
return
|
766
|
+
return _context5.stop();
|
710
767
|
}
|
711
|
-
},
|
768
|
+
}, _callee5, this);
|
712
769
|
}));
|
713
|
-
function getDeviceIdAndCallback(
|
770
|
+
function getDeviceIdAndCallback(_x5) {
|
714
771
|
return _getDeviceIdAndCallback.apply(this, arguments);
|
715
772
|
}
|
716
773
|
return getDeviceIdAndCallback;
|
@@ -718,9 +775,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
718
775
|
}, {
|
719
776
|
key: "getUserAgentAndCallback",
|
720
777
|
value: function () {
|
721
|
-
var _getUserAgentAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
722
|
-
return _regeneratorRuntime().wrap(function
|
723
|
-
while (1) switch (
|
778
|
+
var _getUserAgentAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(eventContext) {
|
779
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
780
|
+
while (1) switch (_context6.prev = _context6.next) {
|
724
781
|
case 0:
|
725
782
|
if (eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId) {
|
726
783
|
try {
|
@@ -729,19 +786,22 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
729
786
|
event: 'appEventCallback',
|
730
787
|
eventCallbackId: eventContext === null || eventContext === void 0 ? void 0 : eventContext.eventCallbackId,
|
731
788
|
data: {
|
732
|
-
|
789
|
+
// TODO 上线前删除链接参数
|
790
|
+
userAgent: window.navigator.userAgent + window.location.search
|
733
791
|
}
|
734
792
|
}
|
735
793
|
});
|
736
|
-
} catch (error) {
|
794
|
+
} catch (error) {
|
795
|
+
/* empty */
|
796
|
+
}
|
737
797
|
}
|
738
798
|
case 1:
|
739
799
|
case "end":
|
740
|
-
return
|
800
|
+
return _context6.stop();
|
741
801
|
}
|
742
|
-
},
|
802
|
+
}, _callee6, this);
|
743
803
|
}));
|
744
|
-
function getUserAgentAndCallback(
|
804
|
+
function getUserAgentAndCallback(_x6) {
|
745
805
|
return _getUserAgentAndCallback.apply(this, arguments);
|
746
806
|
}
|
747
807
|
return getUserAgentAndCallback;
|
@@ -749,10 +809,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
749
809
|
}, {
|
750
810
|
key: "returnDataAndCallback",
|
751
811
|
value: function () {
|
752
|
-
var _returnDataAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
812
|
+
var _returnDataAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(eventContext) {
|
753
813
|
var _eventContext$data, targetData;
|
754
|
-
return _regeneratorRuntime().wrap(function
|
755
|
-
while (1) switch (
|
814
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
815
|
+
while (1) switch (_context7.prev = _context7.next) {
|
756
816
|
case 0:
|
757
817
|
if (eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId) {
|
758
818
|
targetData = this._globalData.get((_eventContext$data = eventContext.data) === null || _eventContext$data === void 0 ? void 0 : _eventContext$data.dataKey);
|
@@ -766,11 +826,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
766
826
|
}
|
767
827
|
case 1:
|
768
828
|
case "end":
|
769
|
-
return
|
829
|
+
return _context7.stop();
|
770
830
|
}
|
771
|
-
},
|
831
|
+
}, _callee7, this);
|
772
832
|
}));
|
773
|
-
function returnDataAndCallback(
|
833
|
+
function returnDataAndCallback(_x7) {
|
774
834
|
return _returnDataAndCallback.apply(this, arguments);
|
775
835
|
}
|
776
836
|
return returnDataAndCallback;
|
@@ -827,7 +887,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
827
887
|
this._globalData.set((_data$context$data = data.context.data) === null || _data$context$data === void 0 ? void 0 : _data$context$data.dataKey, (_data$context$data2 = data.context.data) === null || _data$context$data2 === void 0 ? void 0 : _data$context$data2.data);
|
828
888
|
return;
|
829
889
|
}
|
830
|
-
if (data.context.event === EVENT.
|
890
|
+
if (data.context.event === EVENT.popupWindow.name) {
|
831
891
|
var _data$context;
|
832
892
|
this.createDialog((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
|
833
893
|
return;
|
@@ -843,6 +903,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
843
903
|
}
|
844
904
|
if (data.context.event === EVENT.dismissLoading.name) {
|
845
905
|
var _data$context$data3;
|
906
|
+
this.dismissLoadingFunc(false);
|
846
907
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
847
908
|
code: 'SDK_END_OF_LOADING',
|
848
909
|
message: ((_data$context$data3 = data.context.data) === null || _data$context$data3 === void 0 ? void 0 : _data$context$data3.message) || ''
|
@@ -904,6 +965,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
904
965
|
// The plug-in communicates with the sdk after processing
|
905
966
|
this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
|
906
967
|
}
|
968
|
+
}, {
|
969
|
+
key: "dismissLoadingFunc",
|
970
|
+
value: function dismissLoadingFunc() {
|
971
|
+
var _document$getElementB2;
|
972
|
+
var isShowMockup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
973
|
+
var mockup = document.getElementById(MOCKUP_ID);
|
974
|
+
if (mockup) {
|
975
|
+
mockup.style.background = 'rgb(0, 0, 0, 0.6)';
|
976
|
+
mockup.style.display = isShowMockup ? 'block' : 'none';
|
977
|
+
}
|
978
|
+
(_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.remove();
|
979
|
+
}
|
907
980
|
}, {
|
908
981
|
key: "handleSizeChanged",
|
909
982
|
value: function handleSizeChanged(data) {
|
@@ -912,13 +985,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
912
985
|
var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
|
913
986
|
cashier.style.height = "".concat(data.context.data.height, "px");
|
914
987
|
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
915
|
-
|
916
|
-
var mockup = document.getElementById(MOCKUP_ID);
|
917
|
-
if (mockup) {
|
918
|
-
mockup.style.background = 'rgb(0, 0, 0, 0.6)';
|
919
|
-
mockup.style.display = 'block';
|
920
|
-
}
|
921
|
-
(_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.remove();
|
988
|
+
this.dismissLoadingFunc();
|
922
989
|
if (this.platform === 'desktop') {
|
923
990
|
cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
924
991
|
if (data.context.data.width) cashier.style.width = "".concat(data.context.data.width, "px");
|
@@ -1005,20 +1072,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1005
1072
|
window.open(_data.normalUrl);
|
1006
1073
|
return;
|
1007
1074
|
}
|
1075
|
+
if (_data.target === targetEnum.REPLACE) {
|
1076
|
+
if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
|
1077
|
+
successCallback(RedirectType.NormalUrl, _data.normalUrl);
|
1078
|
+
window.location.replace(_data.normalUrl);
|
1079
|
+
return;
|
1080
|
+
}
|
1008
1081
|
this.cleanContainer();
|
1009
1082
|
this.AMSSDK._redirect({
|
1010
1083
|
applinkUrl: _data === null || _data === void 0 ? void 0 : _data.applinkUrl
|
1011
1084
|
}).then(function () {
|
1012
1085
|
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1013
1086
|
}).catch(function () {
|
1014
|
-
failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1087
|
+
if (_data !== null && _data !== void 0 && _data.applinkUrl) failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1015
1088
|
return _this7.AMSSDK._redirect({
|
1016
1089
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
1017
1090
|
});
|
1018
1091
|
}).then(function () {
|
1019
1092
|
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1020
1093
|
}).catch(function () {
|
1021
|
-
failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1094
|
+
if (_data !== null && _data !== void 0 && _data.schemeUrl) failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1022
1095
|
return _this7.AMSSDK._redirect({
|
1023
1096
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
1024
1097
|
});
|
@@ -1126,27 +1199,27 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1126
1199
|
*/
|
1127
1200
|
}, {
|
1128
1201
|
key: "sendRenderEvent",
|
1129
|
-
value: function () {
|
1130
|
-
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1202
|
+
value: (function () {
|
1203
|
+
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1131
1204
|
var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
|
1132
|
-
return _regeneratorRuntime().wrap(function
|
1133
|
-
while (1) switch (
|
1205
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1206
|
+
while (1) switch (_context8.prev = _context8.next) {
|
1134
1207
|
case 0:
|
1135
|
-
|
1208
|
+
_context8.prev = 0;
|
1136
1209
|
if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
|
1137
|
-
|
1210
|
+
_context8.next = 3;
|
1138
1211
|
break;
|
1139
1212
|
}
|
1140
|
-
return
|
1213
|
+
return _context8.abrupt("return");
|
1141
1214
|
case 3:
|
1142
|
-
|
1215
|
+
_context8.next = 5;
|
1143
1216
|
return this._actionQueryPromise;
|
1144
1217
|
case 5:
|
1145
|
-
res =
|
1146
|
-
|
1218
|
+
res = _context8.sent;
|
1219
|
+
_context8.next = 8;
|
1147
1220
|
return this._actionSubmitPromise;
|
1148
1221
|
case 8:
|
1149
|
-
submitRes =
|
1222
|
+
submitRes = _context8.sent;
|
1150
1223
|
this._performanceData.push({
|
1151
1224
|
key: 'sdk_render_component',
|
1152
1225
|
value: Date.now()
|
@@ -1180,16 +1253,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1180
1253
|
}
|
1181
1254
|
});
|
1182
1255
|
// eslint-disable-next-line no-empty
|
1183
|
-
|
1256
|
+
_context8.next = 16;
|
1184
1257
|
break;
|
1185
1258
|
case 14:
|
1186
|
-
|
1187
|
-
|
1259
|
+
_context8.prev = 14;
|
1260
|
+
_context8.t0 = _context8["catch"](0);
|
1188
1261
|
case 16:
|
1189
1262
|
case "end":
|
1190
|
-
return
|
1263
|
+
return _context8.stop();
|
1191
1264
|
}
|
1192
|
-
},
|
1265
|
+
}, _callee8, this, [[0, 14]]);
|
1193
1266
|
}));
|
1194
1267
|
function sendRenderEvent() {
|
1195
1268
|
return _sendRenderEvent.apply(this, arguments);
|
@@ -1199,6 +1272,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1199
1272
|
/**
|
1200
1273
|
* @description close cashier
|
1201
1274
|
*/
|
1275
|
+
)
|
1202
1276
|
}, {
|
1203
1277
|
key: "cleanContainer",
|
1204
1278
|
value: function cleanContainer() {
|
@@ -16,29 +16,38 @@ export var createModal = function createModal(_ref) {
|
|
16
16
|
url = _ref.url,
|
17
17
|
widthPadding = _ref.widthPadding,
|
18
18
|
heightPadding = _ref.heightPadding;
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
19
|
+
return new Promise(function (resolve, reject) {
|
20
|
+
try {
|
21
|
+
var overlay = document.createElement('div');
|
22
|
+
overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
23
|
+
var modal = document.createElement('div');
|
24
|
+
modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
25
|
+
if (device === 'desktop') {
|
26
|
+
modal.style.width = '600px';
|
27
|
+
modal.style.height = '464px';
|
28
|
+
modal.style.borderRadius = '12px';
|
29
|
+
} else {
|
30
|
+
modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
|
31
|
+
modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
|
32
|
+
modal.style.borderRadius = '8px';
|
33
|
+
}
|
34
|
+
var iframe = document.createElement('iframe');
|
35
|
+
iframe.src = url; // 替换为实际的 URL 地址
|
36
|
+
iframe.style.border = 'none';
|
37
|
+
iframe.style.width = '100%';
|
38
|
+
iframe.style.height = '100%';
|
39
|
+
modal.appendChild(iframe);
|
40
|
+
var body = document.getElementsByTagName('body')[0];
|
41
|
+
body.appendChild(overlay);
|
42
|
+
body.appendChild(modal);
|
43
|
+
resolve(iframe);
|
44
|
+
} catch (error) {
|
45
|
+
reject({
|
46
|
+
title: 'sdk_error_create_pop_up',
|
47
|
+
message: error === null || error === void 0 ? void 0 : error.toString()
|
48
|
+
});
|
49
|
+
}
|
50
|
+
});
|
42
51
|
};
|
43
52
|
|
44
53
|
// 销毁弹窗
|
@@ -3,8 +3,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
3
3
|
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); } }
|
4
4
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
5
|
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; }
|
6
|
-
function _toPropertyKey(
|
7
|
-
function _toPrimitive(
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
|
+
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); }
|
8
8
|
/**
|
9
9
|
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
10
10
|
* 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:
|