@alipay/ams-checkout 0.0.1757298389-dev.1 → 0.0.1757298389-dev.11
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/component/component.popup.style.d.ts +1 -0
- package/esm/component/component.popup.style.js +1 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +47 -0
- package/esm/constant/index.js +50 -0
- package/esm/core/component/element/EventCenter/index.d.ts +29 -0
- package/esm/core/component/element/EventCenter/index.js +141 -0
- package/esm/core/component/element/elementContainerService/containerService.js +3 -2
- package/esm/core/component/element/elementController/index.d.ts +20 -2
- package/esm/core/component/element/elementController/index.js +463 -262
- package/esm/core/component/element/elementProcessor/addressProcessor.js +3 -3
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +20 -14
- package/esm/core/component/element/index.d.ts +6 -1
- package/esm/core/component/element/index.js +5 -2
- package/esm/core/component/element/type.d.ts +35 -3
- package/esm/core/component/element/type.js +43 -1
- package/esm/core/component/element/util.d.ts +17 -4
- package/esm/core/component/element/util.js +45 -6
- package/esm/core/component/index.d.ts +4 -1
- package/esm/core/component/index.js +105 -2
- package/esm/foundation/service/log/keys.js +2 -0
- package/esm/foundation/service/requester/requester.js +2 -3
- package/esm/index.d.ts +10 -1
- package/esm/index.js +15 -1
- package/esm/plugin/component/index.d.ts +2 -0
- package/esm/plugin/component/index.js +23 -7
- package/esm/plugin/paypal/index.js +5 -2
- package/esm/types/index.d.ts +8 -1
- package/esm/util/spm-map.d.ts +2 -0
- package/esm/util/spm-map.js +2 -1
- package/package.json +2 -2
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
var _excluded = ["type"];
|
|
2
2
|
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); }
|
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
3
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
8
|
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."); }
|
|
5
9
|
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); }
|
|
@@ -31,13 +35,12 @@ import { ElementProcessor } from "../../../../foundation/product-processor/eleme
|
|
|
31
35
|
import { ProductSceneEnum } from "../../../../types";
|
|
32
36
|
import { ElementContainerService } from "../elementContainerService"; // 引入 ElementContainerService
|
|
33
37
|
import { IContainerStatus } from "../elementContainerService/containerService";
|
|
38
|
+
import { EventCenter as ElementEventCenter } from "../EventCenter/index";
|
|
34
39
|
import { oneAccountUpdate, sdkActionUpdate } from "../mock";
|
|
35
|
-
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, MountElementType } from "../type";
|
|
36
|
-
import { checkCanMount, checkCanUpdate, handleRedirect, showToast } from "../util";
|
|
40
|
+
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EXPOSURE_API_EVENT, MountElementType } from "../type";
|
|
41
|
+
import { checkCanMount, checkCanUpdate, handleRedirect, isLoadErrorPage, showToast } from "../util";
|
|
37
42
|
var TIMEOUT_DURATION = 10000;
|
|
38
43
|
var ElementController = /*#__PURE__*/function () {
|
|
39
|
-
// 新增变量
|
|
40
|
-
|
|
41
44
|
function ElementController(options) {
|
|
42
45
|
_classCallCheck(this, ElementController);
|
|
43
46
|
_defineProperty(this, "options", void 0);
|
|
@@ -49,6 +52,9 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
49
52
|
_defineProperty(this, "elementContainerService", void 0);
|
|
50
53
|
// 新增变量
|
|
51
54
|
_defineProperty(this, "onStatusChangeCallback", void 0);
|
|
55
|
+
// 新增变量
|
|
56
|
+
_defineProperty(this, "submitPayPromise", void 0);
|
|
57
|
+
_defineProperty(this, "elementEventCenter", void 0);
|
|
52
58
|
_defineProperty(this, "onValidateFunc", function (event, target) {
|
|
53
59
|
return new Promise(function (resolve) {
|
|
54
60
|
event.emitAndListen({
|
|
@@ -88,6 +94,9 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
88
94
|
instanceId: this.elementContainer.getInstanceId()
|
|
89
95
|
});
|
|
90
96
|
this.setControllerStatusOrView(IElementStatus.READY);
|
|
97
|
+
this.elementEventCenter = new ElementEventCenter({
|
|
98
|
+
logger: this.elementContainer.getServiceProvider().getService('Log')
|
|
99
|
+
});
|
|
91
100
|
}
|
|
92
101
|
_createClass(ElementController, [{
|
|
93
102
|
key: "initService",
|
|
@@ -124,207 +133,324 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
124
133
|
result: result
|
|
125
134
|
});
|
|
126
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* 处理初始化错误的方法
|
|
138
|
+
*/
|
|
127
139
|
}, {
|
|
128
|
-
key: "
|
|
129
|
-
value: function
|
|
140
|
+
key: "handleInitializationError",
|
|
141
|
+
value: function handleInitializationError() {
|
|
142
|
+
this.changeLoading(false);
|
|
143
|
+
this.setControllerStatusOrView(IElementStatus.READY);
|
|
144
|
+
this.onEventCallback(ERRORMESSAGE.SDK_LAUNCH_PAYMENT_APP_ERROR.CALL_APP_URL_ERROR);
|
|
145
|
+
this.elementContainerService.getContainerServices().forEach(function (value) {
|
|
146
|
+
value.getContainerElement().remove();
|
|
147
|
+
});
|
|
148
|
+
this.elementContainerService.destroy();
|
|
149
|
+
} // 处理挂载检查失败
|
|
150
|
+
}, {
|
|
151
|
+
key: "handleMountError",
|
|
152
|
+
value: function handleMountError(_ref2) {
|
|
153
|
+
var result = _ref2.result,
|
|
154
|
+
resolve = _ref2.resolve;
|
|
155
|
+
var errorMsg = result.errorMsg,
|
|
156
|
+
error = result.error;
|
|
157
|
+
this.onEventCallback({
|
|
158
|
+
code: EventCallbackCode.SDK_CREATE_COMPONENT_ERROR,
|
|
159
|
+
message: errorMsg
|
|
160
|
+
});
|
|
161
|
+
resolve({
|
|
162
|
+
error: error
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 清除并设置初始化定时器
|
|
167
|
+
}, {
|
|
168
|
+
key: "clearAndSetInitTimeout",
|
|
169
|
+
value: function clearAndSetInitTimeout(resolve) {
|
|
170
|
+
clearTimeout(this.initTimeout);
|
|
171
|
+
this.initTimeout = null;
|
|
172
|
+
this.initTimeout = this.setInitTimeout(resolve);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 设置初始化超时定时器
|
|
176
|
+
}, {
|
|
177
|
+
key: "setInitTimeout",
|
|
178
|
+
value: function setInitTimeout(resolve) {
|
|
130
179
|
var _this = this;
|
|
131
|
-
return
|
|
132
|
-
var _checkCanMount = checkCanMount({
|
|
133
|
-
sdkSelector: sdkSelector,
|
|
134
|
-
status: _this.elementContainer.getStatus(),
|
|
135
|
-
containerService: _this.elementContainerService.getContainerService(renderOptions.type)
|
|
136
|
-
}),
|
|
137
|
-
success = _checkCanMount.success,
|
|
138
|
-
errorMsg = _checkCanMount.errorMsg;
|
|
139
|
-
if (!success) {
|
|
140
|
-
_this.onEventCallback({
|
|
141
|
-
code: EventCallbackCode.SDK_CREATE_COMPONENT_ERROR,
|
|
142
|
-
message: errorMsg
|
|
143
|
-
});
|
|
144
|
-
resolve({
|
|
145
|
-
success: false
|
|
146
|
-
});
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
180
|
+
return setTimeout(function () {
|
|
149
181
|
clearTimeout(_this.initTimeout);
|
|
150
182
|
_this.initTimeout = null;
|
|
151
|
-
_this.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
183
|
+
_this.handleInitializationError();
|
|
184
|
+
resolve({
|
|
185
|
+
error: ERRORMESSAGE.INITALIZE_TIMEOUT.WEB
|
|
186
|
+
});
|
|
187
|
+
}, TIMEOUT_DURATION);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// 初始化并挂载元素处理器
|
|
191
|
+
}, {
|
|
192
|
+
key: "initializeAndMountProcessor",
|
|
193
|
+
value: function initializeAndMountProcessor(type, selector, options) {
|
|
194
|
+
this.initElementProcessors(type);
|
|
195
|
+
this.elementContainerService.mount({
|
|
196
|
+
type: type,
|
|
197
|
+
selector: selector,
|
|
198
|
+
processor: this.elementProcessors[type],
|
|
199
|
+
options: options
|
|
200
|
+
});
|
|
201
|
+
this.elementProcessors[type].registerEventCenter(this.elementContainerService.getEventService(type));
|
|
202
|
+
this.elementProcessors[type].beforeMount();
|
|
203
|
+
}
|
|
204
|
+
// 处理业务流程启动失败
|
|
205
|
+
}, {
|
|
206
|
+
key: "handleStartBizFlowError",
|
|
207
|
+
value: function handleStartBizFlowError(error, readyCallback) {
|
|
208
|
+
readyCallback({
|
|
209
|
+
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.PARAM_INVALID), {}, {
|
|
210
|
+
context: JSON.stringify(error)
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
this.onEventCallback({
|
|
214
|
+
code: EventCallbackCode.SDK_CREATEPAYMENT_PARAMETER_ERROR,
|
|
215
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || 'Initialization parameter exception.'
|
|
216
|
+
});
|
|
217
|
+
clearTimeout(this.initTimeout);
|
|
218
|
+
this.initTimeout = null;
|
|
219
|
+
this.changeLoading(false);
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
key: "mount",
|
|
223
|
+
value: function mount(renderOptions, sdkSelector) {
|
|
224
|
+
var _this2 = this;
|
|
225
|
+
var startEventId = this.elementEventCenter.registerEvent(EXPOSURE_API_EVENT.MOUNT);
|
|
226
|
+
return new Promise(function (resolve) {
|
|
227
|
+
var checkMountResult = checkCanMount({
|
|
228
|
+
sdkSelector: sdkSelector,
|
|
229
|
+
status: _this2.elementContainer.getStatus(),
|
|
230
|
+
containerService: _this2.elementContainerService.getContainerService(renderOptions.type)
|
|
231
|
+
});
|
|
232
|
+
var readyCallback = function readyCallback(payload) {
|
|
233
|
+
_this2.elementEventCenter.endEvent(startEventId, payload);
|
|
234
|
+
resolve(payload);
|
|
168
235
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || 'Initialization parameter exception.'
|
|
236
|
+
if (!checkMountResult.success) {
|
|
237
|
+
_this2.handleMountError({
|
|
238
|
+
result: checkMountResult,
|
|
239
|
+
resolve: readyCallback
|
|
174
240
|
});
|
|
175
|
-
clearTimeout(_this.initTimeout);
|
|
176
|
-
_this.initTimeout = null;
|
|
177
|
-
_this.changeLoading(false);
|
|
178
241
|
return;
|
|
179
|
-
});
|
|
180
|
-
_this.initElementProcessors(renderOptions.type);
|
|
181
|
-
_this.elementContainerService.mount({
|
|
182
|
-
type: renderOptions.type,
|
|
183
|
-
selector: sdkSelector,
|
|
184
|
-
processor: _this.elementProcessors[renderOptions.type],
|
|
185
|
-
options: renderOptions
|
|
186
|
-
});
|
|
187
|
-
_this.elementProcessors[renderOptions.type].registerEventCenter(_this.elementContainerService.getEventService(renderOptions.type));
|
|
188
|
-
_this.elementProcessors[renderOptions.type].beforeMount();
|
|
189
|
-
_this.sendRequestAndWaitWebLaunch(renderOptions);
|
|
190
|
-
function readyCallback(payload) {
|
|
191
|
-
var _this2 = this;
|
|
192
|
-
var resultData = _objectSpread({
|
|
193
|
-
getValue: this === null || this === void 0 ? void 0 : this.elementProcessors[renderOptions.type].getValue.bind(this === null || this === void 0 ? void 0 : this.elementProcessors[renderOptions.type]),
|
|
194
|
-
on: function on(event, callback) {
|
|
195
|
-
_this2 === null || _this2 === void 0 || _this2.elementProcessors[renderOptions.type].registerEventListener(event, callback);
|
|
196
|
-
}
|
|
197
|
-
}, payload);
|
|
198
|
-
resolve(resultData);
|
|
199
242
|
}
|
|
200
|
-
|
|
201
|
-
|
|
243
|
+
_this2.clearAndSetInitTimeout(readyCallback);
|
|
244
|
+
_this2.changeLoading(true);
|
|
245
|
+
try {
|
|
246
|
+
var startBizFlowData = {
|
|
247
|
+
paymentSession: _this2.options.sessionData,
|
|
248
|
+
displayInfo: _objectSpread(_objectSpread({}, renderOptions), {}, {
|
|
249
|
+
appendAliasContainerId: true
|
|
250
|
+
})
|
|
251
|
+
};
|
|
252
|
+
_this2.setControllerStatusOrView(IElementStatus.IN_BIZ_FLOW);
|
|
253
|
+
_this2.elementContainer.startBizFlow(startBizFlowData);
|
|
254
|
+
_this2.initializeAndMountProcessor(renderOptions.type, sdkSelector, renderOptions);
|
|
255
|
+
_this2.sendRequestAndWaitWebLaunch(renderOptions, readyCallback);
|
|
256
|
+
_this2.addEventListener(readyCallback);
|
|
257
|
+
_this2.serviceMap.EventCenter.addIFrame(_this2.elementContainerService.getContainerService(renderOptions.type).getContainerService().getWebApp());
|
|
258
|
+
} catch (error) {
|
|
259
|
+
_this2.handleStartBizFlowError(error, readyCallback);
|
|
260
|
+
}
|
|
202
261
|
});
|
|
203
262
|
}
|
|
204
263
|
}, {
|
|
205
264
|
key: "validateFields",
|
|
206
|
-
value:
|
|
265
|
+
value: (
|
|
207
266
|
/**
|
|
208
267
|
* 25/09/08 新增商户主动校验api
|
|
209
268
|
* @returns {Promise<{isValid: boolean}>}
|
|
210
269
|
*/
|
|
211
|
-
function
|
|
212
|
-
var
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
_context.prev = 1;
|
|
225
|
-
_context.next = 4;
|
|
226
|
-
return _this3.onValidateFunc((_this3$elementProcess2 = _this3.elementProcessors[ElementType.payment]) === null || _this3$elementProcess2 === void 0 ? void 0 : _this3$elementProcess2.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT);
|
|
227
|
-
case 4:
|
|
228
|
-
validateResult = _context.sent;
|
|
229
|
-
return _context.abrupt("return", resolve({
|
|
230
|
-
isValid: validateResult.data.success
|
|
231
|
-
}));
|
|
232
|
-
case 8:
|
|
233
|
-
_context.prev = 8;
|
|
234
|
-
_context.t0 = _context["catch"](1);
|
|
235
|
-
return _context.abrupt("return", resolve({
|
|
236
|
-
isValid: false
|
|
237
|
-
}));
|
|
238
|
-
case 11:
|
|
239
|
-
_context.next = 14;
|
|
270
|
+
function () {
|
|
271
|
+
var _validateFields = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
272
|
+
var startEventId, result, _this$elementProcesso, _validateResult$data, validateResult;
|
|
273
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
274
|
+
while (1) switch (_context.prev = _context.next) {
|
|
275
|
+
case 0:
|
|
276
|
+
startEventId = this.elementEventCenter.registerEvent(EXPOSURE_API_EVENT.VALIDATAFIELDS);
|
|
277
|
+
result = {
|
|
278
|
+
isValid: false
|
|
279
|
+
};
|
|
280
|
+
_context.prev = 2;
|
|
281
|
+
if (!(this.initTimeout || !((_this$elementProcesso = this.elementProcessors) !== null && _this$elementProcesso !== void 0 && _this$elementProcesso[ElementType.payment]))) {
|
|
282
|
+
_context.next = 5;
|
|
240
283
|
break;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
284
|
+
}
|
|
285
|
+
return _context.abrupt("return", result);
|
|
286
|
+
case 5:
|
|
287
|
+
_context.next = 7;
|
|
288
|
+
return this.onValidateFunc(this.elementProcessors[ElementType.payment].eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT);
|
|
289
|
+
case 7:
|
|
290
|
+
validateResult = _context.sent;
|
|
291
|
+
result = (_validateResult$data = validateResult.data) !== null && _validateResult$data !== void 0 ? _validateResult$data : {
|
|
292
|
+
isValid: false
|
|
293
|
+
};
|
|
294
|
+
return _context.abrupt("return", result);
|
|
295
|
+
case 12:
|
|
296
|
+
_context.prev = 12;
|
|
297
|
+
_context.t0 = _context["catch"](2);
|
|
298
|
+
return _context.abrupt("return", result);
|
|
299
|
+
case 15:
|
|
300
|
+
_context.prev = 15;
|
|
301
|
+
this.elementEventCenter.endEvent(startEventId, result);
|
|
302
|
+
return _context.finish(15);
|
|
303
|
+
case 18:
|
|
304
|
+
case "end":
|
|
305
|
+
return _context.stop();
|
|
306
|
+
}
|
|
307
|
+
}, _callee, this, [[2, 12, 15, 18]]);
|
|
308
|
+
}));
|
|
309
|
+
function validateFields() {
|
|
310
|
+
return _validateFields.apply(this, arguments);
|
|
311
|
+
}
|
|
312
|
+
return validateFields;
|
|
313
|
+
}())
|
|
256
314
|
}, {
|
|
257
315
|
key: "submitPayment",
|
|
258
|
-
value: function
|
|
259
|
-
var
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
316
|
+
value: function () {
|
|
317
|
+
var _submitPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
318
|
+
var _this3 = this;
|
|
319
|
+
var startEventId, res, recordResult;
|
|
320
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
321
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
322
|
+
case 0:
|
|
323
|
+
startEventId = this.elementEventCenter.registerEvent(EXPOSURE_API_EVENT.SUBMITPAYMENT);
|
|
324
|
+
if (!(this.elementContainer.getStatus() !== IElementStatus.IN_BIZ_FLOW)) {
|
|
325
|
+
_context4.next = 5;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
res = {
|
|
329
|
+
error: ERRORMESSAGE.CONTAINER_NOT_LOADED
|
|
330
|
+
};
|
|
331
|
+
this.elementEventCenter.endEvent(startEventId, res);
|
|
332
|
+
return _context4.abrupt("return", Promise.resolve(res));
|
|
333
|
+
case 5:
|
|
334
|
+
this.changeLoading(true);
|
|
335
|
+
recordResult = null;
|
|
336
|
+
_context4.prev = 7;
|
|
337
|
+
_context4.next = 10;
|
|
338
|
+
return new Promise( /*#__PURE__*/function () {
|
|
339
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
|
340
|
+
var params, processStep, _yield$_this3$onValid2, data, errorResult;
|
|
341
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
342
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
343
|
+
case 0:
|
|
344
|
+
_context3.prev = 0;
|
|
345
|
+
_this3.submitPayPromise = resolve;
|
|
346
|
+
params = {}; // 统一处理逻辑
|
|
347
|
+
processStep = /*#__PURE__*/function () {
|
|
348
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(elementType, method) {
|
|
349
|
+
var _yield$_this3$onValid, data;
|
|
350
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
351
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
352
|
+
case 0:
|
|
353
|
+
if (_this3.elementProcessors[elementType]) {
|
|
354
|
+
_context2.next = 2;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
return _context2.abrupt("return", true);
|
|
358
|
+
case 2:
|
|
359
|
+
_context2.next = 4;
|
|
360
|
+
return _this3.onValidateAndSubmitPay(_this3.elementProcessors[elementType].eventCenter, method);
|
|
361
|
+
case 4:
|
|
362
|
+
_yield$_this3$onValid = _context2.sent;
|
|
363
|
+
data = _yield$_this3$onValid.data;
|
|
364
|
+
params.shipping = data === null || data === void 0 ? void 0 : data.data;
|
|
365
|
+
if (data !== null && data !== void 0 && data.success) {
|
|
366
|
+
_context2.next = 11;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
recordResult = data;
|
|
370
|
+
resolve(data);
|
|
371
|
+
return _context2.abrupt("return", false);
|
|
372
|
+
case 11:
|
|
373
|
+
return _context2.abrupt("return", true);
|
|
374
|
+
case 12:
|
|
375
|
+
case "end":
|
|
376
|
+
return _context2.stop();
|
|
377
|
+
}
|
|
378
|
+
}, _callee2);
|
|
379
|
+
}));
|
|
380
|
+
return function processStep(_x2, _x3) {
|
|
381
|
+
return _ref4.apply(this, arguments);
|
|
382
|
+
};
|
|
383
|
+
}(); // 按顺序处理步骤
|
|
384
|
+
_context3.next = 6;
|
|
385
|
+
return processStep(ElementType.auth, ElementPaymentMethod.AUTH_ELEMENT);
|
|
386
|
+
case 6:
|
|
387
|
+
if (_context3.sent) {
|
|
388
|
+
_context3.next = 8;
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
return _context3.abrupt("return");
|
|
392
|
+
case 8:
|
|
393
|
+
_context3.next = 10;
|
|
394
|
+
return processStep(ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT);
|
|
395
|
+
case 10:
|
|
396
|
+
if (_context3.sent) {
|
|
397
|
+
_context3.next = 12;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
return _context3.abrupt("return");
|
|
401
|
+
case 12:
|
|
402
|
+
if (!_this3.elementProcessors[ElementType.payment]) {
|
|
403
|
+
_context3.next = 19;
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
_context3.next = 15;
|
|
407
|
+
return _this3.onValidateAndSubmitPay(_this3.elementProcessors[ElementType.payment].eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT, params);
|
|
408
|
+
case 15:
|
|
409
|
+
_yield$_this3$onValid2 = _context3.sent;
|
|
410
|
+
data = _yield$_this3$onValid2.data;
|
|
411
|
+
recordResult = data;
|
|
412
|
+
resolve(data);
|
|
413
|
+
case 19:
|
|
414
|
+
_context3.next = 26;
|
|
415
|
+
break;
|
|
416
|
+
case 21:
|
|
417
|
+
_context3.prev = 21;
|
|
418
|
+
_context3.t0 = _context3["catch"](0);
|
|
419
|
+
errorResult = {
|
|
420
|
+
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED), {}, {
|
|
421
|
+
context: JSON.stringify(_context3.t0)
|
|
422
|
+
})
|
|
423
|
+
};
|
|
424
|
+
recordResult = errorResult;
|
|
425
|
+
resolve(errorResult);
|
|
426
|
+
case 26:
|
|
427
|
+
case "end":
|
|
428
|
+
return _context3.stop();
|
|
429
|
+
}
|
|
430
|
+
}, _callee3, null, [[0, 21]]);
|
|
431
|
+
}));
|
|
432
|
+
return function (_x) {
|
|
433
|
+
return _ref3.apply(this, arguments);
|
|
434
|
+
};
|
|
435
|
+
}());
|
|
436
|
+
case 10:
|
|
437
|
+
return _context4.abrupt("return", _context4.sent);
|
|
438
|
+
case 11:
|
|
439
|
+
_context4.prev = 11;
|
|
440
|
+
this.elementEventCenter.endEvent(startEventId, recordResult);
|
|
441
|
+
this.changeLoading(false);
|
|
442
|
+
return _context4.finish(11);
|
|
443
|
+
case 15:
|
|
444
|
+
case "end":
|
|
445
|
+
return _context4.stop();
|
|
446
|
+
}
|
|
447
|
+
}, _callee4, this, [[7,, 11, 15]]);
|
|
448
|
+
}));
|
|
449
|
+
function submitPayment() {
|
|
450
|
+
return _submitPayment.apply(this, arguments);
|
|
451
|
+
}
|
|
452
|
+
return submitPayment;
|
|
453
|
+
}()
|
|
328
454
|
}, {
|
|
329
455
|
key: "changeLoading",
|
|
330
456
|
value: function changeLoading(loading) {
|
|
@@ -347,21 +473,19 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
347
473
|
}, {
|
|
348
474
|
key: "addEventListener",
|
|
349
475
|
value: function addEventListener(renderCallback) {
|
|
350
|
-
var
|
|
476
|
+
var _this4 = this;
|
|
351
477
|
this.serviceMap.EventCenter.listen(ElementPaymentEvent.ON_EVENT_CALLBACK, function (data) {
|
|
352
|
-
var
|
|
353
|
-
(
|
|
478
|
+
var _this4$onEventCallbac;
|
|
479
|
+
(_this4$onEventCallbac = _this4.onEventCallback) === null || _this4$onEventCallbac === void 0 || _this4$onEventCallbac.call(_this4, data);
|
|
354
480
|
});
|
|
355
481
|
this.serviceMap.EventCenter.listen(EVENT.sizeChanged.name, function (data) {
|
|
356
|
-
clearTimeout(
|
|
357
|
-
|
|
358
|
-
if (
|
|
359
|
-
renderCallback(
|
|
360
|
-
|
|
361
|
-
});
|
|
362
|
-
_this5.elementContainerService.getContainerService(data.source).switchContainerStatus(IContainerStatus.IN_BIZ_FLOW);
|
|
482
|
+
clearTimeout(_this4.initTimeout);
|
|
483
|
+
_this4.initTimeout = null;
|
|
484
|
+
if (_this4.elementContainerService.getContainerService(data.source)) {
|
|
485
|
+
renderCallback();
|
|
486
|
+
_this4.elementContainerService.getContainerService(data.source).switchContainerStatus(IContainerStatus.IN_BIZ_FLOW);
|
|
363
487
|
}
|
|
364
|
-
|
|
488
|
+
_this4.changeLoading(false);
|
|
365
489
|
// 遍历containerService中的所有container查看是否所有状态都是IN_BIZ_FLOW
|
|
366
490
|
// const allContainersInBizFlow = Object.values(this.elementContainerService.getContainerServices()).every(
|
|
367
491
|
// (containerService) => containerService.getContainerStatus() === IContainerStatus.IN_BIZ_FLOW,
|
|
@@ -371,22 +495,21 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
371
495
|
// }
|
|
372
496
|
});
|
|
373
497
|
this.serviceMap.EventCenter.listen(EVENT.redirect.name, function (data) {
|
|
374
|
-
var onEventCallback =
|
|
498
|
+
var onEventCallback = _this4.onEventCallback.bind(_this4);
|
|
375
499
|
handleRedirect(data, false, onEventCallback);
|
|
376
500
|
});
|
|
377
501
|
this.serviceMap.EventCenter.listen(EVENT.destroy.name, function () {
|
|
378
|
-
|
|
379
|
-
|
|
502
|
+
_this4.setControllerStatusOrView(IElementStatus.READY);
|
|
503
|
+
_this4.destroyHandle();
|
|
380
504
|
});
|
|
381
505
|
this.serviceMap.EventCenter.listen(EVENT.webAppReady.name, function (data) {
|
|
382
|
-
clearTimeout(
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
_this5.elementContainerService.getContainerService(data.source).switchContainerStatus(IContainerStatus.IN_BIZ_FLOW);
|
|
506
|
+
clearTimeout(_this4.initTimeout);
|
|
507
|
+
_this4.initTimeout = null;
|
|
508
|
+
if (_this4.elementContainerService.getContainerService(data.source)) {
|
|
509
|
+
renderCallback();
|
|
510
|
+
_this4.elementContainerService.getContainerService(data.source).switchContainerStatus(IContainerStatus.IN_BIZ_FLOW);
|
|
388
511
|
}
|
|
389
|
-
|
|
512
|
+
_this4.changeLoading(false);
|
|
390
513
|
});
|
|
391
514
|
this.serviceMap.EventCenter.listen(EVENT.showToast.name, function (data) {
|
|
392
515
|
showToast(data);
|
|
@@ -394,47 +517,120 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
394
517
|
this.serviceMap.EventCenter.listen(EVENT.messageForward.name, function (data) {
|
|
395
518
|
var source = MountElementType[data.source];
|
|
396
519
|
var target = MountElementType[data.target];
|
|
397
|
-
if (
|
|
398
|
-
|
|
520
|
+
if (_this4.elementProcessors[source] && _this4.elementProcessors[target]) {
|
|
521
|
+
_this4.elementProcessors[target].eventCenter.dispatchToApp({
|
|
399
522
|
event: data.event,
|
|
400
523
|
data: data
|
|
401
524
|
});
|
|
402
525
|
}
|
|
403
526
|
});
|
|
527
|
+
this.serviceMap.EventCenter.listen(EVENT.submitPromiseCallback.name, function (data) {
|
|
528
|
+
var _this4$submitPayPromi;
|
|
529
|
+
(_this4$submitPayPromi = _this4.submitPayPromise) === null || _this4$submitPayPromi === void 0 || _this4$submitPayPromi.call(_this4, data);
|
|
530
|
+
});
|
|
404
531
|
}
|
|
405
532
|
}, {
|
|
406
533
|
key: "sendRequestAndWaitWebLaunch",
|
|
407
|
-
value: function
|
|
408
|
-
var
|
|
409
|
-
|
|
410
|
-
options
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
534
|
+
value: function () {
|
|
535
|
+
var _sendRequestAndWaitWebLaunch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(renderOptions, readyCallback) {
|
|
536
|
+
var _this5 = this;
|
|
537
|
+
var type, options, containerService, _yield$Promise$all, _yield$Promise$all2, _, obtainDataResult, error;
|
|
538
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
539
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
540
|
+
case 0:
|
|
541
|
+
type = renderOptions.type, options = _objectWithoutProperties(renderOptions, _excluded);
|
|
542
|
+
_context5.prev = 1;
|
|
543
|
+
containerService = this.elementContainerService.getContainerService(type);
|
|
544
|
+
if (containerService) {
|
|
545
|
+
_context5.next = 7;
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
this.handleInitializationError();
|
|
549
|
+
// 容器服务不存在,直接返回
|
|
550
|
+
readyCallback({
|
|
551
|
+
error: ERRORMESSAGE.UI_STATE_ERROR
|
|
552
|
+
});
|
|
553
|
+
return _context5.abrupt("return");
|
|
554
|
+
case 7:
|
|
555
|
+
_context5.next = 9;
|
|
556
|
+
return Promise.all([containerService.createWebLaunchPromise(), this.elementProcessors[type].obtainData()]);
|
|
557
|
+
case 9:
|
|
558
|
+
_yield$Promise$all = _context5.sent;
|
|
559
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
560
|
+
_ = _yield$Promise$all2[0];
|
|
561
|
+
obtainDataResult = _yield$Promise$all2[1];
|
|
562
|
+
containerService === null || containerService === void 0 || containerService.switchContainerStatus(IContainerStatus.READY);
|
|
563
|
+
error = this.getErrorFromResponse(obtainDataResult);
|
|
564
|
+
if (!error) {
|
|
565
|
+
_context5.next = 19;
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
this.handleInitializationError();
|
|
569
|
+
readyCallback({
|
|
570
|
+
error: error
|
|
571
|
+
});
|
|
572
|
+
return _context5.abrupt("return");
|
|
573
|
+
case 19:
|
|
574
|
+
if (this.areAllContainersReady()) {
|
|
575
|
+
this.elementContainerService.getContainerServices().forEach(function (_, key) {
|
|
576
|
+
_this5.sendReady(key, options);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
_context5.next = 26;
|
|
580
|
+
break;
|
|
581
|
+
case 22:
|
|
582
|
+
_context5.prev = 22;
|
|
583
|
+
_context5.t0 = _context5["catch"](1);
|
|
584
|
+
this.handleInitializationError();
|
|
585
|
+
readyCallback({
|
|
586
|
+
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.INITALIZE_TIMEOUT.API), {}, {
|
|
587
|
+
traceId: _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.traceId
|
|
588
|
+
})
|
|
589
|
+
});
|
|
590
|
+
case 26:
|
|
591
|
+
case "end":
|
|
592
|
+
return _context5.stop();
|
|
593
|
+
}
|
|
594
|
+
}, _callee5, this, [[1, 22]]);
|
|
595
|
+
}));
|
|
596
|
+
function sendRequestAndWaitWebLaunch(_x4, _x5) {
|
|
597
|
+
return _sendRequestAndWaitWebLaunch.apply(this, arguments);
|
|
598
|
+
}
|
|
599
|
+
return sendRequestAndWaitWebLaunch;
|
|
600
|
+
}()
|
|
601
|
+
}, {
|
|
602
|
+
key: "getErrorFromResponse",
|
|
603
|
+
value: function getErrorFromResponse(response) {
|
|
604
|
+
if (isLoadErrorPage(response === null || response === void 0 ? void 0 : response.originActionQueryResult)) {
|
|
605
|
+
var _response$originActio = response.originActionQueryResult,
|
|
606
|
+
traceId = _response$originActio.traceId,
|
|
607
|
+
errorCode = _response$originActio.errorCode;
|
|
608
|
+
var baseError = ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED;
|
|
609
|
+
if ([ERRORMESSAGE.INQUIRY_PAYMENT_SESSION_FAILED.code, ERRORMESSAGE.UNKNOWN_EXCEPTION.code].includes(errorCode)) {
|
|
610
|
+
baseError = ERRORMESSAGE[errorCode];
|
|
427
611
|
}
|
|
612
|
+
return _objectSpread(_objectSpread({}, baseError), {}, {
|
|
613
|
+
traceId: traceId !== null && traceId !== void 0 ? traceId : ''
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
}, {
|
|
619
|
+
key: "areAllContainersReady",
|
|
620
|
+
value: function areAllContainersReady() {
|
|
621
|
+
var container = this.elementContainerService.getContainerServices();
|
|
622
|
+
return _toConsumableArray(container.values()).every(function (service) {
|
|
623
|
+
return service.getContainerStatus() === IContainerStatus.READY;
|
|
428
624
|
});
|
|
429
625
|
}
|
|
430
626
|
}, {
|
|
431
627
|
key: "sendReady",
|
|
432
628
|
value: function sendReady(type, options) {
|
|
433
|
-
var _this$
|
|
434
|
-
var paymentResult = (_this$
|
|
629
|
+
var _this$elementProcesso2, _paymentSessionObj$co, _paymentSessionObj$pa, _paymentResult$origin;
|
|
630
|
+
var paymentResult = (_this$elementProcesso2 = this.elementProcessors[ElementType.payment]) === null || _this$elementProcesso2 === void 0 ? void 0 : _this$elementProcesso2.getObtainDataRes();
|
|
435
631
|
var paymentContext = this.elementContainer.getPaymentContext();
|
|
436
632
|
var paymentSessionObj = paymentContext.paymentSessionObj;
|
|
437
|
-
var isConnect = paymentSessionObj.connectFactor.enableConnect && ((_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
|
|
633
|
+
var isConnect = ((_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect) && ((_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
|
|
438
634
|
if (!(paymentResult !== null && paymentResult !== void 0 && (_paymentResult$origin = paymentResult.originActionQueryResult) !== null && _paymentResult$origin !== void 0 && _paymentResult$origin.success) && isConnect) {
|
|
439
635
|
var _this$onEventCallback;
|
|
440
636
|
clearTimeout(this.initTimeout);
|
|
@@ -458,37 +654,37 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
458
654
|
}, {
|
|
459
655
|
key: "updatePayment",
|
|
460
656
|
value: function () {
|
|
461
|
-
var _updatePayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
462
|
-
var
|
|
463
|
-
return _regeneratorRuntime().wrap(function
|
|
464
|
-
while (1) switch (
|
|
657
|
+
var _updatePayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(paymentSessionData) {
|
|
658
|
+
var _this6 = this;
|
|
659
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
660
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
465
661
|
case 0:
|
|
466
|
-
return
|
|
467
|
-
var
|
|
662
|
+
return _context7.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
663
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(resolve) {
|
|
468
664
|
var prePaymentSessionData, data, LOCAL_MOCK;
|
|
469
|
-
return _regeneratorRuntime().wrap(function
|
|
470
|
-
while (1) switch (
|
|
665
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
666
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
471
667
|
case 0:
|
|
472
668
|
if (checkCanUpdate({
|
|
473
|
-
status:
|
|
474
|
-
paymentContainerService:
|
|
669
|
+
status: _this6.elementContainer.getStatus(),
|
|
670
|
+
paymentContainerService: _this6.elementContainerService.getContainerService(ElementType.payment),
|
|
475
671
|
newPaymentSessionData: paymentSessionData,
|
|
476
|
-
oldPaymentSessionData:
|
|
672
|
+
oldPaymentSessionData: _this6.options.sessionData
|
|
477
673
|
})) {
|
|
478
|
-
|
|
674
|
+
_context6.next = 2;
|
|
479
675
|
break;
|
|
480
676
|
}
|
|
481
|
-
return
|
|
677
|
+
return _context6.abrupt("return", resolve(false));
|
|
482
678
|
case 2:
|
|
483
|
-
prePaymentSessionData =
|
|
484
|
-
|
|
679
|
+
prePaymentSessionData = _this6.elementContainer.getPaymentContext().paymentSession;
|
|
680
|
+
_this6.elementContainer.updatePaymentSessionData(paymentSessionData);
|
|
485
681
|
// 1、数据获取
|
|
486
|
-
|
|
487
|
-
return
|
|
682
|
+
_context6.next = 6;
|
|
683
|
+
return _this6.elementProcessors[ElementType.payment].obtainData();
|
|
488
684
|
case 6:
|
|
489
|
-
data =
|
|
685
|
+
data = _context6.sent;
|
|
490
686
|
LOCAL_MOCK = window.location.href.indexOf('LOCAL_MOCK=1') !== -1; // 2、发送update消息
|
|
491
|
-
Object.values(
|
|
687
|
+
Object.values(_this6.elementProcessors).forEach(function (processor) {
|
|
492
688
|
processor.update({
|
|
493
689
|
data: {
|
|
494
690
|
originActionQueryResult: LOCAL_MOCK ? sdkActionUpdate : data.originActionQueryResult,
|
|
@@ -498,30 +694,30 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
498
694
|
});
|
|
499
695
|
});
|
|
500
696
|
// 3、返回更新结果
|
|
501
|
-
|
|
697
|
+
_this6.serviceMap.EventCenter.listen(EVENT.updated.name, function (data) {
|
|
502
698
|
// 若更新不成功,还原core.paymentContext信息
|
|
503
699
|
if (!data.success) {
|
|
504
|
-
|
|
700
|
+
_this6.elementContainer.updatePaymentSessionData(prePaymentSessionData);
|
|
505
701
|
}
|
|
506
702
|
return resolve(data.success || false);
|
|
507
703
|
});
|
|
508
704
|
case 10:
|
|
509
705
|
case "end":
|
|
510
|
-
return
|
|
706
|
+
return _context6.stop();
|
|
511
707
|
}
|
|
512
|
-
},
|
|
708
|
+
}, _callee6);
|
|
513
709
|
}));
|
|
514
|
-
return function (
|
|
515
|
-
return
|
|
710
|
+
return function (_x7) {
|
|
711
|
+
return _ref5.apply(this, arguments);
|
|
516
712
|
};
|
|
517
713
|
}()));
|
|
518
714
|
case 1:
|
|
519
715
|
case "end":
|
|
520
|
-
return
|
|
716
|
+
return _context7.stop();
|
|
521
717
|
}
|
|
522
|
-
},
|
|
718
|
+
}, _callee7);
|
|
523
719
|
}));
|
|
524
|
-
function updatePayment(
|
|
720
|
+
function updatePayment(_x6) {
|
|
525
721
|
return _updatePayment.apply(this, arguments);
|
|
526
722
|
}
|
|
527
723
|
return updatePayment;
|
|
@@ -541,8 +737,13 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
541
737
|
}, {
|
|
542
738
|
key: "destroy",
|
|
543
739
|
value: function destroy() {
|
|
544
|
-
this.
|
|
545
|
-
|
|
740
|
+
var startEventId = this.elementEventCenter.registerEvent(EXPOSURE_API_EVENT.DESTORY);
|
|
741
|
+
try {
|
|
742
|
+
this.destroyHandle();
|
|
743
|
+
this.setControllerStatusOrView(IElementStatus.DESTROYED);
|
|
744
|
+
} finally {
|
|
745
|
+
this.elementEventCenter.endEvent(startEventId);
|
|
746
|
+
}
|
|
546
747
|
}
|
|
547
748
|
}, {
|
|
548
749
|
key: "setControllerStatusOrView",
|