@rebilly/instruments 12.69.0 → 12.71.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/CHANGELOG.md +2 -2
- package/dist/index.js +57 -9
- package/dist/index.min.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## [12.
|
|
1
|
+
## [12.71.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v12.70.0...instruments/core-v12.71.0) (2025-06-06)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
* **
|
|
6
|
+
* **instruments:** Klarna BNPL payment method ([#11906](https://github.com/Rebilly/rebilly/issues/11906)) ([f3ca281](https://github.com/Rebilly/rebilly/commit/f3ca2816ba58f76c2507b1a391c772e8f373fc6a)), closes [#12632](https://github.com/Rebilly/rebilly/issues/12632)
|
package/dist/index.js
CHANGED
|
@@ -2907,6 +2907,11 @@ function showError(error, isCloseable = true) {
|
|
|
2907
2907
|
});
|
|
2908
2908
|
}
|
|
2909
2909
|
console.error("Rebilly Instruments Error", error);
|
|
2910
|
+
if (error.code === window.Framepay.errorCodes.klarna) {
|
|
2911
|
+
setTimeout(() => {
|
|
2912
|
+
location.reload();
|
|
2913
|
+
}, 3e3);
|
|
2914
|
+
}
|
|
2910
2915
|
window.focus();
|
|
2911
2916
|
}
|
|
2912
2917
|
function showErrorHandler(iframe) {
|
|
@@ -3003,6 +3008,28 @@ function showConfirmationModal({ title, message, confirmText, cancelText }) {
|
|
|
3003
3008
|
});
|
|
3004
3009
|
});
|
|
3005
3010
|
}
|
|
3011
|
+
function klarnaWindowHandler(iframe) {
|
|
3012
|
+
iframe.component.on(
|
|
3013
|
+
`${iframe.name}-open-klarna-window`,
|
|
3014
|
+
(isOpen) => {
|
|
3015
|
+
if (isOpen) {
|
|
3016
|
+
const form = document.querySelector(
|
|
3017
|
+
'[data-rebilly-instruments="form"]'
|
|
3018
|
+
);
|
|
3019
|
+
if (form) {
|
|
3020
|
+
form.classList.add("rebilly-instruments-klarna-open");
|
|
3021
|
+
}
|
|
3022
|
+
} else {
|
|
3023
|
+
const form = document.querySelector(
|
|
3024
|
+
'[data-rebilly-instruments="form"]'
|
|
3025
|
+
);
|
|
3026
|
+
if (form) {
|
|
3027
|
+
form.classList.remove("rebilly-instruments-klarna-open");
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
);
|
|
3032
|
+
}
|
|
3006
3033
|
let ViewIframe$1 = class ViewIframe extends BaseIframe {
|
|
3007
3034
|
constructor(args = {}) {
|
|
3008
3035
|
super(args);
|
|
@@ -3017,6 +3044,7 @@ let ViewIframe$1 = class ViewIframe extends BaseIframe {
|
|
|
3017
3044
|
updateAddonsHandler(this);
|
|
3018
3045
|
updateInvoiceHandler(this);
|
|
3019
3046
|
showConfirmationModalHandler(this);
|
|
3047
|
+
klarnaWindowHandler(this);
|
|
3020
3048
|
}
|
|
3021
3049
|
};
|
|
3022
3050
|
function changeIframeSrcHandler(iframe) {
|
|
@@ -6300,7 +6328,7 @@ function C$1({ options: e2 }) {
|
|
|
6300
6328
|
}
|
|
6301
6329
|
function o2() {
|
|
6302
6330
|
const i = {
|
|
6303
|
-
"REB-API-CONSUMER": `${["Rebilly", e2.appName, "js-sdk"].filter((g) => g).join("/")}@
|
|
6331
|
+
"REB-API-CONSUMER": `${["Rebilly", e2.appName, "js-sdk"].filter((g) => g).join("/")}@f3ca281`
|
|
6304
6332
|
};
|
|
6305
6333
|
return e2.apiKey && (i["REB-APIKEY"] = e2.apiKey), i;
|
|
6306
6334
|
}
|
|
@@ -16557,7 +16585,10 @@ const _ReadyToPayFeatureModel = class _ReadyToPayFeatureModel {
|
|
|
16557
16585
|
billingAgreementToken = "",
|
|
16558
16586
|
paypalClientId = "",
|
|
16559
16587
|
// Plaid fields
|
|
16560
|
-
linkToken = ""
|
|
16588
|
+
linkToken = "",
|
|
16589
|
+
// Klarna fields
|
|
16590
|
+
clientToken = "",
|
|
16591
|
+
sessionId = ""
|
|
16561
16592
|
} = {}) {
|
|
16562
16593
|
this.name = name;
|
|
16563
16594
|
this.expirationTime = expirationTime;
|
|
@@ -16569,12 +16600,15 @@ const _ReadyToPayFeatureModel = class _ReadyToPayFeatureModel {
|
|
|
16569
16600
|
this.billingAgreementToken = billingAgreementToken;
|
|
16570
16601
|
this.paypalClientId = paypalClientId;
|
|
16571
16602
|
this.linkToken = linkToken;
|
|
16603
|
+
this.clientToken = clientToken;
|
|
16604
|
+
this.sessionId = sessionId;
|
|
16572
16605
|
}
|
|
16573
16606
|
};
|
|
16574
16607
|
_ReadyToPayFeatureModel.FeatureName = {
|
|
16575
16608
|
paypalBillingAgreement: "PayPal billing agreement",
|
|
16576
16609
|
googlePay: "Google Pay",
|
|
16577
|
-
applePay: "Apple Pay"
|
|
16610
|
+
applePay: "Apple Pay",
|
|
16611
|
+
klarna: "Klarna"
|
|
16578
16612
|
};
|
|
16579
16613
|
let ReadyToPayFeatureModel = _ReadyToPayFeatureModel;
|
|
16580
16614
|
class ReadyToPayModel {
|
|
@@ -16593,7 +16627,7 @@ class ReadyToPayModel {
|
|
|
16593
16627
|
this.filters = filters;
|
|
16594
16628
|
this.metadata = metadata ? new PaymentMetadataModel(metadata) : null;
|
|
16595
16629
|
}
|
|
16596
|
-
get
|
|
16630
|
+
get optionsExpressPaymentInstrumentsKey() {
|
|
16597
16631
|
var _a;
|
|
16598
16632
|
switch ((_a = this.feature) == null ? void 0 : _a.name) {
|
|
16599
16633
|
case ReadyToPayFeatureModel.FeatureName.paypalBillingAgreement:
|
|
@@ -16627,9 +16661,6 @@ function filterReadyToPay(readyToPay) {
|
|
|
16627
16661
|
// card cvv is required
|
|
16628
16662
|
// expiration month is required
|
|
16629
16663
|
// expiration year is required
|
|
16630
|
-
"Klarna",
|
|
16631
|
-
// Klarna authorization token is required
|
|
16632
|
-
// Klarna session ID is required
|
|
16633
16664
|
// Methods to ignore
|
|
16634
16665
|
"Apple Pay",
|
|
16635
16666
|
// Apple Pay should be used only from payment-card method
|
|
@@ -16653,7 +16684,8 @@ function filterReadyToPay(readyToPay) {
|
|
|
16653
16684
|
const isExpressBlocked = BLOCKED_EXPRESS_METHODS.includes(
|
|
16654
16685
|
(_a = readyData.feature) == null ? void 0 : _a.name
|
|
16655
16686
|
);
|
|
16656
|
-
|
|
16687
|
+
const isKlarna = readyData.method === "Klarna" && !readyData.feature;
|
|
16688
|
+
return !isOldPayPal && !isPlaid && !isBlocked && !isExpressBlocked && !isKlarna;
|
|
16657
16689
|
}).map((fields, index2) => {
|
|
16658
16690
|
const metadata = paymentMethodsMetadata.find(
|
|
16659
16691
|
(methodMetadata) => methodMetadata.apiName === fields.method
|
|
@@ -17388,7 +17420,7 @@ async function mountExpressMethods({ methods, container }) {
|
|
|
17388
17420
|
function generateExpressMethodHeight(method) {
|
|
17389
17421
|
var _a, _b;
|
|
17390
17422
|
let height;
|
|
17391
|
-
const optionId = method.
|
|
17423
|
+
const optionId = method.optionsExpressPaymentInstrumentsKey;
|
|
17392
17424
|
if (!optionId) return "48px";
|
|
17393
17425
|
const { buttonHeight, displayOptions } = ((_b = (_a = state.options) == null ? void 0 : _a.paymentInstruments) == null ? void 0 : _b[optionId]) || {};
|
|
17394
17426
|
if (displayOptions) {
|
|
@@ -20130,6 +20162,22 @@ const vars = (theme2) => `
|
|
|
20130
20162
|
}
|
|
20131
20163
|
}
|
|
20132
20164
|
|
|
20165
|
+
|
|
20166
|
+
div[data-rebilly-instruments="form"].rebilly-instruments-klarna-open {
|
|
20167
|
+
position: fixed;
|
|
20168
|
+
top: 0;
|
|
20169
|
+
bottom: 0;
|
|
20170
|
+
left: 0;
|
|
20171
|
+
right: 0;
|
|
20172
|
+
width: 100vw;
|
|
20173
|
+
height: 100vh;
|
|
20174
|
+
z-index: 99999999999999;
|
|
20175
|
+
}
|
|
20176
|
+
|
|
20177
|
+
div[data-rebilly-instruments="form"].rebilly-instruments-klarna-open .rebilly-instruments-iframe {
|
|
20178
|
+
height: 100% !important;
|
|
20179
|
+
}
|
|
20180
|
+
|
|
20133
20181
|
/* Components. Divider
|
|
20134
20182
|
------------------------------------------------------------ */
|
|
20135
20183
|
.rebilly-instruments-divider {
|