@alipay/ams-checkout 0.0.1744283958-dev.0 → 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/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- 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 +2 -0
- package/esm/core/component/element/elementController/index.js +64 -17
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +4 -1
- package/esm/core/component/element/elementProcessor/addressProcessor.js +27 -5
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +4 -1
- package/esm/core/component/element/elementProcessor/authProcessor.js +28 -566
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +2 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +6 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +16 -3
- package/esm/core/component/element/mock.d.ts +8 -0
- package/esm/core/component/element/mock.js +927 -0
- package/package.json +1 -1
package/esm/config/index.d.ts
CHANGED
@@ -5,10 +5,10 @@ export declare const sdkVersion: string;
|
|
5
5
|
/**
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
7
|
*/
|
8
|
-
export declare const AMSCheckoutAppVersion = "1.
|
9
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
10
|
-
export declare const AMSEasyPayAppVersion = "1.
|
11
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
12
|
-
export declare const AMSVaultingAppVersion = "1.
|
13
|
-
export declare const AMSPaymentElementAppVersion = "1.
|
14
|
-
export declare const ADDRESSElementAppVersion = "1.
|
8
|
+
export declare const AMSCheckoutAppVersion = "1.34.0";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.34.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.34.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.34.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.34.0";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.34.0";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.34.0";
|
package/esm/config/index.js
CHANGED
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
|
|
35
35
|
/**
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
37
|
*/
|
38
|
-
export var AMSCheckoutAppVersion = '1.
|
39
|
-
export var AMSAutoDebitAppVersion = '1.
|
40
|
-
export var AMSEasyPayAppVersion = '1.
|
41
|
-
export var AMSCashierPaymentAppVersion = '1.
|
42
|
-
export var AMSVaultingAppVersion = '1.
|
43
|
-
export var AMSPaymentElementAppVersion = '1.
|
44
|
-
export var ADDRESSElementAppVersion = '1.
|
38
|
+
export var AMSCheckoutAppVersion = '1.34.0'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.34.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.34.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.34.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.34.0'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.34.0'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.34.0'; // address element
|
@@ -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) {
|
@@ -5,6 +5,7 @@ declare class ElementController {
|
|
5
5
|
private serviceMap;
|
6
6
|
private loading;
|
7
7
|
private elementProcessors;
|
8
|
+
private initTimeout;
|
8
9
|
private elementContainerService;
|
9
10
|
constructor(options: IElementOptions);
|
10
11
|
private initService;
|
@@ -16,6 +17,7 @@ declare class ElementController {
|
|
16
17
|
private changeLoading;
|
17
18
|
private addEventListener;
|
18
19
|
private sendRequestAndWaitWebLaunch;
|
20
|
+
private sendReady;
|
19
21
|
updatePayment(paymentSessionData: any): Promise<unknown>;
|
20
22
|
destroy(): void;
|
21
23
|
}
|
@@ -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,13 +294,36 @@ 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.
|
280
|
-
|
281
|
-
|
301
|
+
(_this4$elementContain = _this4.elementContainerService.getContainerService(type)) === null || _this4$elementContain === void 0 || _this4$elementContain.switchContainerStatus(IContainerStatus.READY);
|
302
|
+
var allReady = true;
|
303
|
+
_this4.elementContainerService.getContainerServices().forEach(function (item) {
|
304
|
+
if (!allReady) return;
|
305
|
+
allReady = item.getContainerStatus() === IContainerStatus.READY;
|
306
|
+
});
|
307
|
+
if (allReady) {
|
308
|
+
_this4.elementContainerService.getContainerServices().forEach(function (value, key) {
|
309
|
+
_this4.sendReady(key, options);
|
310
|
+
});
|
311
|
+
}
|
312
|
+
});
|
313
|
+
}
|
314
|
+
}, {
|
315
|
+
key: "sendReady",
|
316
|
+
value: function sendReady(type, options) {
|
317
|
+
var _this$elementProcesso;
|
318
|
+
var paymentResult = (_this$elementProcesso = this.elementProcessors[ElementType.payment]) === null || _this$elementProcesso === void 0 ? void 0 : _this$elementProcesso.getObtainDataRes();
|
319
|
+
var paymentContext = this.elementContainer.getPaymentContext();
|
320
|
+
var params = _objectSpread(_objectSpread({}, options), {}, {
|
321
|
+
originActionQueryResult: paymentResult === null || paymentResult === void 0 ? void 0 : paymentResult.originActionQuery,
|
322
|
+
originOneAccountQueryResult: paymentResult === null || paymentResult === void 0 ? void 0 : paymentResult.originOneAccountQuery,
|
323
|
+
paymentSessionData: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionId,
|
324
|
+
sessionResult: (paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionObj) || {}
|
282
325
|
});
|
326
|
+
this.elementProcessors[type].onReady(params);
|
283
327
|
}
|
284
328
|
}, {
|
285
329
|
key: "updatePayment",
|
@@ -317,7 +361,10 @@ var ElementController = /*#__PURE__*/function () {
|
|
317
361
|
Object.values(_this5.elementProcessors).forEach(function (processor) {
|
318
362
|
processor.update({
|
319
363
|
data: {
|
320
|
-
originActionQuery: data.originActionQuery
|
364
|
+
// originActionQuery: data.originActionQuery,
|
365
|
+
// originOneAccountQuery: data.originOneAccountQuery,
|
366
|
+
originActionQuery: sdkActionUpdate,
|
367
|
+
originOneAccountQuery: oneAccountUpdate
|
321
368
|
},
|
322
369
|
paymentSessionData: paymentSessionData
|
323
370
|
});
|
@@ -354,15 +401,15 @@ var ElementController = /*#__PURE__*/function () {
|
|
354
401
|
}, {
|
355
402
|
key: "destroy",
|
356
403
|
value: function destroy() {
|
357
|
-
this.
|
358
|
-
|
359
|
-
});
|
404
|
+
this.elementContainer.destroy();
|
405
|
+
this.elementContainer.setStatus(IContainerStatus.DESTROYED);
|
360
406
|
// popup未注册会报错,但element不需要感知popup是否被注册
|
361
407
|
try {
|
362
408
|
destroyModal(); // 关闭popup弹窗
|
363
409
|
} catch (error) {}
|
364
|
-
this.
|
365
|
-
|
410
|
+
this.elementContainerService.getContainerServices().forEach(function (value) {
|
411
|
+
value.getContainerElement().remove();
|
412
|
+
});
|
366
413
|
}
|
367
414
|
}]);
|
368
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
|
}
|
@@ -90,6 +98,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
90
98
|
key: "obtainData",
|
91
99
|
value: function obtainData() {
|
92
100
|
// 实现 obtainData 方法
|
101
|
+
this.obtainDataRes = {};
|
93
102
|
return {};
|
94
103
|
}
|
95
104
|
}, {
|
@@ -112,10 +121,23 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
112
121
|
}
|
113
122
|
}, {
|
114
123
|
key: "update",
|
115
|
-
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];
|
116
131
|
// 实现 update 方法的具体逻辑
|
117
|
-
|
118
|
-
|
132
|
+
this.eventCenter.dispatchToApp({
|
133
|
+
event: 'updatePayment',
|
134
|
+
data: {
|
135
|
+
paymentSessionData: paymentSessionData,
|
136
|
+
data: data,
|
137
|
+
sessionResult: parseData,
|
138
|
+
sessionData: sessionData
|
139
|
+
}
|
140
|
+
});
|
119
141
|
}
|
120
142
|
}]);
|
121
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;
|