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