@alma/widgets 2.3.4 → 2.5.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/dist/raw/widgets.js +166 -75
- package/dist/raw/widgets.js.map +1 -1
- package/dist/raw/widgets.m.js +166 -75
- package/dist/raw/widgets.m.js.map +1 -1
- package/dist/raw/widgets.modern.js +163 -71
- package/dist/raw/widgets.modern.js.map +1 -1
- package/dist/raw/widgets.umd.js +166 -75
- package/dist/raw/widgets.umd.js.map +1 -1
- package/dist/types/Widgets/EligibilityModal/DesktopModal/index.d.ts +3 -1
- package/dist/types/Widgets/EligibilityModal/MobileModal/index.d.ts +3 -1
- package/dist/types/Widgets/EligibilityModal/ModalContainer.test.d.ts +1 -0
- package/dist/types/Widgets/EligibilityModal/classNames.const.d.ts +18 -0
- package/dist/types/Widgets/EligibilityModal/components/Title/index.d.ts +3 -1
- package/dist/types/Widgets/EligibilityModal/modal.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/Basics.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/Credit.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/CustomTransitionDelay.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/HideWidget.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/IneligibleOptions.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/LanguageCheck.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/LaunchModal.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/SuggestedPaymentPlan.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/__tests__/WithoutPlans.test.d.ts +1 -0
- package/dist/types/Widgets/PaymentPlans/classNames.const.d.ts +13 -0
- package/dist/types/test/fixtures.d.ts +41 -0
- package/dist/types/types.d.ts +7 -1
- package/dist/types/utils/index.test.d.ts +1 -0
- package/dist/widgets.js +1 -1
- package/dist/widgets.js.map +1 -1
- package/dist/widgets.m.js +1 -1
- package/dist/widgets.m.js.map +1 -1
- package/dist/widgets.modern.js +1 -1
- package/dist/widgets.modern.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/raw/widgets.js
CHANGED
|
@@ -1838,8 +1838,9 @@ var messagesDE = {
|
|
|
1838
1838
|
"eligibility-modal.credit-commitment": "Ein Kredit verpflichtet Sie und muss zurückgezahlt werden. Prüfen Sie Ihre Rückzahlungsfähigkeit, bevor Sie sich verpflichten.",
|
|
1839
1839
|
"eligibility-modal.credit-cost": "Davon Kreditkosten",
|
|
1840
1840
|
"eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
|
|
1841
|
-
"eligibility-modal.no-eligibility": "Ups, die Simulation
|
|
1842
|
-
"eligibility-modal.title": "<highlighted>Bezahlen Sie in Raten</highlighted>
|
|
1841
|
+
"eligibility-modal.no-eligibility": "Ups, die Simulation hat anscheinend nicht funktioniert.",
|
|
1842
|
+
"eligibility-modal.title": "<highlighted>Bezahlen Sie in Raten</highlighted> per Kreditkarte mit Alma.",
|
|
1843
|
+
"eligibility-modal.title-deferred": "<highlighted>Bezahlen Sie in Raten</highlighted> oder später per Kreditkarte mit Alma.",
|
|
1843
1844
|
"eligibility-modal.total": "Insgesamt",
|
|
1844
1845
|
"installments.today": "Heutzutage",
|
|
1845
1846
|
"payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
|
|
@@ -1861,7 +1862,8 @@ var messagesEN = {
|
|
|
1861
1862
|
"eligibility-modal.credit-cost": "Of which cost of credit",
|
|
1862
1863
|
"eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
|
|
1863
1864
|
"eligibility-modal.no-eligibility": "Oops, looks like the simulation didn't work.",
|
|
1864
|
-
"eligibility-modal.title": "<highlighted>Pay in installments</highlighted>
|
|
1865
|
+
"eligibility-modal.title": "<highlighted>Pay in installments</highlighted> by credit card with Alma.",
|
|
1866
|
+
"eligibility-modal.title-deferred": "<highlighted>Pay in installments</highlighted> or later by credit card with Alma.",
|
|
1865
1867
|
"eligibility-modal.total": "Total",
|
|
1866
1868
|
"installments.today": "Today",
|
|
1867
1869
|
"payment-plan-strings.day-abbreviation": "T{numberOfDeferredDays}",
|
|
@@ -1883,7 +1885,8 @@ var messagesES = {
|
|
|
1883
1885
|
"eligibility-modal.credit-cost": "Coste de crédito (incl. en el total)",
|
|
1884
1886
|
"eligibility-modal.credit-cost-amount": "{creditCost} (TAE {TAEG})",
|
|
1885
1887
|
"eligibility-modal.no-eligibility": "Uy, parece que la simulación no ha funcionado.",
|
|
1886
|
-
"eligibility-modal.title": "<highlighted>Paga a plazos</highlighted>
|
|
1888
|
+
"eligibility-modal.title": "<highlighted>Paga a plazos</highlighted> con tarjeta de crédito con Alma.",
|
|
1889
|
+
"eligibility-modal.title-deferred": "<highlighted>Paga a plazos</highlighted> o más adelante con tu tarjeta, a través de Alma.",
|
|
1887
1890
|
"eligibility-modal.total": "Total",
|
|
1888
1891
|
"installments.today": "Hoy",
|
|
1889
1892
|
"payment-plan-strings.day-abbreviation": "D{numberOfDeferredDays}",
|
|
@@ -1904,8 +1907,9 @@ var messagesFR = {
|
|
|
1904
1907
|
"eligibility-modal.credit-commitment": "Un crédit vous engage et doit être remboursé. Vérifiez vos capacités de remboursement avant de vous engager.",
|
|
1905
1908
|
"eligibility-modal.credit-cost": "Dont coût du crédit",
|
|
1906
1909
|
"eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
|
|
1907
|
-
"eligibility-modal.no-eligibility": "Oups, il semblerait que la simulation n'
|
|
1908
|
-
"eligibility-modal.title": "<highlighted>Payez en plusieurs fois</highlighted>
|
|
1910
|
+
"eligibility-modal.no-eligibility": "Oups, il semblerait que la simulation n'ait pas fonctionné.",
|
|
1911
|
+
"eligibility-modal.title": "<highlighted>Payez en plusieurs fois</highlighted> par carte bancaire avec Alma.",
|
|
1912
|
+
"eligibility-modal.title-deferred": "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
|
|
1909
1913
|
"eligibility-modal.total": "Total",
|
|
1910
1914
|
"installments.today": "Aujourd'hui",
|
|
1911
1915
|
"payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
|
|
@@ -1927,7 +1931,8 @@ var messagesIT = {
|
|
|
1927
1931
|
"eligibility-modal.credit-cost": "Di cui commissioni",
|
|
1928
1932
|
"eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
|
|
1929
1933
|
"eligibility-modal.no-eligibility": "Ops, sembra che la simulazione non abbia funzionato.",
|
|
1930
|
-
"eligibility-modal.title": "<highlighted>Paga a rate</highlighted>
|
|
1934
|
+
"eligibility-modal.title": "<highlighted>Paga a rate</highlighted> con carta di credito con Alma.",
|
|
1935
|
+
"eligibility-modal.title-deferred": "<highlighted>Paga a rate</highlighted> e posticipa il pagamento con Alma, senza interessi.",
|
|
1931
1936
|
"eligibility-modal.total": "Totale",
|
|
1932
1937
|
"installments.today": "Oggi",
|
|
1933
1938
|
"payment-plan-strings.day-abbreviation": "G{numberOfDeferredDays}",
|
|
@@ -1949,7 +1954,8 @@ var messagesNL = {
|
|
|
1949
1954
|
"eligibility-modal.credit-cost": "Waarvan kosten van krediet",
|
|
1950
1955
|
"eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
|
|
1951
1956
|
"eligibility-modal.no-eligibility": "Oeps, het lijkt erop dat de simulatie niet werkte.",
|
|
1952
|
-
"eligibility-modal.title": "<highlighted>Betaal in termijnen</highlighted>
|
|
1957
|
+
"eligibility-modal.title": "<highlighted>Betaal in termijnen</highlighted> met kredietkaart bij Alma.",
|
|
1958
|
+
"eligibility-modal.title-deferred": "<highlighted>Betaal in termijnen</highlighted> of later per credit card met Alma.",
|
|
1953
1959
|
"eligibility-modal.total": "Totaal",
|
|
1954
1960
|
"installments.today": "Tegenwoordig",
|
|
1955
1961
|
"payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
|
|
@@ -2052,16 +2058,34 @@ var fetchFromApi = function fetchFromApi(url, data, headers) {
|
|
|
2052
2058
|
}
|
|
2053
2059
|
};
|
|
2054
2060
|
|
|
2061
|
+
var isPlanEligible = function isPlanEligible(plan, configPlan) {
|
|
2062
|
+
if (!plan.eligible) {
|
|
2063
|
+
return false;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
return configPlan ? plan.purchase_amount >= (configPlan == null ? void 0 : configPlan.minAmount) && plan.purchase_amount <= (configPlan == null ? void 0 : configPlan.maxAmount) : false;
|
|
2067
|
+
};
|
|
2068
|
+
|
|
2069
|
+
var getPaymentPlanBoundaries = function getPaymentPlanBoundaries(plan, configPlan) {
|
|
2070
|
+
var _plan$constraints;
|
|
2071
|
+
|
|
2072
|
+
// When the plan is not eligible, the purchase amount constraints is given from the merchant config
|
|
2073
|
+
var purchaseAmountConstraints = (_plan$constraints = plan.constraints) == null ? void 0 : _plan$constraints.purchase_amount;
|
|
2074
|
+
|
|
2075
|
+
if (purchaseAmountConstraints && configPlan) {
|
|
2076
|
+
return {
|
|
2077
|
+
minAmount: Math.max(configPlan.minAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.minimum),
|
|
2078
|
+
maxAmount: Math.min(configPlan.maxAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.maximum)
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
return configPlan != null ? configPlan : {};
|
|
2083
|
+
};
|
|
2084
|
+
|
|
2055
2085
|
var filterELigibility = function filterELigibility(eligibilities, configPlans) {
|
|
2056
2086
|
// Remove p1x
|
|
2057
2087
|
var filteredEligibilityPlans = eligibilities.filter(function (plan) {
|
|
2058
2088
|
return !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0);
|
|
2059
|
-
}) // Keeps the plans that have a payment_plan property
|
|
2060
|
-
.filter(function (plan) {
|
|
2061
|
-
return plan.payment_plan;
|
|
2062
|
-
}) // Remove plans that have a reasons property
|
|
2063
|
-
.filter(function (plan) {
|
|
2064
|
-
return !plan.reasons;
|
|
2065
2089
|
}); // If no configPlans was provided, return eligibility response
|
|
2066
2090
|
|
|
2067
2091
|
if (!configPlans) {
|
|
@@ -2077,10 +2101,8 @@ var filterELigibility = function filterELigibility(eligibilities, configPlans) {
|
|
|
2077
2101
|
return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
|
|
2078
2102
|
});
|
|
2079
2103
|
return _extends({}, plan, {
|
|
2080
|
-
eligible:
|
|
2081
|
-
|
|
2082
|
-
maxAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount
|
|
2083
|
-
});
|
|
2104
|
+
eligible: isPlanEligible(plan, relatedConfigPlan)
|
|
2105
|
+
}, getPaymentPlanBoundaries(plan, relatedConfigPlan));
|
|
2084
2106
|
});
|
|
2085
2107
|
};
|
|
2086
2108
|
|
|
@@ -2154,6 +2176,29 @@ function CrossIcon(_ref) {
|
|
|
2154
2176
|
}));
|
|
2155
2177
|
}
|
|
2156
2178
|
|
|
2179
|
+
/**
|
|
2180
|
+
* Prefix classes to avoid name collisions.
|
|
2181
|
+
*/
|
|
2182
|
+
var prefix = 'alma-eligibility-modal';
|
|
2183
|
+
/**
|
|
2184
|
+
* Class names for the **eligibility modale** widget.
|
|
2185
|
+
* Those classes are intended to be used by the **merchant developer**.
|
|
2186
|
+
*/
|
|
2187
|
+
|
|
2188
|
+
var STATIC_CUSTOMISATION_CLASSES = {
|
|
2189
|
+
leftSide: prefix + '-left-side',
|
|
2190
|
+
rightSide: prefix + '-right-side',
|
|
2191
|
+
title: prefix + '-title',
|
|
2192
|
+
info: prefix + '-info',
|
|
2193
|
+
infoMessage: prefix + '-info-message',
|
|
2194
|
+
eligibilityOptions: prefix + '-eligibility-options',
|
|
2195
|
+
activeOption: prefix + '-active-option',
|
|
2196
|
+
closeButton: prefix + '-close-button',
|
|
2197
|
+
scheduleDetails: prefix + '-schedule-details',
|
|
2198
|
+
scheduleTotal: prefix + '-schedule-total',
|
|
2199
|
+
scheduleCredit: prefix + '-schedule-credit'
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2157
2202
|
var _excluded = ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"];
|
|
2158
2203
|
|
|
2159
2204
|
var ControlledModal = function ControlledModal(_ref) {
|
|
@@ -2186,7 +2231,7 @@ var ControlledModal = function ControlledModal(_ref) {
|
|
|
2186
2231
|
className: s$1.header
|
|
2187
2232
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
2188
2233
|
onClick: onClose,
|
|
2189
|
-
className: s$1.closeButton,
|
|
2234
|
+
className: cx(s$1.closeButton, STATIC_CUSTOMISATION_CLASSES.closeButton),
|
|
2190
2235
|
"data-testid": "modal-close-button"
|
|
2191
2236
|
}, /*#__PURE__*/React__default.createElement(CrossIcon, null))), /*#__PURE__*/React__default.createElement("div", {
|
|
2192
2237
|
className: cx(s$1.content, contentClassName, (_cx = {}, _cx[s$1.contentScrollable] = scrollable, _cx))
|
|
@@ -2211,6 +2256,20 @@ var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
|
2211
2256
|
return installmentsCount + "x";
|
|
2212
2257
|
}
|
|
2213
2258
|
};
|
|
2259
|
+
|
|
2260
|
+
var withNoFee = function withNoFee(payment) {
|
|
2261
|
+
var _payment$payment_plan;
|
|
2262
|
+
|
|
2263
|
+
if ((_payment$payment_plan = payment.payment_plan) != null && _payment$payment_plan.every(function (plan) {
|
|
2264
|
+
return plan.customer_fee === 0 && plan.customer_interest === 0;
|
|
2265
|
+
})) {
|
|
2266
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, ' ', /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2267
|
+
id: "payment-plan-strings.no-fee",
|
|
2268
|
+
defaultMessage: '(sans frais)'
|
|
2269
|
+
}));
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2272
|
+
|
|
2214
2273
|
var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
2215
2274
|
var deferred_days = payment.deferred_days,
|
|
2216
2275
|
deferred_months = payment.deferred_months,
|
|
@@ -2220,20 +2279,10 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2220
2279
|
_payment$minAmount = payment.minAmount,
|
|
2221
2280
|
minAmount = _payment$minAmount === void 0 ? 0 : _payment$minAmount,
|
|
2222
2281
|
_payment$maxAmount = payment.maxAmount,
|
|
2223
|
-
maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount
|
|
2282
|
+
maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount,
|
|
2283
|
+
payment_plan = payment.payment_plan;
|
|
2224
2284
|
var deferredDaysCount = deferred_days + deferred_months * 30;
|
|
2225
2285
|
|
|
2226
|
-
var withNoFee = function withNoFee() {
|
|
2227
|
-
if (payment.payment_plan.every(function (plan) {
|
|
2228
|
-
return plan.customer_fee === 0 && plan.customer_interest === 0;
|
|
2229
|
-
})) {
|
|
2230
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, ' ', /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2231
|
-
id: "payment-plan-strings.no-fee",
|
|
2232
|
-
defaultMessage: '(sans frais)'
|
|
2233
|
-
}));
|
|
2234
|
-
}
|
|
2235
|
-
};
|
|
2236
|
-
|
|
2237
2286
|
if (!eligible) {
|
|
2238
2287
|
return purchaseAmount > maxAmount ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2239
2288
|
id: "payment-plan-strings.ineligible-greater-than-max",
|
|
@@ -2256,27 +2305,32 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2256
2305
|
})
|
|
2257
2306
|
}
|
|
2258
2307
|
});
|
|
2308
|
+
} else if (!payment_plan) {
|
|
2309
|
+
/* This error should never happen. We added this condition to avoid a typescript warning on
|
|
2310
|
+
payment_plan possibly undefined. As far as we know, it only happens when the plan is not
|
|
2311
|
+
eligible, which is checked above. */
|
|
2312
|
+
throw Error("No payment plan provided for payment in " + installmentsCount + " installments. Please contact us if you see this error.");
|
|
2259
2313
|
} else if (deferredDaysCount !== 0 && installmentsCount === 1) {
|
|
2260
2314
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2261
2315
|
id: "payment-plan-strings.deferred",
|
|
2262
2316
|
defaultMessage: "{totalAmount} \xE0 payer le {dueDate}",
|
|
2263
2317
|
values: {
|
|
2264
2318
|
totalAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2265
|
-
value: priceFromCents(
|
|
2319
|
+
value: priceFromCents(payment_plan[0].total_amount),
|
|
2266
2320
|
style: "currency",
|
|
2267
2321
|
currency: "EUR"
|
|
2268
2322
|
}),
|
|
2269
2323
|
dueDate: /*#__PURE__*/React__default.createElement(reactIntl.FormattedDate, {
|
|
2270
|
-
value: dateFns.secondsToMilliseconds(
|
|
2324
|
+
value: dateFns.secondsToMilliseconds(payment_plan[0].due_date),
|
|
2271
2325
|
day: "numeric",
|
|
2272
2326
|
month: "long",
|
|
2273
2327
|
year: "numeric"
|
|
2274
2328
|
})
|
|
2275
2329
|
}
|
|
2276
|
-
}), withNoFee());
|
|
2330
|
+
}), withNoFee(payment));
|
|
2277
2331
|
} else if (installmentsCount > 0) {
|
|
2278
|
-
var areInstallmentsOfSameAmount =
|
|
2279
|
-
return index === 0 || installment.total_amount ===
|
|
2332
|
+
var areInstallmentsOfSameAmount = payment_plan == null ? void 0 : payment_plan.every(function (installment, index) {
|
|
2333
|
+
return index === 0 || installment.total_amount === payment_plan[0].total_amount;
|
|
2280
2334
|
});
|
|
2281
2335
|
|
|
2282
2336
|
if (areInstallmentsOfSameAmount) {
|
|
@@ -2285,13 +2339,13 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2285
2339
|
defaultMessage: "{installmentsCount} x {totalAmount}",
|
|
2286
2340
|
values: {
|
|
2287
2341
|
totalAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2288
|
-
value: priceFromCents(
|
|
2342
|
+
value: priceFromCents(payment_plan[0].total_amount),
|
|
2289
2343
|
style: "currency",
|
|
2290
2344
|
currency: "EUR"
|
|
2291
2345
|
}),
|
|
2292
2346
|
installmentsCount: installmentsCount
|
|
2293
2347
|
}
|
|
2294
|
-
}), withNoFee());
|
|
2348
|
+
}), withNoFee(payment));
|
|
2295
2349
|
}
|
|
2296
2350
|
|
|
2297
2351
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
@@ -2299,18 +2353,18 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2299
2353
|
defaultMessage: "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
|
|
2300
2354
|
values: {
|
|
2301
2355
|
firstInstallmentAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2302
|
-
value: priceFromCents(
|
|
2356
|
+
value: priceFromCents(payment_plan[0].total_amount),
|
|
2303
2357
|
style: "currency",
|
|
2304
2358
|
currency: "EUR"
|
|
2305
2359
|
}),
|
|
2306
2360
|
numberOfRemainingInstallments: installmentsCount - 1,
|
|
2307
2361
|
othersInstallmentAmount: /*#__PURE__*/React__default.createElement(reactIntl.FormattedNumber, {
|
|
2308
|
-
value: priceFromCents(
|
|
2362
|
+
value: priceFromCents(payment_plan[1].total_amount),
|
|
2309
2363
|
style: "currency",
|
|
2310
2364
|
currency: "EUR"
|
|
2311
2365
|
})
|
|
2312
2366
|
}
|
|
2313
|
-
}), withNoFee());
|
|
2367
|
+
}), withNoFee(payment));
|
|
2314
2368
|
}
|
|
2315
2369
|
|
|
2316
2370
|
return /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
@@ -2326,13 +2380,13 @@ var EligibilityPlansButtons = function EligibilityPlansButtons(_ref) {
|
|
|
2326
2380
|
currentPlanIndex = _ref.currentPlanIndex,
|
|
2327
2381
|
setCurrentPlanIndex = _ref.setCurrentPlanIndex;
|
|
2328
2382
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2329
|
-
className: s$2.buttons
|
|
2383
|
+
className: cx(s$2.buttons, STATIC_CUSTOMISATION_CLASSES.eligibilityOptions)
|
|
2330
2384
|
}, eligibilityPlans.map(function (eligibilityPlan, index) {
|
|
2331
2385
|
var _cx;
|
|
2332
2386
|
|
|
2333
2387
|
return /*#__PURE__*/React__default.createElement("button", {
|
|
2334
2388
|
key: index,
|
|
2335
|
-
className: cx((_cx = {}, _cx[s$2.active] = index === currentPlanIndex, _cx)),
|
|
2389
|
+
className: cx((_cx = {}, _cx[cx(s$2.active, STATIC_CUSTOMISATION_CLASSES.activeOption)] = index === currentPlanIndex, _cx)),
|
|
2336
2390
|
onClick: function onClick() {
|
|
2337
2391
|
return setCurrentPlanIndex(index);
|
|
2338
2392
|
}
|
|
@@ -2351,10 +2405,10 @@ var Schedule = function Schedule(_ref) {
|
|
|
2351
2405
|
var isCredit = currentPlan && currentPlan.installments_count > 4;
|
|
2352
2406
|
var intl = reactIntl.useIntl();
|
|
2353
2407
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2354
|
-
className: s$3.schedule,
|
|
2408
|
+
className: cx(s$3.schedule, STATIC_CUSTOMISATION_CLASSES.scheduleDetails),
|
|
2355
2409
|
"data-testid": "modal-installments-element"
|
|
2356
2410
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2357
|
-
className: cx(s$3.scheduleLine, s$3.total)
|
|
2411
|
+
className: cx(s$3.scheduleLine, s$3.total, STATIC_CUSTOMISATION_CLASSES.scheduleTotal)
|
|
2358
2412
|
}, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2359
2413
|
id: "eligibility-modal.total",
|
|
2360
2414
|
defaultMessage: "Total"
|
|
@@ -2363,7 +2417,7 @@ var Schedule = function Schedule(_ref) {
|
|
|
2363
2417
|
style: "currency",
|
|
2364
2418
|
currency: "EUR"
|
|
2365
2419
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
2366
|
-
className: cx(s$3.scheduleLine, s$3.creditCost)
|
|
2420
|
+
className: cx(s$3.scheduleLine, s$3.creditCost, STATIC_CUSTOMISATION_CLASSES.scheduleCredit)
|
|
2367
2421
|
}, isCredit ? /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2368
2422
|
id: "eligibility-modal.credit-cost",
|
|
2369
2423
|
defaultMessage: "Dont co\xFBt du cr\xE9dit"
|
|
@@ -2416,13 +2470,15 @@ var s$4 = {"list":"_180ro","listItem":"_1HqCO","bullet":"_3B8wx"};
|
|
|
2416
2470
|
|
|
2417
2471
|
var Info = function Info() {
|
|
2418
2472
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2419
|
-
className: s$4.list,
|
|
2473
|
+
className: cx(s$4.list, STATIC_CUSTOMISATION_CLASSES.info),
|
|
2420
2474
|
"data-testid": "modal-info-element"
|
|
2421
2475
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2422
2476
|
className: s$4.listItem
|
|
2423
2477
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2424
2478
|
className: s$4.bullet
|
|
2425
|
-
}, "1"), /*#__PURE__*/React__default.createElement("div",
|
|
2479
|
+
}, "1"), /*#__PURE__*/React__default.createElement("div", {
|
|
2480
|
+
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2481
|
+
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2426
2482
|
id: "eligibility-modal.bullet-1",
|
|
2427
2483
|
defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
|
|
2428
2484
|
values: {
|
|
@@ -2434,7 +2490,9 @@ var Info = function Info() {
|
|
|
2434
2490
|
className: s$4.listItem
|
|
2435
2491
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2436
2492
|
className: s$4.bullet
|
|
2437
|
-
}, "2"), /*#__PURE__*/React__default.createElement("div",
|
|
2493
|
+
}, "2"), /*#__PURE__*/React__default.createElement("div", {
|
|
2494
|
+
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2495
|
+
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2438
2496
|
id: "eligibility-modal.bullet-2",
|
|
2439
2497
|
defaultMessage: "Renseignez les <strong>informations</strong> demand\xE9es.",
|
|
2440
2498
|
values: {
|
|
@@ -2446,7 +2504,9 @@ var Info = function Info() {
|
|
|
2446
2504
|
className: s$4.listItem
|
|
2447
2505
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2448
2506
|
className: s$4.bullet
|
|
2449
|
-
}, "3"), /*#__PURE__*/React__default.createElement("div",
|
|
2507
|
+
}, "3"), /*#__PURE__*/React__default.createElement("div", {
|
|
2508
|
+
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2509
|
+
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2450
2510
|
id: "eligibility-modal.bullet-3",
|
|
2451
2511
|
defaultMessage: "La validation de votre paiement <strong>instantan\xE9e</strong> !",
|
|
2452
2512
|
values: {
|
|
@@ -2502,32 +2562,44 @@ var Logo = function Logo() {
|
|
|
2502
2562
|
|
|
2503
2563
|
var s$6 = {"title":"_3ERx-"};
|
|
2504
2564
|
|
|
2505
|
-
var Title = function Title() {
|
|
2565
|
+
var Title = function Title(_ref) {
|
|
2566
|
+
var isSomePlanDeferred = _ref.isSomePlanDeferred;
|
|
2506
2567
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2507
|
-
className: s$6.title,
|
|
2568
|
+
className: cx(s$6.title, STATIC_CUSTOMISATION_CLASSES.title),
|
|
2508
2569
|
"data-testid": "modal-title-element"
|
|
2509
|
-
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2510
|
-
id:
|
|
2570
|
+
}, isSomePlanDeferred ? /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2571
|
+
id: 'eligibility-modal.title-deferred',
|
|
2511
2572
|
defaultMessage: "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
|
|
2512
2573
|
values: {
|
|
2513
2574
|
highlighted: function highlighted() {
|
|
2514
2575
|
return /*#__PURE__*/React__default.createElement("span", null, [].slice.call(arguments));
|
|
2515
2576
|
}
|
|
2516
2577
|
}
|
|
2578
|
+
}) : /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2579
|
+
id: 'eligibility-modal.title',
|
|
2580
|
+
defaultMessage: "<highlighted>Payez en plusieurs fois</highlighted> par carte bancaire avec Alma.",
|
|
2581
|
+
values: {
|
|
2582
|
+
highlighted: function highlighted() {
|
|
2583
|
+
return /*#__PURE__*/React__default.createElement("span", null, [].slice.call(arguments));
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2517
2586
|
}));
|
|
2518
2587
|
};
|
|
2519
2588
|
|
|
2520
2589
|
var s$7 = {"container":"_21g6u","block":"_3zaP5","left":"_2SBRC"};
|
|
2521
2590
|
|
|
2522
2591
|
var DesktopModal = function DesktopModal(_ref) {
|
|
2523
|
-
var children = _ref.children
|
|
2592
|
+
var children = _ref.children,
|
|
2593
|
+
isSomePlanDeferred = _ref.isSomePlanDeferred;
|
|
2524
2594
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2525
2595
|
className: s$7.container,
|
|
2526
2596
|
"data-testid": "modal-container"
|
|
2527
2597
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2528
|
-
className: cx([s$7.block, s$7.left])
|
|
2529
|
-
}, /*#__PURE__*/React__default.createElement(Title,
|
|
2530
|
-
|
|
2598
|
+
className: cx([s$7.block, s$7.left, STATIC_CUSTOMISATION_CLASSES.leftSide])
|
|
2599
|
+
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
2600
|
+
isSomePlanDeferred: isSomePlanDeferred
|
|
2601
|
+
}), /*#__PURE__*/React__default.createElement(Info, null), /*#__PURE__*/React__default.createElement(Logo, null)), /*#__PURE__*/React__default.createElement("div", {
|
|
2602
|
+
className: cx(s$7.block, STATIC_CUSTOMISATION_CLASSES.rightSide)
|
|
2531
2603
|
}, children));
|
|
2532
2604
|
};
|
|
2533
2605
|
|
|
@@ -2536,11 +2608,14 @@ var s$8 = {"noEligibility":"_17qNJ","loader":"_2oTJq"};
|
|
|
2536
2608
|
var s$9 = {"container":"_2G7Ch"};
|
|
2537
2609
|
|
|
2538
2610
|
var MobileModal = function MobileModal(_ref) {
|
|
2539
|
-
var children = _ref.children
|
|
2611
|
+
var children = _ref.children,
|
|
2612
|
+
isSomePlanDeferred = _ref.isSomePlanDeferred;
|
|
2540
2613
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2541
2614
|
className: s$9.container,
|
|
2542
2615
|
"data-testid": "modal-container"
|
|
2543
|
-
}, /*#__PURE__*/React__default.createElement(Title,
|
|
2616
|
+
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
2617
|
+
isSomePlanDeferred: isSomePlanDeferred
|
|
2618
|
+
}), children, /*#__PURE__*/React__default.createElement(Info, null), /*#__PURE__*/React__default.createElement(Logo, null));
|
|
2544
2619
|
};
|
|
2545
2620
|
|
|
2546
2621
|
var EligibilityModal = function EligibilityModal(_ref) {
|
|
@@ -2561,25 +2636,23 @@ var EligibilityModal = function EligibilityModal(_ref) {
|
|
|
2561
2636
|
return plan.eligible;
|
|
2562
2637
|
});
|
|
2563
2638
|
var currentPlan = eligiblePlans[currentPlanIndex];
|
|
2564
|
-
var
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
setCurrentPlanIndex: setCurrentPlanIndex,
|
|
2568
|
-
currentPlan: currentPlan,
|
|
2569
|
-
status: status
|
|
2570
|
-
};
|
|
2639
|
+
var isSomePlanDeferred = eligibilityPlans.some(function (plan) {
|
|
2640
|
+
return plan.deferred_days > 0 || plan.deferred_months > 0;
|
|
2641
|
+
});
|
|
2571
2642
|
return /*#__PURE__*/React__default.createElement(ControlledModal, {
|
|
2572
2643
|
onClose: onClose,
|
|
2573
2644
|
ariaHideApp: false,
|
|
2574
2645
|
scrollable: true,
|
|
2575
2646
|
isOpen: true
|
|
2576
|
-
}, /*#__PURE__*/React__default.createElement(ModalComponent,
|
|
2647
|
+
}, /*#__PURE__*/React__default.createElement(ModalComponent, {
|
|
2648
|
+
isSomePlanDeferred: isSomePlanDeferred
|
|
2649
|
+
}, status === apiStatus.PENDING && /*#__PURE__*/React__default.createElement("div", {
|
|
2577
2650
|
className: s$8.loader
|
|
2578
2651
|
}, /*#__PURE__*/React__default.createElement(LoadingIndicator, null)), status === apiStatus.SUCCESS && eligiblePlans.length === 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
2579
2652
|
className: s$8.noEligibility
|
|
2580
2653
|
}, /*#__PURE__*/React__default.createElement(reactIntl.FormattedMessage, {
|
|
2581
2654
|
id: "eligibility-modal.no-eligibility",
|
|
2582
|
-
defaultMessage: "Oups, il semblerait que la simulation n'
|
|
2655
|
+
defaultMessage: "Oups, il semblerait que la simulation n'ait pas fonctionn\xE9."
|
|
2583
2656
|
})), status === apiStatus.SUCCESS && eligiblePlans.length >= 1 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(EligibilityPlansButtons, {
|
|
2584
2657
|
eligibilityPlans: eligiblePlans,
|
|
2585
2658
|
currentPlanIndex: currentPlanIndex,
|
|
@@ -2696,6 +2769,24 @@ var getIndexOfActivePlan = function getIndexOfActivePlan(_ref) {
|
|
|
2696
2769
|
return 0;
|
|
2697
2770
|
};
|
|
2698
2771
|
|
|
2772
|
+
/**
|
|
2773
|
+
* Prefix classes to avoid name collisions.
|
|
2774
|
+
*/
|
|
2775
|
+
var prefix$1 = 'alma-payment-plans';
|
|
2776
|
+
/**
|
|
2777
|
+
* Class names for the **payment plans** widget.
|
|
2778
|
+
* Those classes are intended to be used by the **merchant developer**.
|
|
2779
|
+
*/
|
|
2780
|
+
|
|
2781
|
+
var STATIC_CUSTOMISATION_CLASSES$1 = {
|
|
2782
|
+
container: prefix$1 + '-container',
|
|
2783
|
+
eligibilityLine: prefix$1 + '-eligibility-line',
|
|
2784
|
+
eligibilityOptions: prefix$1 + '-eligibility-options',
|
|
2785
|
+
notEligibleOption: prefix$1 + '-not-eligible-option',
|
|
2786
|
+
paymentInfo: prefix$1 + '-payment-info',
|
|
2787
|
+
activeOption: prefix$1 + '-active-option'
|
|
2788
|
+
};
|
|
2789
|
+
|
|
2699
2790
|
var s$b = {"widgetButton":"_TSkFv","logo":"_LJ4nZ","primaryContainer":"_bMClc","paymentPlans":"_17c_S","plan":"_2Kqjn","active":"_3dG_J","notEligible":"_3O1bg","info":"_25GrF","loader":"_30j1O","error":"_R0YlN","errorText":"_2kGhu","errorButton":"_73d_Y","pending":"_1ZDMS","clickable":"_UksZa","unClickable":"_1lr-q"};
|
|
2700
2791
|
|
|
2701
2792
|
var VERY_LONG_TIME_IN_MS = 1000 * 3600 * 24 * 365;
|
|
@@ -2722,7 +2813,7 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
2722
2813
|
eligibilityPlans: eligibilityPlans,
|
|
2723
2814
|
suggestedPaymentPlan: suggestedPaymentPlan != null ? suggestedPaymentPlan : 0
|
|
2724
2815
|
});
|
|
2725
|
-
var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
|
|
2816
|
+
var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
|
|
2726
2817
|
|
|
2727
2818
|
var isTransitionSpecified = transitionDelay !== undefined; // 👈 The merchant has specified a transition time
|
|
2728
2819
|
|
|
@@ -2807,14 +2898,14 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
2807
2898
|
|
|
2808
2899
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
2809
2900
|
onClick: handleOpenModal,
|
|
2810
|
-
className: cx(s$b.widgetButton, (_cx = {}, _cx[s$b.clickable] = eligiblePlans.length > 0, _cx[s$b.unClickable] = eligiblePlans.length === 0, _cx)),
|
|
2901
|
+
className: cx(s$b.widgetButton, (_cx = {}, _cx[s$b.clickable] = eligiblePlans.length > 0, _cx[s$b.unClickable] = eligiblePlans.length === 0, _cx), STATIC_CUSTOMISATION_CLASSES$1.container),
|
|
2811
2902
|
"data-testid": "widget-button"
|
|
2812
2903
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2813
|
-
className: s$b.primaryContainer
|
|
2904
|
+
className: cx(s$b.primaryContainer, STATIC_CUSTOMISATION_CLASSES$1.eligibilityLine)
|
|
2814
2905
|
}, /*#__PURE__*/React__default.createElement(LogoIcon, {
|
|
2815
2906
|
className: s$b.logo
|
|
2816
2907
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
2817
|
-
className: s$b.paymentPlans
|
|
2908
|
+
className: cx(s$b.paymentPlans, STATIC_CUSTOMISATION_CLASSES$1.eligibilityOptions)
|
|
2818
2909
|
}, eligibilityPlans.map(function (eligibilityPlan, key) {
|
|
2819
2910
|
var _cx2;
|
|
2820
2911
|
|
|
@@ -2824,10 +2915,10 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
2824
2915
|
return onHover(key);
|
|
2825
2916
|
},
|
|
2826
2917
|
onMouseOut: onLeave,
|
|
2827
|
-
className: cx(s$b.plan, (_cx2 = {}, _cx2[s$b.active] = current === key, _cx2[s$b.notEligible] = !eligibilityPlan.eligible, _cx2))
|
|
2918
|
+
className: cx(s$b.plan, (_cx2 = {}, _cx2[cx(s$b.active, STATIC_CUSTOMISATION_CLASSES$1.activeOption)] = current === key, _cx2[cx(s$b.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = !eligibilityPlan.eligible, _cx2))
|
|
2828
2919
|
}, paymentPlanShorthandName(eligibilityPlan));
|
|
2829
2920
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
2830
|
-
className: cx(s$b.info, (_cx3 = {}, _cx3[s$b.notEligible] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3))
|
|
2921
|
+
className: cx(s$b.info, (_cx3 = {}, _cx3[cx(s$b.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3), STATIC_CUSTOMISATION_CLASSES$1.paymentInfo)
|
|
2831
2922
|
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/React__default.createElement(EligibilityModal, {
|
|
2832
2923
|
initialPlanIndex: getIndexWithinEligiblePlans(current),
|
|
2833
2924
|
onClose: closeModal,
|