@alipay/ams-checkout 0.0.1730107332-dev.24 → 0.0.1730107332-dev.26
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.inline.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 +3 -0
- package/esm/constant/index.js +3 -0
- 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 +36 -0
- package/esm/core/bus/interface.js +40 -0
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +89 -0
- package/esm/core/component/ckp/index.d.ts +27 -0
- package/esm/core/component/ckp/index.js +166 -0
- package/esm/core/component/index.d.ts +51 -0
- package/esm/core/component/index.js +531 -0
- package/esm/core/drop-in/index.d.ts +22 -0
- package/esm/core/drop-in/index.js +104 -0
- package/esm/core/instance/index.d.ts +89 -0
- package/esm/core/instance/index.js +499 -0
- package/esm/foundation/core/index.d.ts +2 -2
- package/esm/foundation/index.d.ts +5 -5
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +2 -2
- package/esm/foundation/product-processor/easysafepay/deps.js +1 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -2
- package/esm/foundation/service/api-bus/index.d.ts +2 -2
- package/esm/foundation/service/container/index.d.ts +2 -2
- package/esm/foundation/service/event-center.d.ts +4 -4
- package/esm/foundation/service/event-center.js +10 -10
- package/esm/foundation/service/global-data/index.d.ts +2 -2
- package/esm/foundation/service/index.d.ts +2 -2
- package/esm/foundation/service/log/index.d.ts +2 -2
- package/esm/foundation/service/requester/deps.d.ts +1 -1
- package/esm/foundation/service/requester/requester.d.ts +2 -2
- package/esm/foundation/service/security/index.d.ts +2 -2
- package/esm/foundation/utils/redirect_utils.d.ts +5 -0
- package/esm/foundation/utils/redirect_utils.js +135 -1
- package/esm/foundation/utils/web_app_url_utils.js +1 -1
- package/esm/index.d.ts +27 -2
- package/esm/index.js +131 -6
- package/esm/plugin/applepay/component.d.ts +50 -0
- package/esm/plugin/applepay/component.js +339 -0
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/plugin/applepay/interface.d.ts +161 -0
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/plugin/applepay/service.d.ts +54 -0
- package/esm/plugin/applepay/service.js +289 -0
- package/esm/plugin/component/cashierApp.d.ts +34 -0
- package/esm/plugin/component/cashierApp.js +237 -0
- package/esm/plugin/component/channel.d.ts +21 -0
- package/esm/plugin/component/channel.js +89 -0
- package/esm/plugin/component/component.inline.style.d.ts +10 -0
- package/esm/plugin/component/component.inline.style.js +119 -0
- package/esm/plugin/component/component.popup.style.d.ts +16 -0
- package/esm/plugin/component/component.popup.style.js +174 -0
- package/esm/plugin/component/index.d.ts +126 -0
- package/esm/plugin/component/index.js +1839 -0
- package/esm/plugin/component/popupWindow.style.d.ts +11 -0
- package/esm/plugin/component/popupWindow.style.js +121 -0
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +33 -0
- package/esm/plugin/drop-in/index.d.ts +71 -0
- package/esm/plugin/drop-in/index.js +324 -0
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +390 -0
- package/esm/plugin/type.d.ts +34 -0
- package/esm/plugin/type.js +1 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- package/esm/types/index.d.ts +28 -9
- package/esm/types/index.js +5 -1
- package/esm/util/createIframeNode.d.ts +6 -0
- package/esm/util/createIframeNode.js +48 -0
- package/esm/util/getBackScheme.d.ts +2 -2
- package/esm/util/getBackScheme.js +2 -2
- package/esm/util/index.d.ts +11 -1
- package/esm/util/index.js +84 -3
- package/esm/util/intl-callapp/es/index.js +0 -1
- package/esm/util/security.d.ts +33 -0
- package/esm/util/security.js +182 -0
- package/package.json +2 -2
- package/esm/foundation/types/index.d.ts +0 -4
- package/esm/foundation/types/index.js +0 -4
@@ -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,36 @@
|
|
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
|
+
destroyComponent = "plugin_CARD_APPLE_PAY_destroyComponent"
|
8
|
+
}
|
9
|
+
export declare enum PaypalActionEnum {
|
10
|
+
mountComponent = "plugin_Paypal_mountComponent",
|
11
|
+
destroyComponent = "plugin_Paypal_destroyComponent"
|
12
|
+
}
|
13
|
+
export declare enum SDKCallbackActionEnum {
|
14
|
+
onEventCallback = "onEventCallback"
|
15
|
+
}
|
16
|
+
export declare enum SecuritySDKActionEnum {
|
17
|
+
getSecurityDeviceId = "getSecurityDeviceId"
|
18
|
+
}
|
19
|
+
export declare enum TrackerActionEnum {
|
20
|
+
/**
|
21
|
+
* level: string info/error
|
22
|
+
* basic: json object
|
23
|
+
* extra: json object
|
24
|
+
*/
|
25
|
+
reportAnalytics = "reportAnalytics"
|
26
|
+
}
|
27
|
+
export declare enum ComponentActiontEnum {
|
28
|
+
onDestory = "onDestory"
|
29
|
+
}
|
30
|
+
export declare enum RequestActiontEnum {
|
31
|
+
onDestory = "httpRequest"
|
32
|
+
}
|
33
|
+
export declare enum LoadingActiontEnum {
|
34
|
+
showLoading = "showLoading",
|
35
|
+
dismissLoading = "dismissLoading"
|
36
|
+
}
|
@@ -0,0 +1,40 @@
|
|
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["destroyComponent"] = "plugin_CARD_APPLE_PAY_destroyComponent";
|
9
|
+
return ApplePayActionEnum;
|
10
|
+
}({});
|
11
|
+
export var PaypalActionEnum = /*#__PURE__*/function (PaypalActionEnum) {
|
12
|
+
PaypalActionEnum["mountComponent"] = "plugin_Paypal_mountComponent";
|
13
|
+
PaypalActionEnum["destroyComponent"] = "plugin_Paypal_destroyComponent";
|
14
|
+
return PaypalActionEnum;
|
15
|
+
}({});
|
16
|
+
export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum) {
|
17
|
+
SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
|
18
|
+
return SDKCallbackActionEnum;
|
19
|
+
}({});
|
20
|
+
export var SecuritySDKActionEnum = /*#__PURE__*/function (SecuritySDKActionEnum) {
|
21
|
+
SecuritySDKActionEnum["getSecurityDeviceId"] = "getSecurityDeviceId";
|
22
|
+
return SecuritySDKActionEnum;
|
23
|
+
}({});
|
24
|
+
export var TrackerActionEnum = /*#__PURE__*/function (TrackerActionEnum) {
|
25
|
+
TrackerActionEnum["reportAnalytics"] = "reportAnalytics";
|
26
|
+
return TrackerActionEnum;
|
27
|
+
}({});
|
28
|
+
export var ComponentActiontEnum = /*#__PURE__*/function (ComponentActiontEnum) {
|
29
|
+
ComponentActiontEnum["onDestory"] = "onDestory";
|
30
|
+
return ComponentActiontEnum;
|
31
|
+
}({});
|
32
|
+
export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
33
|
+
RequestActiontEnum["onDestory"] = "httpRequest";
|
34
|
+
return RequestActiontEnum;
|
35
|
+
}({});
|
36
|
+
export var LoadingActiontEnum = /*#__PURE__*/function (LoadingActiontEnum) {
|
37
|
+
LoadingActiontEnum["showLoading"] = "showLoading";
|
38
|
+
LoadingActiontEnum["dismissLoading"] = "dismissLoading";
|
39
|
+
return LoadingActiontEnum;
|
40
|
+
}({});
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { IoptionsParams } from '../../types';
|
2
|
+
import { AMSComponent } from './index';
|
3
|
+
export declare class AddressComponent extends AMSComponent {
|
4
|
+
constructor(options: IoptionsParams & {
|
5
|
+
appVersion: string;
|
6
|
+
});
|
7
|
+
getValue(hasValidate?: boolean): Promise<unknown>;
|
8
|
+
}
|
@@ -0,0 +1,72 @@
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
+
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
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
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); }
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
12
|
+
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
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
14
|
+
/**
|
15
|
+
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
16
|
+
*
|
17
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
18
|
+
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
19
|
+
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
20
|
+
*/
|
21
|
+
import { v4 as uuid } from 'uuid';
|
22
|
+
import { BusManager, BusMessage } from "../bus";
|
23
|
+
import { AMSComponent } from "./index";
|
24
|
+
export var AddressComponent = /*#__PURE__*/function (_AMSComponent) {
|
25
|
+
_inherits(AddressComponent, _AMSComponent);
|
26
|
+
var _super = _createSuper(AddressComponent);
|
27
|
+
function AddressComponent(options) {
|
28
|
+
_classCallCheck(this, AddressComponent);
|
29
|
+
return _super.call(this, options);
|
30
|
+
}
|
31
|
+
_createClass(AddressComponent, [{
|
32
|
+
key: "getValue",
|
33
|
+
value: function getValue(hasValidate) {
|
34
|
+
var _this = this;
|
35
|
+
return new Promise(function (resolve, reject) {
|
36
|
+
try {
|
37
|
+
var _this$getBusActionNam;
|
38
|
+
var eventCallbackId = uuid();
|
39
|
+
_this.logger.logInfo({
|
40
|
+
title: 'sdk_event_apiGetValue'
|
41
|
+
});
|
42
|
+
var actionName = (_this$getBusActionNam = _this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.getValue;
|
43
|
+
if (actionName && BusManager.isSubscribed(actionName)) {
|
44
|
+
// 执行出错了,在通用拦截器返回
|
45
|
+
BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
|
46
|
+
appendParams: _this._appendParams,
|
47
|
+
options: _this.originOptions,
|
48
|
+
data: hasValidate
|
49
|
+
}))).then(function (busMessage) {
|
50
|
+
resolve(busMessage === null || busMessage === void 0 ? void 0 : busMessage.getJSONObject());
|
51
|
+
});
|
52
|
+
} else {
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
54
|
+
_this._eventCenter.once(eventCallbackId, function (_data) {
|
55
|
+
resolve(_data);
|
56
|
+
});
|
57
|
+
_this._componentApp.dispatchToApp({
|
58
|
+
context: {
|
59
|
+
event: 'getValue',
|
60
|
+
eventCallbackId: eventCallbackId,
|
61
|
+
data: hasValidate
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
} catch (error) {
|
66
|
+
reject(error);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}]);
|
71
|
+
return AddressComponent;
|
72
|
+
}(AMSComponent);
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function loadChannelPneumaticControl(paymentSessionFactor: any, logger: any): Promise<unknown>;
|
@@ -0,0 +1,89 @@
|
|
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
5
|
+
import { loadSDKScript } from "../../util";
|
6
|
+
export function loadChannelPneumaticControl(_x, _x2) {
|
7
|
+
return _loadChannelPneumaticControl.apply(this, arguments);
|
8
|
+
}
|
9
|
+
function _loadChannelPneumaticControl() {
|
10
|
+
_loadChannelPneumaticControl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(paymentSessionFactor, logger) {
|
11
|
+
var _ref, _ref$frontModulesToBe, frontModulesToBeLoaded, paymentRequestId;
|
12
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
13
|
+
while (1) switch (_context2.prev = _context2.next) {
|
14
|
+
case 0:
|
15
|
+
_ref = paymentSessionFactor || {}, _ref$frontModulesToBe = _ref.frontModulesToBeLoaded, frontModulesToBeLoaded = _ref$frontModulesToBe === void 0 ? [] : _ref$frontModulesToBe, paymentRequestId = _ref.paymentRequestId;
|
16
|
+
if (Array.isArray(frontModulesToBeLoaded)) {
|
17
|
+
_context2.next = 3;
|
18
|
+
break;
|
19
|
+
}
|
20
|
+
return _context2.abrupt("return");
|
21
|
+
case 3:
|
22
|
+
if (!(frontModulesToBeLoaded.length === 0)) {
|
23
|
+
_context2.next = 5;
|
24
|
+
break;
|
25
|
+
}
|
26
|
+
return _context2.abrupt("return");
|
27
|
+
case 5:
|
28
|
+
return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
|
29
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) {
|
30
|
+
var NONE_LOAD_SDK_CHANNEL_LIST, promiseList;
|
31
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
32
|
+
while (1) switch (_context.prev = _context.next) {
|
33
|
+
case 0:
|
34
|
+
NONE_LOAD_SDK_CHANNEL_LIST = /*#__PURE__*/function (NONE_LOAD_SDK_CHANNEL_LIST) {
|
35
|
+
NONE_LOAD_SDK_CHANNEL_LIST["AIRWALLEX"] = "AIRWALLEX";
|
36
|
+
return NONE_LOAD_SDK_CHANNEL_LIST;
|
37
|
+
}({});
|
38
|
+
promiseList = [];
|
39
|
+
logger.logInfo({
|
40
|
+
title: 'load_channel_sdk_start'
|
41
|
+
}, {
|
42
|
+
frontModulesToBeLoaded: JSON.stringify(frontModulesToBeLoaded),
|
43
|
+
paymentRequestId: paymentRequestId
|
44
|
+
});
|
45
|
+
frontModulesToBeLoaded.forEach(function (loadItem) {
|
46
|
+
var acquirerName = loadItem.acquirerName,
|
47
|
+
scriptUrl = loadItem.scriptUrl;
|
48
|
+
var promiseItem = null;
|
49
|
+
if (acquirerName === NONE_LOAD_SDK_CHANNEL_LIST.AIRWALLEX) {
|
50
|
+
var attrOptions = {
|
51
|
+
defer: true,
|
52
|
+
id: 'airwallex-fraud-api',
|
53
|
+
'data-order-session-id': paymentRequestId
|
54
|
+
};
|
55
|
+
promiseItem = loadSDKScript({
|
56
|
+
src: scriptUrl,
|
57
|
+
attrOptions: attrOptions,
|
58
|
+
timeOut: 3
|
59
|
+
}, logger);
|
60
|
+
} else {
|
61
|
+
promiseItem = loadSDKScript({
|
62
|
+
src: scriptUrl,
|
63
|
+
timeOut: 3
|
64
|
+
}, logger);
|
65
|
+
}
|
66
|
+
promiseList.push(promiseItem);
|
67
|
+
});
|
68
|
+
_context.next = 6;
|
69
|
+
return Promise.all(promiseList);
|
70
|
+
case 6:
|
71
|
+
resolve(true);
|
72
|
+
case 7:
|
73
|
+
case "end":
|
74
|
+
return _context.stop();
|
75
|
+
}
|
76
|
+
}, _callee);
|
77
|
+
}));
|
78
|
+
return function (_x3) {
|
79
|
+
return _ref2.apply(this, arguments);
|
80
|
+
};
|
81
|
+
}()));
|
82
|
+
case 6:
|
83
|
+
case "end":
|
84
|
+
return _context2.stop();
|
85
|
+
}
|
86
|
+
}, _callee2);
|
87
|
+
}));
|
88
|
+
return _loadChannelPneumaticControl.apply(this, arguments);
|
89
|
+
}
|