@alipay/ams-checkout 0.0.1710212811-dev.9 → 0.0.1710840616-dev.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/common/applepay/index.d.ts +3 -5
- package/esm/common/applepay/index.js +20 -84
- package/esm/common/applepay/interface.d.ts +0 -61
- package/esm/common/applepay/interface.js +1 -73
- package/esm/config/request.js +3 -3
- package/esm/core/applepay/index.d.ts +1 -4
- package/esm/core/applepay/index.js +4 -13
- package/esm/core/component/index.d.ts +1 -7
- package/esm/core/component/index.js +17 -91
- package/esm/core/instance/index.d.ts +0 -1
- package/esm/core/instance/index.js +1 -3
- package/esm/plugin/component/index.d.ts +1 -2
- package/esm/plugin/component/index.js +74 -42
- package/esm/request/index.js +8 -14
- package/esm/types/index.d.ts +7 -47
- package/esm/types/index.js +0 -8
- package/esm/util/versionCompare.d.ts +2 -0
- package/esm/util/versionCompare.js +75 -0
- package/package.json +1 -1
- package/esm/core/bus/ability/sdk.d.ts +0 -9
- package/esm/core/bus/ability/sdk.js +0 -55
- package/esm/core/bus/index.d.ts +0 -63
- package/esm/core/bus/index.js +0 -287
- package/esm/core/bus/interface.d.ts +0 -24
- package/esm/core/bus/interface.js +0 -31
- package/esm/plugin/applepay/index.d.ts +0 -15
- package/esm/plugin/applepay/index.js +0 -99
package/esm/core/bus/index.d.ts
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 扩展协议可序列化的消息定义
|
3
|
-
*/
|
4
|
-
export declare class BusMessage {
|
5
|
-
private action;
|
6
|
-
private data;
|
7
|
-
private jsonData;
|
8
|
-
constructor(action: string, data: string);
|
9
|
-
getAction(): string;
|
10
|
-
getData(): string;
|
11
|
-
isJSONData(): boolean;
|
12
|
-
getJSONObject(): any;
|
13
|
-
private parseJSONData;
|
14
|
-
result(result: boolean): BusMessage;
|
15
|
-
}
|
16
|
-
export type OnBusCallback = (message: BusMessage) => void;
|
17
|
-
/**
|
18
|
-
* 扩展总线可选的Context参数,在Web端用于实时回调
|
19
|
-
*/
|
20
|
-
export declare class BusContext {
|
21
|
-
private callback;
|
22
|
-
constructor(callback: OnBusCallback);
|
23
|
-
onCallBack(message: BusMessage): void;
|
24
|
-
}
|
25
|
-
/**
|
26
|
-
* 扩展能力的能力定义,基于此协议实现扩展能力
|
27
|
-
*/
|
28
|
-
export declare abstract class BusSubscriber {
|
29
|
-
abstract actionNames(): string[];
|
30
|
-
abstract onMessage(context: BusContext, message: BusMessage): void;
|
31
|
-
}
|
32
|
-
/**
|
33
|
-
* 拦截器,可增加扩展性
|
34
|
-
*/
|
35
|
-
export interface BusInterceptor {
|
36
|
-
/**
|
37
|
-
* 未订阅场景拦截
|
38
|
-
* @param actionName
|
39
|
-
*/
|
40
|
-
onUnsubscribedAction?(actionName: string): boolean;
|
41
|
-
/**
|
42
|
-
* 分发消息场景处理异常
|
43
|
-
* @param message
|
44
|
-
*/
|
45
|
-
onPublishException?(message: BusMessage, e: any): void;
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* 事件总线入口,支持的关系为:
|
49
|
-
* 发送者 和 接收者的关系: 一对一,大多数场景,支持callback
|
50
|
-
* 发送者 和 接收者的关系: 多对一, 设计上多一对,但是同一时间点,只会一个发送者,支持callback
|
51
|
-
* 发送者 和 接收者的关系: 一对多,可能有,埋点多重上报?不需要callback,业务场景应该是一个广播场景
|
52
|
-
*/
|
53
|
-
export declare class BusManager {
|
54
|
-
private static interceptors;
|
55
|
-
private static subscribersMap;
|
56
|
-
static clear(): void;
|
57
|
-
static addInterceptor(interceptor: BusInterceptor): void;
|
58
|
-
static publishForResult(message: BusMessage, timeoutMs?: number): Promise<BusMessage>;
|
59
|
-
static publish(message: BusMessage, callback?: OnBusCallback): void;
|
60
|
-
static subscribe(subscriber: BusSubscriber): void;
|
61
|
-
static unsubscribe(subscriber: BusSubscriber): void;
|
62
|
-
static isSubscribed(actionName: string): boolean;
|
63
|
-
}
|
package/esm/core/bus/index.js
DELETED
@@ -1,287 +0,0 @@
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
-
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); } }
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
8
|
-
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; }
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
10
|
-
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); }
|
11
|
-
/**
|
12
|
-
* 扩展协议可序列化的消息定义
|
13
|
-
*/
|
14
|
-
export var BusMessage = /*#__PURE__*/function () {
|
15
|
-
function BusMessage(action, data) {
|
16
|
-
_classCallCheck(this, BusMessage);
|
17
|
-
_defineProperty(this, "action", void 0);
|
18
|
-
_defineProperty(this, "data", void 0);
|
19
|
-
_defineProperty(this, "jsonData", null);
|
20
|
-
this.action = action;
|
21
|
-
this.data = data;
|
22
|
-
}
|
23
|
-
_createClass(BusMessage, [{
|
24
|
-
key: "getAction",
|
25
|
-
value: function getAction() {
|
26
|
-
return this.action;
|
27
|
-
}
|
28
|
-
}, {
|
29
|
-
key: "getData",
|
30
|
-
value: function getData() {
|
31
|
-
return this.data;
|
32
|
-
}
|
33
|
-
}, {
|
34
|
-
key: "isJSONData",
|
35
|
-
value: function isJSONData() {
|
36
|
-
this.parseJSONData();
|
37
|
-
return this.jsonData !== null;
|
38
|
-
}
|
39
|
-
}, {
|
40
|
-
key: "getJSONObject",
|
41
|
-
value: function getJSONObject() {
|
42
|
-
this.parseJSONData();
|
43
|
-
return this.jsonData;
|
44
|
-
}
|
45
|
-
}, {
|
46
|
-
key: "parseJSONData",
|
47
|
-
value: function parseJSONData() {
|
48
|
-
if (this.jsonData === null) {
|
49
|
-
try {
|
50
|
-
this.jsonData = JSON.parse(this.data);
|
51
|
-
} catch (e) {
|
52
|
-
// handle error if JSON parsing fails
|
53
|
-
this.jsonData = null;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}, {
|
58
|
-
key: "result",
|
59
|
-
value: function result(_result) {
|
60
|
-
return new BusMessage(this.action, JSON.stringify({
|
61
|
-
result: _result
|
62
|
-
}));
|
63
|
-
}
|
64
|
-
}]);
|
65
|
-
return BusMessage;
|
66
|
-
}();
|
67
|
-
/**
|
68
|
-
* 扩展总线可选的Context参数,在Web端用于实时回调
|
69
|
-
*/
|
70
|
-
export var BusContext = /*#__PURE__*/function () {
|
71
|
-
function BusContext(callback) {
|
72
|
-
_classCallCheck(this, BusContext);
|
73
|
-
_defineProperty(this, "callback", void 0);
|
74
|
-
this.callback = callback;
|
75
|
-
}
|
76
|
-
_createClass(BusContext, [{
|
77
|
-
key: "onCallBack",
|
78
|
-
value: function onCallBack(message) {
|
79
|
-
if (this.callback) {
|
80
|
-
this.callback(message);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}]);
|
84
|
-
return BusContext;
|
85
|
-
}();
|
86
|
-
|
87
|
-
/**
|
88
|
-
* 扩展能力的能力定义,基于此协议实现扩展能力
|
89
|
-
*/
|
90
|
-
export var BusSubscriber = /*#__PURE__*/_createClass(function BusSubscriber() {
|
91
|
-
_classCallCheck(this, BusSubscriber);
|
92
|
-
});
|
93
|
-
|
94
|
-
/**
|
95
|
-
* 拦截器,可增加扩展性
|
96
|
-
*/
|
97
|
-
|
98
|
-
/**
|
99
|
-
* 事件总线入口,支持的关系为:
|
100
|
-
* 发送者 和 接收者的关系: 一对一,大多数场景,支持callback
|
101
|
-
* 发送者 和 接收者的关系: 多对一, 设计上多一对,但是同一时间点,只会一个发送者,支持callback
|
102
|
-
* 发送者 和 接收者的关系: 一对多,可能有,埋点多重上报?不需要callback,业务场景应该是一个广播场景
|
103
|
-
*/
|
104
|
-
export var BusManager = /*#__PURE__*/function () {
|
105
|
-
function BusManager() {
|
106
|
-
_classCallCheck(this, BusManager);
|
107
|
-
}
|
108
|
-
_createClass(BusManager, null, [{
|
109
|
-
key: "clear",
|
110
|
-
value: function clear() {
|
111
|
-
BusManager.interceptors.length = 0;
|
112
|
-
BusManager.subscribersMap.clear();
|
113
|
-
}
|
114
|
-
}, {
|
115
|
-
key: "addInterceptor",
|
116
|
-
value: function addInterceptor(interceptor) {
|
117
|
-
if (!BusManager.interceptors.includes(interceptor)) {
|
118
|
-
BusManager.interceptors.push(interceptor);
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}, {
|
122
|
-
key: "publishForResult",
|
123
|
-
value: function publishForResult(message) {
|
124
|
-
var _this = this;
|
125
|
-
var timeoutMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000;
|
126
|
-
return new Promise(function (resolve, reject) {
|
127
|
-
_this.publish(message, function (result) {
|
128
|
-
resolve(result);
|
129
|
-
});
|
130
|
-
setTimeout(function () {
|
131
|
-
reject("publish timeout");
|
132
|
-
}, timeoutMs);
|
133
|
-
});
|
134
|
-
}
|
135
|
-
}, {
|
136
|
-
key: "publish",
|
137
|
-
value: function publish(message, callback) {
|
138
|
-
var context = new BusContext(callback);
|
139
|
-
var actionName = message.getAction();
|
140
|
-
var subscribers = BusManager.subscribersMap.get(actionName);
|
141
|
-
if (subscribers) {
|
142
|
-
var _iterator = _createForOfIteratorHelper(subscribers),
|
143
|
-
_step;
|
144
|
-
try {
|
145
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
146
|
-
var subscriber = _step.value;
|
147
|
-
try {
|
148
|
-
subscriber.onMessage(context, message);
|
149
|
-
} catch (e) {
|
150
|
-
var _iterator2 = _createForOfIteratorHelper(BusManager.interceptors),
|
151
|
-
_step2;
|
152
|
-
try {
|
153
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
154
|
-
var interceptor = _step2.value;
|
155
|
-
interceptor === null || interceptor === void 0 || interceptor.onPublishException(message, e);
|
156
|
-
}
|
157
|
-
} catch (err) {
|
158
|
-
_iterator2.e(err);
|
159
|
-
} finally {
|
160
|
-
_iterator2.f();
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
} catch (err) {
|
165
|
-
_iterator.e(err);
|
166
|
-
} finally {
|
167
|
-
_iterator.f();
|
168
|
-
}
|
169
|
-
} else {
|
170
|
-
var handle = false;
|
171
|
-
var _iterator3 = _createForOfIteratorHelper(BusManager.interceptors),
|
172
|
-
_step3;
|
173
|
-
try {
|
174
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
175
|
-
var _interceptor = _step3.value;
|
176
|
-
handle = handle || (_interceptor === null || _interceptor === void 0 ? void 0 : _interceptor.onUnsubscribedAction(message.getAction()));
|
177
|
-
}
|
178
|
-
} catch (err) {
|
179
|
-
_iterator3.e(err);
|
180
|
-
} finally {
|
181
|
-
_iterator3.f();
|
182
|
-
}
|
183
|
-
if (handle) {
|
184
|
-
BusManager.publish(message, callback); // Re-publish the message
|
185
|
-
} else {
|
186
|
-
// BusTraceUtils.notSubscribeMessage(message); // Implement this function as needed
|
187
|
-
}
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
// public static publish(message: BusMessage): void {
|
192
|
-
// const actionName = message.getAction();
|
193
|
-
// const subscribers = BusManager.subscribersMap.get(actionName);
|
194
|
-
// if (subscribers) {
|
195
|
-
// for (const subscriber of subscribers) {
|
196
|
-
// try {
|
197
|
-
// subscriber.onMessage(context, message);
|
198
|
-
// } catch (e) {
|
199
|
-
// // BusTraceUtils.sendMessageError(message, e); // Implement this function as needed
|
200
|
-
// }
|
201
|
-
// }
|
202
|
-
// } else {
|
203
|
-
// let handle = false;
|
204
|
-
// for (const interceptor of BusManager.interceptors) {
|
205
|
-
// handle = handle || interceptor.onUnsubscribedAction(message.getAction());
|
206
|
-
// }
|
207
|
-
// if (handle) {
|
208
|
-
// BusManager.publish(context, message); // Re-publish the message
|
209
|
-
// } else {
|
210
|
-
// // BusTraceUtils.notSubscribeMessage(message); // Implement this function as needed
|
211
|
-
// }
|
212
|
-
// }
|
213
|
-
// }
|
214
|
-
}, {
|
215
|
-
key: "subscribe",
|
216
|
-
value: function subscribe(subscriber) {
|
217
|
-
var _iterator4 = _createForOfIteratorHelper(subscriber.actionNames()),
|
218
|
-
_step4;
|
219
|
-
try {
|
220
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
221
|
-
var _actionName = _step4.value;
|
222
|
-
if (!BusManager.subscribersMap.has(_actionName)) {
|
223
|
-
BusManager.subscribersMap.set(_actionName, []);
|
224
|
-
}
|
225
|
-
var subscribers = BusManager.subscribersMap.get(_actionName);
|
226
|
-
if (subscribers && !subscribers.includes(subscriber)) {
|
227
|
-
subscribers.push(subscriber);
|
228
|
-
}
|
229
|
-
}
|
230
|
-
} catch (err) {
|
231
|
-
_iterator4.e(err);
|
232
|
-
} finally {
|
233
|
-
_iterator4.f();
|
234
|
-
}
|
235
|
-
}
|
236
|
-
}, {
|
237
|
-
key: "unsubscribe",
|
238
|
-
value: function unsubscribe(subscriber) {
|
239
|
-
var _iterator5 = _createForOfIteratorHelper(subscriber.actionNames()),
|
240
|
-
_step5;
|
241
|
-
try {
|
242
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
243
|
-
var _actionName2 = _step5.value;
|
244
|
-
var subscribers = BusManager.subscribersMap.get(_actionName2);
|
245
|
-
if (subscribers) {
|
246
|
-
var index = subscribers.indexOf(subscriber);
|
247
|
-
if (index !== -1) {
|
248
|
-
subscribers.splice(index, 1);
|
249
|
-
}
|
250
|
-
}
|
251
|
-
}
|
252
|
-
} catch (err) {
|
253
|
-
_iterator5.e(err);
|
254
|
-
} finally {
|
255
|
-
_iterator5.f();
|
256
|
-
}
|
257
|
-
}
|
258
|
-
}, {
|
259
|
-
key: "isSubscribed",
|
260
|
-
value: function isSubscribed(actionName) {
|
261
|
-
var subscribers = BusManager.subscribersMap.get(actionName);
|
262
|
-
if (subscribers && subscribers.length > 0) {
|
263
|
-
return true;
|
264
|
-
}
|
265
|
-
var handle = false;
|
266
|
-
var _iterator6 = _createForOfIteratorHelper(BusManager.interceptors),
|
267
|
-
_step6;
|
268
|
-
try {
|
269
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
270
|
-
var interceptor = _step6.value;
|
271
|
-
handle = handle || interceptor.onUnsubscribedAction(actionName);
|
272
|
-
}
|
273
|
-
} catch (err) {
|
274
|
-
_iterator6.e(err);
|
275
|
-
} finally {
|
276
|
-
_iterator6.f();
|
277
|
-
}
|
278
|
-
if (handle) {
|
279
|
-
return BusManager.subscribersMap.has(actionName);
|
280
|
-
}
|
281
|
-
return false;
|
282
|
-
}
|
283
|
-
}]);
|
284
|
-
return BusManager;
|
285
|
-
}();
|
286
|
-
_defineProperty(BusManager, "interceptors", []);
|
287
|
-
_defineProperty(BusManager, "subscribersMap", new Map());
|
@@ -1,24 +0,0 @@
|
|
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 ComponentActiontEnum {
|
13
|
-
onDestory = "onDestory"
|
14
|
-
}
|
15
|
-
export declare enum RequestActiontEnum {
|
16
|
-
onDestory = "httpRequest"
|
17
|
-
}
|
18
|
-
export declare enum MonitorActiontEnum {
|
19
|
-
reportAnalytics = "reportAnalytics"
|
20
|
-
}
|
21
|
-
export declare enum LoadingActiontEnum {
|
22
|
-
showLoading = "showLoading",
|
23
|
-
dismissLoading = "dismissLoading"
|
24
|
-
}
|
@@ -1,31 +0,0 @@
|
|
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 ComponentActiontEnum = /*#__PURE__*/function (ComponentActiontEnum) {
|
16
|
-
ComponentActiontEnum["onDestory"] = "onDestory";
|
17
|
-
return ComponentActiontEnum;
|
18
|
-
}({});
|
19
|
-
export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
20
|
-
RequestActiontEnum["onDestory"] = "httpRequest";
|
21
|
-
return RequestActiontEnum;
|
22
|
-
}({});
|
23
|
-
export var MonitorActiontEnum = /*#__PURE__*/function (MonitorActiontEnum) {
|
24
|
-
MonitorActiontEnum["reportAnalytics"] = "reportAnalytics";
|
25
|
-
return MonitorActiontEnum;
|
26
|
-
}({});
|
27
|
-
export var LoadingActiontEnum = /*#__PURE__*/function (LoadingActiontEnum) {
|
28
|
-
LoadingActiontEnum["showLoading"] = "showLoading";
|
29
|
-
LoadingActiontEnum["dismissLoading"] = "dismissLoading";
|
30
|
-
return LoadingActiontEnum;
|
31
|
-
}({});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { BusContext, BusMessage, BusSubscriber } from "../../core/bus";
|
2
|
-
export declare class ApplePayInitMessage {
|
3
|
-
private environment;
|
4
|
-
private locale;
|
5
|
-
}
|
6
|
-
export declare class ApplePayBusSubscriber extends BusSubscriber {
|
7
|
-
private applePay;
|
8
|
-
constructor();
|
9
|
-
actionNames(): string[];
|
10
|
-
protected onOptionalInit(context: BusContext, message: BusMessage): void;
|
11
|
-
protected onCanMakePayments(context: BusContext, message: BusMessage): void;
|
12
|
-
protected onCreateComponent(context: BusContext, message: BusMessage): void;
|
13
|
-
protected onDestoryComponent(context: BusContext, message: BusMessage): void;
|
14
|
-
onMessage(context: BusContext, message: BusMessage): void;
|
15
|
-
}
|
@@ -1,99 +0,0 @@
|
|
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 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; }
|
3
|
-
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; }
|
4
|
-
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); }
|
5
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
6
|
-
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); }; }
|
7
|
-
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); }
|
8
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
9
|
-
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; } }
|
10
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
11
|
-
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); } }
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
13
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14
|
-
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; }
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
16
|
-
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); }
|
17
|
-
import { BusManager, BusMessage, BusSubscriber } from "../../core/bus";
|
18
|
-
import { ApplePayActionEnum, PaymentActionEnum, SDKCallbackActionEnum } from "../../core/bus/interface";
|
19
|
-
import ApplePayComponent from "../../core/applepay";
|
20
|
-
import ApplePayService from "../../common/applepay";
|
21
|
-
export var ApplePayInitMessage = /*#__PURE__*/_createClass(function ApplePayInitMessage() {
|
22
|
-
_classCallCheck(this, ApplePayInitMessage);
|
23
|
-
_defineProperty(this, "environment", void 0);
|
24
|
-
_defineProperty(this, "locale", void 0);
|
25
|
-
});
|
26
|
-
export var ApplePayBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
27
|
-
_inherits(ApplePayBusSubscriber, _BusSubscriber);
|
28
|
-
var _super = _createSuper(ApplePayBusSubscriber);
|
29
|
-
function ApplePayBusSubscriber() {
|
30
|
-
var _this;
|
31
|
-
_classCallCheck(this, ApplePayBusSubscriber);
|
32
|
-
_this = _super.call(this);
|
33
|
-
_defineProperty(_assertThisInitialized(_this), "applePay", void 0);
|
34
|
-
return _this;
|
35
|
-
}
|
36
|
-
_createClass(ApplePayBusSubscriber, [{
|
37
|
-
key: "actionNames",
|
38
|
-
value: function actionNames() {
|
39
|
-
return Object.values(ApplePayActionEnum).concat(Object.values(PaymentActionEnum));
|
40
|
-
}
|
41
|
-
}, {
|
42
|
-
key: "onOptionalInit",
|
43
|
-
value: function onOptionalInit(context, message) {
|
44
|
-
console.log('onOptionalInit', message.getData());
|
45
|
-
}
|
46
|
-
}, {
|
47
|
-
key: "onCanMakePayments",
|
48
|
-
value: function onCanMakePayments(context, message) {
|
49
|
-
var _message$getJSONObjec;
|
50
|
-
console.log('onCanMakePayments', message.getData());
|
51
|
-
var canMakePayments = ApplePayService.canMakePayments((_message$getJSONObjec = message.getJSONObject()) === null || _message$getJSONObjec === void 0 ? void 0 : _message$getJSONObjec.subPaymentMethod);
|
52
|
-
context === null || context === void 0 || context.onCallBack(message.result(canMakePayments));
|
53
|
-
}
|
54
|
-
}, {
|
55
|
-
key: "onCreateComponent",
|
56
|
-
value: function onCreateComponent(context, message) {
|
57
|
-
var data = message.getJSONObject();
|
58
|
-
console.log('onCreateComponent', message);
|
59
|
-
this.applePay = new ApplePayComponent(_objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.options), {}, {
|
60
|
-
// todo 需要补充其它参数的桥接
|
61
|
-
onEventCallback: function onEventCallback(state) {
|
62
|
-
console.log('onCreateComponent#onEventCallback', state);
|
63
|
-
if (state) {
|
64
|
-
BusManager.publish(new BusMessage(SDKCallbackActionEnum.onEventCallback, JSON.stringify(state)));
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}));
|
68
|
-
var paymentSessionData = data === null || data === void 0 ? void 0 : data.paymentSessionData;
|
69
|
-
this.applePay.submitPay(paymentSessionData);
|
70
|
-
}
|
71
|
-
}, {
|
72
|
-
key: "onDestoryComponent",
|
73
|
-
value: function onDestoryComponent(context, message) {
|
74
|
-
this.applePay = null;
|
75
|
-
console.log('onDestoryComponent', context, message);
|
76
|
-
}
|
77
|
-
}, {
|
78
|
-
key: "onMessage",
|
79
|
-
value: function onMessage(context, message) {
|
80
|
-
switch (message.getAction()) {
|
81
|
-
case PaymentActionEnum.optional_init:
|
82
|
-
this.onOptionalInit(context, message);
|
83
|
-
break;
|
84
|
-
case ApplePayActionEnum.canMakePayments:
|
85
|
-
this.onCanMakePayments(context, message);
|
86
|
-
break;
|
87
|
-
case ApplePayActionEnum.createComponent:
|
88
|
-
this.onCreateComponent(context, message);
|
89
|
-
break;
|
90
|
-
case ApplePayActionEnum.destoryComponent:
|
91
|
-
this.onDestoryComponent(context, message);
|
92
|
-
break;
|
93
|
-
default:
|
94
|
-
console.log("Unknown action: " + message.getAction());
|
95
|
-
}
|
96
|
-
}
|
97
|
-
}]);
|
98
|
-
return ApplePayBusSubscriber;
|
99
|
-
}(BusSubscriber);
|