@alipay/ams-checkout 0.0.1737621505-dev.2 → 0.0.1738831627-dev.4
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/core/component/element/index.d.ts +4 -5
- package/esm/core/component/element/index.js +103 -166
- package/esm/core/component/element/type.d.ts +164 -7
- package/esm/core/component/element/type.js +45 -1
- package/esm/plugin/component/channel.d.ts +26 -20
- package/esm/plugin/component/channel.js +427 -390
- package/esm/plugin/component/index.d.ts +1 -0
- package/esm/plugin/component/index.js +33 -38
- package/esm/service/index.d.ts +0 -1
- package/esm/service/index.js +0 -2
- package/esm/types/index.d.ts +2 -120
- package/esm/types/index.js +0 -35
- package/esm/util/index.d.ts +1 -2
- package/esm/util/index.js +1 -16
- package/esm/util/spm-map.d.ts +3 -0
- package/esm/util/spm-map.js +3 -0
- package/esm/util/versionCompare.d.ts +1 -1
- package/package.json +1 -1
- package/esm/service/element.d.ts +0 -4
- package/esm/service/element.js +0 -51
@@ -23,12 +23,13 @@ import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK
|
|
23
23
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
24
24
|
import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, TargetEnum } from "../../types";
|
25
25
|
import { getType, isJsonString, isPC } from "../../util";
|
26
|
+
import { ElementPaymentMethod } from "../../core/component/element/type";
|
26
27
|
import { getBackScheme } from "../../util/getBackScheme";
|
27
28
|
import { isLocalMock } from "../../util/mock";
|
28
29
|
import { matchVersion } from "../../util/versionCompare";
|
29
30
|
import { handlePaymentSessionConfig } from "../payment-element/utils";
|
30
31
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
31
|
-
import {
|
32
|
+
import { ApplePayService, getChannelBehavior, handleGooglePay } from "./channel";
|
32
33
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
33
34
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
|
34
35
|
import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
|
@@ -1168,15 +1169,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1168
1169
|
window.removeEventListener('resize', window["".concat(LISTENER_PREFIX, "_").concat(this.AMSSDK._instanceId, "_resize")]);
|
1169
1170
|
}
|
1170
1171
|
|
1172
|
+
// element payment event callback回调码
|
1173
|
+
}, {
|
1174
|
+
key: "elementEventCallback",
|
1175
|
+
value: function elementEventCallback(data) {
|
1176
|
+
var _data$context, _data$context2;
|
1177
|
+
if (data.context.event === EVENT.sendMuitiAppEventToSdk.name && ((_data$context = data.context) === null || _data$context === void 0 || (_data$context = _data$context.data) === null || _data$context === void 0 ? void 0 : _data$context.source) === ElementPaymentMethod.PAYMENT_ELEMENT && ((_data$context2 = data.context) === null || _data$context2 === void 0 || (_data$context2 = _data$context2.data) === null || _data$context2 === void 0 ? void 0 : _data$context2.target) === ElementPaymentMethod.CONTAINER_ELEMENT) {
|
1178
|
+
var _data$context3;
|
1179
|
+
this.dispatchToSDK(EVENT.eventCallback.name, (_data$context3 = data.context) === null || _data$context3 === void 0 || (_data$context3 = _data$context3.data) === null || _data$context3 === void 0 ? void 0 : _data$context3.data);
|
1180
|
+
}
|
1181
|
+
}
|
1182
|
+
|
1171
1183
|
/**
|
1172
1184
|
* @description Processing messages from iframe
|
1173
1185
|
*/
|
1174
1186
|
}, {
|
1175
1187
|
key: "_handleAppMessage",
|
1176
1188
|
value: function _handleAppMessage(data) {
|
1177
|
-
var _data$
|
1189
|
+
var _data$context5,
|
1178
1190
|
_this7 = this,
|
1179
|
-
_data$
|
1191
|
+
_data$context6;
|
1180
1192
|
var eventKeyMap = Object.keys(EVENT).map(function (key) {
|
1181
1193
|
return EVENT[key].name;
|
1182
1194
|
});
|
@@ -1205,11 +1217,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1205
1217
|
return;
|
1206
1218
|
}
|
1207
1219
|
if (data.context.event === EVENT.popupWindow.name) {
|
1208
|
-
var _data$
|
1209
|
-
this.createDialog((_data$
|
1220
|
+
var _data$context4;
|
1221
|
+
this.createDialog((_data$context4 = data.context) === null || _data$context4 === void 0 ? void 0 : _data$context4.data);
|
1210
1222
|
return;
|
1211
1223
|
}
|
1212
1224
|
if (data.context.event === EVENT.sendMuitiAppEventToSdk.name) {
|
1225
|
+
this.elementEventCallback(data);
|
1213
1226
|
this.dispatchToApp({
|
1214
1227
|
context: {
|
1215
1228
|
event: 'receiveMuitiAppFromSdk',
|
@@ -1305,7 +1318,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1305
1318
|
title: 'sdk_event_event_callback'
|
1306
1319
|
}).send();
|
1307
1320
|
}
|
1308
|
-
if ((data === null || data === void 0 || (_data$
|
1321
|
+
if ((data === null || data === void 0 || (_data$context5 = data.context) === null || _data$context5 === void 0 ? void 0 : _data$context5.event) === EVENT.getGooglePayToken.name) {
|
1309
1322
|
handleGooglePay(data).then(function (res) {
|
1310
1323
|
_this7.dispatchToApp({
|
1311
1324
|
context: {
|
@@ -1337,38 +1350,20 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1337
1350
|
this.dispatchToApp({
|
1338
1351
|
context: {
|
1339
1352
|
event: EVENT.closePaymentPolling.name,
|
1340
|
-
data:
|
1353
|
+
data: data.context.data
|
1341
1354
|
}
|
1342
1355
|
});
|
1343
1356
|
}
|
1344
|
-
if ((data === null || data === void 0 || (_data$
|
1345
|
-
var _this$_renderParams16, _this$_renderParams17;
|
1346
|
-
var applePayService = new
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
_this7.dispatchToApp({
|
1353
|
-
context: {
|
1354
|
-
event: 'getApplePayToken',
|
1355
|
-
data: {
|
1356
|
-
success: true,
|
1357
|
-
result: res
|
1358
|
-
}
|
1359
|
-
}
|
1360
|
-
});
|
1361
|
-
}).catch(function (err) {
|
1362
|
-
_this7.dispatchToApp({
|
1363
|
-
context: {
|
1364
|
-
event: 'getApplePayToken',
|
1365
|
-
data: {
|
1366
|
-
success: false,
|
1367
|
-
result: err
|
1368
|
-
}
|
1369
|
-
}
|
1370
|
-
});
|
1357
|
+
if ((data === null || data === void 0 || (_data$context6 = data.context) === null || _data$context6 === void 0 ? void 0 : _data$context6.event) === EVENT.getApplePayToken.name) {
|
1358
|
+
var _data$context7, _this$_renderParams16, _this$_renderParams17;
|
1359
|
+
var applePayService = new ApplePayService({
|
1360
|
+
paymentMethod: data === null || data === void 0 || (_data$context7 = data.context) === null || _data$context7 === void 0 || (_data$context7 = _data$context7.data) === null || _data$context7 === void 0 ? void 0 : _data$context7.paymentMethod,
|
1361
|
+
sessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
|
1362
|
+
paymentSessionMetaData: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.paymentSessionMetaData,
|
1363
|
+
logger: this.AMSSDK.logger,
|
1364
|
+
dispatchToApp: this.dispatchToApp.bind(this)
|
1371
1365
|
});
|
1366
|
+
applePayService.submit();
|
1372
1367
|
return;
|
1373
1368
|
}
|
1374
1369
|
// log event before sending the callback
|
@@ -1386,11 +1381,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1386
1381
|
key: "logEventCallback",
|
1387
1382
|
value: function logEventCallback(data, title) {
|
1388
1383
|
if (data.context.event === EVENT.eventCallback.name) {
|
1389
|
-
var _data$
|
1384
|
+
var _data$context9;
|
1390
1385
|
var callbackData = '';
|
1391
1386
|
try {
|
1392
|
-
var _data$
|
1393
|
-
callbackData = JSON.stringify((data === null || data === void 0 || (_data$
|
1387
|
+
var _data$context8;
|
1388
|
+
callbackData = JSON.stringify((data === null || data === void 0 || (_data$context8 = data.context) === null || _data$context8 === void 0 ? void 0 : _data$context8.data) || '');
|
1394
1389
|
} catch (e) {
|
1395
1390
|
console.error(e);
|
1396
1391
|
}
|
@@ -1398,7 +1393,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1398
1393
|
title: title
|
1399
1394
|
}, {
|
1400
1395
|
callbackData: callbackData,
|
1401
|
-
callbackId: (data === null || data === void 0 || (_data$
|
1396
|
+
callbackId: (data === null || data === void 0 || (_data$context9 = data.context) === null || _data$context9 === void 0 ? void 0 : _data$context9.eventCallbackId) || ''
|
1402
1397
|
}).send();
|
1403
1398
|
}
|
1404
1399
|
}
|
package/esm/service/index.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { ApplePayPaymentSessionRequest, ApplePayPaymentSessionResult, CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
|
2
2
|
import type { Logger } from '../util/logger';
|
3
|
-
export * as elementService from './element';
|
4
3
|
export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
|
5
4
|
export declare function antomConfig(options: RequestConfig, logger: Logger): Promise<any>;
|
6
5
|
export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
|
package/esm/service/index.js
CHANGED
@@ -16,8 +16,6 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
16
16
|
*/
|
17
17
|
import { marmotConfigMap } from "../config";
|
18
18
|
import { request } from "../request";
|
19
|
-
import * as _elementService from "./element";
|
20
|
-
export { _elementService as elementService };
|
21
19
|
export function queryPaymentInfo(_x, _x2, _x3) {
|
22
20
|
return _queryPaymentInfo.apply(this, arguments);
|
23
21
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -5,9 +5,8 @@
|
|
5
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
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
7
|
*/
|
8
|
-
import { IApplePayContactField } from '../plugin/applepay/interface';
|
9
|
-
export * from '../core/component/element/type';
|
10
8
|
export type onChange = () => onCnageResult;
|
9
|
+
export type { IElementOptions, ThemeType, PaymentElementLayout } from '../core/component/element/type';
|
11
10
|
interface onCnageResult {
|
12
11
|
complete: boolean;
|
13
12
|
addressValue: AddressItem[];
|
@@ -265,8 +264,6 @@ export interface IPaymentSessionMetaData {
|
|
265
264
|
extendInfo?: {
|
266
265
|
merchantCapabilities?: string[];
|
267
266
|
supportedNetworks?: string[];
|
268
|
-
requiredBillingContactFields: IApplePayContactField[];
|
269
|
-
requiredShippingContactFields: IApplePayContactField[];
|
270
267
|
};
|
271
268
|
merchantInfo?: {
|
272
269
|
registeredCountry?: string;
|
@@ -673,43 +670,7 @@ export type IAppendParams = {
|
|
673
670
|
componentSign: ComponentSignEnum;
|
674
671
|
iframeNodesParams: IappendIframeNodesParams;
|
675
672
|
};
|
676
|
-
|
677
|
-
EFFECTIVE = "EFFECTIVE",
|
678
|
-
UNREGISTERED = "UNREGISTERED"
|
679
|
-
}
|
680
|
-
export type IAccountInfo = {
|
681
|
-
email?: string;
|
682
|
-
verifyId?: string;
|
683
|
-
accountStatus?: AccountStatusEnum;
|
684
|
-
oneAccountId?: string;
|
685
|
-
needOtp?: boolean;
|
686
|
-
errorMsg?: string;
|
687
|
-
inputStatus?: 'success' | 'loading' | 'error' | 'focused' | '';
|
688
|
-
resendLeftTimes?: number;
|
689
|
-
};
|
690
|
-
export interface AccountQueryRequest {
|
691
|
-
paymentSessionData: string;
|
692
|
-
paymentSessionConfig: any;
|
693
|
-
accountInfo: IAccountInfo;
|
694
|
-
}
|
695
|
-
export interface ShippingsItem {
|
696
|
-
shippingName: {
|
697
|
-
firstName: string;
|
698
|
-
lastName: string;
|
699
|
-
};
|
700
|
-
prefer: '1' | '0';
|
701
|
-
shippingId: string;
|
702
|
-
shippingPhoneNo: string;
|
703
|
-
shippingAddress: {
|
704
|
-
region: string;
|
705
|
-
state: string;
|
706
|
-
city: string;
|
707
|
-
address1: string;
|
708
|
-
address2: string;
|
709
|
-
zipCode: string;
|
710
|
-
};
|
711
|
-
}
|
712
|
-
export interface ISubPaymentElementView {
|
673
|
+
interface ISubPaymentElementView {
|
713
674
|
defaultText: string;
|
714
675
|
defaultValue: string;
|
715
676
|
elementMandatory: boolean;
|
@@ -805,85 +766,6 @@ export interface IPaymentMethod {
|
|
805
766
|
paymentAmountView?: IAmountView;
|
806
767
|
paymentQuoteId?: string;
|
807
768
|
}
|
808
|
-
interface Estimate {
|
809
|
-
unit: string;
|
810
|
-
value: number;
|
811
|
-
}
|
812
|
-
interface DeliveryEstimate {
|
813
|
-
maximum: Estimate;
|
814
|
-
minimum: Estimate;
|
815
|
-
}
|
816
|
-
interface FixedAmount {
|
817
|
-
amount: number;
|
818
|
-
currency: string;
|
819
|
-
}
|
820
|
-
interface ShippingRateData {
|
821
|
-
displayName: string;
|
822
|
-
deliveryEstimate: DeliveryEstimate;
|
823
|
-
fixedAmount: FixedAmount;
|
824
|
-
}
|
825
|
-
export interface ShippingAddress {
|
826
|
-
address1: string;
|
827
|
-
address2: string;
|
828
|
-
city: string;
|
829
|
-
region: string;
|
830
|
-
state: string;
|
831
|
-
zipCode: string;
|
832
|
-
}
|
833
|
-
export interface IUserName {
|
834
|
-
firstName: string;
|
835
|
-
middleName?: string;
|
836
|
-
lastName: string;
|
837
|
-
fullName?: string;
|
838
|
-
}
|
839
|
-
export type Shippings = ShippingsItem[];
|
840
|
-
export type IPaymentMethods = IPaymentMethod[];
|
841
|
-
export interface CKPShipping {
|
842
|
-
shippingRateId?: string;
|
843
|
-
shippingRateData?: ShippingRateData;
|
844
|
-
shippingAddress: ShippingAddress;
|
845
|
-
shippingFee?: IAmount;
|
846
|
-
shippingFeeView?: IAmountView;
|
847
|
-
shippingDescription?: string;
|
848
|
-
deliveryEstimate?: DeliveryEstimate;
|
849
|
-
shippingFeeId?: string;
|
850
|
-
shippingName?: IUserName;
|
851
|
-
shippingPhoneNo?: string;
|
852
|
-
shipToEmail?: string;
|
853
|
-
notes?: string;
|
854
|
-
}
|
855
|
-
export interface AccountQueryResult {
|
856
|
-
accountInfo: IAccountInfo;
|
857
|
-
actionForm?: ActionForm;
|
858
|
-
paymentMethods: IPaymentMethods;
|
859
|
-
shippings: Shippings;
|
860
|
-
success: boolean;
|
861
|
-
errorCode?: string;
|
862
|
-
errorMessage?: string;
|
863
|
-
errorStatus?: string;
|
864
|
-
shippingInfo?: CKPShipping;
|
865
|
-
}
|
866
|
-
export declare enum ElementPaymentMethod {
|
867
|
-
CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
|
868
|
-
AUTH_ELEMENT = "AUTH_ELEMENT",
|
869
|
-
ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
|
870
|
-
PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
|
871
|
-
}
|
872
|
-
export declare enum ElementPaymentEvent {
|
873
|
-
RENDER_COMPONENT = "renderComponent",
|
874
|
-
CAPTURE_ASSET = "onCaptureAsset",
|
875
|
-
SIGN_OUT = "onSignout",
|
876
|
-
BLUR = "onBlur",
|
877
|
-
VALIDATE = "submitPay",
|
878
|
-
SUBMIT_RISK = "onSubmitRisk",
|
879
|
-
AFTER_SUBMIT = "onAfterSubmit",
|
880
|
-
SIZE_CHANGE = "onSizeChange",
|
881
|
-
LAUNCH = "onLaunch",
|
882
|
-
CALLBACK = "callback",
|
883
|
-
SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
|
884
|
-
LOG = "log",
|
885
|
-
HANDLE_PAYMENT = "handlePayment"
|
886
|
-
}
|
887
769
|
export declare enum ConnectErrorCode {
|
888
770
|
RISK_REJECT = "RISK_REJECT",
|
889
771
|
USER_AUTH_VERIFICATION_FAILED = "USER_AUTH_VERIFICATION_FAILED",
|
package/esm/types/index.js
CHANGED
@@ -5,9 +5,7 @@
|
|
5
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
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
7
|
*/
|
8
|
-
|
9
8
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
10
|
-
export * from "../core/component/element/type";
|
11
9
|
|
12
10
|
/**
|
13
11
|
* SDK options
|
@@ -211,14 +209,6 @@ export var ProductSceneVersion = /*#__PURE__*/function (ProductSceneVersion) {
|
|
211
209
|
ProductSceneVersion["V2"] = "2.0";
|
212
210
|
return ProductSceneVersion;
|
213
211
|
}({});
|
214
|
-
export var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
|
215
|
-
AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
|
216
|
-
AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
|
217
|
-
return AccountStatusEnum;
|
218
|
-
}({});
|
219
|
-
|
220
|
-
// element 接口start
|
221
|
-
|
222
212
|
export var InterActionTypeEnum = /*#__PURE__*/function (InterActionTypeEnum) {
|
223
213
|
InterActionTypeEnum["COLLECT_REDIRECT"] = "COLLECT_REDIRECT";
|
224
214
|
InterActionTypeEnum["SHOW_CODE"] = "SHOW_CODE";
|
@@ -226,31 +216,6 @@ export var InterActionTypeEnum = /*#__PURE__*/function (InterActionTypeEnum) {
|
|
226
216
|
InterActionTypeEnum["REDIRECT"] = "REDIRECT";
|
227
217
|
return InterActionTypeEnum;
|
228
218
|
}({});
|
229
|
-
// element 接口end
|
230
|
-
|
231
|
-
export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
|
232
|
-
ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
|
233
|
-
ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
|
234
|
-
ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
|
235
|
-
ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
|
236
|
-
return ElementPaymentMethod;
|
237
|
-
}({});
|
238
|
-
export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
|
239
|
-
ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
|
240
|
-
ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
|
241
|
-
ElementPaymentEvent["SIGN_OUT"] = "onSignout";
|
242
|
-
ElementPaymentEvent["BLUR"] = "onBlur";
|
243
|
-
ElementPaymentEvent["VALIDATE"] = "submitPay";
|
244
|
-
ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
|
245
|
-
ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
|
246
|
-
ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
|
247
|
-
ElementPaymentEvent["LAUNCH"] = "onLaunch";
|
248
|
-
ElementPaymentEvent["CALLBACK"] = "callback";
|
249
|
-
ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
|
250
|
-
ElementPaymentEvent["LOG"] = "log";
|
251
|
-
ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
|
252
|
-
return ElementPaymentEvent;
|
253
|
-
}({});
|
254
219
|
export var ConnectErrorCode = /*#__PURE__*/function (ConnectErrorCode) {
|
255
220
|
ConnectErrorCode["RISK_REJECT"] = "RISK_REJECT";
|
256
221
|
ConnectErrorCode["USER_AUTH_VERIFICATION_FAILED"] = "USER_AUTH_VERIFICATION_FAILED";
|
package/esm/util/index.d.ts
CHANGED
@@ -46,5 +46,4 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
|
|
46
46
|
timeOut?: number;
|
47
47
|
loadCallback?: any;
|
48
48
|
}, logger: any): Promise<unknown>;
|
49
|
-
|
50
|
-
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, };
|
49
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
|
package/esm/util/index.js
CHANGED
@@ -328,19 +328,4 @@ function loadSDKScript(_ref, logger) {
|
|
328
328
|
document.head.appendChild(script);
|
329
329
|
});
|
330
330
|
}
|
331
|
-
|
332
|
-
// 判断空对象
|
333
|
-
if (value && _typeof(value) === 'object' && Object.keys(value).length === 0) {
|
334
|
-
return true;
|
335
|
-
}
|
336
|
-
// 判断空数组
|
337
|
-
if (Array.isArray(value) && value.length === 0) {
|
338
|
-
return true;
|
339
|
-
}
|
340
|
-
// 判断空值
|
341
|
-
if (value === null || value === undefined || value === '') {
|
342
|
-
return true;
|
343
|
-
}
|
344
|
-
return false;
|
345
|
-
};
|
346
|
-
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty };
|
331
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
|
package/esm/util/spm-map.d.ts
CHANGED
@@ -164,6 +164,9 @@ export declare const SPM_MAP: {
|
|
164
164
|
load_item_sdk_timeout: string;
|
165
165
|
MerchantValidationError: string;
|
166
166
|
PaymentAuthorizedError: string;
|
167
|
+
sdk_element_create: string;
|
168
|
+
sdk_element_mount_fail: string;
|
169
|
+
sdk_element_mount_start: string;
|
167
170
|
'ApplePaySession is only support in Safari': string;
|
168
171
|
'Abnormal params paymentSessionFactor': string;
|
169
172
|
'Abnormal params recurringInfo': string;
|
package/esm/util/spm-map.js
CHANGED
@@ -164,6 +164,9 @@ export var SPM_MAP = {
|
|
164
164
|
load_item_sdk_timeout: 'a3753.b101271.c388188.d512345',
|
165
165
|
MerchantValidationError: 'a3753.b101271.c388189.d518377',
|
166
166
|
PaymentAuthorizedError: 'a3753.b101271.c388189.d518377',
|
167
|
+
sdk_element_create: 'a3753.b101271.c386688',
|
168
|
+
sdk_element_mount_fail: 'a3753.b101271.c386691',
|
169
|
+
sdk_element_mount_start: 'a3753.b101271.c386690',
|
167
170
|
'ApplePaySession is only support in Safari': 'a3753.b101271.c388189.d518377',
|
168
171
|
'Abnormal params paymentSessionFactor': 'a3753.b101271.c388189.d518377',
|
169
172
|
'Abnormal params recurringInfo': 'a3753.b101271.c388189.d518377',
|
package/package.json
CHANGED
package/esm/service/element.d.ts
DELETED
@@ -1,4 +0,0 @@
|
|
1
|
-
import { AccountQueryRequest, RequestConfig, AccountQueryResult, CashierSdkActionQueryRequest, CashierSdkActionQueryResult } from '../types';
|
2
|
-
import type { Logger } from '../util/logger';
|
3
|
-
export declare function getElementOneAccount(payload: AccountQueryRequest, options: RequestConfig, logger: Logger): Promise<AccountQueryResult>;
|
4
|
-
export declare function getElementSdkAction(payload: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
|
package/esm/service/element.js
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
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(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
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
9
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
10
|
-
import { request } from "../request";
|
11
|
-
export function getElementOneAccount(_x, _x2, _x3) {
|
12
|
-
return _getElementOneAccount.apply(this, arguments);
|
13
|
-
}
|
14
|
-
function _getElementOneAccount() {
|
15
|
-
_getElementOneAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload, options, logger) {
|
16
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
17
|
-
while (1) switch (_context.prev = _context.next) {
|
18
|
-
case 0:
|
19
|
-
return _context.abrupt("return", request(payload, _objectSpread(_objectSpread({}, options), {}, {
|
20
|
-
'Operation-Type': 'com.ipay.iexpfront.one.account.query'
|
21
|
-
}), logger));
|
22
|
-
case 1:
|
23
|
-
case "end":
|
24
|
-
return _context.stop();
|
25
|
-
}
|
26
|
-
}, _callee);
|
27
|
-
}));
|
28
|
-
return _getElementOneAccount.apply(this, arguments);
|
29
|
-
}
|
30
|
-
export function getElementSdkAction(_x4, _x5, _x6) {
|
31
|
-
return _getElementSdkAction.apply(this, arguments);
|
32
|
-
}
|
33
|
-
function _getElementSdkAction() {
|
34
|
-
_getElementSdkAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload, options, logger) {
|
35
|
-
var _options;
|
36
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
37
|
-
while (1) switch (_context2.prev = _context2.next) {
|
38
|
-
case 0:
|
39
|
-
// const deviceId = await getDeviceId();
|
40
|
-
_options = _objectSpread({}, options);
|
41
|
-
return _context2.abrupt("return", request(payload, _objectSpread(_objectSpread({}, _options), {}, {
|
42
|
-
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
43
|
-
}), logger));
|
44
|
-
case 2:
|
45
|
-
case "end":
|
46
|
-
return _context2.stop();
|
47
|
-
}
|
48
|
-
}, _callee2);
|
49
|
-
}));
|
50
|
-
return _getElementSdkAction.apply(this, arguments);
|
51
|
-
}
|