@alipay/ams-checkout 0.0.1701850681-dev.4 → 0.0.1701850681-dev.5
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/esm/constant/index.d.ts
CHANGED
@@ -164,6 +164,9 @@ export declare const EVENT: {
|
|
164
164
|
receiveMuitiAppFromSdk: {
|
165
165
|
name: string;
|
166
166
|
};
|
167
|
+
getUserAgentFromSdk: {
|
168
|
+
name: string;
|
169
|
+
};
|
167
170
|
};
|
168
171
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
169
172
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
package/esm/constant/index.js
CHANGED
@@ -160,16 +160,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
160
160
|
_this2._eventCenter.emit(EVENT.error.name, error);
|
161
161
|
return Promise.reject(error);
|
162
162
|
}).then(function (appendParams) {
|
163
|
-
var _appendParams$iframeN, _appendParams$iframeN2;
|
164
|
-
// This version, easypay2.0 only supports alipayhk
|
165
|
-
var productSceneVersion = appendParams === null || appendParams === void 0 || (_appendParams$iframeN = appendParams.iframeNodesParams) === null || _appendParams$iframeN === void 0 || (_appendParams$iframeN = _appendParams$iframeN.paymentSessionMetaData) === null || _appendParams$iframeN === void 0 || (_appendParams$iframeN = _appendParams$iframeN.paymentSessionConfig) === null || _appendParams$iframeN === void 0 ? void 0 : _appendParams$iframeN.productSceneVersion;
|
166
|
-
var paymentMethodType = appendParams === null || appendParams === void 0 || (_appendParams$iframeN2 = appendParams.iframeNodesParams) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentSessionMetaData) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentMethodInfoView) === null || _appendParams$iframeN2 === void 0 ? void 0 : _appendParams$iframeN2.paymentMethodType;
|
167
|
-
if ((appendParams === null || appendParams === void 0 ? void 0 : appendParams.componentSign) === componentSignEnum.EASY_PAY_WALLET && productSceneVersion === '2.0' && paymentMethodType !== 'ALIPAY_HK') {
|
168
|
-
return Promise.reject({
|
169
|
-
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
170
|
-
message: "Abnormal response data, interface failure, or unsupported payment method"
|
171
|
-
});
|
172
|
-
}
|
173
163
|
return _this2.pluginAppendIframe(appendParams);
|
174
164
|
});
|
175
165
|
}
|
@@ -15,7 +15,6 @@ 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 { marmotMap } from '../../config/index';
|
19
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";
|
20
19
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
21
20
|
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
|
@@ -713,12 +712,43 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
713
712
|
return getDeviceIdAndCallback;
|
714
713
|
}()
|
715
714
|
}, {
|
716
|
-
key: "
|
715
|
+
key: "getUserAgentAndCallback",
|
717
716
|
value: function () {
|
718
|
-
var
|
719
|
-
var _eventContext$data, targetData;
|
717
|
+
var _getUserAgentAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventContext) {
|
720
718
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
721
719
|
while (1) switch (_context5.prev = _context5.next) {
|
720
|
+
case 0:
|
721
|
+
if (eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId) {
|
722
|
+
try {
|
723
|
+
this.dispatchToApp({
|
724
|
+
context: {
|
725
|
+
event: 'appEventCallback',
|
726
|
+
eventCallbackId: eventContext === null || eventContext === void 0 ? void 0 : eventContext.eventCallbackId,
|
727
|
+
data: {
|
728
|
+
userAgent: window.navigator.userAgent + window.location.search // TODO location.search用于模拟配置ua,测试完成后,删除
|
729
|
+
}
|
730
|
+
}
|
731
|
+
});
|
732
|
+
} catch (error) {/* empty */}
|
733
|
+
}
|
734
|
+
case 1:
|
735
|
+
case "end":
|
736
|
+
return _context5.stop();
|
737
|
+
}
|
738
|
+
}, _callee5, this);
|
739
|
+
}));
|
740
|
+
function getUserAgentAndCallback(_x5) {
|
741
|
+
return _getUserAgentAndCallback.apply(this, arguments);
|
742
|
+
}
|
743
|
+
return getUserAgentAndCallback;
|
744
|
+
}()
|
745
|
+
}, {
|
746
|
+
key: "returnDataAndCallback",
|
747
|
+
value: function () {
|
748
|
+
var _returnDataAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(eventContext) {
|
749
|
+
var _eventContext$data, targetData;
|
750
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
751
|
+
while (1) switch (_context6.prev = _context6.next) {
|
722
752
|
case 0:
|
723
753
|
if (eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId) {
|
724
754
|
targetData = this._globalData.get((_eventContext$data = eventContext.data) === null || _eventContext$data === void 0 ? void 0 : _eventContext$data.dataKey);
|
@@ -732,11 +762,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
732
762
|
}
|
733
763
|
case 1:
|
734
764
|
case "end":
|
735
|
-
return
|
765
|
+
return _context6.stop();
|
736
766
|
}
|
737
|
-
},
|
767
|
+
}, _callee6, this);
|
738
768
|
}));
|
739
|
-
function returnDataAndCallback(
|
769
|
+
function returnDataAndCallback(_x6) {
|
740
770
|
return _returnDataAndCallback.apply(this, arguments);
|
741
771
|
}
|
742
772
|
return returnDataAndCallback;
|
@@ -776,6 +806,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
776
806
|
this.getDeviceIdAndCallback(data.context);
|
777
807
|
return;
|
778
808
|
}
|
809
|
+
if (data.context.event === EVENT.getUserAgentFromSdk.name) {
|
810
|
+
this.getUserAgentAndCallback(data.context);
|
811
|
+
return;
|
812
|
+
}
|
779
813
|
if (data.context.event === EVENT.popWindow.name) {
|
780
814
|
destroyModal();
|
781
815
|
return;
|
@@ -1089,26 +1123,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1089
1123
|
}, {
|
1090
1124
|
key: "sendRenderEvent",
|
1091
1125
|
value: function () {
|
1092
|
-
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1126
|
+
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
1093
1127
|
var _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, res, submitRes;
|
1094
|
-
return _regeneratorRuntime().wrap(function
|
1095
|
-
while (1) switch (
|
1128
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
1129
|
+
while (1) switch (_context7.prev = _context7.next) {
|
1096
1130
|
case 0:
|
1097
|
-
|
1131
|
+
_context7.prev = 0;
|
1098
1132
|
if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
|
1099
|
-
|
1133
|
+
_context7.next = 3;
|
1100
1134
|
break;
|
1101
1135
|
}
|
1102
|
-
return
|
1136
|
+
return _context7.abrupt("return");
|
1103
1137
|
case 3:
|
1104
|
-
|
1138
|
+
_context7.next = 5;
|
1105
1139
|
return this._actionQueryPromise;
|
1106
1140
|
case 5:
|
1107
|
-
res =
|
1108
|
-
|
1141
|
+
res = _context7.sent;
|
1142
|
+
_context7.next = 8;
|
1109
1143
|
return this._actionSubmitPromise;
|
1110
1144
|
case 8:
|
1111
|
-
submitRes =
|
1145
|
+
submitRes = _context7.sent;
|
1112
1146
|
this._performanceData.push({
|
1113
1147
|
key: 'sdk_render_component',
|
1114
1148
|
value: Date.now()
|
@@ -1141,16 +1175,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1141
1175
|
}
|
1142
1176
|
});
|
1143
1177
|
// eslint-disable-next-line no-empty
|
1144
|
-
|
1178
|
+
_context7.next = 16;
|
1145
1179
|
break;
|
1146
1180
|
case 14:
|
1147
|
-
|
1148
|
-
|
1181
|
+
_context7.prev = 14;
|
1182
|
+
_context7.t0 = _context7["catch"](0);
|
1149
1183
|
case 16:
|
1150
1184
|
case "end":
|
1151
|
-
return
|
1185
|
+
return _context7.stop();
|
1152
1186
|
}
|
1153
|
-
},
|
1187
|
+
}, _callee7, this, [[0, 14]]);
|
1154
1188
|
}));
|
1155
1189
|
function sendRenderEvent() {
|
1156
1190
|
return _sendRenderEvent.apply(this, arguments);
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"@alipay/ams-checkout","version":"0.0.1701850681-dev.
|
1
|
+
{"name":"@alipay/ams-checkout","version":"0.0.1701850681-dev.5","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
|