@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.
Files changed (36) hide show
  1. package/dist/raw/widgets.js +166 -75
  2. package/dist/raw/widgets.js.map +1 -1
  3. package/dist/raw/widgets.m.js +166 -75
  4. package/dist/raw/widgets.m.js.map +1 -1
  5. package/dist/raw/widgets.modern.js +163 -71
  6. package/dist/raw/widgets.modern.js.map +1 -1
  7. package/dist/raw/widgets.umd.js +166 -75
  8. package/dist/raw/widgets.umd.js.map +1 -1
  9. package/dist/types/Widgets/EligibilityModal/DesktopModal/index.d.ts +3 -1
  10. package/dist/types/Widgets/EligibilityModal/MobileModal/index.d.ts +3 -1
  11. package/dist/types/Widgets/EligibilityModal/ModalContainer.test.d.ts +1 -0
  12. package/dist/types/Widgets/EligibilityModal/classNames.const.d.ts +18 -0
  13. package/dist/types/Widgets/EligibilityModal/components/Title/index.d.ts +3 -1
  14. package/dist/types/Widgets/EligibilityModal/modal.test.d.ts +1 -0
  15. package/dist/types/Widgets/PaymentPlans/__tests__/Basics.test.d.ts +1 -0
  16. package/dist/types/Widgets/PaymentPlans/__tests__/Credit.test.d.ts +1 -0
  17. package/dist/types/Widgets/PaymentPlans/__tests__/CustomTransitionDelay.test.d.ts +1 -0
  18. package/dist/types/Widgets/PaymentPlans/__tests__/HideWidget.test.d.ts +1 -0
  19. package/dist/types/Widgets/PaymentPlans/__tests__/IneligibleOptions.test.d.ts +1 -0
  20. package/dist/types/Widgets/PaymentPlans/__tests__/LanguageCheck.test.d.ts +1 -0
  21. package/dist/types/Widgets/PaymentPlans/__tests__/LaunchModal.test.d.ts +1 -0
  22. package/dist/types/Widgets/PaymentPlans/__tests__/SuggestedPaymentPlan.test.d.ts +1 -0
  23. package/dist/types/Widgets/PaymentPlans/__tests__/WithoutPlans.test.d.ts +1 -0
  24. package/dist/types/Widgets/PaymentPlans/classNames.const.d.ts +13 -0
  25. package/dist/types/test/fixtures.d.ts +41 -0
  26. package/dist/types/types.d.ts +7 -1
  27. package/dist/types/utils/index.test.d.ts +1 -0
  28. package/dist/widgets.js +1 -1
  29. package/dist/widgets.js.map +1 -1
  30. package/dist/widgets.m.js +1 -1
  31. package/dist/widgets.m.js.map +1 -1
  32. package/dist/widgets.modern.js +1 -1
  33. package/dist/widgets.modern.js.map +1 -1
  34. package/dist/widgets.umd.js +1 -1
  35. package/dist/widgets.umd.js.map +1 -1
  36. package/package.json +1 -1
@@ -6292,8 +6292,9 @@
6292
6292
  "eligibility-modal.credit-commitment": "Ein Kredit verpflichtet Sie und muss zurückgezahlt werden. Prüfen Sie Ihre Rückzahlungsfähigkeit, bevor Sie sich verpflichten.",
6293
6293
  "eligibility-modal.credit-cost": "Davon Kreditkosten",
6294
6294
  "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
6295
- "eligibility-modal.no-eligibility": "Ups, die Simulation scheint nicht funktioniert zu haben.",
6296
- "eligibility-modal.title": "<highlighted>Bezahlen Sie in Raten</highlighted> oder später per Kreditkarte mit Alma.",
6295
+ "eligibility-modal.no-eligibility": "Ups, die Simulation hat anscheinend nicht funktioniert.",
6296
+ "eligibility-modal.title": "<highlighted>Bezahlen Sie in Raten</highlighted> per Kreditkarte mit Alma.",
6297
+ "eligibility-modal.title-deferred": "<highlighted>Bezahlen Sie in Raten</highlighted> oder später per Kreditkarte mit Alma.",
6297
6298
  "eligibility-modal.total": "Insgesamt",
6298
6299
  "installments.today": "Heutzutage",
6299
6300
  "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
@@ -6315,7 +6316,8 @@
6315
6316
  "eligibility-modal.credit-cost": "Of which cost of credit",
6316
6317
  "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
6317
6318
  "eligibility-modal.no-eligibility": "Oops, looks like the simulation didn't work.",
6318
- "eligibility-modal.title": "<highlighted>Pay in installments</highlighted> or later by credit card with Alma.",
6319
+ "eligibility-modal.title": "<highlighted>Pay in installments</highlighted> by credit card with Alma.",
6320
+ "eligibility-modal.title-deferred": "<highlighted>Pay in installments</highlighted> or later by credit card with Alma.",
6319
6321
  "eligibility-modal.total": "Total",
6320
6322
  "installments.today": "Today",
6321
6323
  "payment-plan-strings.day-abbreviation": "T{numberOfDeferredDays}",
@@ -6337,7 +6339,8 @@
6337
6339
  "eligibility-modal.credit-cost": "Coste de crédito (incl. en el total)",
6338
6340
  "eligibility-modal.credit-cost-amount": "{creditCost} (TAE {TAEG})",
6339
6341
  "eligibility-modal.no-eligibility": "Uy, parece que la simulación no ha funcionado.",
6340
- "eligibility-modal.title": "<highlighted>Paga a plazos</highlighted> o más adelante con tu tarjeta, a través de Alma.",
6342
+ "eligibility-modal.title": "<highlighted>Paga a plazos</highlighted> con tarjeta de crédito con Alma.",
6343
+ "eligibility-modal.title-deferred": "<highlighted>Paga a plazos</highlighted> o más adelante con tu tarjeta, a través de Alma.",
6341
6344
  "eligibility-modal.total": "Total",
6342
6345
  "installments.today": "Hoy",
6343
6346
  "payment-plan-strings.day-abbreviation": "D{numberOfDeferredDays}",
@@ -6358,8 +6361,9 @@
6358
6361
  "eligibility-modal.credit-commitment": "Un crédit vous engage et doit être remboursé. Vérifiez vos capacités de remboursement avant de vous engager.",
6359
6362
  "eligibility-modal.credit-cost": "Dont coût du crédit",
6360
6363
  "eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
6361
- "eligibility-modal.no-eligibility": "Oups, il semblerait que la simulation n'aie pas fonctionné.",
6362
- "eligibility-modal.title": "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
6364
+ "eligibility-modal.no-eligibility": "Oups, il semblerait que la simulation n'ait pas fonctionné.",
6365
+ "eligibility-modal.title": "<highlighted>Payez en plusieurs fois</highlighted> par carte bancaire avec Alma.",
6366
+ "eligibility-modal.title-deferred": "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
6363
6367
  "eligibility-modal.total": "Total",
6364
6368
  "installments.today": "Aujourd'hui",
6365
6369
  "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
@@ -6381,7 +6385,8 @@
6381
6385
  "eligibility-modal.credit-cost": "Di cui commissioni",
6382
6386
  "eligibility-modal.credit-cost-amount": "{creditCost} (TAEG {TAEG})",
6383
6387
  "eligibility-modal.no-eligibility": "Ops, sembra che la simulazione non abbia funzionato.",
6384
- "eligibility-modal.title": "<highlighted>Paga a rate</highlighted> e posticipa il pagamento con Alma, senza interessi.",
6388
+ "eligibility-modal.title": "<highlighted>Paga a rate</highlighted> con carta di credito con Alma.",
6389
+ "eligibility-modal.title-deferred": "<highlighted>Paga a rate</highlighted> e posticipa il pagamento con Alma, senza interessi.",
6385
6390
  "eligibility-modal.total": "Totale",
6386
6391
  "installments.today": "Oggi",
6387
6392
  "payment-plan-strings.day-abbreviation": "G{numberOfDeferredDays}",
@@ -6403,7 +6408,8 @@
6403
6408
  "eligibility-modal.credit-cost": "Waarvan kosten van krediet",
6404
6409
  "eligibility-modal.credit-cost-amount": "{creditCost} (APR {TAEG})",
6405
6410
  "eligibility-modal.no-eligibility": "Oeps, het lijkt erop dat de simulatie niet werkte.",
6406
- "eligibility-modal.title": "<highlighted>Betaal in termijnen</highlighted> of later per credit card met Alma.",
6411
+ "eligibility-modal.title": "<highlighted>Betaal in termijnen</highlighted> met kredietkaart bij Alma.",
6412
+ "eligibility-modal.title-deferred": "<highlighted>Betaal in termijnen</highlighted> of later per credit card met Alma.",
6407
6413
  "eligibility-modal.total": "Totaal",
6408
6414
  "installments.today": "Tegenwoordig",
6409
6415
  "payment-plan-strings.day-abbreviation": "J{numberOfDeferredDays}",
@@ -14473,16 +14479,34 @@
14473
14479
  }
14474
14480
  };
14475
14481
 
14482
+ var isPlanEligible = function isPlanEligible(plan, configPlan) {
14483
+ if (!plan.eligible) {
14484
+ return false;
14485
+ }
14486
+
14487
+ return configPlan ? plan.purchase_amount >= (configPlan == null ? void 0 : configPlan.minAmount) && plan.purchase_amount <= (configPlan == null ? void 0 : configPlan.maxAmount) : false;
14488
+ };
14489
+
14490
+ var getPaymentPlanBoundaries = function getPaymentPlanBoundaries(plan, configPlan) {
14491
+ var _plan$constraints;
14492
+
14493
+ // When the plan is not eligible, the purchase amount constraints is given from the merchant config
14494
+ var purchaseAmountConstraints = (_plan$constraints = plan.constraints) == null ? void 0 : _plan$constraints.purchase_amount;
14495
+
14496
+ if (purchaseAmountConstraints && configPlan) {
14497
+ return {
14498
+ minAmount: Math.max(configPlan.minAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.minimum),
14499
+ maxAmount: Math.min(configPlan.maxAmount, purchaseAmountConstraints == null ? void 0 : purchaseAmountConstraints.maximum)
14500
+ };
14501
+ }
14502
+
14503
+ return configPlan != null ? configPlan : {};
14504
+ };
14505
+
14476
14506
  var filterELigibility = function filterELigibility(eligibilities, configPlans) {
14477
14507
  // Remove p1x
14478
14508
  var filteredEligibilityPlans = eligibilities.filter(function (plan) {
14479
14509
  return !(plan.installments_count === 1 && plan.deferred_days === 0 && plan.deferred_months === 0);
14480
- }) // Keeps the plans that have a payment_plan property
14481
- .filter(function (plan) {
14482
- return plan.payment_plan;
14483
- }) // Remove plans that have a reasons property
14484
- .filter(function (plan) {
14485
- return !plan.reasons;
14486
14510
  }); // If no configPlans was provided, return eligibility response
14487
14511
 
14488
14512
  if (!configPlans) {
@@ -14498,10 +14522,8 @@
14498
14522
  return plan.installments_count === configPlan.installmentsCount && eligibilityDeferredDays === configPlanDeferredDays;
14499
14523
  });
14500
14524
  return _extends({}, plan, {
14501
- eligible: relatedConfigPlan ? plan.purchase_amount >= (relatedConfigPlan == null ? void 0 : relatedConfigPlan.minAmount) && plan.purchase_amount <= (relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount) : false,
14502
- minAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.minAmount,
14503
- maxAmount: relatedConfigPlan == null ? void 0 : relatedConfigPlan.maxAmount
14504
- });
14525
+ eligible: isPlanEligible(plan, relatedConfigPlan)
14526
+ }, getPaymentPlanBoundaries(plan, relatedConfigPlan));
14505
14527
  });
14506
14528
  };
14507
14529
 
@@ -16738,6 +16760,29 @@
16738
16760
  }));
16739
16761
  }
16740
16762
 
16763
+ /**
16764
+ * Prefix classes to avoid name collisions.
16765
+ */
16766
+ var prefix = 'alma-eligibility-modal';
16767
+ /**
16768
+ * Class names for the **eligibility modale** widget.
16769
+ * Those classes are intended to be used by the **merchant developer**.
16770
+ */
16771
+
16772
+ var STATIC_CUSTOMISATION_CLASSES = {
16773
+ leftSide: prefix + '-left-side',
16774
+ rightSide: prefix + '-right-side',
16775
+ title: prefix + '-title',
16776
+ info: prefix + '-info',
16777
+ infoMessage: prefix + '-info-message',
16778
+ eligibilityOptions: prefix + '-eligibility-options',
16779
+ activeOption: prefix + '-active-option',
16780
+ closeButton: prefix + '-close-button',
16781
+ scheduleDetails: prefix + '-schedule-details',
16782
+ scheduleTotal: prefix + '-schedule-total',
16783
+ scheduleCredit: prefix + '-schedule-credit'
16784
+ };
16785
+
16741
16786
  var _excluded = ["children", "isOpen", "onClose", "className", "contentClassName", "scrollable"];
16742
16787
 
16743
16788
  var ControlledModal = function ControlledModal(_ref) {
@@ -16770,7 +16815,7 @@
16770
16815
  className: s$1.header
16771
16816
  }, /*#__PURE__*/react.createElement("button", {
16772
16817
  onClick: onClose,
16773
- className: s$1.closeButton,
16818
+ className: classnames(s$1.closeButton, STATIC_CUSTOMISATION_CLASSES.closeButton),
16774
16819
  "data-testid": "modal-close-button"
16775
16820
  }, /*#__PURE__*/react.createElement(CrossIcon, null))), /*#__PURE__*/react.createElement("div", {
16776
16821
  className: classnames(s$1.content, contentClassName, (_cx = {}, _cx[s$1.contentScrollable] = scrollable, _cx))
@@ -18139,6 +18184,20 @@
18139
18184
  return installmentsCount + "x";
18140
18185
  }
18141
18186
  };
18187
+
18188
+ var withNoFee = function withNoFee(payment) {
18189
+ var _payment$payment_plan;
18190
+
18191
+ if ((_payment$payment_plan = payment.payment_plan) != null && _payment$payment_plan.every(function (plan) {
18192
+ return plan.customer_fee === 0 && plan.customer_interest === 0;
18193
+ })) {
18194
+ return /*#__PURE__*/react.createElement(react.Fragment, null, ' ', /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18195
+ id: "payment-plan-strings.no-fee",
18196
+ defaultMessage: '(sans frais)'
18197
+ }));
18198
+ }
18199
+ };
18200
+
18142
18201
  var paymentPlanInfoText = function paymentPlanInfoText(payment) {
18143
18202
  var deferred_days = payment.deferred_days,
18144
18203
  deferred_months = payment.deferred_months,
@@ -18148,20 +18207,10 @@
18148
18207
  _payment$minAmount = payment.minAmount,
18149
18208
  minAmount = _payment$minAmount === void 0 ? 0 : _payment$minAmount,
18150
18209
  _payment$maxAmount = payment.maxAmount,
18151
- maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount;
18210
+ maxAmount = _payment$maxAmount === void 0 ? 0 : _payment$maxAmount,
18211
+ payment_plan = payment.payment_plan;
18152
18212
  var deferredDaysCount = deferred_days + deferred_months * 30;
18153
18213
 
18154
- var withNoFee = function withNoFee() {
18155
- if (payment.payment_plan.every(function (plan) {
18156
- return plan.customer_fee === 0 && plan.customer_interest === 0;
18157
- })) {
18158
- return /*#__PURE__*/react.createElement(react.Fragment, null, ' ', /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18159
- id: "payment-plan-strings.no-fee",
18160
- defaultMessage: '(sans frais)'
18161
- }));
18162
- }
18163
- };
18164
-
18165
18214
  if (!eligible) {
18166
18215
  return purchaseAmount > maxAmount ? /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18167
18216
  id: "payment-plan-strings.ineligible-greater-than-max",
@@ -18184,27 +18233,32 @@
18184
18233
  })
18185
18234
  }
18186
18235
  });
18236
+ } else if (!payment_plan) {
18237
+ /* This error should never happen. We added this condition to avoid a typescript warning on
18238
+ payment_plan possibly undefined. As far as we know, it only happens when the plan is not
18239
+ eligible, which is checked above. */
18240
+ throw Error("No payment plan provided for payment in " + installmentsCount + " installments. Please contact us if you see this error.");
18187
18241
  } else if (deferredDaysCount !== 0 && installmentsCount === 1) {
18188
18242
  return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18189
18243
  id: "payment-plan-strings.deferred",
18190
18244
  defaultMessage: "{totalAmount} \xE0 payer le {dueDate}",
18191
18245
  values: {
18192
18246
  totalAmount: /*#__PURE__*/react.createElement(FormattedNumber, {
18193
- value: priceFromCents(payment.payment_plan[0].total_amount),
18247
+ value: priceFromCents(payment_plan[0].total_amount),
18194
18248
  style: "currency",
18195
18249
  currency: "EUR"
18196
18250
  }),
18197
18251
  dueDate: /*#__PURE__*/react.createElement(FormattedDate, {
18198
- value: secondsToMilliseconds(payment.payment_plan[0].due_date),
18252
+ value: secondsToMilliseconds(payment_plan[0].due_date),
18199
18253
  day: "numeric",
18200
18254
  month: "long",
18201
18255
  year: "numeric"
18202
18256
  })
18203
18257
  }
18204
- }), withNoFee());
18258
+ }), withNoFee(payment));
18205
18259
  } else if (installmentsCount > 0) {
18206
- var areInstallmentsOfSameAmount = payment.payment_plan.every(function (installment, index) {
18207
- return index === 0 || installment.total_amount === payment.payment_plan[0].total_amount;
18260
+ var areInstallmentsOfSameAmount = payment_plan == null ? void 0 : payment_plan.every(function (installment, index) {
18261
+ return index === 0 || installment.total_amount === payment_plan[0].total_amount;
18208
18262
  });
18209
18263
 
18210
18264
  if (areInstallmentsOfSameAmount) {
@@ -18213,13 +18267,13 @@
18213
18267
  defaultMessage: "{installmentsCount} x {totalAmount}",
18214
18268
  values: {
18215
18269
  totalAmount: /*#__PURE__*/react.createElement(FormattedNumber, {
18216
- value: priceFromCents(payment.payment_plan[0].total_amount),
18270
+ value: priceFromCents(payment_plan[0].total_amount),
18217
18271
  style: "currency",
18218
18272
  currency: "EUR"
18219
18273
  }),
18220
18274
  installmentsCount: installmentsCount
18221
18275
  }
18222
- }), withNoFee());
18276
+ }), withNoFee(payment));
18223
18277
  }
18224
18278
 
18225
18279
  return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
@@ -18227,18 +18281,18 @@
18227
18281
  defaultMessage: "{numberOfRemainingInstallments, plural, one {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}} other {{firstInstallmentAmount} puis {numberOfRemainingInstallments} x {othersInstallmentAmount}}}",
18228
18282
  values: {
18229
18283
  firstInstallmentAmount: /*#__PURE__*/react.createElement(FormattedNumber, {
18230
- value: priceFromCents(payment.payment_plan[0].total_amount),
18284
+ value: priceFromCents(payment_plan[0].total_amount),
18231
18285
  style: "currency",
18232
18286
  currency: "EUR"
18233
18287
  }),
18234
18288
  numberOfRemainingInstallments: installmentsCount - 1,
18235
18289
  othersInstallmentAmount: /*#__PURE__*/react.createElement(FormattedNumber, {
18236
- value: priceFromCents(payment.payment_plan[1].total_amount),
18290
+ value: priceFromCents(payment_plan[1].total_amount),
18237
18291
  style: "currency",
18238
18292
  currency: "EUR"
18239
18293
  })
18240
18294
  }
18241
- }), withNoFee());
18295
+ }), withNoFee(payment));
18242
18296
  }
18243
18297
 
18244
18298
  return /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
@@ -18254,13 +18308,13 @@
18254
18308
  currentPlanIndex = _ref.currentPlanIndex,
18255
18309
  setCurrentPlanIndex = _ref.setCurrentPlanIndex;
18256
18310
  return /*#__PURE__*/react.createElement("div", {
18257
- className: s$2.buttons
18311
+ className: classnames(s$2.buttons, STATIC_CUSTOMISATION_CLASSES.eligibilityOptions)
18258
18312
  }, eligibilityPlans.map(function (eligibilityPlan, index) {
18259
18313
  var _cx;
18260
18314
 
18261
18315
  return /*#__PURE__*/react.createElement("button", {
18262
18316
  key: index,
18263
- className: classnames((_cx = {}, _cx[s$2.active] = index === currentPlanIndex, _cx)),
18317
+ className: classnames((_cx = {}, _cx[classnames(s$2.active, STATIC_CUSTOMISATION_CLASSES.activeOption)] = index === currentPlanIndex, _cx)),
18264
18318
  onClick: function onClick() {
18265
18319
  return setCurrentPlanIndex(index);
18266
18320
  }
@@ -18279,10 +18333,10 @@
18279
18333
  var isCredit = currentPlan && currentPlan.installments_count > 4;
18280
18334
  var intl = useIntl();
18281
18335
  return /*#__PURE__*/react.createElement("div", {
18282
- className: s$3.schedule,
18336
+ className: classnames(s$3.schedule, STATIC_CUSTOMISATION_CLASSES.scheduleDetails),
18283
18337
  "data-testid": "modal-installments-element"
18284
18338
  }, /*#__PURE__*/react.createElement("div", {
18285
- className: classnames(s$3.scheduleLine, s$3.total)
18339
+ className: classnames(s$3.scheduleLine, s$3.total, STATIC_CUSTOMISATION_CLASSES.scheduleTotal)
18286
18340
  }, /*#__PURE__*/react.createElement("span", null, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18287
18341
  id: "eligibility-modal.total",
18288
18342
  defaultMessage: "Total"
@@ -18291,7 +18345,7 @@
18291
18345
  style: "currency",
18292
18346
  currency: "EUR"
18293
18347
  }))), /*#__PURE__*/react.createElement("div", {
18294
- className: classnames(s$3.scheduleLine, s$3.creditCost)
18348
+ className: classnames(s$3.scheduleLine, s$3.creditCost, STATIC_CUSTOMISATION_CLASSES.scheduleCredit)
18295
18349
  }, isCredit ? /*#__PURE__*/react.createElement("span", null, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18296
18350
  id: "eligibility-modal.credit-cost",
18297
18351
  defaultMessage: "Dont co\xFBt du cr\xE9dit"
@@ -18344,13 +18398,15 @@
18344
18398
 
18345
18399
  var Info = function Info() {
18346
18400
  return /*#__PURE__*/react.createElement("div", {
18347
- className: s$4.list,
18401
+ className: classnames(s$4.list, STATIC_CUSTOMISATION_CLASSES.info),
18348
18402
  "data-testid": "modal-info-element"
18349
18403
  }, /*#__PURE__*/react.createElement("div", {
18350
18404
  className: s$4.listItem
18351
18405
  }, /*#__PURE__*/react.createElement("div", {
18352
18406
  className: s$4.bullet
18353
- }, "1"), /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18407
+ }, "1"), /*#__PURE__*/react.createElement("div", {
18408
+ className: STATIC_CUSTOMISATION_CLASSES.infoMessage
18409
+ }, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18354
18410
  id: "eligibility-modal.bullet-1",
18355
18411
  defaultMessage: "Choisissez <strong>Alma</strong> au moment du paiement.",
18356
18412
  values: {
@@ -18362,7 +18418,9 @@
18362
18418
  className: s$4.listItem
18363
18419
  }, /*#__PURE__*/react.createElement("div", {
18364
18420
  className: s$4.bullet
18365
- }, "2"), /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18421
+ }, "2"), /*#__PURE__*/react.createElement("div", {
18422
+ className: STATIC_CUSTOMISATION_CLASSES.infoMessage
18423
+ }, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18366
18424
  id: "eligibility-modal.bullet-2",
18367
18425
  defaultMessage: "Renseignez les <strong>informations</strong> demand\xE9es.",
18368
18426
  values: {
@@ -18374,7 +18432,9 @@
18374
18432
  className: s$4.listItem
18375
18433
  }, /*#__PURE__*/react.createElement("div", {
18376
18434
  className: s$4.bullet
18377
- }, "3"), /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18435
+ }, "3"), /*#__PURE__*/react.createElement("div", {
18436
+ className: STATIC_CUSTOMISATION_CLASSES.infoMessage
18437
+ }, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18378
18438
  id: "eligibility-modal.bullet-3",
18379
18439
  defaultMessage: "La validation de votre paiement <strong>instantan\xE9e</strong> !",
18380
18440
  values: {
@@ -18430,32 +18490,44 @@
18430
18490
 
18431
18491
  var s$6 = {"title":"_3ERx-"};
18432
18492
 
18433
- var Title = function Title() {
18493
+ var Title = function Title(_ref) {
18494
+ var isSomePlanDeferred = _ref.isSomePlanDeferred;
18434
18495
  return /*#__PURE__*/react.createElement("div", {
18435
- className: s$6.title,
18496
+ className: classnames(s$6.title, STATIC_CUSTOMISATION_CLASSES.title),
18436
18497
  "data-testid": "modal-title-element"
18437
- }, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18438
- id: "eligibility-modal.title",
18498
+ }, isSomePlanDeferred ? /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18499
+ id: 'eligibility-modal.title-deferred',
18439
18500
  defaultMessage: "<highlighted>Payez en plusieurs fois</highlighted> ou plus tard par carte bancaire avec Alma.",
18440
18501
  values: {
18441
18502
  highlighted: function highlighted() {
18442
18503
  return /*#__PURE__*/react.createElement("span", null, [].slice.call(arguments));
18443
18504
  }
18444
18505
  }
18506
+ }) : /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18507
+ id: 'eligibility-modal.title',
18508
+ defaultMessage: "<highlighted>Payez en plusieurs fois</highlighted> par carte bancaire avec Alma.",
18509
+ values: {
18510
+ highlighted: function highlighted() {
18511
+ return /*#__PURE__*/react.createElement("span", null, [].slice.call(arguments));
18512
+ }
18513
+ }
18445
18514
  }));
18446
18515
  };
18447
18516
 
18448
18517
  var s$7 = {"container":"_21g6u","block":"_3zaP5","left":"_2SBRC"};
18449
18518
 
18450
18519
  var DesktopModal = function DesktopModal(_ref) {
18451
- var children = _ref.children;
18520
+ var children = _ref.children,
18521
+ isSomePlanDeferred = _ref.isSomePlanDeferred;
18452
18522
  return /*#__PURE__*/react.createElement("div", {
18453
18523
  className: s$7.container,
18454
18524
  "data-testid": "modal-container"
18455
18525
  }, /*#__PURE__*/react.createElement("div", {
18456
- className: classnames([s$7.block, s$7.left])
18457
- }, /*#__PURE__*/react.createElement(Title, null), /*#__PURE__*/react.createElement(Info, null), /*#__PURE__*/react.createElement(Logo, null)), /*#__PURE__*/react.createElement("div", {
18458
- className: s$7.block
18526
+ className: classnames([s$7.block, s$7.left, STATIC_CUSTOMISATION_CLASSES.leftSide])
18527
+ }, /*#__PURE__*/react.createElement(Title, {
18528
+ isSomePlanDeferred: isSomePlanDeferred
18529
+ }), /*#__PURE__*/react.createElement(Info, null), /*#__PURE__*/react.createElement(Logo, null)), /*#__PURE__*/react.createElement("div", {
18530
+ className: classnames(s$7.block, STATIC_CUSTOMISATION_CLASSES.rightSide)
18459
18531
  }, children));
18460
18532
  };
18461
18533
 
@@ -18464,11 +18536,14 @@
18464
18536
  var s$9 = {"container":"_2G7Ch"};
18465
18537
 
18466
18538
  var MobileModal = function MobileModal(_ref) {
18467
- var children = _ref.children;
18539
+ var children = _ref.children,
18540
+ isSomePlanDeferred = _ref.isSomePlanDeferred;
18468
18541
  return /*#__PURE__*/react.createElement("div", {
18469
18542
  className: s$9.container,
18470
18543
  "data-testid": "modal-container"
18471
- }, /*#__PURE__*/react.createElement(Title, null), children, /*#__PURE__*/react.createElement(Info, null), /*#__PURE__*/react.createElement(Logo, null));
18544
+ }, /*#__PURE__*/react.createElement(Title, {
18545
+ isSomePlanDeferred: isSomePlanDeferred
18546
+ }), children, /*#__PURE__*/react.createElement(Info, null), /*#__PURE__*/react.createElement(Logo, null));
18472
18547
  };
18473
18548
 
18474
18549
  var EligibilityModal = function EligibilityModal(_ref) {
@@ -18489,25 +18564,23 @@
18489
18564
  return plan.eligible;
18490
18565
  });
18491
18566
  var currentPlan = eligiblePlans[currentPlanIndex];
18492
- var modalProps = {
18493
- eligibilityPlans: eligiblePlans,
18494
- currentPlanIndex: currentPlanIndex,
18495
- setCurrentPlanIndex: setCurrentPlanIndex,
18496
- currentPlan: currentPlan,
18497
- status: status
18498
- };
18567
+ var isSomePlanDeferred = eligibilityPlans.some(function (plan) {
18568
+ return plan.deferred_days > 0 || plan.deferred_months > 0;
18569
+ });
18499
18570
  return /*#__PURE__*/react.createElement(ControlledModal, {
18500
18571
  onClose: onClose,
18501
18572
  ariaHideApp: false,
18502
18573
  scrollable: true,
18503
18574
  isOpen: true
18504
- }, /*#__PURE__*/react.createElement(ModalComponent, Object.assign({}, modalProps), status === apiStatus.PENDING && /*#__PURE__*/react.createElement("div", {
18575
+ }, /*#__PURE__*/react.createElement(ModalComponent, {
18576
+ isSomePlanDeferred: isSomePlanDeferred
18577
+ }, status === apiStatus.PENDING && /*#__PURE__*/react.createElement("div", {
18505
18578
  className: s$8.loader
18506
18579
  }, /*#__PURE__*/react.createElement(LoadingIndicator, null)), status === apiStatus.SUCCESS && eligiblePlans.length === 0 && /*#__PURE__*/react.createElement("div", {
18507
18580
  className: s$8.noEligibility
18508
18581
  }, /*#__PURE__*/react.createElement(MemoizedFormattedMessage, {
18509
18582
  id: "eligibility-modal.no-eligibility",
18510
- defaultMessage: "Oups, il semblerait que la simulation n'aie pas fonctionn\xE9."
18583
+ defaultMessage: "Oups, il semblerait que la simulation n'ait pas fonctionn\xE9."
18511
18584
  })), status === apiStatus.SUCCESS && eligiblePlans.length >= 1 && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(EligibilityPlansButtons, {
18512
18585
  eligibilityPlans: eligiblePlans,
18513
18586
  currentPlanIndex: currentPlanIndex,
@@ -18624,6 +18697,24 @@
18624
18697
  return 0;
18625
18698
  };
18626
18699
 
18700
+ /**
18701
+ * Prefix classes to avoid name collisions.
18702
+ */
18703
+ var prefix$1 = 'alma-payment-plans';
18704
+ /**
18705
+ * Class names for the **payment plans** widget.
18706
+ * Those classes are intended to be used by the **merchant developer**.
18707
+ */
18708
+
18709
+ var STATIC_CUSTOMISATION_CLASSES$1 = {
18710
+ container: prefix$1 + '-container',
18711
+ eligibilityLine: prefix$1 + '-eligibility-line',
18712
+ eligibilityOptions: prefix$1 + '-eligibility-options',
18713
+ notEligibleOption: prefix$1 + '-not-eligible-option',
18714
+ paymentInfo: prefix$1 + '-payment-info',
18715
+ activeOption: prefix$1 + '-active-option'
18716
+ };
18717
+
18627
18718
  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"};
18628
18719
 
18629
18720
  var VERY_LONG_TIME_IN_MS = 1000 * 3600 * 24 * 365;
@@ -18650,7 +18741,7 @@
18650
18741
  eligibilityPlans: eligibilityPlans,
18651
18742
  suggestedPaymentPlan: suggestedPaymentPlan != null ? suggestedPaymentPlan : 0
18652
18743
  });
18653
- var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab and remove animated transition.
18744
+ var isSuggestedPaymentPlanSpecified = suggestedPaymentPlan !== undefined; // 👈 The merchant decided to focus a tab
18654
18745
 
18655
18746
  var isTransitionSpecified = transitionDelay !== undefined; // 👈 The merchant has specified a transition time
18656
18747
 
@@ -18735,14 +18826,14 @@
18735
18826
 
18736
18827
  return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("div", {
18737
18828
  onClick: handleOpenModal,
18738
- className: classnames(s$b.widgetButton, (_cx = {}, _cx[s$b.clickable] = eligiblePlans.length > 0, _cx[s$b.unClickable] = eligiblePlans.length === 0, _cx)),
18829
+ className: classnames(s$b.widgetButton, (_cx = {}, _cx[s$b.clickable] = eligiblePlans.length > 0, _cx[s$b.unClickable] = eligiblePlans.length === 0, _cx), STATIC_CUSTOMISATION_CLASSES$1.container),
18739
18830
  "data-testid": "widget-button"
18740
18831
  }, /*#__PURE__*/react.createElement("div", {
18741
- className: s$b.primaryContainer
18832
+ className: classnames(s$b.primaryContainer, STATIC_CUSTOMISATION_CLASSES$1.eligibilityLine)
18742
18833
  }, /*#__PURE__*/react.createElement(LogoIcon, {
18743
18834
  className: s$b.logo
18744
18835
  }), /*#__PURE__*/react.createElement("div", {
18745
- className: s$b.paymentPlans
18836
+ className: classnames(s$b.paymentPlans, STATIC_CUSTOMISATION_CLASSES$1.eligibilityOptions)
18746
18837
  }, eligibilityPlans.map(function (eligibilityPlan, key) {
18747
18838
  var _cx2;
18748
18839
 
@@ -18752,10 +18843,10 @@
18752
18843
  return onHover(key);
18753
18844
  },
18754
18845
  onMouseOut: onLeave,
18755
- className: classnames(s$b.plan, (_cx2 = {}, _cx2[s$b.active] = current === key, _cx2[s$b.notEligible] = !eligibilityPlan.eligible, _cx2))
18846
+ className: classnames(s$b.plan, (_cx2 = {}, _cx2[classnames(s$b.active, STATIC_CUSTOMISATION_CLASSES$1.activeOption)] = current === key, _cx2[classnames(s$b.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = !eligibilityPlan.eligible, _cx2))
18756
18847
  }, paymentPlanShorthandName(eligibilityPlan));
18757
18848
  }))), /*#__PURE__*/react.createElement("div", {
18758
- className: classnames(s$b.info, (_cx3 = {}, _cx3[s$b.notEligible] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3))
18849
+ className: classnames(s$b.info, (_cx3 = {}, _cx3[classnames(s$b.notEligible, STATIC_CUSTOMISATION_CLASSES$1.notEligibleOption)] = eligibilityPlans[current] && !eligibilityPlans[current].eligible, _cx3), STATIC_CUSTOMISATION_CLASSES$1.paymentInfo)
18759
18850
  }, eligibilityPlans.length !== 0 && paymentPlanInfoText(eligibilityPlans[current]))), isOpen && /*#__PURE__*/react.createElement(EligibilityModal, {
18760
18851
  initialPlanIndex: getIndexWithinEligiblePlans(current),
18761
18852
  onClose: closeModal,