@rebilly/instruments 8.25.1 → 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,17 @@
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
+
8
+ ## [8.25.2](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.25.1...instruments/core-v8.25.2) (2024-01-19)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **instruments:** Update secondary button style ([#2984](https://github.com/Rebilly/rebilly/issues/2984)) ([878e4cb](https://github.com/Rebilly/rebilly/commit/878e4cb694fdbaa00f2f414e292c4e42aee79831))
14
+
1
15
  ## [8.25.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.25.0...instruments/core-v8.25.1) (2024-01-19)
2
16
 
3
17
 
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.0",
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
  });
@@ -24315,7 +24330,7 @@ const properties = {
24315
24330
  buttonSecondaryColorText: {
24316
24331
  fallback: {
24317
24332
  type: "variable",
24318
- value: "colorPrimary"
24333
+ value: "colorText"
24319
24334
  }
24320
24335
  },
24321
24336
  buttonSecondaryFontFamily: {
@@ -24345,13 +24360,13 @@ const properties = {
24345
24360
  buttonSecondaryBorder: {
24346
24361
  fallback: {
24347
24362
  type: "func",
24348
- value: (theme2) => `1px solid ${theme2.colorPrimary}`
24363
+ value: (theme2) => `1px solid ${theme2.colorMutedBorder}`
24349
24364
  }
24350
24365
  },
24351
24366
  buttonSecondaryBorderColor: {
24352
24367
  fallback: {
24353
24368
  type: "variable",
24354
- value: "colorPrimary"
24369
+ value: "colorMutedBorder"
24355
24370
  }
24356
24371
  },
24357
24372
  buttonSecondaryBorderWidth: {
@@ -24467,14 +24482,19 @@ const properties = {
24467
24482
  /** Buttons Secondary: Hover */
24468
24483
  buttonSecondaryHoverColorBackground: {
24469
24484
  fallback: {
24470
- type: "variable",
24471
- value: "colorBackground"
24485
+ type: "func",
24486
+ value: (theme2) => {
24487
+ if (theme2.colorBackgroundProvided) {
24488
+ return darken(theme2.colorBackground, 3);
24489
+ }
24490
+ return darken(theme2.colorBackground, 3);
24491
+ }
24472
24492
  }
24473
24493
  },
24474
24494
  buttonSecondaryHoverColorText: {
24475
24495
  fallback: {
24476
24496
  type: "variable",
24477
- value: "buttonSecondaryColorText"
24497
+ value: "colorText"
24478
24498
  }
24479
24499
  },
24480
24500
  buttonSecondaryHoverFontFamily: {
@@ -24510,7 +24530,7 @@ const properties = {
24510
24530
  buttonSecondaryHoverBorderColor: {
24511
24531
  fallback: {
24512
24532
  type: "variable",
24513
- value: "colorPrimary"
24533
+ value: "buttonSecondaryBorderColor"
24514
24534
  }
24515
24535
  },
24516
24536
  buttonSecondaryHoverBorderWidth: {
@@ -26533,7 +26553,7 @@ async function mount({
26533
26553
  setupFramepay: setupFramepay$1 = setupFramepay,
26534
26554
  ...options
26535
26555
  } = {}) {
26536
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
26556
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
26537
26557
  try {
26538
26558
  state.data = {};
26539
26559
  state.options = {};
@@ -26579,20 +26599,26 @@ async function mount({
26579
26599
  }
26580
26600
  state.i18n();
26581
26601
  state.hasMounted = true;
26582
- const invoiceId = ((_d = state.options) == null ? void 0 : _d.invoiceId) || ((_f = (_e = state.data) == null ? void 0 : _e.transaction) == null ? void 0 : _f.invoiceId);
26583
- if (invoiceId && ((_g = state.data.invoice) == null ? void 0 : _g.isPaid)) {
26602
+ const clearFormOnError = (errorMessage) => {
26584
26603
  state.loader.stopLoading({ id: "rebilly-instruments-form" });
26585
26604
  removeForm();
26586
- showError(
26587
- state.translate.getTranslation("form.error.invoiceIsPaid"),
26588
- false
26589
- );
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");
26590
26616
  }
26591
26617
  let hasNoPaymentMethods = false;
26592
26618
  if (data.payout) {
26593
- hasNoPaymentMethods = !((_h = data.readyToPayout) == null ? void 0 : _h.length);
26619
+ hasNoPaymentMethods = !((_k = data.readyToPayout) == null ? void 0 : _k.length);
26594
26620
  } else {
26595
- hasNoPaymentMethods = !((_i = data.readyToPay) == null ? void 0 : _i.length);
26621
+ hasNoPaymentMethods = !((_l = data.readyToPay) == null ? void 0 : _l.length);
26596
26622
  }
26597
26623
  if (hasNoPaymentMethods) {
26598
26624
  state.loader.stopLoading({ id: "rebilly-instruments-form" });
@@ -26662,7 +26688,7 @@ class RebillyInstrumentsInstance {
26662
26688
  await show({ componentName, payload });
26663
26689
  }
26664
26690
  get version() {
26665
- return `RebillyInstruments Ver.${"8.25.0"}`;
26691
+ return `RebillyInstruments Ver.${"8.25.2"}`;
26666
26692
  }
26667
26693
  on(eventName, callback) {
26668
26694
  on({ eventName, callback });