@alipay/ams-checkout 0.0.1710212811-dev.9 → 0.0.1710748686-dev.2
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/constant/index.d.ts +2 -2
- package/esm/constant/index.js +4 -4
- 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 +0 -2
- package/esm/plugin/component/index.js +12 -12
- package/esm/types/index.d.ts +2 -47
- package/esm/types/index.js +0 -8
- 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
@@ -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);
|