@pollar/react 0.12.0-rc.5 → 0.12.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/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { AUTH_ERROR_CODES, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, describeRampAction, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, rampRailLabel, rampNoRouteText, rampFieldError, rampFieldValid, rampLegNote, rampStepTitle, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, isPollarClient, PollarClient, isInteractiveAuthAdapter, rampTrustlineErrorText, toBaseUnits, appUnavailableMessage, cosignRefusalMessage, fromBaseUnits, assertRampStellarSigner } from '@pollar/core';
2
+ import { AUTH_ERROR_CODES, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, describeRampAction, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, rampRailLabel, rampNoRouteText, rampFieldError, rampFieldValid, rampLegNote, rampStepTitle, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, isPollarClient, PollarClient, isInteractiveAuthAdapter, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, appUnavailableMessage, cosignRefusalMessage, fromBaseUnits, assertRampStellarSigner } from '@pollar/core';
3
3
  import { forwardRef, createContext, useState, useCallback, useEffect, useMemo, useRef, useContext, Component } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { startAuthentication, startRegistration } from '@simplewebauthn/browser';
@@ -1042,7 +1042,7 @@ var PollarModalFooter = () => {
1042
1042
  /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1043
1043
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1044
1044
  "v",
1045
- "0.12.0-rc.5"
1045
+ "0.12.0"
1046
1046
  ] })
1047
1047
  ] });
1048
1048
  };
@@ -4810,6 +4810,7 @@ function RampWidget({ onClose }) {
4810
4810
  const [pollTrouble, setPollTrouble] = useState(false);
4811
4811
  const [pollKey, setPollKey] = useState(0);
4812
4812
  const [paymentCheckUntil, setPaymentCheckUntil] = useState(null);
4813
+ const checkErrorRef = useRef(null);
4813
4814
  const promptedApproval = useRef(null);
4814
4815
  const custodyChoice = appConfig.application?.walletCustodyMode === "USER_CHOICE";
4815
4816
  const appChains = appConfig.application?.chains;
@@ -4893,6 +4894,12 @@ function RampWidget({ onClose }) {
4893
4894
  }, PAYMENT_CHECK_EVERY_MS);
4894
4895
  return () => clearInterval(timer);
4895
4896
  }, [client, orderId, awaitingPayment, paymentCheckUntil]);
4897
+ useEffect(() => {
4898
+ if (awaitingPayment || checkErrorRef.current === null) return;
4899
+ const shown = checkErrorRef.current;
4900
+ checkErrorRef.current = null;
4901
+ setErrorMsg((current) => current === shown ? null : current);
4902
+ }, [awaitingPayment]);
4896
4903
  const approval = order?.pendingAction?.kind === "COSIGN_APPROVAL" ? order.pendingAction.actionId : null;
4897
4904
  useEffect(() => {
4898
4905
  if (!approval || promptedApproval.current === approval) return;
@@ -5123,8 +5130,11 @@ function RampWidget({ onClose }) {
5123
5130
  try {
5124
5131
  setOrder(await client.checkRampOrder(order.id));
5125
5132
  } catch (error) {
5133
+ if (isPollarNetworkError(error)) return;
5126
5134
  setPaymentCheckUntil(null);
5127
- setErrorMsg(rampErrorMessage(error, "Could not check the payment. Please try again."));
5135
+ const message = rampErrorMessage(error, "Could not check the payment. Please try again.");
5136
+ checkErrorRef.current = message;
5137
+ setErrorMsg(message);
5128
5138
  }
5129
5139
  }
5130
5140
  async function handleRetryOrder() {