@pollar/react 0.12.1-rc.11 → 0.12.1-rc.13

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
@@ -1284,7 +1284,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
1284
1284
  /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1285
1285
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1286
1286
  "v",
1287
- "0.12.1-rc.11"
1287
+ "0.12.1-rc.13"
1288
1288
  ] })
1289
1289
  ] });
1290
1290
  };
@@ -10883,11 +10883,11 @@ var CARD_COPY = {
10883
10883
  funding: {
10884
10884
  CREATED: {
10885
10885
  title: "Confirming your payment",
10886
- hint: "Your USDC payment is being confirmed on Stellar. This takes a few seconds."
10886
+ hint: "Your USDC payment is being confirmed. This takes a few seconds."
10887
10887
  },
10888
10888
  BURNED: {
10889
10889
  title: "Sending it to the card network",
10890
- hint: "Your USDC left Stellar. Circle is confirming the transfer, usually in about a minute."
10890
+ hint: "Your USDC left your wallet. Circle is confirming the transfer, usually within a few minutes."
10891
10891
  },
10892
10892
  ATTESTED: {
10893
10893
  title: "Crossing to the card network",
@@ -10903,7 +10903,7 @@ var CARD_COPY = {
10903
10903
  fundingSolana: {
10904
10904
  CREATED: {
10905
10905
  title: "Confirming your payment",
10906
- hint: "Your USDC payment is being confirmed on Solana. This takes a few seconds."
10906
+ hint: "Your USDC payment is being confirmed. This takes a few seconds."
10907
10907
  },
10908
10908
  SENT: {
10909
10909
  title: "Arrived, crediting your card",
@@ -11042,18 +11042,20 @@ var CARD_COPY = {
11042
11042
  noBalance: "Your wallet does not have enough USDC for this amount.",
11043
11043
  notPaid: "The payment was not sent.",
11044
11044
  failed: "The payment could not be completed. Please try again.",
11045
- delayed: "Taking longer than usual. We are following up with the card provider."
11045
+ delayed: "Taking longer than usual. We are following up with the card provider.",
11046
+ crossing: "Your USDC crosses to the card network. It takes a few minutes, and the network fees are covered.",
11047
+ noRoute: "Your wallets cannot fund this card right now."
11046
11048
  }
11047
11049
  },
11048
11050
  es: {
11049
11051
  funding: {
11050
11052
  CREATED: {
11051
11053
  title: "Confirmando tu pago",
11052
- hint: "Tu pago en USDC se est\xE1 confirmando en Stellar. Esto toma unos segundos."
11054
+ hint: "Tu pago en USDC se est\xE1 confirmando. Esto toma unos segundos."
11053
11055
  },
11054
11056
  BURNED: {
11055
11057
  title: "Envi\xE1ndolo a la red de la tarjeta",
11056
- hint: "Tus USDC salieron de Stellar. Circle est\xE1 confirmando la transferencia, normalmente en un minuto."
11058
+ hint: "Tus USDC salieron de tu wallet. Circle est\xE1 confirmando la transferencia, normalmente en unos minutos."
11057
11059
  },
11058
11060
  ATTESTED: {
11059
11061
  title: "Cruzando a la red de la tarjeta",
@@ -11069,7 +11071,7 @@ var CARD_COPY = {
11069
11071
  fundingSolana: {
11070
11072
  CREATED: {
11071
11073
  title: "Confirmando tu pago",
11072
- hint: "Tu pago en USDC se est\xE1 confirmando en Solana. Esto toma unos segundos."
11074
+ hint: "Tu pago en USDC se est\xE1 confirmando. Esto toma unos segundos."
11073
11075
  },
11074
11076
  SENT: {
11075
11077
  title: "Lleg\xF3, acreditando tu tarjeta",
@@ -11208,18 +11210,20 @@ var CARD_COPY = {
11208
11210
  noBalance: "Tu wallet no tiene suficiente USDC para este monto.",
11209
11211
  notPaid: "El pago no se envi\xF3.",
11210
11212
  failed: "No se pudo completar el pago. Intenta de nuevo.",
11211
- delayed: "Est\xE1 tardando m\xE1s de lo normal. Estamos haciendo seguimiento con el emisor de la tarjeta."
11213
+ delayed: "Est\xE1 tardando m\xE1s de lo normal. Estamos haciendo seguimiento con el emisor de la tarjeta.",
11214
+ crossing: "Tus USDC cruzan a la red de la tarjeta. Toma unos minutos y las comisiones de red est\xE1n cubiertas.",
11215
+ noRoute: "Tus wallets no pueden fondear esta tarjeta por ahora."
11212
11216
  }
11213
11217
  },
11214
11218
  pt: {
11215
11219
  funding: {
11216
11220
  CREATED: {
11217
11221
  title: "Confirmando seu pagamento",
11218
- hint: "Seu pagamento em USDC est\xE1 sendo confirmado na Stellar. Isso leva alguns segundos."
11222
+ hint: "Seu pagamento em USDC est\xE1 sendo confirmado. Isso leva alguns segundos."
11219
11223
  },
11220
11224
  BURNED: {
11221
11225
  title: "Enviando para a rede do cart\xE3o",
11222
- hint: "Seus USDC sa\xEDram da Stellar. A Circle est\xE1 confirmando a transfer\xEAncia, normalmente em cerca de um minuto."
11226
+ hint: "Seus USDC sa\xEDram da sua carteira. A Circle est\xE1 confirmando a transfer\xEAncia, normalmente em alguns minutos."
11223
11227
  },
11224
11228
  ATTESTED: {
11225
11229
  title: "Atravessando para a rede do cart\xE3o",
@@ -11235,7 +11239,7 @@ var CARD_COPY = {
11235
11239
  fundingSolana: {
11236
11240
  CREATED: {
11237
11241
  title: "Confirmando seu pagamento",
11238
- hint: "Seu pagamento em USDC est\xE1 sendo confirmado na Solana. Isso leva alguns segundos."
11242
+ hint: "Seu pagamento em USDC est\xE1 sendo confirmado. Isso leva alguns segundos."
11239
11243
  },
11240
11244
  SENT: {
11241
11245
  title: "Chegou, creditando seu cart\xE3o",
@@ -11374,7 +11378,9 @@ var CARD_COPY = {
11374
11378
  noBalance: "Sua carteira n\xE3o tem USDC suficiente para este valor.",
11375
11379
  notPaid: "O pagamento n\xE3o foi enviado.",
11376
11380
  failed: "N\xE3o foi poss\xEDvel concluir o pagamento. Tente novamente.",
11377
- delayed: "Est\xE1 demorando mais que o normal. Estamos acompanhando com o emissor do cart\xE3o."
11381
+ delayed: "Est\xE1 demorando mais que o normal. Estamos acompanhando com o emissor do cart\xE3o.",
11382
+ crossing: "Seus USDC atravessam para a rede do cart\xE3o. Leva alguns minutos, e as taxas de rede est\xE3o cobertas.",
11383
+ noRoute: "Suas carteiras n\xE3o podem recarregar este cart\xE3o por enquanto."
11378
11384
  }
11379
11385
  }
11380
11386
  };
@@ -11436,11 +11442,9 @@ function newFundingKey() {
11436
11442
  return `fund-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
11437
11443
  }
11438
11444
  var FUNDING_STEPS = {
11439
- STELLAR: ["CREATED", "BURNED", "ATTESTED", "MINTED"],
11440
- SOLANA: ["CREATED", "SENT"]
11445
+ CCTP: ["CREATED", "BURNED", "ATTESTED", "MINTED"],
11446
+ DIRECT: ["CREATED", "SENT"]
11441
11447
  };
11442
- var FUNDING_CHAINS = ["STELLAR", "SOLANA"];
11443
- var isFundingChain = (chain) => FUNDING_CHAINS.includes(chain);
11444
11448
  var INCOME_RANGES = ["0-1000", "1000-5000", "5000-10000", "10000+"];
11445
11449
  var KYC_PENDING = /* @__PURE__ */ new Set(["PENDING", "NEEDS_ACTION", "IN_REVIEW"]);
11446
11450
  var KYC_FINAL = /* @__PURE__ */ new Set(["DENIED", "LOCKED", "CANCELED"]);
@@ -11514,6 +11518,7 @@ function CardModal({ onClose, initial }) {
11514
11518
  const [fundAmount, setFundAmount] = useState(() => seededAmount(initial?.amount));
11515
11519
  const fundKey = useRef(null);
11516
11520
  const [fundChain, setFundChain] = useState(initial?.chain ?? null);
11521
+ const [fundRoutes, setFundRoutes] = useState(null);
11517
11522
  const fundPanelSeed = useRef(initial?.panel === "fund");
11518
11523
  const [showManual, setShowManual] = useState(false);
11519
11524
  const [occupations, setOccupations] = useState([]);
@@ -11527,8 +11532,10 @@ function CardModal({ onClose, initial }) {
11527
11532
  const revealTimer = useRef(null);
11528
11533
  const provider = providers?.[0] ?? null;
11529
11534
  const fundingAsset = provider?.fundingAssets[0] ?? "USDC";
11530
- const fundChains = useChains().chains.filter(isFundingChain);
11535
+ const appOrder = useChains().chains;
11536
+ const fundChains = (fundRoutes ?? []).map((route) => route.source).sort((a, b) => appOrder.indexOf(a) - appOrder.indexOf(b));
11531
11537
  const selectedFundChain = (fundChain && fundChains.includes(fundChain) ? fundChain : null) ?? fundChains[0] ?? "STELLAR";
11538
+ const selectedRoute = fundRoutes?.find((route) => route.source === selectedFundChain);
11532
11539
  const fundAvailable = useWalletAvailable(panel === "fund" ? { chain: selectedFundChain, code: fundingAsset } : null);
11533
11540
  const card = cards?.[0] ?? null;
11534
11541
  const expiry = card?.expMonth && card.expYear ? `${card.expMonth}/${card.expYear.slice(-2)}` : null;
@@ -11687,7 +11694,9 @@ function CardModal({ onClose, initial }) {
11687
11694
  const openFund = () => run(
11688
11695
  "fund",
11689
11696
  async () => {
11690
- setFundings(await getClient().listCardFundings());
11697
+ const [list, routes] = await Promise.all([getClient().listCardFundings(), getClient().getCardFundingRoutes()]);
11698
+ setFundings(list);
11699
+ setFundRoutes(routes);
11691
11700
  setPanel("fund");
11692
11701
  },
11693
11702
  copy.failed.loadFundings
@@ -11703,10 +11712,12 @@ function CardModal({ onClose, initial }) {
11703
11712
  fundKey.current ?? (fundKey.current = newFundingKey());
11704
11713
  let outcome;
11705
11714
  try {
11706
- outcome = await getClient().fundCard({
11715
+ const client = getClient();
11716
+ outcome = await client.fundCard({
11707
11717
  amount: fundAmount.trim(),
11708
11718
  chain: selectedFundChain,
11709
- idempotencyKey: fundKey.current
11719
+ idempotencyKey: fundKey.current,
11720
+ signBridgeStep: (transferId, actionId) => signStepWithWallet(client, transferId, actionId, BRIDGE_COPY[language])
11710
11721
  });
11711
11722
  } catch (e) {
11712
11723
  if (isPollarApiError(e)) fundKey.current = null;
@@ -12098,6 +12109,8 @@ function CardModal({ onClose, initial }) {
12098
12109
  language
12099
12110
  }
12100
12111
  ),
12112
+ fundRoutes?.length === 0 && /* @__PURE__ */ jsx("p", { className: "pollar-card-note", children: copy.fundingProblem.noRoute }),
12113
+ selectedRoute?.route === "CCTP" && /* @__PURE__ */ jsx("p", { className: "pollar-card-note", children: copy.fundingProblem.crossing }),
12101
12114
  /* @__PURE__ */ jsx(
12102
12115
  AmountField,
12103
12116
  {
@@ -12117,15 +12130,15 @@ function CardModal({ onClose, initial }) {
12117
12130
  type: "button",
12118
12131
  className: "pollar-btn-primary",
12119
12132
  onClick: () => void fund(),
12120
- disabled: busy !== null || !(Number(fundAmount) >= 1),
12133
+ disabled: busy !== null || !selectedRoute || !(Number(fundAmount) >= 1),
12121
12134
  children: busy === "fund-send" ? copy.sending : copy.fundFromWallet
12122
12135
  }
12123
12136
  ) }),
12124
12137
  fundings && fundings.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
12125
12138
  /* @__PURE__ */ jsx("p", { className: "pollar-card-section-title", children: copy.yourFundings }),
12126
12139
  fundings.map((f) => {
12127
- const state = (f.chain === "SOLANA" ? copy.fundingSolana[f.status] : void 0) ?? copy.funding[f.status];
12128
- const steps = FUNDING_STEPS[isFundingChain(f.chain) ? f.chain : "STELLAR"];
12140
+ const state = (f.route === "DIRECT" ? copy.fundingSolana[f.status] : void 0) ?? copy.funding[f.status];
12141
+ const steps = FUNDING_STEPS[f.route];
12129
12142
  const step = steps.indexOf(f.status) + 1;
12130
12143
  const inflight = FUNDING_INFLIGHT.has(f.status);
12131
12144
  return /* @__PURE__ */ jsxs("div", { className: "pollar-card-tx", "aria-busy": inflight, children: [