@rebilly/instruments 8.42.0 → 8.43.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [8.43.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.42.1...instruments/core-v8.43.0) (2024-02-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * **rebilly-js-sdk:** Add Subscriptions resource ([#3329](https://github.com/Rebilly/rebilly/issues/3329)) ([754309b](https://github.com/Rebilly/rebilly/commit/754309bbcd2a733a6fe1fe6d3267d43def87916a))
7
+
8
+ ## [8.42.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.42.0...instruments/core-v8.42.1) (2024-02-06)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **instrument:** Prevent payment for completed transaction ([#3310](https://github.com/Rebilly/rebilly/issues/3310)) ([cd331c5](https://github.com/Rebilly/rebilly/commit/cd331c53199a06a4182ecbd31865e0d7ef8e4afe))
14
+
1
15
  ## [8.42.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.41.1...instruments/core-v8.42.0) (2024-02-05)
2
16
 
3
17
 
package/dist/index.js CHANGED
@@ -1481,7 +1481,8 @@ const en = {
1481
1481
  invoiceIsPaid: "The invoice has been fully paid.",
1482
1482
  invoiceIsVoid: "The invoice has been voided.",
1483
1483
  invoiceIsAbandoned: "The invoice has been abandoned.",
1484
- invoiceIsRefunded: "The invoice has been refunded."
1484
+ invoiceIsRefunded: "The invoice has been refunded.",
1485
+ transactionIsCompleted: "This transaction cannot be updated."
1485
1486
  },
1486
1487
  loaderMessages: {
1487
1488
  processingPayment: "Processing payment instrument."
@@ -1520,7 +1521,8 @@ const es = {
1520
1521
  invoiceIsPaid: "La factura ha sido completamente pagada.",
1521
1522
  invoiceIsVoid: "La factura ha sido anulada.",
1522
1523
  invoiceIsAbandoned: "La factura ha sido abandonada.",
1523
- invoiceIsRefunded: "La factura ha reembolsada."
1524
+ invoiceIsRefunded: "La factura ha reembolsada.",
1525
+ transactionIsCompleted: "La transacción no pudo ser actualizada."
1524
1526
  },
1525
1527
  loaderMessages: {
1526
1528
  processingPayment: "Procesamiento de instrumento de pago."
@@ -5994,7 +5996,7 @@ function cloneArrayDeep(val, instanceClone) {
5994
5996
  return res;
5995
5997
  }
5996
5998
  var cloneDeep_1 = cloneDeep;
5997
- const version = "55.16.0";
5999
+ const version = "55.17.0";
5998
6000
  let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
5999
6001
  let nanoid = (size2 = 21) => {
6000
6002
  let id2 = "";
@@ -8250,7 +8252,7 @@ function SubscriptionReactivationsResource({ apiHandler }) {
8250
8252
  }
8251
8253
  };
8252
8254
  }
8253
- function SubscriptionsResource$1({ apiHandler }) {
8255
+ function SubscriptionsResource$2({ apiHandler }) {
8254
8256
  return {
8255
8257
  getAll({
8256
8258
  filter: filter2 = null,
@@ -8705,7 +8707,7 @@ class ApiInstance {
8705
8707
  this.subscriptionReactivations = SubscriptionReactivationsResource({
8706
8708
  apiHandler
8707
8709
  });
8708
- this.subscriptions = SubscriptionsResource$1({ apiHandler });
8710
+ this.subscriptions = SubscriptionsResource$2({ apiHandler });
8709
8711
  this.tags = TagsResource({ apiHandler });
8710
8712
  this.tagsRules = TagsRulesResource({ apiHandler });
8711
8713
  this.tracking = TrackingResource({ apiHandler });
@@ -9091,7 +9093,7 @@ function ReportsResource({ apiHandler }) {
9091
9093
  }
9092
9094
  };
9093
9095
  }
9094
- function SubscriptionsResource({ apiHandler }) {
9096
+ function SubscriptionsResource$1({ apiHandler }) {
9095
9097
  return {
9096
9098
  getSubscriptionSummaryMetrics({ subscriptionId }) {
9097
9099
  return apiHandler.get(`subscriptions/${subscriptionId}/summary-metrics`);
@@ -9138,7 +9140,7 @@ const ExperimentalResources = {
9138
9140
  DataExportsResource,
9139
9141
  HistogramsResource,
9140
9142
  ReportsResource,
9141
- SubscriptionsResource,
9143
+ SubscriptionsResource: SubscriptionsResource$1,
9142
9144
  TimelinesResource,
9143
9145
  LocationResource
9144
9146
  };
@@ -9327,9 +9329,6 @@ function OrdersResource({ apiHandler }) {
9327
9329
  const params = { filter: filter2, sort, limit, offset, q };
9328
9330
  return apiHandler.getAll(`orders`, params);
9329
9331
  },
9330
- create({ data }) {
9331
- return apiHandler.post(`orders`, data);
9332
- },
9333
9332
  get({ id: id2 }) {
9334
9333
  return apiHandler.get(`orders/${id2}`);
9335
9334
  },
@@ -9484,6 +9483,13 @@ function RichBillingPortalsResource({ apiHandler }) {
9484
9483
  }
9485
9484
  };
9486
9485
  }
9486
+ function SubscriptionsResource({ apiHandler }) {
9487
+ return {
9488
+ create({ data }) {
9489
+ return apiHandler.post(`subscriptions`, data);
9490
+ }
9491
+ };
9492
+ }
9487
9493
  function TransactionsResource({ apiHandler }) {
9488
9494
  return {
9489
9495
  getAll({
@@ -9540,6 +9546,7 @@ class StorefrontApiInstance {
9540
9546
  this.quotes = QuotesResource({ apiHandler });
9541
9547
  this.readyToPayout = ReadyToPayoutResource({ apiHandler });
9542
9548
  this.richBillingPortals = RichBillingPortalsResource({ apiHandler });
9549
+ this.subscriptions = SubscriptionsResource({ apiHandler });
9543
9550
  this.transactions = TransactionsResource({ apiHandler });
9544
9551
  this.websites = WebsitesResource({ apiHandler });
9545
9552
  this.checkoutForm = this.checkoutForms;
@@ -14234,7 +14241,7 @@ async function fetchInvoiceAndProducts({
14234
14241
  };
14235
14242
  });
14236
14243
  }
14237
- class TransactionModel extends BaseModel {
14244
+ const _TransactionModel = class _TransactionModel2 extends BaseModel {
14238
14245
  constructor({ invoiceIds = [], ...fields }) {
14239
14246
  super(fields);
14240
14247
  this.invoiceIds = invoiceIds || [];
@@ -14245,7 +14252,14 @@ class TransactionModel extends BaseModel {
14245
14252
  get hasInvoice() {
14246
14253
  return Boolean(this.invoiceId);
14247
14254
  }
14248
- }
14255
+ get transactionIsCompleted() {
14256
+ return this.status === _TransactionModel2.Status.completed;
14257
+ }
14258
+ };
14259
+ _TransactionModel.Status = {
14260
+ completed: "completed"
14261
+ };
14262
+ let TransactionModel = _TransactionModel;
14249
14263
  async function fetchTransaction({
14250
14264
  data = null
14251
14265
  }) {
@@ -23435,7 +23449,7 @@ function handleComputedProperty(options) {
23435
23449
  var _a;
23436
23450
  return Object.assign({}, options, {
23437
23451
  _computed: {
23438
- version: "8.41.1",
23452
+ version: "8.42.1",
23439
23453
  paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
23440
23454
  }
23441
23455
  });
@@ -26635,7 +26649,7 @@ async function mount({
26635
26649
  setupFramepay: setupFramepay$1 = setupFramepay,
26636
26650
  ...options
26637
26651
  } = {}) {
26638
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
26652
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
26639
26653
  try {
26640
26654
  state.data = {};
26641
26655
  state.options = {};
@@ -26696,11 +26710,15 @@ async function mount({
26696
26710
  } else if (invoiceId && ((_j = state.data.invoice) == null ? void 0 : _j.isRefunded)) {
26697
26711
  clearFormOnError("form.error.invoiceIsRefunded");
26698
26712
  }
26713
+ const transactionId = ((_k = state.options) == null ? void 0 : _k.transactionId) || ((_m = (_l = state.data) == null ? void 0 : _l.transaction) == null ? void 0 : _m.id);
26714
+ if (transactionId && ((_o = (_n = state.data) == null ? void 0 : _n.transaction) == null ? void 0 : _o.transactionIsCompleted)) {
26715
+ clearFormOnError("form.error.transactionIsCompleted");
26716
+ }
26699
26717
  let hasNoPaymentMethods = false;
26700
26718
  if (data.payout) {
26701
- hasNoPaymentMethods = !((_k = data.readyToPayout) == null ? void 0 : _k.length);
26719
+ hasNoPaymentMethods = !((_p = data.readyToPayout) == null ? void 0 : _p.length);
26702
26720
  } else {
26703
- hasNoPaymentMethods = !((_l = data.readyToPay) == null ? void 0 : _l.length);
26721
+ hasNoPaymentMethods = !((_q = data.readyToPay) == null ? void 0 : _q.length);
26704
26722
  }
26705
26723
  if (hasNoPaymentMethods) {
26706
26724
  state.loader.stopLoading({ id: "rebilly-instruments-form" });
@@ -26771,7 +26789,7 @@ class RebillyInstrumentsInstance {
26771
26789
  await show({ componentName, payload });
26772
26790
  }
26773
26791
  get version() {
26774
- return `RebillyInstruments Ver.${"8.41.1"}`;
26792
+ return `RebillyInstruments Ver.${"8.42.1"}`;
26775
26793
  }
26776
26794
  on(eventName, callback) {
26777
26795
  on({ eventName, callback });