@alipay/ams-checkout 0.0.1744283958-dev.1 → 0.0.1744283958-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.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/core/component/element/elementContainerService/containerService.d.ts +2 -0
- package/esm/core/component/element/elementContainerService/containerService.js +7 -1
- package/esm/core/component/element/elementContainerService/index.d.ts +1 -0
- package/esm/core/component/element/elementContainerService/index.js +5 -0
- package/esm/core/component/element/elementController/index.d.ts +1 -0
- package/esm/core/component/element/elementController/index.js +40 -21
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +4 -1
- package/esm/core/component/element/elementProcessor/addressProcessor.js +26 -5
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +4 -1
- package/esm/core/component/element/elementProcessor/authProcessor.js +26 -3
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +2 -2
- package/esm/core/component/element/mock.d.ts +2 -0
- package/esm/core/component/element/mock.js +360 -0
- package/package.json +1 -1
@@ -13,6 +13,7 @@ export declare class ContainerController {
|
|
13
13
|
private instanceId;
|
14
14
|
private containerService;
|
15
15
|
private eventService;
|
16
|
+
private containerElement;
|
16
17
|
private _globalData?;
|
17
18
|
constructor({ type, instanceId, selector, processor, options, }: {
|
18
19
|
type: string;
|
@@ -22,6 +23,7 @@ export declare class ContainerController {
|
|
22
23
|
options: any;
|
23
24
|
});
|
24
25
|
private addEventListener;
|
26
|
+
getContainerElement(): HTMLDivElement;
|
25
27
|
createWebLaunchPromise(): Promise<unknown>;
|
26
28
|
switchContainerStatus(status: IContainerStatus): void;
|
27
29
|
getContainerStatus(): IContainerStatus;
|
@@ -29,6 +29,7 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
29
29
|
_defineProperty(this, "instanceId", void 0);
|
30
30
|
_defineProperty(this, "containerService", void 0);
|
31
31
|
_defineProperty(this, "eventService", void 0);
|
32
|
+
_defineProperty(this, "containerElement", void 0);
|
32
33
|
_defineProperty(this, "_globalData", void 0);
|
33
34
|
this._globalData = new Map();
|
34
35
|
this.switchContainerStatus(IContainerStatus.INITING);
|
@@ -39,7 +40,7 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
39
40
|
sdkVersion: '',
|
40
41
|
webAppVersion: ''
|
41
42
|
});
|
42
|
-
this.containerService.load({
|
43
|
+
this.containerElement = this.containerService.load({
|
43
44
|
type: DisplayTypeEnum.inline,
|
44
45
|
platform: PlatformEnum.desktop,
|
45
46
|
isRetention: false,
|
@@ -72,6 +73,11 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
72
73
|
}
|
73
74
|
});
|
74
75
|
}
|
76
|
+
}, {
|
77
|
+
key: "getContainerElement",
|
78
|
+
value: function getContainerElement() {
|
79
|
+
return this.containerElement;
|
80
|
+
}
|
75
81
|
}, {
|
76
82
|
key: "createWebLaunchPromise",
|
77
83
|
value: function createWebLaunchPromise() {
|
@@ -9,6 +9,7 @@ export declare class ElementContainerService {
|
|
9
9
|
addContainerService(name: ElementType, service: ContainerController): void;
|
10
10
|
getContainerService(name: ElementType): ContainerController | undefined;
|
11
11
|
getContainerServices(): Map<ElementType, ContainerController>;
|
12
|
+
destroy(): void;
|
12
13
|
mount({ type, selector, processor, options }: {
|
13
14
|
type: any;
|
14
15
|
selector: any;
|
@@ -30,6 +30,11 @@ export var ElementContainerService = /*#__PURE__*/function () {
|
|
30
30
|
value: function getContainerServices() {
|
31
31
|
return this.containerServices;
|
32
32
|
}
|
33
|
+
}, {
|
34
|
+
key: "destroy",
|
35
|
+
value: function destroy() {
|
36
|
+
this.containerServices = new Map();
|
37
|
+
}
|
33
38
|
}, {
|
34
39
|
key: "mount",
|
35
40
|
value: function mount(_ref2) {
|
@@ -29,8 +29,10 @@ import { destroyModal } from "../../../../plugin/component/popupWindow.style";
|
|
29
29
|
import { ProductSceneEnum } from "../../../../types";
|
30
30
|
import { ElementContainerService } from "../elementContainerService"; // 引入 ElementContainerService
|
31
31
|
import { IContainerStatus } from "../elementContainerService/containerService";
|
32
|
-
import {
|
32
|
+
import { oneAccountUpdate, sdkActionUpdate } from "../mock";
|
33
|
+
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode } from "../type";
|
33
34
|
import { checkCanMount, checkCanUpdate, handleRedirect } from "../util";
|
35
|
+
var TIMEOUT_DURATION = 10000;
|
34
36
|
var ElementController = /*#__PURE__*/function () {
|
35
37
|
// 新增变量
|
36
38
|
|
@@ -41,13 +43,16 @@ var ElementController = /*#__PURE__*/function () {
|
|
41
43
|
_defineProperty(this, "serviceMap", void 0);
|
42
44
|
_defineProperty(this, "loading", void 0);
|
43
45
|
_defineProperty(this, "elementProcessors", void 0);
|
46
|
+
_defineProperty(this, "initTimeout", void 0);
|
44
47
|
_defineProperty(this, "elementContainerService", void 0);
|
45
|
-
_defineProperty(this, "onValidateFunc", function (event, params) {
|
48
|
+
_defineProperty(this, "onValidateFunc", function (event, target, params) {
|
46
49
|
return new Promise(function (resolve) {
|
47
50
|
event.emitAndListen({
|
48
51
|
event: ElementPaymentEvent.VALIDATE,
|
49
52
|
data: {
|
50
|
-
params: _objectSpread({}, params)
|
53
|
+
params: _objectSpread({}, params),
|
54
|
+
target: target,
|
55
|
+
source: ElementPaymentMethod.CONTAINER_ELEMENT
|
51
56
|
}
|
52
57
|
}, function (result) {
|
53
58
|
resolve(result);
|
@@ -112,6 +117,18 @@ var ElementController = /*#__PURE__*/function () {
|
|
112
117
|
});
|
113
118
|
return;
|
114
119
|
}
|
120
|
+
clearTimeout(this.initTimeout);
|
121
|
+
this.initTimeout = null;
|
122
|
+
this.initTimeout = setTimeout(function () {
|
123
|
+
clearTimeout(_this.initTimeout);
|
124
|
+
_this.initTimeout = null;
|
125
|
+
_this.changeLoading(false);
|
126
|
+
_this.elementContainer.setStatus(IContainerStatus.READY);
|
127
|
+
_this.elementContainerService.getContainerServices().forEach(function (value) {
|
128
|
+
value.getContainerElement().remove();
|
129
|
+
});
|
130
|
+
_this.elementContainerService.destroy();
|
131
|
+
}, TIMEOUT_DURATION);
|
115
132
|
this.changeLoading(true);
|
116
133
|
var startBizFlowData = {
|
117
134
|
paymentSession: this.options.sessionData,
|
@@ -166,7 +183,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
166
183
|
break;
|
167
184
|
}
|
168
185
|
_context.next = 4;
|
169
|
-
return _this2.onValidateFunc((_this2$elementProcess = _this2.elementProcessors[ElementType.auth]) === null || _this2$elementProcess === void 0 ? void 0 : _this2$elementProcess.eventCenter);
|
186
|
+
return _this2.onValidateFunc((_this2$elementProcess = _this2.elementProcessors[ElementType.auth]) === null || _this2$elementProcess === void 0 ? void 0 : _this2$elementProcess.eventCenter, ElementPaymentMethod.AUTH_ELEMENT);
|
170
187
|
case 4:
|
171
188
|
result = _context.sent;
|
172
189
|
params.accountInfo = (_result$data = result.data) === null || _result$data === void 0 || (_result$data = _result$data.data) === null || _result$data === void 0 ? void 0 : _result$data.accountInfo;
|
@@ -181,7 +198,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
181
198
|
break;
|
182
199
|
}
|
183
200
|
_context.next = 11;
|
184
|
-
return _this2.onValidateFunc((_this2$elementProcess2 = _this2.elementProcessors[ElementType.address]) === null || _this2$elementProcess2 === void 0 ? void 0 : _this2$elementProcess2.eventCenter);
|
201
|
+
return _this2.onValidateFunc((_this2$elementProcess2 = _this2.elementProcessors[ElementType.address]) === null || _this2$elementProcess2 === void 0 ? void 0 : _this2$elementProcess2.eventCenter, ElementPaymentMethod.ADDRESS_ELEMENT);
|
185
202
|
case 11:
|
186
203
|
_result = _context.sent;
|
187
204
|
params.shipping = (_result$data3 = _result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.data;
|
@@ -197,7 +214,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
197
214
|
}
|
198
215
|
_context.prev = 16;
|
199
216
|
_context.next = 19;
|
200
|
-
return _this2.onValidateFunc((_this2$elementProcess3 = _this2.elementProcessors[ElementType.payment]) === null || _this2$elementProcess3 === void 0 ? void 0 : _this2$elementProcess3.eventCenter, params);
|
217
|
+
return _this2.onValidateFunc((_this2$elementProcess3 = _this2.elementProcessors[ElementType.payment]) === null || _this2$elementProcess3 === void 0 ? void 0 : _this2$elementProcess3.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT, params);
|
201
218
|
case 19:
|
202
219
|
return _context.abrupt("return", resolve(undefined));
|
203
220
|
case 22:
|
@@ -245,13 +262,17 @@ var ElementController = /*#__PURE__*/function () {
|
|
245
262
|
value: function addEventListener() {
|
246
263
|
var _this3 = this;
|
247
264
|
this.serviceMap.EventCenter.listen(ElementPaymentEvent.CALLBACK, function (data) {
|
248
|
-
if (_this3.elementProcessors[data.source].eventListener[data.event]) {
|
265
|
+
if (_this3.elementProcessors[data.source] && _this3.elementProcessors[data.source].eventListener[data.event]) {
|
249
266
|
var _this3$elementProcess, _this3$elementProcess2;
|
250
267
|
(_this3$elementProcess = (_this3$elementProcess2 = _this3.elementProcessors[data.source].eventListener)[data.event]) === null || _this3$elementProcess === void 0 || _this3$elementProcess.call(_this3$elementProcess2, data.data);
|
251
268
|
}
|
252
269
|
});
|
253
270
|
this.serviceMap.EventCenter.listen(EVENT.sizeChanged.name, function (data) {
|
254
|
-
_this3.
|
271
|
+
clearTimeout(_this3.initTimeout);
|
272
|
+
_this3.initTimeout = null;
|
273
|
+
if (_this3.elementContainerService.getContainerService(data.source)) {
|
274
|
+
_this3.elementContainerService.getContainerService(data.source).switchContainerStatus(IContainerStatus.IN_BIZ_FLOW);
|
275
|
+
}
|
255
276
|
_this3.changeLoading(false);
|
256
277
|
// 遍历containerService中的所有container查看是否所有状态都是IN_BIZ_FLOW
|
257
278
|
// const allContainersInBizFlow = Object.values(this.elementContainerService.getContainerServices()).every(
|
@@ -273,10 +294,11 @@ var ElementController = /*#__PURE__*/function () {
|
|
273
294
|
options = _objectWithoutProperties(renderOptions, _excluded);
|
274
295
|
var webLaunchPromise = this.elementContainerService.getContainerService(type).createWebLaunchPromise();
|
275
296
|
Promise.all([webLaunchPromise, this.elementProcessors[type].obtainData()]).then(function (_ref3) {
|
297
|
+
var _this4$elementContain;
|
276
298
|
var _ref4 = _slicedToArray(_ref3, 2),
|
277
299
|
_webLaunchRes = _ref4[0],
|
278
300
|
_obtainDataRes = _ref4[1];
|
279
|
-
_this4.elementContainerService.getContainerService(type).switchContainerStatus(IContainerStatus.READY);
|
301
|
+
(_this4$elementContain = _this4.elementContainerService.getContainerService(type)) === null || _this4$elementContain === void 0 || _this4$elementContain.switchContainerStatus(IContainerStatus.READY);
|
280
302
|
var allReady = true;
|
281
303
|
_this4.elementContainerService.getContainerServices().forEach(function (item) {
|
282
304
|
if (!allReady) return;
|
@@ -301,12 +323,6 @@ var ElementController = /*#__PURE__*/function () {
|
|
301
323
|
paymentSessionData: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionId,
|
302
324
|
sessionResult: (paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionObj) || {}
|
303
325
|
});
|
304
|
-
if (type === ElementType.address) {
|
305
|
-
var _paymentResult$origin;
|
306
|
-
params.prefillValue = (paymentResult === null || paymentResult === void 0 || (_paymentResult$origin = paymentResult.originOneAccountQuery) === null || _paymentResult$origin === void 0 ? void 0 : _paymentResult$origin.shippings) || [];
|
307
|
-
} else if (type === ElementType.payment) {
|
308
|
-
params.queryResult = paymentResult === null || paymentResult === void 0 ? void 0 : paymentResult.originActionQuery;
|
309
|
-
}
|
310
326
|
this.elementProcessors[type].onReady(params);
|
311
327
|
}
|
312
328
|
}, {
|
@@ -345,7 +361,10 @@ var ElementController = /*#__PURE__*/function () {
|
|
345
361
|
Object.values(_this5.elementProcessors).forEach(function (processor) {
|
346
362
|
processor.update({
|
347
363
|
data: {
|
348
|
-
originActionQuery: data.originActionQuery
|
364
|
+
// originActionQuery: data.originActionQuery,
|
365
|
+
// originOneAccountQuery: data.originOneAccountQuery,
|
366
|
+
originActionQuery: sdkActionUpdate,
|
367
|
+
originOneAccountQuery: oneAccountUpdate
|
349
368
|
},
|
350
369
|
paymentSessionData: paymentSessionData
|
351
370
|
});
|
@@ -382,15 +401,15 @@ var ElementController = /*#__PURE__*/function () {
|
|
382
401
|
}, {
|
383
402
|
key: "destroy",
|
384
403
|
value: function destroy() {
|
385
|
-
this.
|
386
|
-
|
387
|
-
});
|
404
|
+
this.elementContainer.destroy();
|
405
|
+
this.elementContainer.setStatus(IContainerStatus.DESTROYED);
|
388
406
|
// popup未注册会报错,但element不需要感知popup是否被注册
|
389
407
|
try {
|
390
408
|
destroyModal(); // 关闭popup弹窗
|
391
409
|
} catch (error) {}
|
392
|
-
this.
|
393
|
-
|
410
|
+
this.elementContainerService.getContainerServices().forEach(function (value) {
|
411
|
+
value.getContainerElement().remove();
|
412
|
+
});
|
394
413
|
}
|
395
414
|
}]);
|
396
415
|
return ElementController;
|
@@ -12,6 +12,9 @@ declare class AddressProcessor extends BaseElementProcessor {
|
|
12
12
|
}): string;
|
13
13
|
obtainData(): any;
|
14
14
|
getValue(hasValidate?: boolean): any;
|
15
|
-
update(data
|
15
|
+
update({ data, paymentSessionData }: {
|
16
|
+
data: any;
|
17
|
+
paymentSessionData: any;
|
18
|
+
}): void;
|
16
19
|
}
|
17
20
|
export default AddressProcessor;
|
@@ -1,4 +1,10 @@
|
|
1
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
2
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
9
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -11,6 +17,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
11
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
12
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
13
19
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
20
|
+
import { parseSessionData } from "../..";
|
14
21
|
import PackageJson from "../../../../../package.json";
|
15
22
|
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
16
23
|
import BaseElementProcessor from "./baseElementProcessor";
|
@@ -24,7 +31,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
24
31
|
_createClass(AddressProcessor, [{
|
25
32
|
key: "onReady",
|
26
33
|
value: function onReady(extraParam) {
|
27
|
-
var _this$elementContaine, _this$elementContaine2, _this$elementContaine3;
|
34
|
+
var _this$elementContaine, _this$elementContaine2, _this$elementContaine3, _extraParam$originOne;
|
28
35
|
this.eventCenter.dispatchToApp({
|
29
36
|
event: 'renderComponent',
|
30
37
|
data: {
|
@@ -37,7 +44,8 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
37
44
|
screenWidth: screen.width
|
38
45
|
},
|
39
46
|
appearance: (_this$elementContaine2 = this.elementContainer.getPaymentContext()) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.displayInfo.appearance,
|
40
|
-
sessionResult: (_this$elementContaine3 = this.elementContainer.getPaymentContext()) === null || _this$elementContaine3 === void 0 ? void 0 : _this$elementContaine3.paymentSessionObj
|
47
|
+
sessionResult: (_this$elementContaine3 = this.elementContainer.getPaymentContext()) === null || _this$elementContaine3 === void 0 ? void 0 : _this$elementContaine3.paymentSessionObj,
|
48
|
+
prefillValue: (extraParam === null || extraParam === void 0 || (_extraParam$originOne = extraParam.originOneAccountQueryResult) === null || _extraParam$originOne === void 0 ? void 0 : _extraParam$originOne.shippings) || []
|
41
49
|
},
|
42
50
|
target: 'ADDRESS_ELEMENT'
|
43
51
|
}
|
@@ -113,10 +121,23 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
113
121
|
}
|
114
122
|
}, {
|
115
123
|
key: "update",
|
116
|
-
value: function update(
|
124
|
+
value: function update(_ref3) {
|
125
|
+
var data = _ref3.data,
|
126
|
+
paymentSessionData = _ref3.paymentSessionData;
|
127
|
+
var _parseSessionData = parseSessionData(paymentSessionData),
|
128
|
+
_parseSessionData2 = _slicedToArray(_parseSessionData, 2),
|
129
|
+
parseData = _parseSessionData2[0],
|
130
|
+
sessionData = _parseSessionData2[1];
|
117
131
|
// 实现 update 方法的具体逻辑
|
118
|
-
|
119
|
-
|
132
|
+
this.eventCenter.dispatchToApp({
|
133
|
+
event: 'updatePayment',
|
134
|
+
data: {
|
135
|
+
paymentSessionData: paymentSessionData,
|
136
|
+
data: data,
|
137
|
+
sessionResult: parseData,
|
138
|
+
sessionData: sessionData
|
139
|
+
}
|
140
|
+
});
|
120
141
|
}
|
121
142
|
}]);
|
122
143
|
return AddressProcessor;
|
@@ -12,6 +12,9 @@ declare class AuthProcessor extends BaseElementProcessor {
|
|
12
12
|
}): string;
|
13
13
|
obtainData(): any;
|
14
14
|
getValue(): any;
|
15
|
-
update(data
|
15
|
+
update({ data, paymentSessionData }: {
|
16
|
+
data: any;
|
17
|
+
paymentSessionData: any;
|
18
|
+
}): void;
|
16
19
|
}
|
17
20
|
export default AuthProcessor;
|
@@ -1,4 +1,10 @@
|
|
1
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
2
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
9
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -11,6 +17,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
11
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
12
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
13
19
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
20
|
+
import { parseSessionData } from "../../index";
|
14
21
|
import PackageJson from "../../../../../package.json";
|
15
22
|
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
16
23
|
import BaseElementProcessor from "./baseElementProcessor";
|
@@ -91,10 +98,26 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
91
98
|
}
|
92
99
|
}, {
|
93
100
|
key: "update",
|
94
|
-
value: function update(
|
101
|
+
value: function update(_ref3) {
|
102
|
+
var data = _ref3.data,
|
103
|
+
paymentSessionData = _ref3.paymentSessionData;
|
104
|
+
var _parseSessionData = parseSessionData(paymentSessionData),
|
105
|
+
_parseSessionData2 = _slicedToArray(_parseSessionData, 2),
|
106
|
+
parseData = _parseSessionData2[0],
|
107
|
+
sessionData = _parseSessionData2[1];
|
95
108
|
// 实现 update 方法的具体逻辑
|
96
|
-
|
97
|
-
|
109
|
+
this.eventCenter.dispatchToApp({
|
110
|
+
event: 'updatePayment',
|
111
|
+
data: {
|
112
|
+
params: {
|
113
|
+
paymentSessionData: paymentSessionData,
|
114
|
+
sessionResult: parseData,
|
115
|
+
sessionData: sessionData,
|
116
|
+
originActionQueryResult: data.originActionQuery,
|
117
|
+
originOneAccountQueryResult: data.originOneAccountQuery
|
118
|
+
}
|
119
|
+
}
|
120
|
+
});
|
98
121
|
}
|
99
122
|
}]);
|
100
123
|
return AuthProcessor;
|
@@ -23,7 +23,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
23
23
|
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; }
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
25
25
|
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); }
|
26
|
-
import { parseSessionData } from "
|
26
|
+
import { parseSessionData } from "../../index";
|
27
27
|
import PackageJson from "../../../../../package.json";
|
28
28
|
import { EVENT } from "../../../../constant";
|
29
29
|
import { ServiceProvider } from "../../../../foundation/service";
|
@@ -57,7 +57,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
57
57
|
data: {
|
58
58
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
59
59
|
paymentSessionData: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionId,
|
60
|
-
queryResult: extraParam === null || extraParam === void 0 ? void 0 : extraParam.
|
60
|
+
queryResult: extraParam === null || extraParam === void 0 ? void 0 : extraParam.originActionQuery,
|
61
61
|
envInfo: {
|
62
62
|
screenHeight: screen.height,
|
63
63
|
screenWidth: screen.width
|