@rebilly/instruments 9.66.4 → 9.66.5

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 +1,6 @@
1
- ## [9.66.4](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.66.3...instruments/core-v9.66.4) (2024-07-15)
1
+ ## [9.66.5](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.66.4...instruments/core-v9.66.5) (2024-07-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **Instruments:** Remove infinte load when paypal fails to mount ([#6479](https://github.com/Rebilly/rebilly/issues/6479)) ([8f49e94](https://github.com/Rebilly/rebilly/commit/8f49e94acfa57891a97ab86c376c43f21946b5a5))
package/dist/index.js CHANGED
@@ -16926,7 +16926,7 @@ function mountExpressMethod({ state: state2, id: id2 }) {
16926
16926
  applePayButton.style.height = buttonHeight;
16927
16927
  applePayButton.style.cursor = "pointer";
16928
16928
  }
16929
- function mountButton() {
16929
+ return function mountButton() {
16930
16930
  if (!container.children.length) {
16931
16931
  const mountFunction = {
16932
16932
  "google-pay": "googlePay",
@@ -16945,13 +16945,7 @@ function mountExpressMethod({ state: state2, id: id2 }) {
16945
16945
  console.warn(`method '${id2}' is not supported`);
16946
16946
  }
16947
16947
  }
16948
- }
16949
- Framepay == null ? void 0 : Framepay.on("ready", () => {
16950
- mountButton();
16951
- });
16952
- Framepay == null ? void 0 : Framepay.on("error", (error2) => {
16953
- console.error(error2);
16954
- });
16948
+ };
16955
16949
  }
16956
16950
  function generateFramepayConfig({ methodIds } = {}) {
16957
16951
  var _a, _b;
@@ -17034,18 +17028,44 @@ async function mountExpressMethods({ methods, container }) {
17034
17028
  }
17035
17029
  return height;
17036
17030
  }
17037
- methods.forEach((method) => {
17038
- const { METHOD_ID: id2 } = getMethodData(method);
17039
- if (id2 === "apple-pay" && !browserIsSafari()) return;
17040
- container.innerHTML += `
17031
+ Framepay == null ? void 0 : Framepay.on("ready", () => {
17032
+ const mountingMethods = [];
17033
+ methods.map((method) => {
17034
+ const { METHOD_ID: id2 } = getMethodData(method);
17035
+ if (id2 === "apple-pay" && !browserIsSafari()) return;
17036
+ container.innerHTML += `
17041
17037
  <div class="rebilly-instruments-${id2}-method" style="height: ${generateExpressMethodHeight(
17042
- method
17043
- )}"></div>
17038
+ method
17039
+ )}"></div>
17044
17040
  `;
17045
- mountExpressMethod({
17046
- state,
17047
- id: id2
17041
+ mountingMethods.push(
17042
+ mountExpressMethod({
17043
+ state,
17044
+ id: id2
17045
+ })
17046
+ );
17048
17047
  });
17048
+ mountingMethods.forEach((mount2) => mount2());
17049
+ });
17050
+ Framepay == null ? void 0 : Framepay.on("error", (error2) => {
17051
+ if (error2.code === "paypal-error") {
17052
+ const paypalEl = document.querySelector(
17053
+ ".rebilly-instruments-pay-pal-billing-agreement-method"
17054
+ );
17055
+ if (paypalEl) {
17056
+ paypalEl.remove();
17057
+ if (container.children.length <= 0) {
17058
+ const divider = document.querySelector(
17059
+ '[data-rebilly-instruments="divider"]'
17060
+ );
17061
+ if (divider) {
17062
+ divider.remove();
17063
+ }
17064
+ }
17065
+ }
17066
+ } else {
17067
+ console.error(error2);
17068
+ }
17049
17069
  });
17050
17070
  const redirectUrl = state.options.apiMode === "sandbox" ? "https://forms-sandbox.secure-payments.app/approval-url?close=true" : "https://forms.secure-payments.app/approval-url?close=true";
17051
17071
  Framepay == null ? void 0 : Framepay.on("token-ready", (token) => {