@rebilly/instruments 12.70.0 → 12.71.1
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 +3 -3
- package/dist/index.js +59 -10
- 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.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v12.71.0...instruments/core-v12.71.1) (2025-06-09)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
* **
|
|
6
|
+
* **instruments:** Use correct discount amount value for invoice payments flow ([#12656](https://github.com/Rebilly/rebilly/issues/12656)) ([d027353](https://github.com/Rebilly/rebilly/commit/d027353c60d229ef287b08a5aed3bcbe9f0a0cac))
|
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("/")}@d027353`
|
|
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
|
|
@@ -17089,12 +17121,13 @@ class DataInstance {
|
|
|
17089
17121
|
);
|
|
17090
17122
|
}
|
|
17091
17123
|
get summaryItems() {
|
|
17124
|
+
var _a, _b;
|
|
17092
17125
|
const {
|
|
17093
|
-
discountsAmount = null,
|
|
17094
17126
|
shippingAmount = null,
|
|
17095
17127
|
subtotalAmount = null,
|
|
17096
17128
|
taxAmount = null
|
|
17097
17129
|
} = this.previewPurchase || this.invoice || {};
|
|
17130
|
+
const discountsAmount = ((_a = this.previewPurchase) == null ? void 0 : _a.discountsAmount) ?? ((_b = this.invoice) == null ? void 0 : _b.discountAmount) ?? null;
|
|
17098
17131
|
return {
|
|
17099
17132
|
discountsAmount,
|
|
17100
17133
|
shippingAmount,
|
|
@@ -17388,7 +17421,7 @@ async function mountExpressMethods({ methods, container }) {
|
|
|
17388
17421
|
function generateExpressMethodHeight(method) {
|
|
17389
17422
|
var _a, _b;
|
|
17390
17423
|
let height;
|
|
17391
|
-
const optionId = method.
|
|
17424
|
+
const optionId = method.optionsExpressPaymentInstrumentsKey;
|
|
17392
17425
|
if (!optionId) return "48px";
|
|
17393
17426
|
const { buttonHeight, displayOptions } = ((_b = (_a = state.options) == null ? void 0 : _a.paymentInstruments) == null ? void 0 : _b[optionId]) || {};
|
|
17394
17427
|
if (displayOptions) {
|
|
@@ -20130,6 +20163,22 @@ const vars = (theme2) => `
|
|
|
20130
20163
|
}
|
|
20131
20164
|
}
|
|
20132
20165
|
|
|
20166
|
+
|
|
20167
|
+
div[data-rebilly-instruments="form"].rebilly-instruments-klarna-open {
|
|
20168
|
+
position: fixed;
|
|
20169
|
+
top: 0;
|
|
20170
|
+
bottom: 0;
|
|
20171
|
+
left: 0;
|
|
20172
|
+
right: 0;
|
|
20173
|
+
width: 100vw;
|
|
20174
|
+
height: 100vh;
|
|
20175
|
+
z-index: 99999999999999;
|
|
20176
|
+
}
|
|
20177
|
+
|
|
20178
|
+
div[data-rebilly-instruments="form"].rebilly-instruments-klarna-open .rebilly-instruments-iframe {
|
|
20179
|
+
height: 100% !important;
|
|
20180
|
+
}
|
|
20181
|
+
|
|
20133
20182
|
/* Components. Divider
|
|
20134
20183
|
------------------------------------------------------------ */
|
|
20135
20184
|
.rebilly-instruments-divider {
|