@rebilly/instruments 9.16.3 → 9.17.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [9.17.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.17.0...instruments/core-v9.17.1) (2024-03-25)
2
+
3
+ ## [9.17.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.16.3...instruments/core-v9.17.0) (2024-03-25)
4
+
5
+
6
+ ### Features
7
+
8
+ * **instruments:** Add retry feature for deposit transaction ([#4017](https://github.com/Rebilly/rebilly/issues/4017)) ([cd046ce](https://github.com/Rebilly/rebilly/commit/cd046ce262a14401c5d948a53e66f44c163be568))
9
+
1
10
  ## [9.16.3](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.16.2...instruments/core-v9.16.3) (2024-03-25)
2
11
 
3
12
  ## [9.16.2](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.16.1...instruments/core-v9.16.2) (2024-03-22)
package/dist/index.js CHANGED
@@ -5963,7 +5963,7 @@ function Je(t2, e2) {
5963
5963
  return s2;
5964
5964
  }
5965
5965
  var Ge = P$1;
5966
- const Ye = /* @__PURE__ */ we(Ge), Qe = "56.3.1";
5966
+ const Ye = /* @__PURE__ */ we(Ge), Qe = "56.3.2";
5967
5967
  let Xe = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Ze = (t2 = 21) => {
5968
5968
  let e2 = "", s2 = t2;
5969
5969
  for (; s2--; )
@@ -15781,6 +15781,10 @@ class DataInstance {
15781
15781
  get isPayment() {
15782
15782
  return Boolean(this.invoice || this.transaction || this.money);
15783
15783
  }
15784
+ get isDepositTransaction() {
15785
+ var _a;
15786
+ return Boolean((_a = this.transaction) == null ? void 0 : _a.depositRequestId);
15787
+ }
15784
15788
  get isInvoice() {
15785
15789
  return Boolean(this.invoice);
15786
15790
  }
@@ -15826,6 +15830,7 @@ class DataInstance {
15826
15830
  isPayment: this.isPayment,
15827
15831
  isInvoice: this.isInvoice,
15828
15832
  isPurchase: this.isPurchase,
15833
+ isDepositTransaction: this.isDepositTransaction,
15829
15834
  hasAmountDue: this.hasAmountDue,
15830
15835
  summaryItems: this.summaryItems,
15831
15836
  summaryLineItems: this.summaryLineItems,
@@ -16316,6 +16321,20 @@ async function mountAmountSelector() {
16316
16321
  mountMethodSelector();
16317
16322
  });
16318
16323
  }
16324
+ async function createDeposit({
16325
+ data
16326
+ }) {
16327
+ return Endpoint(async () => {
16328
+ validateStorefront(state.storefront);
16329
+ validateOptions$1(state.options);
16330
+ if (data == null) {
16331
+ throw new Error("Invalid payload.");
16332
+ }
16333
+ state.storefront.setSessionToken(state.options.jwt);
16334
+ const { fields } = await state.storefront.deposit.create({ data });
16335
+ return new TransactionModel(fields);
16336
+ });
16337
+ }
16319
16338
  function getElement(id2, rootElement = state.form) {
16320
16339
  return rootElement.querySelector(`[data-rebilly-instruments="${id2}"]`);
16321
16340
  }
@@ -16469,7 +16488,19 @@ async function mountMethodSelector() {
16469
16488
  });
16470
16489
  (_e2 = iframe == null ? void 0 : iframe.component) == null ? void 0 : _e2.call("update", model);
16471
16490
  if (!((_g = (_f = iframe == null ? void 0 : iframe.component) == null ? void 0 : _f.events) == null ? void 0 : _g["restart-payment-flow"])) {
16472
- (_h = iframe == null ? void 0 : iframe.component) == null ? void 0 : _h.on("restart-payment-flow", () => {
16491
+ (_h = iframe == null ? void 0 : iframe.component) == null ? void 0 : _h.on("restart-payment-flow", async (payload) => {
16492
+ if (payload == null ? void 0 : payload.createNewDeposit) {
16493
+ const transaction = await createDeposit({
16494
+ data: {
16495
+ depositRequestId: payload.depositRequestId,
16496
+ amount: payload.amount
16497
+ }
16498
+ });
16499
+ if (transaction.approvalUrl) {
16500
+ window.location.assign(transaction.approvalUrl);
16501
+ return;
16502
+ }
16503
+ }
16473
16504
  if (state.data.isPurchase) {
16474
16505
  updateSummary();
16475
16506
  }
@@ -24673,7 +24704,7 @@ function handleComputedProperty(options) {
24673
24704
  var _a;
24674
24705
  return Object.assign({}, options, {
24675
24706
  _computed: {
24676
- version: "9.16.2",
24707
+ version: "9.17.0",
24677
24708
  paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
24678
24709
  }
24679
24710
  });
@@ -28015,7 +28046,7 @@ class RebillyInstrumentsInstance {
28015
28046
  await show({ componentName, payload });
28016
28047
  }
28017
28048
  get version() {
28018
- return `RebillyInstruments Ver.${"9.16.2"}`;
28049
+ return `RebillyInstruments Ver.${"9.17.0"}`;
28019
28050
  }
28020
28051
  on(eventName, callback) {
28021
28052
  on({ eventName, callback });