@alipay/ams-checkout 0.0.1711691167-dev.2 → 0.0.1711691167-dev.20
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.
@@ -54,7 +54,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
54
54
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
55
55
|
_defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
|
56
56
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
57
|
-
this._appVersion = '1.
|
57
|
+
this._appVersion = '1.12.0';
|
58
58
|
this._isInitComponent = false;
|
59
59
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
60
60
|
this.createIframeNode = function () {
|
@@ -1,4 +1,6 @@
|
|
1
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; }
|
2
4
|
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
5
|
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
6
|
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); }); }; }
|
@@ -17,7 +19,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
17
19
|
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); }
|
18
20
|
import { BusManager, BusMessage, BusSubscriber } from "../../core/bus";
|
19
21
|
import { PaypalActionEnum, SDKCallbackActionEnum } from "../../core/bus/interface";
|
20
|
-
import {
|
22
|
+
import { queryPaymentInfo } from "../../service";
|
21
23
|
import { eventCodeEnum, payPalConfigurationIntentEnum, PaypalMethodEnum } from "../../types";
|
22
24
|
import { isFunction } from "../../util";
|
23
25
|
import { appendLoadingIcon, isShowLoading } from "../utils";
|
@@ -90,6 +92,8 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
90
92
|
});
|
91
93
|
}
|
92
94
|
var paypalScript = _this.createPaypalScript(paypalPluginProps);
|
95
|
+
// 将script标签添加到DOM中
|
96
|
+
document.body.appendChild(paypalScript);
|
93
97
|
// 在script加载完成后执行回调函数
|
94
98
|
paypalScript.onload = function () {
|
95
99
|
resolve('loading successfully');
|
@@ -98,16 +102,14 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
98
102
|
paypalScript.onerror = function (error) {
|
99
103
|
reject(error);
|
100
104
|
};
|
101
|
-
// 将script标签添加到DOM中
|
102
|
-
document.body.appendChild(paypalScript);
|
103
105
|
});
|
104
106
|
});
|
105
107
|
_defineProperty(_assertThisInitialized(_this), "createPaypalScript", function (paypalPluginProps) {
|
106
108
|
var _paypalPluginProps$pa3, _paypalPluginProps$pa4, _paypalPluginProps$pa5, _paypalPluginProps$pa6;
|
107
|
-
var channelMerchantAccountId = (_paypalPluginProps$pa3 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa3 === void 0 || (_paypalPluginProps$pa3 = _paypalPluginProps$pa3.merchantInfo) === null || _paypalPluginProps$pa3 === void 0 ? void 0 : _paypalPluginProps$pa3.
|
108
|
-
var accessToken = (_paypalPluginProps$pa4 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa4 === void 0 || (_paypalPluginProps$pa4 = _paypalPluginProps$pa4.
|
109
|
+
var channelMerchantAccountId = (_paypalPluginProps$pa3 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa3 === void 0 || (_paypalPluginProps$pa3 = _paypalPluginProps$pa3.merchantInfo) === null || _paypalPluginProps$pa3 === void 0 ? void 0 : _paypalPluginProps$pa3.channelMerchantClientId;
|
110
|
+
var accessToken = (_paypalPluginProps$pa4 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa4 === void 0 || (_paypalPluginProps$pa4 = _paypalPluginProps$pa4.paypal) === null || _paypalPluginProps$pa4 === void 0 ? void 0 : _paypalPluginProps$pa4.accessToken;
|
109
111
|
var locale = paypalPluginProps.locale;
|
110
|
-
var currency = (_paypalPluginProps$pa5 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa5 === void 0 || (_paypalPluginProps$pa5 = _paypalPluginProps$pa5.
|
112
|
+
var currency = (_paypalPluginProps$pa5 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa5 === void 0 || (_paypalPluginProps$pa5 = _paypalPluginProps$pa5.paymentAmount) === null || _paypalPluginProps$pa5 === void 0 ? void 0 : _paypalPluginProps$pa5.currency;
|
111
113
|
var paymentMethodType = (_paypalPluginProps$pa6 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa6 === void 0 || (_paypalPluginProps$pa6 = _paypalPluginProps$pa6.paymentMethodInfo) === null || _paypalPluginProps$pa6 === void 0 ? void 0 : _paypalPluginProps$pa6.paymentMethodType;
|
112
114
|
var _ref2 = (paypalPluginProps === null || paypalPluginProps === void 0 ? void 0 : paypalPluginProps.paypalConfiguration) || {},
|
113
115
|
blockPayPalCreditButton = _ref2.blockPayPalCreditButton,
|
@@ -122,19 +124,15 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
122
124
|
locale: locale,
|
123
125
|
'client-id': channelMerchantAccountId
|
124
126
|
});
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
}
|
135
|
-
if (disableFundingArr.length) {
|
136
|
-
urlSearchParams.append('disable-funding', disableFundingArr.join(','));
|
137
|
-
}
|
127
|
+
var disableFundingArr = [];
|
128
|
+
if (blockPayPalCreditButton && !displayPayPalPayLaterButtonOnly) {
|
129
|
+
disableFundingArr.push('card');
|
130
|
+
}
|
131
|
+
if (blockPayPalPayLaterButton && !displayPayPalPayLaterButtonOnly) {
|
132
|
+
disableFundingArr.push('credit');
|
133
|
+
}
|
134
|
+
if (disableFundingArr.length) {
|
135
|
+
urlSearchParams.append('disable-funding', disableFundingArr.join(','));
|
138
136
|
}
|
139
137
|
if (enableMessages) {
|
140
138
|
urlSearchParams.append('components', 'messages,buttons');
|
@@ -150,7 +148,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
150
148
|
}
|
151
149
|
src += urlSearchParams.toString();
|
152
150
|
script.src = src;
|
153
|
-
script
|
151
|
+
script.setAttribute('data-user-id-token', accessToken);
|
154
152
|
return script;
|
155
153
|
});
|
156
154
|
_defineProperty(_assertThisInitialized(_this), "onShippingChange", /*#__PURE__*/function () {
|
@@ -175,17 +173,23 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
175
173
|
};
|
176
174
|
}());
|
177
175
|
_defineProperty(_assertThisInitialized(_this), "createOrder", /*#__PURE__*/function () {
|
178
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_data, _action, paymentSessionData) {
|
179
|
-
var
|
180
|
-
var
|
176
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_data, _action, paymentSessionData, env, paymentSessionConfig) {
|
177
|
+
var _queryPaymentInfoRes$;
|
178
|
+
var queryPaymentInfoRes;
|
181
179
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
182
180
|
while (1) switch (_context2.prev = _context2.next) {
|
183
181
|
case 0:
|
184
182
|
_context2.next = 2;
|
185
|
-
return
|
183
|
+
return queryPaymentInfo({
|
184
|
+
paymentSessionData: paymentSessionData,
|
185
|
+
paymentSessionConfig: paymentSessionConfig
|
186
|
+
}, {
|
187
|
+
env: env,
|
188
|
+
timeout: 15000
|
189
|
+
}, _this.logger);
|
186
190
|
case 2:
|
187
|
-
|
188
|
-
if (!(!(
|
191
|
+
queryPaymentInfoRes = _context2.sent;
|
192
|
+
if (!(!(queryPaymentInfoRes !== null && queryPaymentInfoRes !== void 0 && queryPaymentInfoRes.success) || !(queryPaymentInfoRes !== null && queryPaymentInfoRes !== void 0 && (_queryPaymentInfoRes$ = queryPaymentInfoRes.extendInfo) !== null && _queryPaymentInfoRes$ !== void 0 && _queryPaymentInfoRes$.channelOrderId))) {
|
189
193
|
_context2.next = 7;
|
190
194
|
break;
|
191
195
|
}
|
@@ -198,14 +202,14 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
198
202
|
});
|
199
203
|
return _context2.abrupt("return");
|
200
204
|
case 7:
|
201
|
-
return _context2.abrupt("return",
|
205
|
+
return _context2.abrupt("return", queryPaymentInfoRes.extendInfo.channelOrderId);
|
202
206
|
case 8:
|
203
207
|
case "end":
|
204
208
|
return _context2.stop();
|
205
209
|
}
|
206
210
|
}, _callee2);
|
207
211
|
}));
|
208
|
-
return function (_x2, _x3, _x4) {
|
212
|
+
return function (_x2, _x3, _x4, _x5, _x6) {
|
209
213
|
return _ref4.apply(this, arguments);
|
210
214
|
};
|
211
215
|
}());
|
@@ -231,7 +235,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
231
235
|
}
|
232
236
|
}, _callee3);
|
233
237
|
}));
|
234
|
-
return function (
|
238
|
+
return function (_x7) {
|
235
239
|
return _ref5.apply(this, arguments);
|
236
240
|
};
|
237
241
|
}());
|
@@ -257,7 +261,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
257
261
|
}
|
258
262
|
}, _callee4);
|
259
263
|
}));
|
260
|
-
return function (
|
264
|
+
return function (_x8) {
|
261
265
|
return _ref6.apply(this, arguments);
|
262
266
|
};
|
263
267
|
}());
|
@@ -281,7 +285,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
281
285
|
}
|
282
286
|
}, _callee5);
|
283
287
|
}));
|
284
|
-
return function (
|
288
|
+
return function (_x9, _x10) {
|
285
289
|
return _ref7.apply(this, arguments);
|
286
290
|
};
|
287
291
|
}());
|
@@ -297,35 +301,43 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
297
301
|
key: "renderPaypalButton",
|
298
302
|
value: function renderPaypalButton(context, message) {
|
299
303
|
var _data$options,
|
304
|
+
_data$options2,
|
300
305
|
_data$appendParams,
|
301
306
|
_data$appendParams2,
|
302
307
|
_data$appendParams3,
|
303
308
|
_data$appendParams4,
|
304
309
|
_data$appendParams5,
|
310
|
+
_data$appendParams6,
|
305
311
|
_this2 = this;
|
306
312
|
var data = message.getJSONObject();
|
307
313
|
var paypalPluginProps = {
|
308
314
|
locale: (_data$options = data.options) === null || _data$options === void 0 ? void 0 : _data$options.locale,
|
315
|
+
environment: (_data$options2 = data.options) === null || _data$options2 === void 0 ? void 0 : _data$options2.environment,
|
309
316
|
paymentSessionData: (_data$appendParams = data.appendParams) === null || _data$appendParams === void 0 || (_data$appendParams = _data$appendParams.iframeNodesParams) === null || _data$appendParams === void 0 ? void 0 : _data$appendParams.sessionData,
|
310
317
|
paymentSessionFactor: (_data$appendParams2 = data.appendParams) === null || _data$appendParams2 === void 0 || (_data$appendParams2 = _data$appendParams2.iframeNodesParams) === null || _data$appendParams2 === void 0 || (_data$appendParams2 = _data$appendParams2.paymentSessionMetaData) === null || _data$appendParams2 === void 0 ? void 0 : _data$appendParams2.paymentSessionFactor,
|
311
318
|
selector: (_data$appendParams3 = data.appendParams) === null || _data$appendParams3 === void 0 || (_data$appendParams3 = _data$appendParams3.iframeNodesParams) === null || _data$appendParams3 === void 0 ? void 0 : _data$appendParams3.selector,
|
312
319
|
paypalConfiguration: (_data$appendParams4 = data.appendParams) === null || _data$appendParams4 === void 0 || (_data$appendParams4 = _data$appendParams4.iframeNodesParams) === null || _data$appendParams4 === void 0 ? void 0 : _data$appendParams4.paypalConfiguration,
|
313
|
-
appearance: (_data$appendParams5 = data.appendParams) === null || _data$appendParams5 === void 0 || (_data$appendParams5 = _data$appendParams5.iframeNodesParams) === null || _data$appendParams5 === void 0 ? void 0 : _data$appendParams5.appearance
|
320
|
+
appearance: (_data$appendParams5 = data.appendParams) === null || _data$appendParams5 === void 0 || (_data$appendParams5 = _data$appendParams5.iframeNodesParams) === null || _data$appendParams5 === void 0 ? void 0 : _data$appendParams5.appearance,
|
321
|
+
paymentSessionConfig: (_data$appendParams6 = data.appendParams) === null || _data$appendParams6 === void 0 || (_data$appendParams6 = _data$appendParams6.iframeNodesParams) === null || _data$appendParams6 === void 0 || (_data$appendParams6 = _data$appendParams6.paymentSessionMetaData) === null || _data$appendParams6 === void 0 ? void 0 : _data$appendParams6.paymentSessionConfig
|
314
322
|
};
|
315
323
|
return this.preCheck(paypalPluginProps).then(function (paypalPluginProps) {
|
316
324
|
return _this2.loadPaypalResource(paypalPluginProps).then(function () {
|
317
|
-
var _paypalPluginProps$pa7, _paypalPluginProps$pa8
|
325
|
+
var _paypalPluginProps$pa7, _paypalPluginProps$pa8;
|
318
326
|
var createButtonConfig = {
|
319
|
-
style: (
|
327
|
+
style: _objectSpread({
|
328
|
+
layout: 'vertical',
|
329
|
+
color: 'gold',
|
330
|
+
shape: 'rect'
|
331
|
+
}, ((_paypalPluginProps$pa7 = paypalPluginProps.paypalConfiguration) === null || _paypalPluginProps$pa7 === void 0 ? void 0 : _paypalPluginProps$pa7.style) || {}),
|
320
332
|
fundingSource: undefined,
|
321
333
|
onShippingChange: _this2.onShippingChange,
|
322
334
|
createOrder: function createOrder(data, action) {
|
323
|
-
return _this2.createOrder(data, action, paypalPluginProps.paymentSessionData);
|
335
|
+
return _this2.createOrder(data, action, paypalPluginProps.paymentSessionData, paypalPluginProps.environment, paypalPluginProps.paymentSessionConfig);
|
324
336
|
},
|
325
337
|
onApprove: _this2.onApprove,
|
326
338
|
onCancel: _this2.onCancel
|
327
339
|
};
|
328
|
-
if ((_paypalPluginProps$
|
340
|
+
if ((_paypalPluginProps$pa8 = paypalPluginProps.paypalConfiguration) !== null && _paypalPluginProps$pa8 !== void 0 && _paypalPluginProps$pa8.displayPayPalPayLaterButtonOnly) {
|
329
341
|
createButtonConfig.fundingSource = window.paypal.FUNDING.PAYLATER;
|
330
342
|
}
|
331
343
|
try {
|
package/esm/plugin/utils.js
CHANGED
@@ -1,3 +1,4 @@
|
|
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); }
|
1
2
|
export var appendLoadingIcon = function appendLoadingIcon(props) {
|
2
3
|
var htmlElement = props.htmlElement,
|
3
4
|
loadingHeight = props.loadingHeight,
|
@@ -17,5 +18,6 @@ export var appendLoadingIcon = function appendLoadingIcon(props) {
|
|
17
18
|
}
|
18
19
|
};
|
19
20
|
export var isShowLoading = function isShowLoading(showLoading) {
|
21
|
+
console.log('showLoading测试', showLoading, _typeof(showLoading), typeof showLoading === 'boolean' ? showLoading : true);
|
20
22
|
return showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
21
23
|
};
|
package/esm/types/index.d.ts
CHANGED
@@ -112,7 +112,7 @@ export interface IbillingAddress {
|
|
112
112
|
export interface Isubmit {
|
113
113
|
billingAddress?: IbillingAddress;
|
114
114
|
}
|
115
|
-
interface IpaymentSessionConfig {
|
115
|
+
export interface IpaymentSessionConfig {
|
116
116
|
productScene: productSceneEnum;
|
117
117
|
paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
|
118
118
|
productSceneVersion: string;
|
@@ -212,12 +212,12 @@ export interface IpaymentSessionMetaData {
|
|
212
212
|
export interface IPaymentSessionFactor {
|
213
213
|
merchantInfo?: IMerchantInfo;
|
214
214
|
paymentMethodInfo: IPaymentMethodInfo;
|
215
|
+
paymentAmount?: IPaymentAmount;
|
216
|
+
paypal?: IPaypalConfig;
|
215
217
|
}
|
216
218
|
export interface IPaymentMethodInfo {
|
217
|
-
paymentAmount?: IPaymentAmount;
|
218
219
|
paymentMethodMetaData?: IPaymentMethodMetaData;
|
219
220
|
paymentMethodType?: PaypalMethodEnum;
|
220
|
-
paypal?: IPaypalConfig;
|
221
221
|
}
|
222
222
|
export type IPaypalConfig = {
|
223
223
|
accessToken: string;
|
@@ -227,7 +227,7 @@ export interface IPaymentMethodMetaData {
|
|
227
227
|
boundPaymentMethod?: string;
|
228
228
|
}
|
229
229
|
export interface IMerchantInfo {
|
230
|
-
|
230
|
+
channelMerchantClientId?: string;
|
231
231
|
}
|
232
232
|
export interface IPaymentAmount {
|
233
233
|
value?: string;
|
@@ -437,6 +437,9 @@ export interface CashierSdkActionQueryResult {
|
|
437
437
|
applinkUrl?: string;
|
438
438
|
schemeUrl?: string;
|
439
439
|
authUrl?: string;
|
440
|
+
extendInfo?: {
|
441
|
+
channelOrderId?: string;
|
442
|
+
};
|
440
443
|
}
|
441
444
|
/**
|
442
445
|
* Get App Pay Payment Session Request.
|
@@ -535,4 +538,3 @@ export type IAppendParams = {
|
|
535
538
|
componentSign: componentSignEnum;
|
536
539
|
iframeNodesParams: IappendIframeNodesParams;
|
537
540
|
};
|
538
|
-
export {};
|