@rebilly/instruments 8.25.2 → 8.25.3

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [8.25.3](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.25.2...instruments/core-v8.25.3) (2024-01-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **instrument:** Fix undefined error ([#3008](https://github.com/Rebilly/rebilly/issues/3008)) ([d6e6b76](https://github.com/Rebilly/rebilly/commit/d6e6b761cd836f1f4d4f00d4ec48d68fa2d840ba))
7
+
1
8
  ## [8.25.2](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.25.1...instruments/core-v8.25.2) (2024-01-19)
2
9
 
3
10
 
package/dist/index.js CHANGED
@@ -1478,7 +1478,10 @@ const en = {
1478
1478
  andMore: "and more",
1479
1479
  error: {
1480
1480
  noPaymentMethods: "No payment methods available for this transaction, please contact support.",
1481
- invoiceIsPaid: "The invoice has been fully paid."
1481
+ invoiceIsPaid: "The invoice has been fully paid.",
1482
+ invoiceIsVoid: "The invoice has been voided.",
1483
+ invoiceIsAbandoned: "The invoice has been abandoned.",
1484
+ invoiceIsRefunded: "The invoice has been refunded."
1482
1485
  },
1483
1486
  loaderMessages: {
1484
1487
  processingPayment: "Processing payment instrument."
@@ -1514,7 +1517,10 @@ const es = {
1514
1517
  andMore: "y más",
1515
1518
  error: {
1516
1519
  noPaymentMethods: "No hay métodos de pago disponibles para esta transacción, por favor, póngase en contacto con el servicio de asistencia.",
1517
- invoiceIsPaid: "La factura ha sido completamente pagada."
1520
+ invoiceIsPaid: "La factura ha sido completamente pagada.",
1521
+ invoiceIsVoid: "La factura ha sido anulada.",
1522
+ invoiceIsAbandoned: "La factura ha sido abandonada.",
1523
+ invoiceIsRefunded: "La factura ha reembolsada."
1518
1524
  },
1519
1525
  loaderMessages: {
1520
1526
  processingPayment: "Procesamiento de instrumento de pago."
@@ -2770,7 +2776,7 @@ const errorTemplate = (error2) => {
2770
2776
  function displayList() {
2771
2777
  function displayDetail(detail) {
2772
2778
  let detailMessage = detail;
2773
- if (detail["data-rebilly"]) {
2779
+ if (detail == null ? void 0 : detail["data-rebilly"]) {
2774
2780
  detailMessage = `"${detail["data-rebilly"]}" ${detail.error}`;
2775
2781
  }
2776
2782
  return detailMessage;
@@ -14140,6 +14146,15 @@ const _InvoiceModel = class _InvoiceModel2 extends BaseModel {
14140
14146
  get isPaid() {
14141
14147
  return this.status === _InvoiceModel2.Status.paid;
14142
14148
  }
14149
+ get isVoid() {
14150
+ return this.status === _InvoiceModel2.Status.voided;
14151
+ }
14152
+ get isRefunded() {
14153
+ return this.status === _InvoiceModel2.Status.refunded;
14154
+ }
14155
+ get isAbandoned() {
14156
+ return this.status === _InvoiceModel2.Status.abandoned;
14157
+ }
14143
14158
  };
14144
14159
  _InvoiceModel.Status = {
14145
14160
  draft: "draft",
@@ -23349,7 +23364,7 @@ function handleComputedProperty(options) {
23349
23364
  var _a;
23350
23365
  return Object.assign({}, options, {
23351
23366
  _computed: {
23352
- version: "8.25.1",
23367
+ version: "8.25.2",
23353
23368
  paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
23354
23369
  }
23355
23370
  });
@@ -26538,7 +26553,7 @@ async function mount({
26538
26553
  setupFramepay: setupFramepay$1 = setupFramepay,
26539
26554
  ...options
26540
26555
  } = {}) {
26541
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
26556
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
26542
26557
  try {
26543
26558
  state.data = {};
26544
26559
  state.options = {};
@@ -26584,20 +26599,26 @@ async function mount({
26584
26599
  }
26585
26600
  state.i18n();
26586
26601
  state.hasMounted = true;
26587
- const invoiceId = ((_d = state.options) == null ? void 0 : _d.invoiceId) || ((_f = (_e = state.data) == null ? void 0 : _e.transaction) == null ? void 0 : _f.invoiceId);
26588
- if (invoiceId && ((_g = state.data.invoice) == null ? void 0 : _g.isPaid)) {
26602
+ const clearFormOnError = (errorMessage) => {
26589
26603
  state.loader.stopLoading({ id: "rebilly-instruments-form" });
26590
26604
  removeForm();
26591
- showError(
26592
- state.translate.getTranslation("form.error.invoiceIsPaid"),
26593
- false
26594
- );
26605
+ showError(state.translate.getTranslation(errorMessage), false);
26606
+ };
26607
+ const invoiceId = ((_d = state.options) == null ? void 0 : _d.invoiceId) || ((_f = (_e = state.data) == null ? void 0 : _e.transaction) == null ? void 0 : _f.invoiceId);
26608
+ if (invoiceId && ((_g = state.data.invoice) == null ? void 0 : _g.isPaid)) {
26609
+ clearFormOnError("form.error.invoiceIsPaid");
26610
+ } else if (invoiceId && ((_h = state.data.invoice) == null ? void 0 : _h.isAbandoned)) {
26611
+ clearFormOnError("form.error.invoiceIsAbandoned");
26612
+ } else if (invoiceId && ((_i = state.data.invoice) == null ? void 0 : _i.isVoid)) {
26613
+ clearFormOnError("form.error.invoiceIsVoid");
26614
+ } else if (invoiceId && ((_j = state.data.invoice) == null ? void 0 : _j.isRefunded)) {
26615
+ clearFormOnError("form.error.invoiceIsRefunded");
26595
26616
  }
26596
26617
  let hasNoPaymentMethods = false;
26597
26618
  if (data.payout) {
26598
- hasNoPaymentMethods = !((_h = data.readyToPayout) == null ? void 0 : _h.length);
26619
+ hasNoPaymentMethods = !((_k = data.readyToPayout) == null ? void 0 : _k.length);
26599
26620
  } else {
26600
- hasNoPaymentMethods = !((_i = data.readyToPay) == null ? void 0 : _i.length);
26621
+ hasNoPaymentMethods = !((_l = data.readyToPay) == null ? void 0 : _l.length);
26601
26622
  }
26602
26623
  if (hasNoPaymentMethods) {
26603
26624
  state.loader.stopLoading({ id: "rebilly-instruments-form" });
@@ -26667,7 +26688,7 @@ class RebillyInstrumentsInstance {
26667
26688
  await show({ componentName, payload });
26668
26689
  }
26669
26690
  get version() {
26670
- return `RebillyInstruments Ver.${"8.25.1"}`;
26691
+ return `RebillyInstruments Ver.${"8.25.2"}`;
26671
26692
  }
26672
26693
  on(eventName, callback) {
26673
26694
  on({ eventName, callback });