@lightspeed/online-payments-sdk 0.2.2 → 0.2.3-rc1
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/cjs/v1/stripe/widget.js +18 -11
- package/dist/cjs/v1/widget.js +2 -1
- package/dist/v1/common.d.ts +1 -0
- package/dist/v1/stripe/widget.js +18 -11
- package/dist/v1/widget.d.ts +1 -1
- package/dist/v1/widget.js +2 -1
- package/package.json +1 -1
|
@@ -73,25 +73,32 @@ function init(context) {
|
|
|
73
73
|
}
|
|
74
74
|
function mount(mountElement, context, listeners, defaultValues) {
|
|
75
75
|
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
-
var _a, stripe, elements, paymentElement;
|
|
76
|
+
var _a, stripe, elements, options, paymentElement;
|
|
77
77
|
var _this = this;
|
|
78
78
|
return __generator(this, function (_b) {
|
|
79
79
|
switch (_b.label) {
|
|
80
80
|
case 0: return [4 /*yield*/, init(context)];
|
|
81
81
|
case 1:
|
|
82
82
|
_a = _b.sent(), stripe = _a.stripe, elements = _a.elements;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
options = {
|
|
84
|
+
wallets: {
|
|
85
|
+
applePay: 'never',
|
|
86
|
+
googlePay: 'never',
|
|
87
|
+
link: 'never',
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
if (defaultValues) {
|
|
91
|
+
options.defaultValues = {
|
|
92
|
+
billingDetails: {
|
|
93
|
+
address: {
|
|
94
|
+
country: defaultValues.country,
|
|
95
|
+
postal_code: defaultValues.postalCode,
|
|
91
96
|
},
|
|
92
97
|
},
|
|
93
|
-
}
|
|
94
|
-
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
paymentElement = elements.create('payment', options);
|
|
101
|
+
paymentElement.on('ready', function () { var _a; return (_a = listeners.onReady) === null || _a === void 0 ? void 0 : _a.call(listeners); });
|
|
95
102
|
paymentElement.mount(mountElement);
|
|
96
103
|
return [2 /*return*/, {
|
|
97
104
|
unmount: function () { return paymentElement.unmount(); },
|
package/dist/cjs/v1/widget.js
CHANGED
|
@@ -46,7 +46,7 @@ var logger_1 = require("./logging/logger");
|
|
|
46
46
|
function mountPaymentWidget(session_2, _a) {
|
|
47
47
|
return __awaiter(this, arguments, void 0, function (session, _b) {
|
|
48
48
|
var decodedSession, logger, handlers, widgetController, _c;
|
|
49
|
-
var mountPoint = _b.mountPoint, onComplete = _b.onComplete, onFail = _b.onFail, defaultValues = _b.defaultValues;
|
|
49
|
+
var mountPoint = _b.mountPoint, onComplete = _b.onComplete, onFail = _b.onFail, onReady = _b.onReady, defaultValues = _b.defaultValues;
|
|
50
50
|
return __generator(this, function (_d) {
|
|
51
51
|
switch (_d.label) {
|
|
52
52
|
case 0:
|
|
@@ -56,6 +56,7 @@ function mountPaymentWidget(session_2, _a) {
|
|
|
56
56
|
handlers = {
|
|
57
57
|
onComplete: (0, common_1.withLogging)(logger, 'complete', onComplete || (function () { })),
|
|
58
58
|
onFail: (0, common_1.withLogging)(logger, 'fail', onFail || (function () { })),
|
|
59
|
+
onReady: (0, common_1.withLogging)(logger, 'ready', onReady || (function () { })),
|
|
59
60
|
};
|
|
60
61
|
logger.log('info', 'mount', { sessionContext: decodedSession.context });
|
|
61
62
|
_c = decodedSession.psp;
|
package/dist/v1/common.d.ts
CHANGED
package/dist/v1/stripe/widget.js
CHANGED
|
@@ -68,25 +68,32 @@ function init(context) {
|
|
|
68
68
|
}
|
|
69
69
|
export function mount(mountElement, context, listeners, defaultValues) {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var _a, stripe, elements, paymentElement;
|
|
71
|
+
var _a, stripe, elements, options, paymentElement;
|
|
72
72
|
var _this = this;
|
|
73
73
|
return __generator(this, function (_b) {
|
|
74
74
|
switch (_b.label) {
|
|
75
75
|
case 0: return [4 /*yield*/, init(context)];
|
|
76
76
|
case 1:
|
|
77
77
|
_a = _b.sent(), stripe = _a.stripe, elements = _a.elements;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
options = {
|
|
79
|
+
wallets: {
|
|
80
|
+
applePay: 'never',
|
|
81
|
+
googlePay: 'never',
|
|
82
|
+
link: 'never',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
if (defaultValues) {
|
|
86
|
+
options.defaultValues = {
|
|
87
|
+
billingDetails: {
|
|
88
|
+
address: {
|
|
89
|
+
country: defaultValues.country,
|
|
90
|
+
postal_code: defaultValues.postalCode,
|
|
86
91
|
},
|
|
87
92
|
},
|
|
88
|
-
}
|
|
89
|
-
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
paymentElement = elements.create('payment', options);
|
|
96
|
+
paymentElement.on('ready', function () { var _a; return (_a = listeners.onReady) === null || _a === void 0 ? void 0 : _a.call(listeners); });
|
|
90
97
|
paymentElement.mount(mountElement);
|
|
91
98
|
return [2 /*return*/, {
|
|
92
99
|
unmount: function () { return paymentElement.unmount(); },
|
package/dist/v1/widget.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export type PaymentWidgetConfiguration = {
|
|
|
3
3
|
mountPoint: HTMLElement;
|
|
4
4
|
defaultValues?: DefaultValues;
|
|
5
5
|
} & Callbacks;
|
|
6
|
-
export declare function mountPaymentWidget(session: string, { mountPoint, onComplete, onFail, defaultValues }: PaymentWidgetConfiguration): Promise<WidgetController>;
|
|
6
|
+
export declare function mountPaymentWidget(session: string, { mountPoint, onComplete, onFail, onReady, defaultValues, }: PaymentWidgetConfiguration): Promise<WidgetController>;
|
package/dist/v1/widget.js
CHANGED
|
@@ -43,7 +43,7 @@ import { getLogger } from './logging/logger';
|
|
|
43
43
|
export function mountPaymentWidget(session_1, _a) {
|
|
44
44
|
return __awaiter(this, arguments, void 0, function (session, _b) {
|
|
45
45
|
var decodedSession, logger, handlers, widgetController, _c;
|
|
46
|
-
var mountPoint = _b.mountPoint, onComplete = _b.onComplete, onFail = _b.onFail, defaultValues = _b.defaultValues;
|
|
46
|
+
var mountPoint = _b.mountPoint, onComplete = _b.onComplete, onFail = _b.onFail, onReady = _b.onReady, defaultValues = _b.defaultValues;
|
|
47
47
|
return __generator(this, function (_d) {
|
|
48
48
|
switch (_d.label) {
|
|
49
49
|
case 0:
|
|
@@ -53,6 +53,7 @@ export function mountPaymentWidget(session_1, _a) {
|
|
|
53
53
|
handlers = {
|
|
54
54
|
onComplete: withLogging(logger, 'complete', onComplete || (function () { })),
|
|
55
55
|
onFail: withLogging(logger, 'fail', onFail || (function () { })),
|
|
56
|
+
onReady: withLogging(logger, 'ready', onReady || (function () { })),
|
|
56
57
|
};
|
|
57
58
|
logger.log('info', 'mount', { sessionContext: decodedSession.context });
|
|
58
59
|
_c = decodedSession.psp;
|
package/package.json
CHANGED