@alipay/ams-checkout 1.10.0 → 1.11.0
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/bus/ability/callback.d.ts +9 -0
- package/esm/core/bus/ability/callback.js +55 -0
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/security.js +104 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/ability/tracker.js +77 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/index.js +366 -0
- package/esm/core/bus/interface.d.ts +32 -0
- package/esm/core/bus/interface.js +35 -0
- package/esm/core/component/index.d.ts +20 -1
- package/esm/core/component/index.js +270 -23
- package/esm/core/instance/index.d.ts +5 -1
- package/esm/core/instance/index.js +41 -4
- package/esm/index.d.ts +9 -4
- package/esm/index.js +56 -21
- package/esm/{core/applepay/index.d.ts → plugin/applepay/component.d.ts} +27 -8
- package/esm/{core/applepay/index.js → plugin/applepay/component.js} +150 -180
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/{common → plugin}/applepay/interface.d.ts +62 -3
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/{common/applepay/index.d.ts → plugin/applepay/service.d.ts} +13 -7
- package/esm/{common/applepay/index.js → plugin/applepay/service.js} +159 -41
- package/esm/plugin/component/cashierApp.d.ts +3 -0
- package/esm/plugin/component/cashierApp.js +23 -2
- package/esm/plugin/component/index.d.ts +6 -2
- package/esm/plugin/component/index.js +126 -44
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +19 -0
- package/esm/plugin/type.d.ts +33 -0
- package/esm/request/index.d.ts +1 -1
- package/esm/service/index.d.ts +1 -1
- package/esm/types/index.d.ts +63 -6
- package/esm/types/index.js +8 -1
- package/esm/util/createIframeNode.d.ts +1 -0
- package/esm/util/createIframeNode.js +6 -0
- package/package.json +1 -1
- /package/esm/{common/applepay/interface.js → plugin/type.js} +0 -0
@@ -0,0 +1,366 @@
|
|
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
3
|
+
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); }
|
4
|
+
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; }
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8
|
+
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); } }
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
10
|
+
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; }
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
12
|
+
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); }
|
13
|
+
/**
|
14
|
+
* Bus 埋点内容定义
|
15
|
+
*/
|
16
|
+
export var BusLogEventEnum = /*#__PURE__*/function (BusLogEventEnum) {
|
17
|
+
BusLogEventEnum["sdk_event_busPublishMessage"] = "sdk_event_busPublishMessage";
|
18
|
+
BusLogEventEnum["sdk_event_busPublishCallback"] = "sdk_event_busPublishCallback";
|
19
|
+
BusLogEventEnum["sdk_event_busIsSubscribe"] = "sdk_event_busIsSubscribe";
|
20
|
+
BusLogEventEnum["sdk_event_busSubscribe"] = "sdk_event_busSubscribe";
|
21
|
+
BusLogEventEnum["sdk_event_busUnsubscribe"] = "sdk_event_busUnsubscribe";
|
22
|
+
BusLogEventEnum["sdk_event_busClear"] = "sdk_event_busClear";
|
23
|
+
BusLogEventEnum["sdk_event_busAddInterceptor"] = "sdk_event_busAddInterceptor";
|
24
|
+
BusLogEventEnum["sdk_error_busPublishUnsubscribeError"] = "sdk_error_busPublishUnsubscribeError";
|
25
|
+
BusLogEventEnum["sdk_error_busPublishError"] = "sdk_error_busPublishError";
|
26
|
+
BusLogEventEnum["sdk_error_busPublishNoResult"] = "sdk_error_busPublishNoResult";
|
27
|
+
return BusLogEventEnum;
|
28
|
+
}({});
|
29
|
+
|
30
|
+
/**
|
31
|
+
* 扩展协议可序列化的消息定义
|
32
|
+
*/
|
33
|
+
export var BusMessage = /*#__PURE__*/function () {
|
34
|
+
function BusMessage(action, data) {
|
35
|
+
_classCallCheck(this, BusMessage);
|
36
|
+
_defineProperty(this, "action", void 0);
|
37
|
+
_defineProperty(this, "data", void 0);
|
38
|
+
_defineProperty(this, "jsonData", null);
|
39
|
+
this.action = action;
|
40
|
+
this.data = data;
|
41
|
+
}
|
42
|
+
_createClass(BusMessage, [{
|
43
|
+
key: "getAction",
|
44
|
+
value: function getAction() {
|
45
|
+
return this.action;
|
46
|
+
}
|
47
|
+
}, {
|
48
|
+
key: "getData",
|
49
|
+
value: function getData() {
|
50
|
+
return this.data;
|
51
|
+
}
|
52
|
+
}, {
|
53
|
+
key: "isJSONData",
|
54
|
+
value: function isJSONData() {
|
55
|
+
this.parseJSONData();
|
56
|
+
return this.jsonData !== null;
|
57
|
+
}
|
58
|
+
}, {
|
59
|
+
key: "getJSONObject",
|
60
|
+
value: function getJSONObject() {
|
61
|
+
var _this$jsonData;
|
62
|
+
this.parseJSONData();
|
63
|
+
return (_this$jsonData = this.jsonData) !== null && _this$jsonData !== void 0 ? _this$jsonData : {};
|
64
|
+
}
|
65
|
+
}, {
|
66
|
+
key: "parseJSONData",
|
67
|
+
value: function parseJSONData() {
|
68
|
+
if (this.jsonData === null) {
|
69
|
+
try {
|
70
|
+
this.jsonData = JSON.parse(this.data);
|
71
|
+
} catch (e) {
|
72
|
+
// handle error if JSON parsing fails
|
73
|
+
this.jsonData = null;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}, {
|
78
|
+
key: "result",
|
79
|
+
value: function result(_result) {
|
80
|
+
return new BusMessage(this.action, JSON.stringify(_result));
|
81
|
+
}
|
82
|
+
}]);
|
83
|
+
return BusMessage;
|
84
|
+
}();
|
85
|
+
/**
|
86
|
+
* 扩展总线可选的Context参数,在Web端用于实时回调
|
87
|
+
*/
|
88
|
+
export var BusContext = /*#__PURE__*/function () {
|
89
|
+
function BusContext(callback) {
|
90
|
+
_classCallCheck(this, BusContext);
|
91
|
+
_defineProperty(this, "callback", void 0);
|
92
|
+
this.callback = callback;
|
93
|
+
}
|
94
|
+
_createClass(BusContext, [{
|
95
|
+
key: "onCallBack",
|
96
|
+
value: function onCallBack(message) {
|
97
|
+
if (this.callback) {
|
98
|
+
this.callback(message);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}]);
|
102
|
+
return BusContext;
|
103
|
+
}();
|
104
|
+
|
105
|
+
/**
|
106
|
+
* 扩展能力的能力定义,基于此协议实现扩展能力
|
107
|
+
*/
|
108
|
+
export var BusSubscriber = /*#__PURE__*/_createClass(function BusSubscriber() {
|
109
|
+
_classCallCheck(this, BusSubscriber);
|
110
|
+
});
|
111
|
+
|
112
|
+
/**
|
113
|
+
* 拦截器,可增加扩展性
|
114
|
+
*/
|
115
|
+
|
116
|
+
/**
|
117
|
+
* 事件总线入口,支持的关系为:
|
118
|
+
* 发送者 和 接收者的关系: 一对一,大多数场景,支持callback
|
119
|
+
* 发送者 和 接收者的关系: 多对一, 设计上多一对,但是同一时间点,只会一个发送者,支持callback
|
120
|
+
* 发送者 和 接收者的关系: 一对多,可能有,埋点多重上报?不需要callback,业务场景应该是一个广播场景
|
121
|
+
*/
|
122
|
+
export var BusManager = /*#__PURE__*/function () {
|
123
|
+
function BusManager() {
|
124
|
+
_classCallCheck(this, BusManager);
|
125
|
+
}
|
126
|
+
_createClass(BusManager, null, [{
|
127
|
+
key: "debugTrace",
|
128
|
+
value: function debugTrace(enable, logger) {
|
129
|
+
this.isDebug = enable;
|
130
|
+
this.logger = logger;
|
131
|
+
}
|
132
|
+
}, {
|
133
|
+
key: "traceLog",
|
134
|
+
value: function traceLog(title, optionalParams) {
|
135
|
+
var report = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
136
|
+
if (this.isDebug) {
|
137
|
+
console.log([BusManager.TAG, title].concat(JSON.stringify(optionalParams)).join(this._logSplit));
|
138
|
+
}
|
139
|
+
if (report && this.logger) {
|
140
|
+
this.logger.logInfo({
|
141
|
+
title: title
|
142
|
+
}, _objectSpread({
|
143
|
+
biz: 'sdk'
|
144
|
+
}, optionalParams)).send();
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}, {
|
148
|
+
key: "traceError",
|
149
|
+
value: function traceError(title, optionalParams) {
|
150
|
+
if (this.isDebug) {
|
151
|
+
console.error([BusManager.TAG, title].concat(JSON.stringify(optionalParams)).join(this._logSplit));
|
152
|
+
}
|
153
|
+
if (this.logger) {
|
154
|
+
this.logger.logError({
|
155
|
+
title: title
|
156
|
+
}, _objectSpread({
|
157
|
+
biz: 'sdk'
|
158
|
+
}, optionalParams)).send();
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}, {
|
162
|
+
key: "clear",
|
163
|
+
value: function clear() {
|
164
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busClear);
|
165
|
+
BusManager.interceptors.length = 0;
|
166
|
+
BusManager.subscribersMap.clear();
|
167
|
+
}
|
168
|
+
}, {
|
169
|
+
key: "addInterceptor",
|
170
|
+
value: function addInterceptor(interceptor) {
|
171
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busAddInterceptor);
|
172
|
+
if (!BusManager.interceptors.includes(interceptor)) {
|
173
|
+
BusManager.interceptors.push(interceptor);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}, {
|
177
|
+
key: "publishForResult",
|
178
|
+
value: function publishForResult(message, config) {
|
179
|
+
var _this = this;
|
180
|
+
var failed = true;
|
181
|
+
return new Promise(function (resolve, reject) {
|
182
|
+
var _config$timeoutMs;
|
183
|
+
_this.publish(message, function (result) {
|
184
|
+
failed = false;
|
185
|
+
resolve(result);
|
186
|
+
});
|
187
|
+
setTimeout(function () {
|
188
|
+
if (failed) {
|
189
|
+
BusManager.traceError(BusLogEventEnum.sdk_error_busPublishNoResult, {
|
190
|
+
action: message.getAction()
|
191
|
+
});
|
192
|
+
if ((config === null || config === void 0 ? void 0 : config.fallback) !== null) {
|
193
|
+
resolve(message.result(config === null || config === void 0 ? void 0 : config.fallback));
|
194
|
+
} else {
|
195
|
+
reject('publish timeout');
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}, (_config$timeoutMs = config === null || config === void 0 ? void 0 : config.timeoutMs) !== null && _config$timeoutMs !== void 0 ? _config$timeoutMs : 2000);
|
199
|
+
});
|
200
|
+
}
|
201
|
+
}, {
|
202
|
+
key: "publish",
|
203
|
+
value: function publish(message, callback) {
|
204
|
+
var _callBack = function _callBack(result) {
|
205
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busPublishCallback, {
|
206
|
+
action: message.getAction()
|
207
|
+
});
|
208
|
+
if (callback) {
|
209
|
+
callback(result);
|
210
|
+
}
|
211
|
+
};
|
212
|
+
var context = new BusContext(_callBack);
|
213
|
+
var actionName = message.getAction();
|
214
|
+
var subscribers = BusManager.subscribersMap.get(actionName);
|
215
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busPublishMessage, {
|
216
|
+
action: message.getAction()
|
217
|
+
});
|
218
|
+
if (subscribers) {
|
219
|
+
var _iterator = _createForOfIteratorHelper(subscribers),
|
220
|
+
_step;
|
221
|
+
try {
|
222
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
223
|
+
var subscriber = _step.value;
|
224
|
+
try {
|
225
|
+
subscriber.onMessage(context, message);
|
226
|
+
} catch (e) {
|
227
|
+
BusManager.traceError(BusLogEventEnum.sdk_error_busPublishError, {
|
228
|
+
action: message.getAction(),
|
229
|
+
error: e
|
230
|
+
});
|
231
|
+
var _iterator2 = _createForOfIteratorHelper(BusManager.interceptors),
|
232
|
+
_step2;
|
233
|
+
try {
|
234
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
235
|
+
var interceptor = _step2.value;
|
236
|
+
interceptor === null || interceptor === void 0 || interceptor.onPublishException(message, e);
|
237
|
+
}
|
238
|
+
} catch (err) {
|
239
|
+
_iterator2.e(err);
|
240
|
+
} finally {
|
241
|
+
_iterator2.f();
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
} catch (err) {
|
246
|
+
_iterator.e(err);
|
247
|
+
} finally {
|
248
|
+
_iterator.f();
|
249
|
+
}
|
250
|
+
} else {
|
251
|
+
var handle = false;
|
252
|
+
var _iterator3 = _createForOfIteratorHelper(BusManager.interceptors),
|
253
|
+
_step3;
|
254
|
+
try {
|
255
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
256
|
+
var _interceptor = _step3.value;
|
257
|
+
BusManager.traceLog('onUnsubscribedAction', JSON.stringify(message));
|
258
|
+
handle = handle || (_interceptor === null || _interceptor === void 0 ? void 0 : _interceptor.onUnsubscribedAction(message.getAction()));
|
259
|
+
}
|
260
|
+
} catch (err) {
|
261
|
+
_iterator3.e(err);
|
262
|
+
} finally {
|
263
|
+
_iterator3.f();
|
264
|
+
}
|
265
|
+
if (handle) {
|
266
|
+
BusManager.publish(message, callback); // Re-publish the message
|
267
|
+
} else {
|
268
|
+
BusManager.traceError(BusLogEventEnum.sdk_error_busPublishUnsubscribeError, {
|
269
|
+
action: message.getAction()
|
270
|
+
});
|
271
|
+
}
|
272
|
+
}
|
273
|
+
}
|
274
|
+
}, {
|
275
|
+
key: "subscribe",
|
276
|
+
value: function subscribe(subscriber) {
|
277
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busSubscribe, {
|
278
|
+
actions: subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames()
|
279
|
+
});
|
280
|
+
var _iterator4 = _createForOfIteratorHelper(subscriber.actionNames()),
|
281
|
+
_step4;
|
282
|
+
try {
|
283
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
284
|
+
var _actionName = _step4.value;
|
285
|
+
if (!BusManager.subscribersMap.has(_actionName)) {
|
286
|
+
BusManager.subscribersMap.set(_actionName, []);
|
287
|
+
}
|
288
|
+
var subscribers = BusManager.subscribersMap.get(_actionName);
|
289
|
+
if (subscribers && !subscribers.includes(subscriber)) {
|
290
|
+
subscribers.push(subscriber);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
} catch (err) {
|
294
|
+
_iterator4.e(err);
|
295
|
+
} finally {
|
296
|
+
_iterator4.f();
|
297
|
+
}
|
298
|
+
}
|
299
|
+
}, {
|
300
|
+
key: "unsubscribe",
|
301
|
+
value: function unsubscribe(subscriber) {
|
302
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busUnsubscribe, {
|
303
|
+
actions: subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames()
|
304
|
+
});
|
305
|
+
var _iterator5 = _createForOfIteratorHelper(subscriber.actionNames()),
|
306
|
+
_step5;
|
307
|
+
try {
|
308
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
309
|
+
var _actionName2 = _step5.value;
|
310
|
+
var subscribers = BusManager.subscribersMap.get(_actionName2);
|
311
|
+
if (subscribers) {
|
312
|
+
var index = subscribers.indexOf(subscriber);
|
313
|
+
if (index !== -1) {
|
314
|
+
subscribers.splice(index, 1);
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
} catch (err) {
|
319
|
+
_iterator5.e(err);
|
320
|
+
} finally {
|
321
|
+
_iterator5.f();
|
322
|
+
}
|
323
|
+
}
|
324
|
+
}, {
|
325
|
+
key: "isSubscribed",
|
326
|
+
value: function isSubscribed(actionName) {
|
327
|
+
var subscribers = BusManager.subscribersMap.get(actionName);
|
328
|
+
if (subscribers && subscribers.length > 0) {
|
329
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
|
330
|
+
action: actionName,
|
331
|
+
sub: true
|
332
|
+
});
|
333
|
+
return true;
|
334
|
+
}
|
335
|
+
var handle = false;
|
336
|
+
var _iterator6 = _createForOfIteratorHelper(BusManager.interceptors),
|
337
|
+
_step6;
|
338
|
+
try {
|
339
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
340
|
+
var interceptor = _step6.value;
|
341
|
+
handle = handle || interceptor.onUnsubscribedAction(actionName);
|
342
|
+
}
|
343
|
+
} catch (err) {
|
344
|
+
_iterator6.e(err);
|
345
|
+
} finally {
|
346
|
+
_iterator6.f();
|
347
|
+
}
|
348
|
+
if (handle) {
|
349
|
+
// 内部会上报
|
350
|
+
return BusManager.subscribersMap.has(actionName);
|
351
|
+
}
|
352
|
+
BusManager.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
|
353
|
+
action: actionName,
|
354
|
+
sub: false
|
355
|
+
});
|
356
|
+
return false;
|
357
|
+
}
|
358
|
+
}]);
|
359
|
+
return BusManager;
|
360
|
+
}();
|
361
|
+
_defineProperty(BusManager, "TAG", 'BusManager');
|
362
|
+
_defineProperty(BusManager, "_logSplit", ' , ');
|
363
|
+
_defineProperty(BusManager, "interceptors", []);
|
364
|
+
_defineProperty(BusManager, "subscribersMap", new Map());
|
365
|
+
_defineProperty(BusManager, "isDebug", true);
|
366
|
+
_defineProperty(BusManager, "logger", void 0);
|
@@ -0,0 +1,32 @@
|
|
1
|
+
export declare enum PaymentActionEnum {
|
2
|
+
optional_init = "plugin_optional_init"
|
3
|
+
}
|
4
|
+
export declare enum ApplePayActionEnum {
|
5
|
+
canMakePayments = "plugin_CARD_APPLE_PAY_available",
|
6
|
+
createComponent = "plugin_CARD_APPLE_PAY_createComponent",
|
7
|
+
destoryComponent = "plugin_CARD_APPLE_PAY_destoryComponent"
|
8
|
+
}
|
9
|
+
export declare enum SDKCallbackActionEnum {
|
10
|
+
onEventCallback = "onEventCallback"
|
11
|
+
}
|
12
|
+
export declare enum SecuritySDKActionEnum {
|
13
|
+
getSecurityDeviceId = "getSecurityDeviceId"
|
14
|
+
}
|
15
|
+
export declare enum TrackerActionEnum {
|
16
|
+
/**
|
17
|
+
* level: string info/error
|
18
|
+
* basic: json object
|
19
|
+
* extra: json object
|
20
|
+
*/
|
21
|
+
reportAnalytics = "reportAnalytics"
|
22
|
+
}
|
23
|
+
export declare enum ComponentActiontEnum {
|
24
|
+
onDestory = "onDestory"
|
25
|
+
}
|
26
|
+
export declare enum RequestActiontEnum {
|
27
|
+
onDestory = "httpRequest"
|
28
|
+
}
|
29
|
+
export declare enum LoadingActiontEnum {
|
30
|
+
showLoading = "showLoading",
|
31
|
+
dismissLoading = "dismissLoading"
|
32
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
export var PaymentActionEnum = /*#__PURE__*/function (PaymentActionEnum) {
|
2
|
+
PaymentActionEnum["optional_init"] = "plugin_optional_init";
|
3
|
+
return PaymentActionEnum;
|
4
|
+
}({});
|
5
|
+
export var ApplePayActionEnum = /*#__PURE__*/function (ApplePayActionEnum) {
|
6
|
+
ApplePayActionEnum["canMakePayments"] = "plugin_CARD_APPLE_PAY_available";
|
7
|
+
ApplePayActionEnum["createComponent"] = "plugin_CARD_APPLE_PAY_createComponent";
|
8
|
+
ApplePayActionEnum["destoryComponent"] = "plugin_CARD_APPLE_PAY_destoryComponent";
|
9
|
+
return ApplePayActionEnum;
|
10
|
+
}({});
|
11
|
+
export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum) {
|
12
|
+
SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
|
13
|
+
return SDKCallbackActionEnum;
|
14
|
+
}({});
|
15
|
+
export var SecuritySDKActionEnum = /*#__PURE__*/function (SecuritySDKActionEnum) {
|
16
|
+
SecuritySDKActionEnum["getSecurityDeviceId"] = "getSecurityDeviceId";
|
17
|
+
return SecuritySDKActionEnum;
|
18
|
+
}({});
|
19
|
+
export var TrackerActionEnum = /*#__PURE__*/function (TrackerActionEnum) {
|
20
|
+
TrackerActionEnum["reportAnalytics"] = "reportAnalytics";
|
21
|
+
return TrackerActionEnum;
|
22
|
+
}({});
|
23
|
+
export var ComponentActiontEnum = /*#__PURE__*/function (ComponentActiontEnum) {
|
24
|
+
ComponentActiontEnum["onDestory"] = "onDestory";
|
25
|
+
return ComponentActiontEnum;
|
26
|
+
}({});
|
27
|
+
export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
28
|
+
RequestActiontEnum["onDestory"] = "httpRequest";
|
29
|
+
return RequestActiontEnum;
|
30
|
+
}({});
|
31
|
+
export var LoadingActiontEnum = /*#__PURE__*/function (LoadingActiontEnum) {
|
32
|
+
LoadingActiontEnum["showLoading"] = "showLoading";
|
33
|
+
LoadingActiontEnum["dismissLoading"] = "dismissLoading";
|
34
|
+
return LoadingActiontEnum;
|
35
|
+
}({});
|
@@ -1,24 +1,43 @@
|
|
1
1
|
import ComponentApp from '../../plugin/component';
|
2
|
-
import { componentSignEnum, IcreateComponent, IoptionsParams, IpaymentSessionMetaData, Iselector, Isubmit } from '../../types';
|
2
|
+
import { componentSignEnum, IcreateComponent, IoptionsParams, IpaymentSessionMetaData, Iselector, Isubmit, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum } from '../../types';
|
3
3
|
import CoreInstance from '../instance/index';
|
4
4
|
export declare const getComponentSign: (params: IpaymentSessionMetaData) => componentSignEnum;
|
5
5
|
export declare const parseSessionData: (sessionData: string) => [IpaymentSessionMetaData, string];
|
6
6
|
export declare class AMSComponent extends CoreInstance {
|
7
7
|
_componentApp: ComponentApp;
|
8
|
+
channelType: componentSignEnum[];
|
9
|
+
productSceneVersion: string;
|
8
10
|
constructor(options: IoptionsParams);
|
9
11
|
private parameterInitAndCheck;
|
10
12
|
private pluginAppendIframe;
|
13
|
+
private savePreviousChannel;
|
14
|
+
/**
|
15
|
+
* 初始化 Bus总线的能力
|
16
|
+
*/
|
17
|
+
private registerBusAbility;
|
18
|
+
/**
|
19
|
+
* To determine whether the corresponding payment method is available,
|
20
|
+
* only the channel described in the document will be called, and it will be returned as available by default
|
21
|
+
* @param paymentMethod - described in the document
|
22
|
+
* @param subPaymentMethod - described in the document
|
23
|
+
* @returns
|
24
|
+
*/
|
25
|
+
canMakePayments(paymentMethod: PaymentMethodTypeEnum, subPaymentMethod?: SubPaymentMethodTypeEnum): Promise<boolean>;
|
11
26
|
/**
|
12
27
|
* @description Create component application
|
13
28
|
* @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
|
14
29
|
*/
|
15
30
|
createComponent(params: IcreateComponent): Promise<void>;
|
31
|
+
private createComponentProcess;
|
32
|
+
preloadComponent(channelType: any, productSceneVersion: any): void;
|
33
|
+
clearPreloadIframe(isTimeOut?: boolean): void;
|
16
34
|
/**
|
17
35
|
* @description Create and render components in the specified element area
|
18
36
|
* @param params - The data source created by the component, necessary sessionData, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
|
19
37
|
* @param selector - Necessary element selector ID
|
20
38
|
*/
|
21
39
|
mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
|
40
|
+
private mountComponentProcess;
|
22
41
|
/**
|
23
42
|
* @description Execute payment submission process
|
24
43
|
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|