@alipay/ams-checkout 0.0.1730107332-dev.1 → 0.0.1730107332-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.
@@ -64,7 +64,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
64
64
  var _this = this;
65
65
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
66
66
  eventCenter.listen(EVENT.redirect.name, function (data) {
67
- var _data$isDestroy;
67
+ var _data$isDestroy, _data$isCallApp, _data$callAppDetectSu;
68
68
  if (!data) {
69
69
  return;
70
70
  }
@@ -75,7 +75,9 @@ export var AntomSDKCore = /*#__PURE__*/function () {
75
75
  applinkUrl: (data === null || data === void 0 ? void 0 : data.applinkUrl) || '',
76
76
  schemeUrl: (data === null || data === void 0 ? void 0 : data.schemeUrl) || '',
77
77
  url: (data === null || data === void 0 ? void 0 : data.normalUrl) || '',
78
- browserLinkTarget: data === null || data === void 0 ? void 0 : data.target
78
+ browserLinkTarget: data === null || data === void 0 ? void 0 : data.target,
79
+ isCallApp: (_data$isCallApp = data === null || data === void 0 ? void 0 : data.isCallApp) !== null && _data$isCallApp !== void 0 ? _data$isCallApp : false,
80
+ callAppDetectSuccessDelay: (_data$callAppDetectSu = data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) !== null && _data$callAppDetectSu !== void 0 ? _data$callAppDetectSu : 5000
79
81
  };
80
82
  redirect(redirectBehavior, _this.instanceId);
81
83
  if (needCleanContainer) {
@@ -84,7 +86,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
84
86
  });
85
87
  eventCenter.listen(EVENT.initSecuritySDK.name, /*#__PURE__*/function () {
86
88
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, payload) {
87
- var securityService, _payload$context, _payload$context2;
89
+ var _payload$context;
90
+ var securityService, success;
88
91
  return _regeneratorRuntime().wrap(function _callee$(_context) {
89
92
  while (1) switch (_context.prev = _context.next) {
90
93
  case 0:
@@ -93,26 +96,22 @@ export var AntomSDKCore = /*#__PURE__*/function () {
93
96
  _context.next = 4;
94
97
  return securityService.initSecurity();
95
98
  case 4:
96
- eventCenter.dispatchToApp({
97
- event: 'appEventCallback',
98
- eventCallbackId: (_payload$context = payload.context) === null || _payload$context === void 0 ? void 0 : _payload$context.eventCallbackId,
99
- data: {
100
- success: true
101
- }
102
- });
99
+ success = true;
103
100
  _context.next = 10;
104
101
  break;
105
102
  case 7:
106
103
  _context.prev = 7;
107
104
  _context.t0 = _context["catch"](1);
105
+ success = false;
106
+ case 10:
108
107
  eventCenter.dispatchToApp({
109
108
  event: 'appEventCallback',
110
- eventCallbackId: (_payload$context2 = payload.context) === null || _payload$context2 === void 0 ? void 0 : _payload$context2.eventCallbackId,
109
+ eventCallbackId: (_payload$context = payload.context) === null || _payload$context === void 0 ? void 0 : _payload$context.eventCallbackId,
111
110
  data: {
112
- success: false
111
+ success: success
113
112
  }
114
113
  });
115
- case 10:
114
+ case 11:
116
115
  case "end":
117
116
  return _context.stop();
118
117
  }
@@ -122,6 +121,35 @@ export var AntomSDKCore = /*#__PURE__*/function () {
122
121
  return _ref.apply(this, arguments);
123
122
  };
124
123
  }());
124
+ eventCenter.listen(EVENT.getDeviceId.name, /*#__PURE__*/function () {
125
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, payload) {
126
+ var _payload$context2;
127
+ var securityService, deviceId;
128
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
129
+ while (1) switch (_context2.prev = _context2.next) {
130
+ case 0:
131
+ securityService = ServiceProvider.getInstance(_this.instanceId).getService('Security');
132
+ _context2.next = 3;
133
+ return securityService.getDeviceId(data);
134
+ case 3:
135
+ deviceId = _context2.sent;
136
+ eventCenter.dispatchToApp({
137
+ event: 'appEventCallback',
138
+ eventCallbackId: (_payload$context2 = payload.context) === null || _payload$context2 === void 0 ? void 0 : _payload$context2.eventCallbackId,
139
+ data: {
140
+ deviceId: deviceId
141
+ }
142
+ });
143
+ case 5:
144
+ case "end":
145
+ return _context2.stop();
146
+ }
147
+ }, _callee2);
148
+ }));
149
+ return function (_x3, _x4) {
150
+ return _ref2.apply(this, arguments);
151
+ };
152
+ }());
125
153
 
126
154
  // execute additional logic from specified product
127
155
  if (this.productProcessors[sdkMetaData.productScene]) {
@@ -131,13 +159,14 @@ export var AntomSDKCore = /*#__PURE__*/function () {
131
159
  }, {
132
160
  key: "startBizFlow",
133
161
  value: function () {
134
- var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
162
+ var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
163
+ var _this$paymentContext$;
135
164
  var paymentSession, displayInfo, _convertPaymentSessio, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
136
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
137
- while (1) switch (_context2.prev = _context2.next) {
165
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
166
+ while (1) switch (_context3.prev = _context3.next) {
138
167
  case 0:
139
168
  if (!(!options || !options.paymentSession)) {
140
- _context2.next = 2;
169
+ _context3.next = 2;
141
170
  break;
142
171
  }
143
172
  throw new Error('paymentSession is empty');
@@ -165,62 +194,62 @@ export var AntomSDKCore = /*#__PURE__*/function () {
165
194
 
166
195
  // Invoke processor
167
196
  productScene = this.paymentContext.paymentSessionObj.paymentSessionConfig.productScene;
168
- paymentMethod = this.paymentContext.paymentSessionObj.paymentMethodInfoView.paymentMethodType;
169
- _context2.prev = 13;
197
+ paymentMethod = (_this$paymentContext$ = this.paymentContext.paymentSessionObj.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType;
198
+ _context3.prev = 13;
170
199
  if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
171
- _context2.next = 20;
200
+ _context3.next = 20;
172
201
  break;
173
202
  }
174
- _context2.next = 17;
203
+ _context3.next = 17;
175
204
  return this.productProcessors["".concat(productScene, "|").concat(paymentMethod)].startBizFlow(this.paymentContext);
176
205
  case 17:
177
- this.bizFlowStartBehavior = _context2.sent;
178
- _context2.next = 24;
206
+ this.bizFlowStartBehavior = _context3.sent;
207
+ _context3.next = 24;
179
208
  break;
180
209
  case 20:
181
210
  if (!this.productProcessors["".concat(productScene)]) {
182
- _context2.next = 24;
211
+ _context3.next = 24;
183
212
  break;
184
213
  }
185
- _context2.next = 23;
214
+ _context3.next = 23;
186
215
  return this.productProcessors["".concat(productScene)].startBizFlow(this.paymentContext);
187
216
  case 23:
188
- this.bizFlowStartBehavior = _context2.sent;
217
+ this.bizFlowStartBehavior = _context3.sent;
189
218
  case 24:
190
- _context2.next = 29;
219
+ _context3.next = 29;
191
220
  break;
192
221
  case 26:
193
- _context2.prev = 26;
194
- _context2.t0 = _context2["catch"](13);
195
- console.error('Invoke processor failed', _context2.t0);
222
+ _context3.prev = 26;
223
+ _context3.t0 = _context3["catch"](13);
224
+ console.error('Invoke processor failed', _context3.t0);
196
225
  case 29:
197
226
  if (!(!this.bizFlowStartBehavior || this.bizFlowStartBehavior.behaviorType === 'NONE' || !this.bizFlowStartBehavior.payload)) {
198
- _context2.next = 31;
227
+ _context3.next = 31;
199
228
  break;
200
229
  }
201
- return _context2.abrupt("return");
230
+ return _context3.abrupt("return");
202
231
  case 31:
203
232
  if (!(this.bizFlowStartBehavior.behaviorType === 'RENDER')) {
204
- _context2.next = 34;
233
+ _context3.next = 34;
205
234
  break;
206
235
  }
207
236
  this.handleBehaviorRender();
208
- return _context2.abrupt("return");
237
+ return _context3.abrupt("return");
209
238
  case 34:
210
239
  if (!(this.bizFlowStartBehavior.behaviorType === 'REDIRECT')) {
211
- _context2.next = 38;
240
+ _context3.next = 38;
212
241
  break;
213
242
  }
214
243
  payload = (_this$bizFlowStartBeh = this.bizFlowStartBehavior) === null || _this$bizFlowStartBeh === void 0 ? void 0 : _this$bizFlowStartBeh.payload;
215
244
  redirect(payload, this.instanceId);
216
- return _context2.abrupt("return");
245
+ return _context3.abrupt("return");
217
246
  case 38:
218
247
  case "end":
219
- return _context2.stop();
248
+ return _context3.stop();
220
249
  }
221
- }, _callee2, this, [[13, 26]]);
250
+ }, _callee3, this, [[13, 26]]);
222
251
  }));
223
- function startBizFlow(_x3) {
252
+ function startBizFlow(_x5) {
224
253
  return _startBizFlow.apply(this, arguments);
225
254
  }
226
255
  return startBizFlow;
@@ -19,6 +19,7 @@ export interface StartBizFlowOptions {
19
19
  paymentSession: string;
20
20
  displayInfo?: Partial<DisplayInfo>;
21
21
  submitPayRequestExtra?: any;
22
+ isAppWebview?: boolean;
22
23
  }
23
24
  export declare class DisplayInfo {
24
25
  type: DisplayTypeEnum;
@@ -50,6 +51,8 @@ export interface RedirectBehaviorPayload {
50
51
  schemeUrl?: string;
51
52
  applinkUrl?: string;
52
53
  browserLinkTarget?: TargetEnum;
54
+ isCallApp?: boolean;
55
+ callAppDetectSuccessDelay?: number;
53
56
  }
54
57
  /**
55
58
  * Provide some capability, such as MonitorService, EventBusService, SecurityService
@@ -6,6 +6,7 @@ export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
6
6
  export { v4 as uuid } from 'uuid';
7
7
  export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IOptionsParams, } from '../../../types';
8
8
  export { isPC } from '../../../util';
9
+ export { getBackScheme } from '../../../util/getBackScheme';
9
10
  export { isLocalMock } from '../../../util/mock';
10
11
  export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload } from '../..';
11
12
  export { ServiceProvider } from '../../service';
@@ -4,6 +4,7 @@ export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from
4
4
  export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
5
5
  export { v4 as uuid } from 'uuid';
6
6
  export { isPC } from "../../../util";
7
+ export { getBackScheme } from "../../../util/getBackScheme";
7
8
  export { isLocalMock } from "../../../util/mock";
8
9
  export { ServiceProvider } from "../../service";
9
10
  export { LogService } from "../../service/log";
@@ -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 { uuid, ProductSceneEnum, ChannelCustomize, DisplayTypeEnum, isLocalMock, isPC, ServiceProvider, ProductInfoCacheUtil, WebAppUrlUtil } from "./deps";
19
+ import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isLocalMock, isPC, ProductInfoCacheUtil, ProductSceneEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
20
20
  export var EasySafePayProcessor = /*#__PURE__*/function () {
21
21
  function EasySafePayProcessor() {
22
22
  _classCallCheck(this, EasySafePayProcessor);
@@ -242,6 +242,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
242
242
  renderDisplayType: _this2.paymentContext.displayInfo.type,
243
243
  appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
244
244
  notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
245
+ isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
245
246
  merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
246
247
  allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
247
248
  envInfo: {
@@ -387,8 +388,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
387
388
  key: "processSubmitPay",
388
389
  value: function () {
389
390
  var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
390
- var _this$paymentContext6, _this$paymentContext7, _this$paymentContext9, _this$channelBehavior3, _this$channelBehavior4, _this$paymentContext$;
391
- var submitParams, shouldSkipSubmitPayInSDK, _this$paymentContext8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref6, _ref6$action, _ref6$action2, _ref6$action2$enableS, enableSignAgreement, _ref6$action2$autoDeb, autoDebitWithToken, requestBizId, extParams, requester, res;
391
+ var _this$paymentContext6, _this$paymentContext7, _this$paymentContext9, _this$channelBehavior3, _this$channelBehavior4, _this$paymentContext$2;
392
+ var submitParams, shouldSkipSubmitPayInSDK, _this$paymentContext8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref6, _ref6$action, _ref6$action2, _ref6$action2$enableS, enableSignAgreement, _ref6$action2$autoDeb, autoDebitWithToken, _this$paymentContext$, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
392
393
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
393
394
  while (1) switch (_context3.prev = _context3.next) {
394
395
  case 0:
@@ -410,6 +411,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
410
411
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
411
412
  ///EasyPay 2.0 首次传signAgreement字段
412
413
  submitParams['signAgreement'] = enableSignAgreement;
414
+ paymentMethodType = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType;
415
+ isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
416
+ if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
417
+ backScheme = getBackScheme(undefined, this.logger);
418
+ if (backScheme && backScheme !== 'https') {
419
+ submitParams['h5FromApp'] = encodeURIComponent(backScheme);
420
+ }
421
+ }
413
422
  }
414
423
  // 带上标记告知WebCheckOut SDK已发送submitpay请求
415
424
  this.allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
@@ -433,7 +442,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
433
442
  extParams = ((_this$channelBehavior3 = this.channelBehavior) === null || _this$channelBehavior3 === void 0 || (_this$channelBehavior4 = _this$channelBehavior3.buildSubmitPayExtParams) === null || _this$channelBehavior4 === void 0 ? void 0 : _this$channelBehavior4.call(_this$channelBehavior3, {
434
443
  instanceId: this.instanceId,
435
444
  locale: this.initConfig.locale,
436
- paymentMethodType: (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType,
445
+ paymentMethodType: (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentMethodInfoView) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.paymentMethodType,
437
446
  paymentSessionData: this.paymentContext.paymentSession,
438
447
  env: this.initConfig.environment,
439
448
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
@@ -499,13 +508,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
499
508
  key: "acquireApdidToken",
500
509
  value: function () {
501
510
  var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
502
- var _this$paymentContext$2;
511
+ var _this$paymentContext$3;
503
512
  var securityService, productScene, deviceId;
504
513
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
505
514
  while (1) switch (_context4.prev = _context4.next) {
506
515
  case 0:
507
516
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
508
- productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
517
+ productScene = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentSessionConfig) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.productScene;
509
518
  deviceId = securityService.getDeviceId({
510
519
  productScene: productScene
511
520
  });
@@ -525,51 +534,57 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
525
534
  key: "initSecuritySDK",
526
535
  value: function () {
527
536
  var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
528
- var _this$paymentContext$3, productSceneVersion, nonCompliant, isFirstTimeToPay;
537
+ var _this$paymentContext$4, productSceneVersion, nonCompliant, isFirstTimeToPay;
529
538
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
530
539
  while (1) switch (_context5.prev = _context5.next) {
531
540
  case 0:
532
541
  _context5.prev = 0;
533
542
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
534
- nonCompliant = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.nonCompliant;
543
+ nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
535
544
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
536
545
  if (!(productSceneVersion === '1.0')) {
537
- _context5.next = 8;
546
+ _context5.next = 9;
538
547
  break;
539
548
  }
549
+ console.log('[web-sdk][security-sdk] skip init security sdk for easypay 1.0');
550
+ // 1.0 不初始化 SecuritySDK
540
551
  return _context5.abrupt("return");
541
- case 8:
552
+ case 9:
542
553
  if (!(productSceneVersion === '2.0')) {
543
- _context5.next = 17;
554
+ _context5.next = 20;
544
555
  break;
545
556
  }
546
557
  if (!(nonCompliant === true)) {
547
- _context5.next = 14;
558
+ _context5.next = 16;
548
559
  break;
549
560
  }
550
- _context5.next = 12;
561
+ // 未切流「隐私合规」
562
+ console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and nonCompliant is true');
563
+ _context5.next = 14;
551
564
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
552
- case 12:
553
- _context5.next = 17;
554
- break;
555
565
  case 14:
566
+ _context5.next = 20;
567
+ break;
568
+ case 16:
556
569
  if (isFirstTimeToPay) {
557
- _context5.next = 17;
570
+ _context5.next = 20;
558
571
  break;
559
572
  }
560
- _context5.next = 17;
573
+ // 切流「隐私合规」且非首次支付
574
+ console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and when not first time to pay');
575
+ _context5.next = 20;
561
576
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
562
- case 17:
563
- _context5.next = 21;
577
+ case 20:
578
+ _context5.next = 24;
564
579
  break;
565
- case 19:
566
- _context5.prev = 19;
580
+ case 22:
581
+ _context5.prev = 22;
567
582
  _context5.t0 = _context5["catch"](0);
568
- case 21:
583
+ case 24:
569
584
  case "end":
570
585
  return _context5.stop();
571
586
  }
572
- }, _callee5, this, [[0, 19]]);
587
+ }, _callee5, this, [[0, 22]]);
573
588
  }));
574
589
  function initSecuritySDK() {
575
590
  return _initSecuritySDK.apply(this, arguments);
@@ -54,7 +54,6 @@ export var ContainerService = /*#__PURE__*/function () {
54
54
  }, {
55
55
  key: "load",
56
56
  value: function load(displayInfo, url, closeBtnFunc) {
57
- console.log('load');
58
57
  var webApp = createIframe('antom-sdk-web-app' + (displayInfo.appendAliasContainerId ? "-".concat(displayInfo.selector) : ''));
59
58
  this.webApp = webApp;
60
59
  this.displayInfo = displayInfo;
@@ -7,7 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { eventCodeEnum, RedirectType, TargetEnum } from "../../types";
8
8
  import { ServiceProvider } from "../service";
9
9
  import { isPC } from "../../util";
10
- import CallApp from "../../util/intl-callapp/es";
10
+ import CallApp from "../../util/intl-callapp/es/index";
11
11
  import { EVENT } from "../../constant";
12
12
 
13
13
  /**
@@ -20,15 +20,31 @@ export var redirect = function redirect(payload, instanceId) {
20
20
  logService.logInfo({
21
21
  title: 'sdk_event_call_url_start'
22
22
  }, _objectSpread({}, payload)).send();
23
+ if (payload.isCallApp && payload.schemeUrl) {
24
+ var detectSuccessDelay = payload.callAppDetectSuccessDelay;
25
+ var _callAppLib = new CallApp({
26
+ successCb: function successCb() {
27
+ successCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
28
+ },
29
+ resultJudgmentTime: detectSuccessDelay
30
+ });
31
+ _callAppLib.open({
32
+ scheme: payload.schemeUrl,
33
+ fallback: function fallback() {
34
+ failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
35
+ }
36
+ });
37
+ return;
38
+ }
23
39
  // 支持 target: _blank,新开tab页打开
24
40
  if (payload.browserLinkTarget === TargetEnum.BLANK) {
25
- if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', payload, serviceProvider);
41
+ if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
26
42
  successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
27
43
  window.open(payload.url);
28
44
  return;
29
45
  }
30
46
  if (payload.browserLinkTarget === TargetEnum.REPLACE && !(payload !== null && payload !== void 0 && payload.applinkUrl) && !(payload !== null && payload !== void 0 && payload.schemeUrl)) {
31
- if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', payload, serviceProvider);
47
+ if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
32
48
  successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
33
49
  window.location.replace(payload.url);
34
50
  return;
@@ -55,14 +71,14 @@ export var redirect = function redirect(payload, instanceId) {
55
71
  fallback: function fallback() {
56
72
  // Applink evoke failed, try to use scheme url
57
73
  if (payload.applinkUrl) {
58
- failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl, payload, serviceProvider);
74
+ failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl, serviceProvider);
59
75
  }
60
76
  callAppLib.open({
61
77
  scheme: payload.schemeUrl,
62
78
  fallback: function fallback() {
63
- // ScehmeUrl evoke failed
79
+ // SchemeUrl evoke failed
64
80
  if (payload.schemeUrl) {
65
- failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, payload, serviceProvider);
81
+ failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
66
82
  }
67
83
  window.location.href = payload.url;
68
84
  successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
@@ -84,10 +100,10 @@ var successCallback = function successCallback(payload, type, url, serviceProvid
84
100
  url: url
85
101
  }).send();
86
102
  };
87
- var failCallback = function failCallback(payload, type, url, behaviorData, serviceProvider) {
103
+ var failCallback = function failCallback(payload, type, url, serviceProvider) {
88
104
  serviceProvider.getService('EventCenter').emit(EVENT.eventCallback.name, {
89
105
  code: eventCodeEnum.SDK_CALL_URL_ERROR,
90
- message: "Failed to open app,applinkUrl: ".concat(behaviorData === null || behaviorData === void 0 ? void 0 : behaviorData.applinkUrl, " schemeUrl: ").concat(behaviorData === null || behaviorData === void 0 ? void 0 : behaviorData.schemeUrl, " normalUrl: ").concat(behaviorData === null || behaviorData === void 0 ? void 0 : behaviorData.url)
106
+ message: "Failed to open app,applinkUrl: ".concat(payload === null || payload === void 0 ? void 0 : payload.applinkUrl, " schemeUrl: ").concat(payload === null || payload === void 0 ? void 0 : payload.schemeUrl, " normalUrl: ").concat(payload === null || payload === void 0 ? void 0 : payload.url)
91
107
  });
92
108
  serviceProvider.getService('Log').logInfo({
93
109
  title: 'sdk_error_call_url_failed'
package/esm/index.js CHANGED
@@ -37,7 +37,8 @@ export var AMSEasyPay = /*#__PURE__*/function () {
37
37
  paymentSession: params.sessionData || params.paymentSessionData,
38
38
  displayInfo: {
39
39
  type: DisplayTypeEnum.popup
40
- }
40
+ },
41
+ isAppWebview: params.isAppWebview
41
42
  });
42
43
  }
43
44
  }]);
@@ -106,25 +106,8 @@ export interface IcreateComponent {
106
106
  accentColor?: string;
107
107
  };
108
108
  merchantAppointParam?: IMerchantAppointParam;
109
+ isAppWebview?: boolean;
109
110
  }
110
- export interface IappendIframeNodesParams extends IcreateComponent {
111
- paymentSessionMetaData: IPaymentSessionMetaData;
112
- renderDisplayType: DisplayTypeEnum;
113
- selector?: Iselector;
114
- paypalConfiguration?: IPaypalConfiguration;
115
- connectFactor?: {
116
- enableConnect: boolean;
117
- };
118
- /** 将address-element参数定义合入原参数定义 */
119
- configParams?: {
120
- hideFields?: string[];
121
- addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
122
- };
123
- prefillValue?: AddressItem[];
124
- componentSession?: string;
125
- loca?: string;
126
- }
127
- /** 表单地址数据 */
128
111
  export interface AddressItem {
129
112
  shippingName: {
130
113
  firstName: string;
@@ -167,7 +150,6 @@ export interface AddressItem {
167
150
  prefer?: '1' | '0';
168
151
  shippingId?: string;
169
152
  }
170
- type addressAutoSuggestDisabledType = 0 | 1;
171
153
  export interface IPaypalConfiguration {
172
154
  style?: object;
173
155
  blockPayPalCreditButton?: boolean;
@@ -655,10 +637,6 @@ export declare enum ProductSceneVersion {
655
637
  V1 = "1.0",
656
638
  V2 = "2.0"
657
639
  }
658
- export type IAppendParams = {
659
- componentSign: ComponentSignEnum;
660
- iframeNodesParams: IappendIframeNodesParams;
661
- };
662
640
  export declare enum EventCallbackCode {
663
641
  Failed = "Failed",
664
642
  Completed = "Completed"
@@ -56,9 +56,6 @@ export var PaymentMethodCategoryTypeEnum = /*#__PURE__*/function (PaymentMethodC
56
56
  PaymentMethodCategoryTypeEnum["ALL"] = "ALL";
57
57
  return PaymentMethodCategoryTypeEnum;
58
58
  }({});
59
-
60
- /** 表单地址数据 */
61
-
62
59
  export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
63
60
  payPalConfigurationIntentEnum["intent"] = "intent";
64
61
  payPalConfigurationIntentEnum["capture"] = "capture";
@@ -0,0 +1,5 @@
1
+ import { LogService } from "../foundation/service/log";
2
+ /**
3
+ * 通过配置规则检测 UA 和获得回跳 scheme
4
+ */
5
+ export declare function getBackScheme(mockUa?: string, logger?: LogService): any;