@alipay/ams-checkout 0.0.1730107332-dev.0 → 0.0.1730107332-dev.3

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.
@@ -84,7 +84,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
84
84
  });
85
85
  eventCenter.listen(EVENT.initSecuritySDK.name, /*#__PURE__*/function () {
86
86
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, payload) {
87
- var securityService, _payload$context, _payload$context2;
87
+ var _payload$context;
88
+ var securityService, success;
88
89
  return _regeneratorRuntime().wrap(function _callee$(_context) {
89
90
  while (1) switch (_context.prev = _context.next) {
90
91
  case 0:
@@ -93,26 +94,22 @@ export var AntomSDKCore = /*#__PURE__*/function () {
93
94
  _context.next = 4;
94
95
  return securityService.initSecurity();
95
96
  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
- });
97
+ success = true;
103
98
  _context.next = 10;
104
99
  break;
105
100
  case 7:
106
101
  _context.prev = 7;
107
102
  _context.t0 = _context["catch"](1);
103
+ success = false;
104
+ case 10:
108
105
  eventCenter.dispatchToApp({
109
106
  event: 'appEventCallback',
110
- eventCallbackId: (_payload$context2 = payload.context) === null || _payload$context2 === void 0 ? void 0 : _payload$context2.eventCallbackId,
107
+ eventCallbackId: (_payload$context = payload.context) === null || _payload$context === void 0 ? void 0 : _payload$context.eventCallbackId,
111
108
  data: {
112
- success: false
109
+ success: success
113
110
  }
114
111
  });
115
- case 10:
112
+ case 11:
116
113
  case "end":
117
114
  return _context.stop();
118
115
  }
@@ -122,6 +119,35 @@ export var AntomSDKCore = /*#__PURE__*/function () {
122
119
  return _ref.apply(this, arguments);
123
120
  };
124
121
  }());
122
+ eventCenter.listen(EVENT.getDeviceId.name, /*#__PURE__*/function () {
123
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, payload) {
124
+ var _payload$context2;
125
+ var securityService, deviceId;
126
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
127
+ while (1) switch (_context2.prev = _context2.next) {
128
+ case 0:
129
+ securityService = ServiceProvider.getInstance(_this.instanceId).getService('Security');
130
+ _context2.next = 3;
131
+ return securityService.getDeviceId(data);
132
+ case 3:
133
+ deviceId = _context2.sent;
134
+ eventCenter.dispatchToApp({
135
+ event: 'appEventCallback',
136
+ eventCallbackId: (_payload$context2 = payload.context) === null || _payload$context2 === void 0 ? void 0 : _payload$context2.eventCallbackId,
137
+ data: {
138
+ deviceId: deviceId
139
+ }
140
+ });
141
+ case 5:
142
+ case "end":
143
+ return _context2.stop();
144
+ }
145
+ }, _callee2);
146
+ }));
147
+ return function (_x3, _x4) {
148
+ return _ref2.apply(this, arguments);
149
+ };
150
+ }());
125
151
 
126
152
  // execute additional logic from specified product
127
153
  if (this.productProcessors[sdkMetaData.productScene]) {
@@ -131,13 +157,14 @@ export var AntomSDKCore = /*#__PURE__*/function () {
131
157
  }, {
132
158
  key: "startBizFlow",
133
159
  value: function () {
134
- var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
160
+ var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
161
+ var _this$paymentContext$;
135
162
  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) {
163
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
164
+ while (1) switch (_context3.prev = _context3.next) {
138
165
  case 0:
139
166
  if (!(!options || !options.paymentSession)) {
140
- _context2.next = 2;
167
+ _context3.next = 2;
141
168
  break;
142
169
  }
143
170
  throw new Error('paymentSession is empty');
@@ -165,62 +192,62 @@ export var AntomSDKCore = /*#__PURE__*/function () {
165
192
 
166
193
  // Invoke processor
167
194
  productScene = this.paymentContext.paymentSessionObj.paymentSessionConfig.productScene;
168
- paymentMethod = this.paymentContext.paymentSessionObj.paymentMethodInfoView.paymentMethodType;
169
- _context2.prev = 13;
195
+ paymentMethod = (_this$paymentContext$ = this.paymentContext.paymentSessionObj.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType;
196
+ _context3.prev = 13;
170
197
  if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
171
- _context2.next = 20;
198
+ _context3.next = 20;
172
199
  break;
173
200
  }
174
- _context2.next = 17;
201
+ _context3.next = 17;
175
202
  return this.productProcessors["".concat(productScene, "|").concat(paymentMethod)].startBizFlow(this.paymentContext);
176
203
  case 17:
177
- this.bizFlowStartBehavior = _context2.sent;
178
- _context2.next = 24;
204
+ this.bizFlowStartBehavior = _context3.sent;
205
+ _context3.next = 24;
179
206
  break;
180
207
  case 20:
181
208
  if (!this.productProcessors["".concat(productScene)]) {
182
- _context2.next = 24;
209
+ _context3.next = 24;
183
210
  break;
184
211
  }
185
- _context2.next = 23;
212
+ _context3.next = 23;
186
213
  return this.productProcessors["".concat(productScene)].startBizFlow(this.paymentContext);
187
214
  case 23:
188
- this.bizFlowStartBehavior = _context2.sent;
215
+ this.bizFlowStartBehavior = _context3.sent;
189
216
  case 24:
190
- _context2.next = 29;
217
+ _context3.next = 29;
191
218
  break;
192
219
  case 26:
193
- _context2.prev = 26;
194
- _context2.t0 = _context2["catch"](13);
195
- console.error('Invoke processor failed', _context2.t0);
220
+ _context3.prev = 26;
221
+ _context3.t0 = _context3["catch"](13);
222
+ console.error('Invoke processor failed', _context3.t0);
196
223
  case 29:
197
224
  if (!(!this.bizFlowStartBehavior || this.bizFlowStartBehavior.behaviorType === 'NONE' || !this.bizFlowStartBehavior.payload)) {
198
- _context2.next = 31;
225
+ _context3.next = 31;
199
226
  break;
200
227
  }
201
- return _context2.abrupt("return");
228
+ return _context3.abrupt("return");
202
229
  case 31:
203
230
  if (!(this.bizFlowStartBehavior.behaviorType === 'RENDER')) {
204
- _context2.next = 34;
231
+ _context3.next = 34;
205
232
  break;
206
233
  }
207
234
  this.handleBehaviorRender();
208
- return _context2.abrupt("return");
235
+ return _context3.abrupt("return");
209
236
  case 34:
210
237
  if (!(this.bizFlowStartBehavior.behaviorType === 'REDIRECT')) {
211
- _context2.next = 38;
238
+ _context3.next = 38;
212
239
  break;
213
240
  }
214
241
  payload = (_this$bizFlowStartBeh = this.bizFlowStartBehavior) === null || _this$bizFlowStartBeh === void 0 ? void 0 : _this$bizFlowStartBeh.payload;
215
242
  redirect(payload, this.instanceId);
216
- return _context2.abrupt("return");
243
+ return _context3.abrupt("return");
217
244
  case 38:
218
245
  case "end":
219
- return _context2.stop();
246
+ return _context3.stop();
220
247
  }
221
- }, _callee2, this, [[13, 26]]);
248
+ }, _callee3, this, [[13, 26]]);
222
249
  }));
223
- function startBizFlow(_x3) {
250
+ function startBizFlow(_x5) {
224
251
  return _startBizFlow.apply(this, arguments);
225
252
  }
226
253
  return startBizFlow;
@@ -534,42 +534,48 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
534
534
  nonCompliant = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.nonCompliant;
535
535
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
536
536
  if (!(productSceneVersion === '1.0')) {
537
- _context5.next = 8;
537
+ _context5.next = 9;
538
538
  break;
539
539
  }
540
+ console.log('[web-sdk][security-sdk] skip init security sdk for easypay 1.0');
541
+ // 1.0 不初始化 SecuritySDK
540
542
  return _context5.abrupt("return");
541
- case 8:
543
+ case 9:
542
544
  if (!(productSceneVersion === '2.0')) {
543
- _context5.next = 17;
545
+ _context5.next = 20;
544
546
  break;
545
547
  }
546
548
  if (!(nonCompliant === true)) {
547
- _context5.next = 14;
549
+ _context5.next = 16;
548
550
  break;
549
551
  }
550
- _context5.next = 12;
552
+ // 未切流「隐私合规」
553
+ console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and nonCompliant is true');
554
+ _context5.next = 14;
551
555
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
552
- case 12:
553
- _context5.next = 17;
554
- break;
555
556
  case 14:
557
+ _context5.next = 20;
558
+ break;
559
+ case 16:
556
560
  if (isFirstTimeToPay) {
557
- _context5.next = 17;
561
+ _context5.next = 20;
558
562
  break;
559
563
  }
560
- _context5.next = 17;
564
+ // 切流「隐私合规」且非首次支付
565
+ console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and when not first time to pay');
566
+ _context5.next = 20;
561
567
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
562
- case 17:
563
- _context5.next = 21;
568
+ case 20:
569
+ _context5.next = 24;
564
570
  break;
565
- case 19:
566
- _context5.prev = 19;
571
+ case 22:
572
+ _context5.prev = 22;
567
573
  _context5.t0 = _context5["catch"](0);
568
- case 21:
574
+ case 24:
569
575
  case "end":
570
576
  return _context5.stop();
571
577
  }
572
- }, _callee5, this, [[0, 19]]);
578
+ }, _callee5, this, [[0, 22]]);
573
579
  }));
574
580
  function initSecuritySDK() {
575
581
  return _initSecuritySDK.apply(this, arguments);
@@ -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
  /**
@@ -60,7 +60,7 @@ export var redirect = function redirect(payload, instanceId) {
60
60
  callAppLib.open({
61
61
  scheme: payload.schemeUrl,
62
62
  fallback: function fallback() {
63
- // ScehmeUrl evoke failed
63
+ // SchemeUrl evoke failed
64
64
  if (payload.schemeUrl) {
65
65
  failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, payload, serviceProvider);
66
66
  }
@@ -35,7 +35,7 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
35
35
  }
36
36
  // 如果是preload模式,添加一个preload的query参数
37
37
  if (isPreload) {
38
- urlParams['preload'] = 'true';
38
+ urlParams['isPreload'] = 'true';
39
39
  }
40
40
  urlParams.appMatched = sdkMetaData.webAppVersion ? 'true' : 'false';
41
41
  urlParams.sdkVersion = sdkMetaData.sdkVersion;
@@ -138,6 +138,7 @@ var CallApp = /*#__PURE__*/function () {
138
138
  fallback = _this$options.fallback;
139
139
  if (!scheme && !link && !intent) {
140
140
  console.error('请至少填一个链接');
141
+ if (fallback) fallback();
141
142
  return;
142
143
  }
143
144
  if (link && checkIsHttpUrl(link)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1730107332-dev.0",
3
+ "version": "0.0.1730107332-dev.3",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",