@alipay/ams-checkout 0.0.1724942009-dev.3 → 0.0.1724942009-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.
@@ -25,6 +25,7 @@ export default class ComponentApp {
25
25
  private _appLocationSearch;
26
26
  private _renderDisplayType;
27
27
  private _multipleCallbackEvents;
28
+ private _isAppWebview;
28
29
  _merchantAppointParam: IMerchantAppointParam;
29
30
  private _webAppHeartBeatTimeoutFn;
30
31
  constructor();
@@ -22,7 +22,7 @@ import { sdkVersion } from "../../config";
22
22
  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, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
23
23
  import { queryPaymentInfo, submitPayInfo } from "../../service";
24
24
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
25
- import { getType, isJsonString, isPC, isWebView } from "../../util";
25
+ import { getType, isJsonString, isPC } from "../../util";
26
26
  import { isLocalMock } from "../../util/mock";
27
27
  import { matchVersion } from "../../util/versionCompare";
28
28
  import { getBackScheme } from "../../util/getBackScheme";
@@ -57,6 +57,7 @@ var ComponentApp = /*#__PURE__*/function () {
57
57
  _defineProperty(this, "_appLocationSearch", void 0);
58
58
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
59
59
  _defineProperty(this, "_multipleCallbackEvents", void 0);
60
+ _defineProperty(this, "_isAppWebview", void 0);
60
61
  _defineProperty(this, "_merchantAppointParam", void 0);
61
62
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
62
63
  this._appVersion = '1.22.0';
@@ -265,6 +266,7 @@ var ComponentApp = /*#__PURE__*/function () {
265
266
  this._componentSign = componentSign;
266
267
  if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
267
268
  this._renderDisplayType = renderParams.renderDisplayType;
269
+ this._isAppWebview = renderParams.isAppWebview;
268
270
  this._merchantAppointParam = renderParams.merchantAppointParam;
269
271
  var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
270
272
  this.initLoggerMeta();
@@ -667,7 +669,7 @@ var ComponentApp = /*#__PURE__*/function () {
667
669
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
668
670
  var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
669
671
  var _channelBehavior$buil, _this6$_renderParams$;
670
- var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _this6$_renderParams3, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, _ref13, _ref13$paymentMethodI, _ref13$paymentMethodI2, _ref13$paymentMethodI3, paymentMethodType, backScheme, extParams;
672
+ var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _this6$_renderParams3, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, _ref13, _ref13$paymentMethodI, _ref13$paymentMethodI2, _ref13$paymentMethodI3, paymentMethodType, isAppWebview, backScheme, extParams;
671
673
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
672
674
  while (1) switch (_context3.prev = _context3.next) {
673
675
  case 0:
@@ -683,11 +685,11 @@ var ComponentApp = /*#__PURE__*/function () {
683
685
  _ref12 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref12$action = _ref12.action, _ref12$action2 = _ref12$action === void 0 ? {} : _ref12$action, _ref12$action2$enable = _ref12$action2.enableSignAgreement, enableSignAgreement = _ref12$action2$enable === void 0 ? false : _ref12$action2$enable, _ref12$action2$autoDe = _ref12$action2.autoDebitWithToken, autoDebitWithToken = _ref12$action2$autoDe === void 0 ? false : _ref12$action2$autoDe;
684
686
  _ref13 = ((_this6$_renderParams3 = _this6._renderParams) === null || _this6$_renderParams3 === void 0 ? void 0 : _this6$_renderParams3.paymentSessionMetaData) || {}, _ref13$paymentMethodI = _ref13.paymentMethodInfoView, _ref13$paymentMethodI2 = _ref13$paymentMethodI === void 0 ? {} : _ref13$paymentMethodI, _ref13$paymentMethodI3 = _ref13$paymentMethodI2.paymentMethodType, paymentMethodType = _ref13$paymentMethodI3 === void 0 ? '' : _ref13$paymentMethodI3;
685
687
  if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
686
- ///EasyPay 2.0 首次传signAgreement字段
688
+ isAppWebview = _this6._isAppWebview || false; ///EasyPay 2.0 首次传signAgreement字段
687
689
  params['signAgreement'] = enableSignAgreement;
688
- if (paymentMethodType == 'ALIPAY_CN' && !isWebView()) {
690
+ if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
689
691
  backScheme = getBackScheme(undefined, _this6.AMSSDK.logger);
690
- if (backScheme) {
692
+ if (backScheme && backScheme !== 'https') {
691
693
  params['h5FromApp'] = encodeURIComponent(backScheme);
692
694
  }
693
695
  }
@@ -1625,6 +1627,7 @@ var ComponentApp = /*#__PURE__*/function () {
1625
1627
  renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
1626
1628
  appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
1627
1629
  notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
1630
+ isAppWebview: this._isAppWebview,
1628
1631
  merchantAppointParam: this._merchantAppointParam,
1629
1632
  allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
1630
1633
  envInfo: {
@@ -81,6 +81,7 @@ export interface IcreateComponent {
81
81
  paymentSessionData?: string;
82
82
  notRedirectAfterComplete?: boolean;
83
83
  appearance?: Record<string, any>;
84
+ isAppWebview?: boolean;
84
85
  merchantAppointParam?: IMerchantAppointParam;
85
86
  }
86
87
  export interface IappendIframeNodesParams extends IcreateComponent {
@@ -29,7 +29,6 @@ declare const device: {
29
29
  };
30
30
  declare const safeJson: (data: any, obj: any) => any;
31
31
  declare const isPC: () => boolean;
32
- declare const isWebView: (mockUA?: string) => boolean;
33
32
  declare const queryParse: (url?: string) => Record<string, any>;
34
33
  declare const getDesignFontSize: () => number;
35
34
  declare const amsSetSize: (event?: any, dom?: any) => void;
@@ -47,4 +46,4 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
47
46
  timeOut?: number;
48
47
  loadCallback?: any;
49
48
  }, logger: any): Promise<unknown>;
50
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, isWebView, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
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
@@ -171,10 +171,6 @@ var isPC = function isPC() {
171
171
  return userAgentInfo.includes(agent);
172
172
  });
173
173
  };
174
- var isWebView = function isWebView(mockUA) {
175
- var ua = mockUA || navigator.userAgent;
176
- return /webview|wv|ip((?!.*safari)|(?=.*like safari))/i.test(ua);
177
- };
178
174
  var queryParse = function queryParse(url) {
179
175
  var qs = {};
180
176
  if (!url) {
@@ -336,4 +332,4 @@ function loadSDKScript(_ref, logger) {
336
332
  document.head.appendChild(script);
337
333
  });
338
334
  }
339
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, isWebView, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
335
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1724942009-dev.3",
3
+ "version": "0.0.1724942009-dev.4",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",