@alipay/ams-checkout 0.0.1730107332-dev.6 → 0.0.1730107332-dev.7
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/foundation/product-processor/easysafepay/deps.d.ts +4 -4
- package/esm/foundation/product-processor/easysafepay/deps.js +3 -3
- package/esm/foundation/product-processor/easysafepay/index.js +29 -24
- package/esm/util/index.d.ts +2 -1
- package/esm/util/index.js +14 -1
- package/package.json +1 -1
@@ -1,18 +1,18 @@
|
|
1
1
|
export type { SDKMetaData } from "../..";
|
2
|
+
export { v4 as uuid } from 'uuid';
|
3
|
+
export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload, } from '../..';
|
2
4
|
export * as ChannelCustomize from '../../../component/channel';
|
3
5
|
export type { IChannelBehavior } from '../../../component/channel';
|
4
6
|
export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from '../../../types';
|
5
|
-
export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
|
6
|
-
export { v4 as uuid } from 'uuid';
|
7
7
|
export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IOptionsParams, } from '../../../types';
|
8
|
-
export { isPC } from '../../../util';
|
8
|
+
export { isEmpty, isPC } from '../../../util';
|
9
9
|
export { getBackScheme } from '../../../util/getBackScheme';
|
10
10
|
export { isLocalMock } from '../../../util/mock';
|
11
|
-
export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload } from '../..';
|
12
11
|
export { ServiceProvider } from '../../service';
|
13
12
|
export type { ContainerService } from '../../service/container';
|
14
13
|
export type { EventCenter } from '../../service/event-center';
|
15
14
|
export { LogService } from '../../service/log';
|
16
15
|
export type { RequesterService } from '../../service/requester/requester';
|
17
16
|
export type { SecurityService } from '../../service/security';
|
17
|
+
export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
|
18
18
|
export * as WebAppUrlUtil from '../../utils/web_app_url_utils';
|
@@ -1,12 +1,12 @@
|
|
1
|
+
export { v4 as uuid } from 'uuid';
|
1
2
|
import * as _ChannelCustomize from "../../../component/channel";
|
2
3
|
export { _ChannelCustomize as ChannelCustomize };
|
3
4
|
export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from "../../../types";
|
4
|
-
export {
|
5
|
-
export { v4 as uuid } from 'uuid';
|
6
|
-
export { isPC } from "../../../util";
|
5
|
+
export { isEmpty, isPC } from "../../../util";
|
7
6
|
export { getBackScheme } from "../../../util/getBackScheme";
|
8
7
|
export { isLocalMock } from "../../../util/mock";
|
9
8
|
export { ServiceProvider } from "../../service";
|
10
9
|
export { LogService } from "../../service/log";
|
10
|
+
export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
|
11
11
|
import * as _WebAppUrlUtil from "../../utils/web_app_url_utils";
|
12
12
|
export { _WebAppUrlUtil as WebAppUrlUtil };
|
@@ -16,7 +16,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
16
16
|
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; }
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
18
18
|
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); }
|
19
|
-
import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, ProductInfoCacheUtil, ProductSceneEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
|
19
|
+
import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, ProductInfoCacheUtil, ProductSceneEnum, ServiceProvider, uuid, WebAppUrlUtil, isEmpty } from "./deps";
|
20
20
|
export var EasySafePayProcessor = /*#__PURE__*/function () {
|
21
21
|
function EasySafePayProcessor() {
|
22
22
|
_classCallCheck(this, EasySafePayProcessor);
|
@@ -216,8 +216,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
216
216
|
});
|
217
217
|
|
218
218
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
219
|
-
Promise.all([this.processSubmitPay, webLaunchPromise]).then(function (_ref) {
|
220
|
-
var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6, _this2$paymentContext7, _this2$paymentContext8;
|
219
|
+
Promise.all([this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
220
|
+
var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6, _this2$paymentContext7, _this2$paymentContext8, _this2$paymentContext9;
|
221
221
|
var _ref2 = _slicedToArray(_ref, 2),
|
222
222
|
submitRes = _ref2[0],
|
223
223
|
launchRes = _ref2[1];
|
@@ -225,18 +225,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
225
225
|
eventCenter.dispatchToApp({
|
226
226
|
event: 'renderComponent',
|
227
227
|
data: {
|
228
|
-
queryResult:
|
229
|
-
|
230
|
-
}
|
231
|
-
|
228
|
+
queryResult: isEmpty((_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj) ? {
|
229
|
+
success: false
|
230
|
+
} : _objectSpread({
|
231
|
+
success: true,
|
232
|
+
orderAmount: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 || (_this2$paymentContext2 = _this2$paymentContext2.paymentSessionObj) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentView
|
233
|
+
}, (_this2$paymentContext3 = _this2.paymentContext) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.paymentSessionObj),
|
234
|
+
sessionResult: (_this2$paymentContext4 = _this2.paymentContext) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.paymentSessionObj,
|
232
235
|
submitResult: submitRes,
|
233
|
-
paymentSessionData: (_this2$
|
236
|
+
paymentSessionData: (_this2$paymentContext5 = _this2.paymentContext) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.paymentSession,
|
234
237
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
235
238
|
renderDisplayType: _this2.paymentContext.displayInfo.type,
|
236
|
-
appearance: (_this2$
|
237
|
-
notRedirectAfterComplete: ((_this2$
|
239
|
+
appearance: (_this2$paymentContext6 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext6 === void 0 ? void 0 : _this2$paymentContext6.appearance,
|
240
|
+
notRedirectAfterComplete: ((_this2$paymentContext7 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext7 === void 0 ? void 0 : _this2$paymentContext7.notRedirectAfterComplete) === true,
|
238
241
|
isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
|
239
|
-
merchantAppointParam: (_this2$
|
242
|
+
merchantAppointParam: (_this2$paymentContext8 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext8 === void 0 ? void 0 : _this2$paymentContext8.merchantAppointParam,
|
240
243
|
allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
|
241
244
|
envInfo: {
|
242
245
|
screenHeight: screen.height,
|
@@ -246,7 +249,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
246
249
|
trackId: logMetaData.requestSeq,
|
247
250
|
platform: logMetaData.platform,
|
248
251
|
firstLogTime: logMetaData.firstLogTime
|
249
|
-
}, ((_this2$
|
252
|
+
}, ((_this2$paymentContext9 = _this2.paymentContext.paymentSessionObj) === null || _this2$paymentContext9 === void 0 ? void 0 : _this2$paymentContext9.paymentSessionConfig) || {}), {}, {
|
250
253
|
renderDisplayType: logMetaData.renderDisplayType,
|
251
254
|
sdkVersion: logMetaData.sdkVersion,
|
252
255
|
merchantId: logMetaData.merchantId,
|
@@ -285,15 +288,16 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
285
288
|
}
|
286
289
|
}
|
287
290
|
this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
|
291
|
+
console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
|
288
292
|
if (this.allowSubmitPayCallAhead) {
|
289
|
-
_context2.next =
|
293
|
+
_context2.next = 8;
|
290
294
|
break;
|
291
295
|
}
|
292
296
|
return _context2.abrupt("return", {
|
293
297
|
message: 'sdk no need to make submitPay request',
|
294
298
|
success: true
|
295
299
|
});
|
296
|
-
case
|
300
|
+
case 8:
|
297
301
|
requestBizId = uuid(); // 下面真实发请求
|
298
302
|
this.logger.logInfo({
|
299
303
|
title: 'sdk_event_submitPay'
|
@@ -313,13 +317,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
313
317
|
extParams.complianceSDK = true;
|
314
318
|
submitParams.extParams = extParams;
|
315
319
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
316
|
-
_context2.prev =
|
320
|
+
_context2.prev = 14;
|
321
|
+
console.log('[web-sdk]call submitPay');
|
317
322
|
_context2.t0 = requester;
|
318
323
|
_context2.t1 = submitParams;
|
319
324
|
_context2.t2 = this.initConfig.environment;
|
320
|
-
_context2.next =
|
325
|
+
_context2.next = 21;
|
321
326
|
return this.acquireApdidToken();
|
322
|
-
case
|
327
|
+
case 21:
|
323
328
|
_context2.t3 = _context2.sent;
|
324
329
|
_context2.t4 = {
|
325
330
|
deviceId: _context2.t3
|
@@ -333,9 +338,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
333
338
|
needEnvInfo: true,
|
334
339
|
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
335
340
|
};
|
336
|
-
_context2.next =
|
341
|
+
_context2.next = 27;
|
337
342
|
return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
|
338
|
-
case
|
343
|
+
case 27:
|
339
344
|
res = _context2.sent;
|
340
345
|
this.logger.logInfo({
|
341
346
|
title: 'sdk_event_submitPayEnd'
|
@@ -345,9 +350,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
345
350
|
traceId: res.traceId
|
346
351
|
});
|
347
352
|
return _context2.abrupt("return", res);
|
348
|
-
case
|
349
|
-
_context2.prev =
|
350
|
-
_context2.t7 = _context2["catch"](
|
353
|
+
case 32:
|
354
|
+
_context2.prev = 32;
|
355
|
+
_context2.t7 = _context2["catch"](14);
|
351
356
|
this.logger.logError({
|
352
357
|
title: 'sdk_event_submitPay_failed'
|
353
358
|
}, {
|
@@ -357,11 +362,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
357
362
|
traceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
|
358
363
|
});
|
359
364
|
throw _context2.t7;
|
360
|
-
case
|
365
|
+
case 36:
|
361
366
|
case "end":
|
362
367
|
return _context2.stop();
|
363
368
|
}
|
364
|
-
}, _callee2, this, [[
|
369
|
+
}, _callee2, this, [[14, 32]]);
|
365
370
|
}));
|
366
371
|
function processSubmitPay() {
|
367
372
|
return _processSubmitPay.apply(this, arguments);
|
package/esm/util/index.d.ts
CHANGED
@@ -36,4 +36,5 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
|
|
36
36
|
timeOut?: number;
|
37
37
|
loadCallback?: any;
|
38
38
|
}, logger: any): Promise<unknown>;
|
39
|
-
|
39
|
+
declare const isEmpty: (value: any) => boolean;
|
40
|
+
export { getType, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, isEmpty, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
|
package/esm/util/index.js
CHANGED
@@ -251,4 +251,17 @@ function loadSDKScript(_ref, logger) {
|
|
251
251
|
document.head.appendChild(script);
|
252
252
|
});
|
253
253
|
}
|
254
|
-
|
254
|
+
var isEmpty = function isEmpty(value) {
|
255
|
+
if (value == null) {
|
256
|
+
// Checks for null and undefined
|
257
|
+
return true;
|
258
|
+
}
|
259
|
+
if (typeof value === 'string' || Array.isArray(value)) {
|
260
|
+
return value.length === 0;
|
261
|
+
}
|
262
|
+
if (_typeof(value) === 'object') {
|
263
|
+
return Object.keys(value).length === 0;
|
264
|
+
}
|
265
|
+
return false; // For other types (like numbers, functions, etc.)
|
266
|
+
};
|
267
|
+
export { getType, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, isEmpty, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
|