@rebilly/instruments 9.47.0 → 9.47.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,6 +1,6 @@
1
- ## [9.47.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.46.1...instruments/core-v9.47.0) (2024-05-21)
1
+ ## [9.47.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.47.0...instruments/core-v9.47.1) (2024-05-22)
2
2
 
3
3
 
4
- ### Features
4
+ ### Bug Fixes
5
5
 
6
- * **api-metadata, rebilly-js-sdk:** Update resources based on latest api definitions ([#5344](https://github.com/Rebilly/rebilly/issues/5344)) ([7dbce9d](https://github.com/Rebilly/rebilly/commit/7dbce9de1f04e4494d49db158ec522c6660bb14b))
6
+ * **instruments:** Deposit flow is not generating the corresponding deposit and transaction ([#5450](https://github.com/Rebilly/rebilly/issues/5450)) ([5f548ee](https://github.com/Rebilly/rebilly/commit/5f548ee416912559f90bad22de3adc1e60484a25))
package/dist/index.js CHANGED
@@ -16864,38 +16864,6 @@ function generateDigitalWallet({ expressMethods = [] }) {
16864
16864
  });
16865
16865
  return output;
16866
16866
  }
16867
- async function mountAmountSelector() {
16868
- var _a, _b, _c;
16869
- if (state.data.money) {
16870
- state.data.money.amount = null;
16871
- state.data.money.currency = null;
16872
- state.updateModel();
16873
- }
16874
- const iframe = iframes.form;
16875
- if (!iframe) {
16876
- await mountForm();
16877
- }
16878
- const modelSafeState = state.toModel();
16879
- const model = {
16880
- options: modelSafeState.options,
16881
- data: modelSafeState.data
16882
- };
16883
- (_a = iframe.component) == null ? void 0 : _a.call("route", {
16884
- name: "amount-selector"
16885
- });
16886
- (_b = iframe.component) == null ? void 0 : _b.call("update", model);
16887
- (_c = iframe == null ? void 0 : iframe.component) == null ? void 0 : _c.on("confirm-amount", async (data) => {
16888
- const { amount, currency } = data;
16889
- state.data.money = {
16890
- amount,
16891
- currency
16892
- };
16893
- const readyToPayUpdated = await fetchReadyToPay();
16894
- state.data.readyToPay = readyToPayUpdated;
16895
- state.updateModel();
16896
- mountMethodSelector();
16897
- });
16898
- }
16899
16867
  async function createDeposit({
16900
16868
  data
16901
16869
  }) {
@@ -16945,38 +16913,6 @@ function hideExtraUI() {
16945
16913
  }
16946
16914
  }
16947
16915
  }
16948
- const backToAmountElement = () => {
16949
- const template = `
16950
- <div class="rebilly-instruments-confirmation-go-back-link" style="display: inline-block;margin-bottom: var(--rebilly-spacingM);margin-left: calc(var(--rebilly-spacingXs) * -1);">
16951
- <a
16952
- class="rebilly-instruments-link has-icon-left"
16953
- style="display: inline-flex;color: var(--rebilly-colorPrimary);cursor: pointer;"
16954
- >
16955
- <svg
16956
- class="rebilly-instruments-icon"
16957
- style="margin-right: var(--rebilly-spacingXs);fill: var(--rebilly-colorPrimary)"
16958
- viewBox="0 0 24 24"
16959
- xmlns="http://www.w3.org/2000/svg"
16960
- >
16961
- <path
16962
- d="M6.2929 11.2929l5-5c.3905-.3905 1.0237-.3905 1.4142 0 .3905.3905.3905 1.0237 0 1.4142L9.4142 11H17c.5523 0 1 .4477 1 1s-.4477 1-1 1H9.4142l3.293 3.2929c.3904.3905.3904 1.0237 0 1.4142-.3906.3905-1.0238.3905-1.4143 0l-5-5A.9969.9969 0 016 12c0-.2761.112-.5261.2929-.7071z"
16963
- fill-rule="nonzero"
16964
- />
16965
- </svg>
16966
- <span data-rebilly-i18n="deposit.goBack"></span>
16967
- </a>
16968
- </div>
16969
- `;
16970
- const rootDiv = document.createElement("div");
16971
- rootDiv.setAttribute("data-rebilly-instruments", "deposit-back");
16972
- rootDiv.innerHTML += template;
16973
- const link = rootDiv.querySelector(".rebilly-instruments-link");
16974
- link.addEventListener("click", () => {
16975
- hideExtraUI();
16976
- mountAmountSelector();
16977
- });
16978
- return rootDiv;
16979
- };
16980
16916
  const expressMethodsElement = ({ expressMethods }) => {
16981
16917
  const rootDiv = document.createElement("div");
16982
16918
  rootDiv.classList.add("rebilly-instruments-method-selector");
@@ -17002,18 +16938,10 @@ const expressMethodsElement = ({ expressMethods }) => {
17002
16938
  return rootDiv;
17003
16939
  };
17004
16940
  async function mountMethodSelector() {
17005
- var _a, _b, _c, _d, _e2, _f, _g, _h;
16941
+ var _a, _b, _c, _d, _e2, _f, _g;
17006
16942
  const contentEl = getElement("content");
17007
16943
  const formEl = getElement("form");
17008
16944
  const { expressMethods, methods } = getPaymentMethods();
17009
- if ((_a = state.options) == null ? void 0 : _a.deposit) {
17010
- const existingDepositBackElement = getElement("deposit-back");
17011
- if (existingDepositBackElement) {
17012
- existingDepositBackElement.style.height = "auto";
17013
- } else {
17014
- contentEl.insertBefore(backToAmountElement(), formEl);
17015
- }
17016
- }
17017
16945
  if (expressMethods.length) {
17018
16946
  const existingExpressMethodElement = getElement("express-methods");
17019
16947
  if (existingExpressMethodElement) {
@@ -17035,7 +16963,7 @@ async function mountMethodSelector() {
17035
16963
  });
17036
16964
  }
17037
16965
  }
17038
- if ((_c = (_b = state.options) == null ? void 0 : _b.bumpOffer) == null ? void 0 : _c.length) {
16966
+ if ((_b = (_a = state.options) == null ? void 0 : _a.bumpOffer) == null ? void 0 : _b.length) {
17039
16967
  const existingExpressMethodElement = getElement("bump-offer");
17040
16968
  if (existingExpressMethodElement) {
17041
16969
  existingExpressMethodElement.style.height = "auto";
@@ -17058,12 +16986,12 @@ async function mountMethodSelector() {
17058
16986
  options: modelSafeState.options,
17059
16987
  data: modelSafeState.data
17060
16988
  };
17061
- (_d = iframe == null ? void 0 : iframe.component) == null ? void 0 : _d.call("route", {
16989
+ (_c = iframe == null ? void 0 : iframe.component) == null ? void 0 : _c.call("route", {
17062
16990
  name: "method-switch"
17063
16991
  });
17064
- (_e2 = iframe == null ? void 0 : iframe.component) == null ? void 0 : _e2.call("update", model);
17065
- if (!((_g = (_f = iframe == null ? void 0 : iframe.component) == null ? void 0 : _f.events) == null ? void 0 : _g["restart-payment-flow"])) {
17066
- (_h = iframe == null ? void 0 : iframe.component) == null ? void 0 : _h.on("restart-payment-flow", async (payload) => {
16992
+ (_d = iframe == null ? void 0 : iframe.component) == null ? void 0 : _d.call("update", model);
16993
+ if (!((_f = (_e2 = iframe == null ? void 0 : iframe.component) == null ? void 0 : _e2.events) == null ? void 0 : _f["restart-payment-flow"])) {
16994
+ (_g = iframe == null ? void 0 : iframe.component) == null ? void 0 : _g.on("restart-payment-flow", async (payload) => {
17067
16995
  if (payload == null ? void 0 : payload.createNewDeposit) {
17068
16996
  const transaction = await createDeposit({
17069
16997
  data: {
@@ -17093,6 +17021,49 @@ async function mountMethodSelector() {
17093
17021
  }
17094
17022
  state.translate.translateItems();
17095
17023
  }
17024
+ async function mountAmountSelector() {
17025
+ var _a, _b, _c;
17026
+ if (state.data.money) {
17027
+ state.data.money.amount = null;
17028
+ state.data.money.currency = null;
17029
+ state.updateModel();
17030
+ }
17031
+ const iframe = iframes.form;
17032
+ if (!iframe) {
17033
+ await mountForm();
17034
+ }
17035
+ const modelSafeState = state.toModel();
17036
+ const model = {
17037
+ options: modelSafeState.options,
17038
+ data: modelSafeState.data
17039
+ };
17040
+ (_a = iframe.component) == null ? void 0 : _a.call("route", {
17041
+ name: "amount-selector"
17042
+ });
17043
+ (_b = iframe.component) == null ? void 0 : _b.call("update", model);
17044
+ (_c = iframe == null ? void 0 : iframe.component) == null ? void 0 : _c.on("confirm-amount", async (data) => {
17045
+ const { amount, currency } = data;
17046
+ const { depositRequestId } = state.options.deposit;
17047
+ state.data.money = {
17048
+ amount,
17049
+ currency
17050
+ };
17051
+ const transaction = await createDeposit({
17052
+ data: {
17053
+ depositRequestId,
17054
+ amount
17055
+ }
17056
+ });
17057
+ if (transaction) {
17058
+ state.data.transaction = transaction;
17059
+ state.options.transactionId = transaction.id;
17060
+ }
17061
+ const readyToPayUpdated = await fetchReadyToPay();
17062
+ state.data.readyToPay = readyToPayUpdated;
17063
+ state.updateModel();
17064
+ mountMethodSelector();
17065
+ });
17066
+ }
17096
17067
  const baseMethodSelectorHTML = () => `
17097
17068
  <div data-rebilly-instruments="content" class="rebilly-instruments-content">
17098
17069
  <div data-rebilly-instruments="content-error" id="rebilly-instruments-error"></div>