@alma/widgets 2.3.4 → 2.4.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/dist/raw/widgets.js +123 -51
- package/dist/raw/widgets.js.map +1 -1
- package/dist/raw/widgets.m.js +123 -51
- package/dist/raw/widgets.m.js.map +1 -1
- package/dist/raw/widgets.modern.js +123 -47
- package/dist/raw/widgets.modern.js.map +1 -1
- package/dist/raw/widgets.umd.js +123 -51
- package/dist/raw/widgets.umd.js.map +1 -1
- package/dist/types/Widgets/EligibilityModal/classNames.const.d.ts +18 -0
- package/dist/types/Widgets/PaymentPlans/classNames.const.d.ts +13 -0
- package/dist/types/test/fixtures.d.ts +40 -0
- package/dist/types/types.d.ts +7 -1
- 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.m.js
CHANGED
|
@@ -2049,16 +2049,34 @@ var fetchFromApi = function fetchFromApi(url, data, headers) {
|
|
|
2049
2049
|
}
|
|
2050
2050
|
};
|
|
2051
2051
|
|
|
2052
|
+
var isPlanEligible = function isPlanEligible(plan, configPlan) {
|
|
2053
|
+
if (!plan.eligible) {
|
|
2054
|
+
return false;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
return configPlan ? plan.purchase_amount >= (configPlan == null ? void 0 : configPlan.minAmount) && plan.purchase_amount <= (configPlan == null ? void 0 : configPlan.maxAmount) : false;
|
|
2058
|
+
};
|
|
2059
|
+
|
|
2060
|
+
var getPaymentPlanBoundaries = function getPaymentPlanBoundaries(plan, configPlan) {
|
|
2061
|
+
var _plan$constraints;
|
|
2062
|
+
|
|
2063
|
+
// When the plan is not eligible, the purchase amount constraints is given from the merchant config
|
|
2064
|
+
var purchaseAmountConstraints = (_plan$constraints = plan.constraints) == null ? void 0 : _plan$constraints.purchase_amount;
|
|
2065
|
+
|
|
2066
|
+
if (purchaseAmountConstraints && configPlan) {
|
|
2067
|
+
return {
|
|
2068
|
+
minAmount: Math.max(configPlan.minAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.minimum),
|
|
2069
|
+
maxAmount: Math.min(configPlan.maxAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.maximum)
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
return configPlan != null ? configPlan : {};
|
|
2074
|
+
};
|
|
2075
|
+
|
|
2052
2076
|
var filterELigibility = function filterELigibility(eligibilities, configPlans) {
|
|
2053
2077
|
// Remove p1x
|
|
2054
2078
|
var filteredEligibilityPlans = eligibilities.filter(function (plan) {
|
|
2055
2079
|
return !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0);
|
|
2056
|
-
}) // Keeps the plans that have a payment_plan property
|
|
2057
|
-
.filter(function (plan) {
|
|
2058
|
-
return plan.payment_plan;
|
|
2059
|
-
}) // Remove plans that have a reasons property
|
|
2060
|
-
.filter(function (plan) {
|
|
2061
|
-
return !plan.reasons;
|
|
2062
2080
|
}); // If no configPlans was provided, return eligibility response
|
|
2063
2081
|
|
|
2064
2082
|
if (!configPlans) {
|
|
@@ -2074,10 +2092,8 @@ var filterELigibility = function filterELigibility(eligibilities, configPlans) {
|
|
|
2074
2092
|
return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
|
|
2075
2093
|
});
|
|
2076
2094
|
return _extends({}, plan, {
|
|
2077
|
-
eligible:
|
|
2078
|
-
|
|
2079
|
-
maxAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount
|
|
2080
|
-
});
|
|
2095
|
+
eligible: isPlanEligible(plan, relatedConfigPlan)
|
|
2096
|
+
}, getPaymentPlanBoundaries(plan, relatedConfigPlan));
|
|
2081
2097
|
});
|
|
2082
2098
|
};
|
|
2083
2099
|
|
|
@@ -2151,6 +2167,29 @@ function CrossIcon(_ref) {
|
|
|
2151
2167
|
}));
|
|
2152
2168
|
}
|
|
2153
2169
|
|
|
2170
|
+
/**
|
|
2171
|
+
* Prefix classes to avoid name collisions.
|
|
2172
|
+
*/
|
|
2173
|
+
var prefix = 'alma-eligibility-modal';
|
|
2174
|
+
/**
|
|
2175
|
+
* Class names for the **eligibility modale** widget.
|
|
2176
|
+
* Those classes are intended to be used by the **merchant developer**.
|
|
2177
|
+
*/
|
|
2178
|
+
|
|
2179
|
+
var STATIC_CUSTOMISATION_CLASSES = {
|
|
2180
|
+
leftSide: prefix + '-left-side',
|
|
2181
|
+
rightSide: prefix + '-right-side',
|
|
2182
|
+
title: prefix + '-title',
|
|
2183
|
+
info: prefix + '-info',
|
|
2184
|
+
infoMessage: prefix + '-info-message',
|
|
2185
|
+
eligibilityOptions: prefix + '-eligibility-options',
|
|
2186
|
+
activeOption: prefix + '-active-option',
|
|
2187
|
+
closeButton: prefix + '-close-button',
|
|
2188
|
+
scheduleDetails: prefix + '-schedule-details',
|
|
2189
|
+
scheduleTotal: prefix + '-schedule-total',
|
|
2190
|
+
scheduleCredit: prefix + '-schedule-credit'
|
|
2191
|
+
};
|
|
2192
|
+
|
|
2154
2193
|
var _excluded = ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"];
|
|
2155
2194
|
|
|
2156
2195
|
var ControlledModal = function ControlledModal(_ref) {
|
|
@@ -2183,7 +2222,7 @@ var ControlledModal = function ControlledModal(_ref) {
|
|
|
2183
2222
|
className: s$1.header
|
|
2184
2223
|
}, /*#__PURE__*/React.createElement("button", {
|
|
2185
2224
|
onClick: onClose,
|
|
2186
|
-
className: s$1.closeButton,
|
|
2225
|
+
className: cx(s$1.closeButton, STATIC_CUSTOMISATION_CLASSES.closeButton),
|
|
2187
2226
|
"data-testid": "modal-close-button"
|
|
2188
2227
|
}, /*#__PURE__*/React.createElement(CrossIcon, null))), /*#__PURE__*/React.createElement("div", {
|
|
2189
2228
|
className: cx(s$1.content, contentClassName, (_cx = {}, _cx[s$1.contentScrollable] = scrollable, _cx))
|
|
@@ -2208,6 +2247,20 @@ var paymentPlanShorthandName = function paymentPlanShorthandName(payment) {
|
|
|
2208
2247
|
return installmentsCount + "x";
|
|
2209
2248
|
}
|
|
2210
2249
|
};
|
|
2250
|
+
|
|
2251
|
+
var withNoFee = function withNoFee(payment) {
|
|
2252
|
+
var _payment$payment_plan;
|
|
2253
|
+
|
|
2254
|
+
if ((_payment$payment_plan = payment.payment_plan) != null && _payment$payment_plan.every(function (plan) {
|
|
2255
|
+
return plan.customer_fee === 0 && plan.customer_interest === 0;
|
|
2256
|
+
})) {
|
|
2257
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, ' ', /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2258
|
+
id: "payment-plan-strings.no-fee",
|
|
2259
|
+
defaultMessage: '(sans frais)'
|
|
2260
|
+
}));
|
|
2261
|
+
}
|
|
2262
|
+
};
|
|
2263
|
+
|
|
2211
2264
|
var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
2212
2265
|
var deferred_days = payment.deferred_days,
|
|
2213
2266
|
deferred_months = payment.deferred_months,
|
|
@@ -2217,20 +2270,10 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2217
2270
|
_payment$minAmount = payment.minAmount,
|
|
2218
2271
|
minAmount = _payment$minAmount === void 0 ? 0 : _payment$minAmount,
|
|
2219
2272
|
_payment$maxAmount = payment.maxAmount,
|
|
2220
|
-
maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount
|
|
2273
|
+
maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount,
|
|
2274
|
+
payment_plan = payment.payment_plan;
|
|
2221
2275
|
var deferredDaysCount = deferred_days + deferred_months * 30;
|
|
2222
2276
|
|
|
2223
|
-
var withNoFee = function withNoFee() {
|
|
2224
|
-
if (payment.payment_plan.every(function (plan) {
|
|
2225
|
-
return plan.customer_fee === 0 && plan.customer_interest === 0;
|
|
2226
|
-
})) {
|
|
2227
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, ' ', /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2228
|
-
id: "payment-plan-strings.no-fee",
|
|
2229
|
-
defaultMessage: '(sans frais)'
|
|
2230
|
-
}));
|
|
2231
|
-
}
|
|
2232
|
-
};
|
|
2233
|
-
|
|
2234
2277
|
if (!eligible) {
|
|
2235
2278
|
return purchaseAmount > maxAmount ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2236
2279
|
id: "payment-plan-strings.ineligible-greater-than-max",
|
|
@@ -2253,27 +2296,32 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2253
2296
|
})
|
|
2254
2297
|
}
|
|
2255
2298
|
});
|
|
2299
|
+
} else if (!payment_plan) {
|
|
2300
|
+
/* This error should never happen. We added this condition to avoid a typescript warning on
|
|
2301
|
+
payment_plan possibly undefined. As far as we know, it only happens when the plan is not
|
|
2302
|
+
eligible, which is checked above. */
|
|
2303
|
+
throw Error("No payment plan provided for payment in " + installmentsCount + " installments. Please contact us if you see this error.");
|
|
2256
2304
|
} else if (deferredDaysCount !== 0 && installmentsCount === 1) {
|
|
2257
2305
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2258
2306
|
id: "payment-plan-strings.deferred",
|
|
2259
2307
|
defaultMessage: "{totalAmount} \xE0 payer le {dueDate}",
|
|
2260
2308
|
values: {
|
|
2261
2309
|
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2262
|
-
value: priceFromCents(
|
|
2310
|
+
value: priceFromCents(payment_plan[0].total_amount),
|
|
2263
2311
|
style: "currency",
|
|
2264
2312
|
currency: "EUR"
|
|
2265
2313
|
}),
|
|
2266
2314
|
dueDate: /*#__PURE__*/React.createElement(FormattedDate, {
|
|
2267
|
-
value: secondsToMilliseconds(
|
|
2315
|
+
value: secondsToMilliseconds(payment_plan[0].due_date),
|
|
2268
2316
|
day: "numeric",
|
|
2269
2317
|
month: "long",
|
|
2270
2318
|
year: "numeric"
|
|
2271
2319
|
})
|
|
2272
2320
|
}
|
|
2273
|
-
}), withNoFee());
|
|
2321
|
+
}), withNoFee(payment));
|
|
2274
2322
|
} else if (installmentsCount > 0) {
|
|
2275
|
-
var areInstallmentsOfSameAmount =
|
|
2276
|
-
return index === 0 || installment.total_amount ===
|
|
2323
|
+
var areInstallmentsOfSameAmount = payment_plan == null ? void 0 : payment_plan.every(function (installment, index) {
|
|
2324
|
+
return index === 0 || installment.total_amount === payment_plan[0].total_amount;
|
|
2277
2325
|
});
|
|
2278
2326
|
|
|
2279
2327
|
if (areInstallmentsOfSameAmount) {
|
|
@@ -2282,13 +2330,13 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2282
2330
|
defaultMessage: "{installmentsCount} x {totalAmount}",
|
|
2283
2331
|
values: {
|
|
2284
2332
|
totalAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2285
|
-
value: priceFromCents(
|
|
2333
|
+
value: priceFromCents(payment_plan[0].total_amount),
|
|
2286
2334
|
style: "currency",
|
|
2287
2335
|
currency: "EUR"
|
|
2288
2336
|
}),
|
|
2289
2337
|
installmentsCount: installmentsCount
|
|
2290
2338
|
}
|
|
2291
|
-
}), withNoFee());
|
|
2339
|
+
}), withNoFee(payment));
|
|
2292
2340
|
}
|
|
2293
2341
|
|
|
2294
2342
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
@@ -2296,18 +2344,18 @@ var paymentPlanInfoText = function paymentPlanInfoText(payment) {
|
|
|
2296
2344
|
defaultMessage: "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
|
|
2297
2345
|
values: {
|
|
2298
2346
|
firstInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2299
|
-
value: priceFromCents(
|
|
2347
|
+
value: priceFromCents(payment_plan[0].total_amount),
|
|
2300
2348
|
style: "currency",
|
|
2301
2349
|
currency: "EUR"
|
|
2302
2350
|
}),
|
|
2303
2351
|
numberOfRemainingInstallments: installmentsCount - 1,
|
|
2304
2352
|
othersInstallmentAmount: /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
2305
|
-
value: priceFromCents(
|
|
2353
|
+
value: priceFromCents(payment_plan[1].total_amount),
|
|
2306
2354
|
style: "currency",
|
|
2307
2355
|
currency: "EUR"
|
|
2308
2356
|
})
|
|
2309
2357
|
}
|
|
2310
|
-
}), withNoFee());
|
|
2358
|
+
}), withNoFee(payment));
|
|
2311
2359
|
}
|
|
2312
2360
|
|
|
2313
2361
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
@@ -2323,13 +2371,13 @@ var EligibilityPlansButtons = function EligibilityPlansButtons(_ref) {
|
|
|
2323
2371
|
currentPlanIndex = _ref.currentPlanIndex,
|
|
2324
2372
|
setCurrentPlanIndex = _ref.setCurrentPlanIndex;
|
|
2325
2373
|
return /*#__PURE__*/React.createElement("div", {
|
|
2326
|
-
className: s$2.buttons
|
|
2374
|
+
className: cx(s$2.buttons, STATIC_CUSTOMISATION_CLASSES.eligibilityOptions)
|
|
2327
2375
|
}, eligibilityPlans.map(function (eligibilityPlan, index) {
|
|
2328
2376
|
var _cx;
|
|
2329
2377
|
|
|
2330
2378
|
return /*#__PURE__*/React.createElement("button", {
|
|
2331
2379
|
key: index,
|
|
2332
|
-
className: cx((_cx = {}, _cx[s$2.active] = index === currentPlanIndex, _cx)),
|
|
2380
|
+
className: cx((_cx = {}, _cx[cx(s$2.active, STATIC_CUSTOMISATION_CLASSES.activeOption)] = index === currentPlanIndex, _cx)),
|
|
2333
2381
|
onClick: function onClick() {
|
|
2334
2382
|
return setCurrentPlanIndex(index);
|
|
2335
2383
|
}
|
|
@@ -2348,10 +2396,10 @@ var Schedule = function Schedule(_ref) {
|
|
|
2348
2396
|
var isCredit = currentPlan && currentPlan.installments_count > 4;
|
|
2349
2397
|
var intl = useIntl();
|
|
2350
2398
|
return /*#__PURE__*/React.createElement("div", {
|
|
2351
|
-
className: s$3.schedule,
|
|
2399
|
+
className: cx(s$3.schedule, STATIC_CUSTOMISATION_CLASSES.scheduleDetails),
|
|
2352
2400
|
"data-testid": "modal-installments-element"
|
|
2353
2401
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2354
|
-
className: cx(s$3.scheduleLine, s$3.total)
|
|
2402
|
+
className: cx(s$3.scheduleLine, s$3.total, STATIC_CUSTOMISATION_CLASSES.scheduleTotal)
|
|
2355
2403
|
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2356
2404
|
id: "eligibility-modal.total",
|
|
2357
2405
|
defaultMessage: "Total"
|
|
@@ -2360,7 +2408,7 @@ var Schedule = function Schedule(_ref) {
|
|
|
2360
2408
|
style: "currency",
|
|
2361
2409
|
currency: "EUR"
|
|
2362
2410
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
2363
|
-
className: cx(s$3.scheduleLine, s$3.creditCost)
|
|
2411
|
+
className: cx(s$3.scheduleLine, s$3.creditCost, STATIC_CUSTOMISATION_CLASSES.scheduleCredit)
|
|
2364
2412
|
}, isCredit ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2365
2413
|
id: "eligibility-modal.credit-cost",
|
|
2366
2414
|
defaultMessage: "Dont co\xFBt du cr\xE9dit"
|
|
@@ -2413,13 +2461,15 @@ var s$4 = {"list":"_180ro","listItem":"_1HqCO","bullet":"_3B8wx"};
|
|
|
2413
2461
|
|
|
2414
2462
|
var Info = function Info() {
|
|
2415
2463
|
return /*#__PURE__*/React.createElement("div", {
|
|
2416
|
-
className: s$4.list,
|
|
2464
|
+
className: cx(s$4.list, STATIC_CUSTOMISATION_CLASSES.info),
|
|
2417
2465
|
"data-testid": "modal-info-element"
|
|
2418
2466
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2419
2467
|
className: s$4.listItem
|
|
2420
2468
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2421
2469
|
className: s$4.bullet
|
|
2422
|
-
}, "1"), /*#__PURE__*/React.createElement("div",
|
|
2470
|
+
}, "1"), /*#__PURE__*/React.createElement("div", {
|
|
2471
|
+
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2472
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2423
2473
|
id: "eligibility-modal.bullet-1",
|
|
2424
2474
|
defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
|
|
2425
2475
|
values: {
|
|
@@ -2431,7 +2481,9 @@ var Info = function Info() {
|
|
|
2431
2481
|
className: s$4.listItem
|
|
2432
2482
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2433
2483
|
className: s$4.bullet
|
|
2434
|
-
}, "2"), /*#__PURE__*/React.createElement("div",
|
|
2484
|
+
}, "2"), /*#__PURE__*/React.createElement("div", {
|
|
2485
|
+
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2486
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2435
2487
|
id: "eligibility-modal.bullet-2",
|
|
2436
2488
|
defaultMessage: "Renseignez les <strong>informations</strong> demand\xE9es.",
|
|
2437
2489
|
values: {
|
|
@@ -2443,7 +2495,9 @@ var Info = function Info() {
|
|
|
2443
2495
|
className: s$4.listItem
|
|
2444
2496
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2445
2497
|
className: s$4.bullet
|
|
2446
|
-
}, "3"), /*#__PURE__*/React.createElement("div",
|
|
2498
|
+
}, "3"), /*#__PURE__*/React.createElement("div", {
|
|
2499
|
+
className: STATIC_CUSTOMISATION_CLASSES.infoMessage
|
|
2500
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2447
2501
|
id: "eligibility-modal.bullet-3",
|
|
2448
2502
|
defaultMessage: "La validation de votre paiement <strong>instantan\xE9e</strong> !",
|
|
2449
2503
|
values: {
|
|
@@ -2501,7 +2555,7 @@ var s$6 = {"title":"_3ERx-"};
|
|
|
2501
2555
|
|
|
2502
2556
|
var Title = function Title() {
|
|
2503
2557
|
return /*#__PURE__*/React.createElement("div", {
|
|
2504
|
-
className: s$6.title,
|
|
2558
|
+
className: cx(s$6.title, STATIC_CUSTOMISATION_CLASSES.title),
|
|
2505
2559
|
"data-testid": "modal-title-element"
|
|
2506
2560
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
2507
2561
|
id: "eligibility-modal.title",
|
|
@@ -2522,9 +2576,9 @@ var DesktopModal = function DesktopModal(_ref) {
|
|
|
2522
2576
|
className: s$7.container,
|
|
2523
2577
|
"data-testid": "modal-container"
|
|
2524
2578
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2525
|
-
className: cx([s$7.block, s$7.left])
|
|
2579
|
+
className: cx([s$7.block, s$7.left, STATIC_CUSTOMISATION_CLASSES.leftSide])
|
|
2526
2580
|
}, /*#__PURE__*/React.createElement(Title, null), /*#__PURE__*/React.createElement(Info, null), /*#__PURE__*/React.createElement(Logo, null)), /*#__PURE__*/React.createElement("div", {
|
|
2527
|
-
className: s$7.block
|
|
2581
|
+
className: cx(s$7.block, STATIC_CUSTOMISATION_CLASSES.rightSide)
|
|
2528
2582
|
}, children));
|
|
2529
2583
|
};
|
|
2530
2584
|
|
|
@@ -2693,6 +2747,24 @@ var getIndexOfActivePlan = function getIndexOfActivePlan(_ref) {
|
|
|
2693
2747
|
return 0;
|
|
2694
2748
|
};
|
|
2695
2749
|
|
|
2750
|
+
/**
|
|
2751
|
+
* Prefix classes to avoid name collisions.
|
|
2752
|
+
*/
|
|
2753
|
+
var prefix$1 = 'alma-payment-plans';
|
|
2754
|
+
/**
|
|
2755
|
+
* Class names for the **payment plans** widget.
|
|
2756
|
+
* Those classes are intended to be used by the **merchant developer**.
|
|
2757
|
+
*/
|
|
2758
|
+
|
|
2759
|
+
var STATIC_CUSTOMISATION_CLASSES$1 = {
|
|
2760
|
+
container: prefix$1 + '-container',
|
|
2761
|
+
eligibilityLine: prefix$1 + '-eligibility-line',
|
|
2762
|
+
eligibilityOptions: prefix$1 + '-eligibility-options',
|
|
2763
|
+
notEligibleOption: prefix$1 + '-not-eligible-option',
|
|
2764
|
+
paymentInfo: prefix$1 + '-payment-info',
|
|
2765
|
+
activeOption: prefix$1 + '-active-option'
|
|
2766
|
+
};
|
|
2767
|
+
|
|
2696
2768
|
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"};
|
|
2697
2769
|
|
|
2698
2770
|
var VERY_LONG_TIME_IN_MS = 1000 * 3600 * 24 * 365;
|
|
@@ -2719,7 +2791,7 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
2719
2791
|
eligibilityPlans: eligibilityPlans,
|
|
2720
2792
|
suggestedPaymentPlan: suggestedPaymentPlan != null ? suggestedPaymentPlan : 0
|
|
2721
2793
|
});
|
|
2722
|
-
var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
|
|
2794
|
+
var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
|
|
2723
2795
|
|
|
2724
2796
|
var isTransitionSpecified = transitionDelay !== undefined; // 👈 The merchant has specified a transition time
|
|
2725
2797
|
|
|
@@ -2804,14 +2876,14 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
2804
2876
|
|
|
2805
2877
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
2806
2878
|
onClick: handleOpenModal,
|
|
2807
|
-
className: cx(s$b.widgetButton, (_cx = {}, _cx[s$b.clickable] = eligiblePlans.length > 0, _cx[s$b.unClickable] = eligiblePlans.length === 0, _cx)),
|
|
2879
|
+
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),
|
|
2808
2880
|
"data-testid": "widget-button"
|
|
2809
2881
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2810
|
-
className: s$b.primaryContainer
|
|
2882
|
+
className: cx(s$b.primaryContainer, STATIC_CUSTOMISATION_CLASSES$1.eligibilityLine)
|
|
2811
2883
|
}, /*#__PURE__*/React.createElement(LogoIcon, {
|
|
2812
2884
|
className: s$b.logo
|
|
2813
2885
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2814
|
-
className: s$b.paymentPlans
|
|
2886
|
+
className: cx(s$b.paymentPlans, STATIC_CUSTOMISATION_CLASSES$1.eligibilityOptions)
|
|
2815
2887
|
}, eligibilityPlans.map(function (eligibilityPlan, key) {
|
|
2816
2888
|
var _cx2;
|
|
2817
2889
|
|
|
@@ -2821,10 +2893,10 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
2821
2893
|
return onHover(key);
|
|
2822
2894
|
},
|
|
2823
2895
|
onMouseOut: onLeave,
|
|
2824
|
-
className: cx(s$b.plan, (_cx2 = {}, _cx2[s$b.active] = current === key, _cx2[s$b.notEligible] = !eligibilityPlan.eligible, _cx2))
|
|
2896
|
+
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))
|
|
2825
2897
|
}, paymentPlanShorthandName(eligibilityPlan));
|
|
2826
2898
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
2827
|
-
className: cx(s$b.info, (_cx3 = {}, _cx3[s$b.notEligible] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3))
|
|
2899
|
+
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)
|
|
2828
2900
|
}, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/React.createElement(EligibilityModal, {
|
|
2829
2901
|
initialPlanIndex: getIndexWithinEligiblePlans(current),
|
|
2830
2902
|
onClose: closeModal,
|