@pollar/react 0.12.1-rc.14 → 0.12.1-rc.15

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.d.mts CHANGED
@@ -1298,7 +1298,7 @@ interface TxDetailRow {
1298
1298
  interface TxReviewData {
1299
1299
  /** The action in plain words: what a user without crypto background reads first. */
1300
1300
  title: string;
1301
- kind: 'send' | 'bridge' | 'approve' | 'swap' | 'payment' | 'create_account' | 'deposit' | 'withdraw' | 'other';
1301
+ kind: 'send' | 'bridge' | 'approve' | 'swap' | 'payment' | 'create_account' | 'deposit' | 'withdraw' | 'sign_in' | 'other';
1302
1302
  from?: TxParty;
1303
1303
  to?: TxParty;
1304
1304
  /**
package/dist/index.d.ts CHANGED
@@ -1298,7 +1298,7 @@ interface TxDetailRow {
1298
1298
  interface TxReviewData {
1299
1299
  /** The action in plain words: what a user without crypto background reads first. */
1300
1300
  title: string;
1301
- kind: 'send' | 'bridge' | 'approve' | 'swap' | 'payment' | 'create_account' | 'deposit' | 'withdraw' | 'other';
1301
+ kind: 'send' | 'bridge' | 'approve' | 'swap' | 'payment' | 'create_account' | 'deposit' | 'withdraw' | 'sign_in' | 'other';
1302
1302
  from?: TxParty;
1303
1303
  to?: TxParty;
1304
1304
  /**
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.14"
1289
+ "0.12.1-rc.15"
1290
1290
  ] })
1291
1291
  ] });
1292
1292
  };
@@ -3637,7 +3637,7 @@ function LoginModalTemplate({
3637
3637
  const isLoading = status === "LOADING";
3638
3638
  const isEmailCodeError = authState.step === "error" && (authState.errorCode === core.AUTH_ERROR_CODES.EMAIL_CODE_EXPIRED || authState.errorCode === core.AUTH_ERROR_CODES.EMAIL_CODE_INVALID);
3639
3639
  const awaitingEmailCode = authState.step === "entering_code" || authState.step === "verifying_email_code" || isEmailCodeError;
3640
- const statusMessage = authState.step === "error" ? authState.message : copy.status[authState.step];
3640
+ const statusMessage = authState.step === "error" ? core.authErrorMessage(authState.code, language) ?? authState.message : copy.status[authState.step];
3641
3641
  const BackButton = ({ onClick }) => /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": copy.back, children: /* @__PURE__ */ jsxRuntime.jsx(
3642
3642
  "svg",
3643
3643
  {
@@ -5398,7 +5398,7 @@ var REGISTRATION_COPY = {
5398
5398
  fix: "Review my details",
5399
5399
  incomplete: "Your registration with the provider did not finish. Register again to complete it.",
5400
5400
  providerDown: "The provider is not responding right now. Please try again in a few minutes.",
5401
- ipNotSupported: "The provider cannot accept your current connection (IPv6). Please try again from another network, for example Wi-Fi.",
5401
+ ipNotSupported: "We could not verify your connection with the provider. Please try again in a few minutes.",
5402
5402
  emailTaken: "This email is already registered with the provider through another app. Use a different email to register here.",
5403
5403
  loadError: "Could not load the registration. Please try again.",
5404
5404
  submitError: "Could not register you. Please try again.",
@@ -5418,7 +5418,7 @@ var REGISTRATION_COPY = {
5418
5418
  fix: "Revisar mis datos",
5419
5419
  incomplete: "Tu registro con el proveedor no se complet\xF3. Reg\xEDstrate de nuevo para terminarlo.",
5420
5420
  providerDown: "El proveedor no responde en este momento. Intenta de nuevo en unos minutos.",
5421
- ipNotSupported: "El proveedor no acepta tu conexi\xF3n actual (IPv6). Intenta desde otra red, por ejemplo Wi-Fi.",
5421
+ ipNotSupported: "No pudimos verificar tu conexi\xF3n con el proveedor. Intenta de nuevo en unos minutos.",
5422
5422
  emailTaken: "Este email ya est\xE1 registrado con el proveedor desde otra app. Usa otro email para registrarte aqu\xED.",
5423
5423
  loadError: "No se pudo cargar el registro. Intenta de nuevo.",
5424
5424
  submitError: "No se pudo completar el registro. Intenta de nuevo.",
@@ -5438,7 +5438,7 @@ var REGISTRATION_COPY = {
5438
5438
  fix: "Revisar meus dados",
5439
5439
  incomplete: "Seu cadastro no provedor n\xE3o foi conclu\xEDdo. Cadastre-se novamente para termin\xE1-lo.",
5440
5440
  providerDown: "O provedor n\xE3o est\xE1 respondendo agora. Tente novamente em alguns minutos.",
5441
- ipNotSupported: "O provedor n\xE3o aceita sua conex\xE3o atual (IPv6). Tente de outra rede, por exemplo Wi-Fi.",
5441
+ ipNotSupported: "N\xE3o conseguimos verificar sua conex\xE3o com o provedor. Tente novamente em alguns minutos.",
5442
5442
  emailTaken: "Este email j\xE1 est\xE1 cadastrado no provedor por outro app. Use outro email para se cadastrar aqui.",
5443
5443
  loadError: "N\xE3o foi poss\xEDvel carregar o cadastro. Tente novamente.",
5444
5444
  submitError: "N\xE3o foi poss\xEDvel concluir o cadastro. Tente novamente.",
@@ -6104,11 +6104,16 @@ function RampWidget({ onClose, language: languageProp, initial }) {
6104
6104
  setErrorMsg((current) => current === shown ? null : current);
6105
6105
  }, [awaitingPayment]);
6106
6106
  const approval = order?.pendingAction?.kind === "COSIGN_APPROVAL" ? order.pendingAction.actionId : null;
6107
+ const approvalRequest = order?.pendingAction?.kind === "COSIGN_APPROVAL" ? order.pendingAction.cosignRequestId : null;
6107
6108
  react.useEffect(() => {
6108
6109
  if (!approval || promptedApproval.current === approval) return;
6109
6110
  promptedApproval.current = approval;
6110
- void client.cosign.pending().catch(() => void 0).then(() => openCosignModal());
6111
- }, [approval, client, openCosignModal]);
6111
+ void client.cosign.pending().catch(() => []).then(async (requests) => {
6112
+ const request = requests.find((r) => r.id === approvalRequest);
6113
+ if (request && await client.autoApproveSignIn(request)) return;
6114
+ openCosignModal();
6115
+ });
6116
+ }, [approval, approvalRequest, client, openCosignModal]);
6112
6117
  const nextApproval = step === "status" && order ? core.rampNextApproval(order, language) : null;
6113
6118
  react.useEffect(() => {
6114
6119
  setCosignNextStep(nextApproval);
@@ -7080,7 +7085,13 @@ var TX_REVIEW_COPY = {
7080
7085
  approve: (asset, spender) => `Allow ${spender} to use your ${asset}`,
7081
7086
  swap: (from, to) => `Swap ${from} for ${to}`,
7082
7087
  payment: (amount, to) => `Pay ${amount} to ${to}`,
7083
- createAccount: "Create an account"
7088
+ createAccount: "Create an account",
7089
+ signIn: "Confirm it's you"
7090
+ },
7091
+ signIn: {
7092
+ body: "The payment provider needs to confirm this account is yours before it can process your order.",
7093
+ noMoney: "No money moves",
7094
+ nothingSent: "Nothing is sent"
7084
7095
  },
7085
7096
  earn: {
7086
7097
  deposit: "Deposit",
@@ -7135,7 +7146,13 @@ var TX_REVIEW_COPY = {
7135
7146
  approve: (asset, spender) => `Permitir que ${spender} use tu ${asset}`,
7136
7147
  swap: (from, to) => `Cambiar ${from} por ${to}`,
7137
7148
  payment: (amount, to) => `Pagar ${amount} a ${to}`,
7138
- createAccount: "Crear una cuenta"
7149
+ createAccount: "Crear una cuenta",
7150
+ signIn: "Confirma que eres t\xFA"
7151
+ },
7152
+ signIn: {
7153
+ body: "El proveedor de pagos necesita confirmar que esta cuenta es tuya antes de procesar tu orden.",
7154
+ noMoney: "No se mueve dinero",
7155
+ nothingSent: "No se env\xEDa nada"
7139
7156
  },
7140
7157
  earn: {
7141
7158
  deposit: "Depositar",
@@ -7190,7 +7207,13 @@ var TX_REVIEW_COPY = {
7190
7207
  approve: (asset, spender) => `Permitir que ${spender} use seu ${asset}`,
7191
7208
  swap: (from, to) => `Trocar ${from} por ${to}`,
7192
7209
  payment: (amount, to) => `Pagar ${amount} para ${to}`,
7193
- createAccount: "Criar uma conta"
7210
+ createAccount: "Criar uma conta",
7211
+ signIn: "Confirme que \xE9 voc\xEA"
7212
+ },
7213
+ signIn: {
7214
+ body: "O provedor de pagamentos precisa confirmar que esta conta \xE9 sua antes de processar seu pedido.",
7215
+ noMoney: "Nenhum dinheiro se move",
7216
+ nothingSent: "Nada \xE9 enviado"
7194
7217
  },
7195
7218
  earn: {
7196
7219
  deposit: "Depositar",
@@ -7271,6 +7294,8 @@ function titleOf(data, fallback, copy) {
7271
7294
  return from?.amount && to?.label ? copy.titles.payment(withAsset(from), displayName(to.label)) : fallback;
7272
7295
  case "create_account":
7273
7296
  return copy.titles.createAccount;
7297
+ case "sign_in":
7298
+ return copy.titles.signIn;
7274
7299
  default:
7275
7300
  return fallback;
7276
7301
  }
@@ -7356,6 +7381,23 @@ function earnOutcome(parts, copy) {
7356
7381
  }
7357
7382
  return parts.name ? copy.earn.withdrew(moved, parts.name, chain) : copy.earn.withdrewOn(moved, chain);
7358
7383
  }
7384
+ function isSignIn(operation, details) {
7385
+ return operation === "provider_sign_in" || operation === "sep10" || details.purpose === "sign_in";
7386
+ }
7387
+ function reviewForSignIn(parts, copy) {
7388
+ const rows = [
7389
+ { label: copy.rows.network, value: [copy.chains[parts.chain], parts.network].filter(Boolean).join(" ") }
7390
+ ];
7391
+ if (parts.signWith) rows.push({ label: copy.yourWallet, value: shortAddress(parts.signWith), copyValue: parts.signWith });
7392
+ rows.push(...parts.extraRows ?? []);
7393
+ return {
7394
+ kind: "sign_in",
7395
+ title: copy.titles.signIn,
7396
+ rows,
7397
+ ...parts.raw ? { raw: parts.raw } : {},
7398
+ ...parts.hash ? { hash: parts.hash } : {}
7399
+ };
7400
+ }
7359
7401
  function reviewFromRequest(parts, copy) {
7360
7402
  const details = parts.details ?? {};
7361
7403
  const earnAction = parts.operation === "earn_deposit" ? "deposit" : parts.operation === "earn_withdraw" ? "withdraw" : null;
@@ -7381,6 +7423,7 @@ function reviewFromRequest(parts, copy) {
7381
7423
  copy
7382
7424
  );
7383
7425
  }
7426
+ if (isSignIn(parts.operation, details)) return reviewForSignIn(parts, copy);
7384
7427
  const flow = rampFlow(details);
7385
7428
  const rows = [];
7386
7429
  let data;
@@ -7575,6 +7618,30 @@ function ContractGlyph() {
7575
7618
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 9V6.75a3 3 0 0 1 6 0V9", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
7576
7619
  ] }) });
7577
7620
  }
7621
+ function SignInGlyph() {
7622
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-txr-signin-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "none", children: [
7623
+ /* @__PURE__ */ jsxRuntime.jsx(
7624
+ "path",
7625
+ {
7626
+ d: "M12 2.75 4.75 5.5v5.25c0 4.6 3.05 8.55 7.25 10 4.2-1.45 7.25-5.4 7.25-10V5.5L12 2.75Z",
7627
+ stroke: "currentColor",
7628
+ strokeWidth: "1.6",
7629
+ strokeLinejoin: "round"
7630
+ }
7631
+ ),
7632
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "10", r: "2.25", stroke: "currentColor", strokeWidth: "1.6" }),
7633
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12.25v3.5M12 14.25h1.75", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
7634
+ ] }) });
7635
+ }
7636
+ function Assurance({ text }) {
7637
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "pollar-txr-assurance", children: [
7638
+ /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
7639
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
7640
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 7l2.5 2.5 4.5-5", stroke: "white", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" })
7641
+ ] }),
7642
+ text
7643
+ ] });
7644
+ }
7578
7645
  function Node2({
7579
7646
  party,
7580
7647
  showAmount,
@@ -7646,6 +7713,14 @@ function TxReview({ data, open: openProp, onToggle, language: languageProp }) {
7646
7713
  /* @__PURE__ */ jsxRuntime.jsx(Node2, { party: to, showAmount: kind !== "approve" && toShowsAmount, glyph: toGlyph, copy })
7647
7714
  ] }),
7648
7715
  kind === "approve" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-txr-note", children: copy.approveNote }),
7716
+ kind === "sign_in" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-signin", children: [
7717
+ /* @__PURE__ */ jsxRuntime.jsx(SignInGlyph, {}),
7718
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-txr-signin-body", children: copy.signIn.body }),
7719
+ /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "pollar-txr-assurances", children: [
7720
+ /* @__PURE__ */ jsxRuntime.jsx(Assurance, { text: copy.signIn.noMoney }),
7721
+ /* @__PURE__ */ jsxRuntime.jsx(Assurance, { text: copy.signIn.nothingSent })
7722
+ ] })
7723
+ ] }),
7649
7724
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-bar", children: [
7650
7725
  data.fee?.sponsored !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(FeeBadge, { sponsored: data.fee.sponsored, copy }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
7651
7726
  /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-txr-toggle", "aria-expanded": open, onClick: toggle, children: [
@@ -11171,7 +11246,7 @@ var CARD_COPY = {
11171
11246
  },
11172
11247
  errors: {
11173
11248
  SDK_CARDS_PROVIDER_ERROR: "The card provider is not responding right now. Please try again in a few minutes.",
11174
- SDK_CARDS_IP_NOT_SUPPORTED: "The card provider cannot accept your current connection (IPv6). Please try again from another network, for example Wi-Fi.",
11249
+ SDK_CARDS_IP_NOT_SUPPORTED: "We could not verify your connection with the card provider. Please try again in a few minutes.",
11175
11250
  SDK_CARDS_PROVIDER_USER_TAKEN: "This email is already registered with the card provider through another app. Use a different email to get a card here."
11176
11251
  },
11177
11252
  blocked: {
@@ -11341,7 +11416,7 @@ var CARD_COPY = {
11341
11416
  },
11342
11417
  errors: {
11343
11418
  SDK_CARDS_PROVIDER_ERROR: "El proveedor de la tarjeta no responde en este momento. Intenta de nuevo en unos minutos.",
11344
- SDK_CARDS_IP_NOT_SUPPORTED: "El proveedor de la tarjeta no acepta tu conexi\xF3n actual (IPv6). Intenta de nuevo desde otra red, por ejemplo Wi-Fi.",
11419
+ SDK_CARDS_IP_NOT_SUPPORTED: "No pudimos verificar tu conexi\xF3n con el proveedor de la tarjeta. Intenta de nuevo en unos minutos.",
11345
11420
  SDK_CARDS_PROVIDER_USER_TAKEN: "Este correo ya est\xE1 registrado con el proveedor de la tarjeta a trav\xE9s de otra app. Usa otro correo para obtener una tarjeta aqu\xED."
11346
11421
  },
11347
11422
  blocked: {
@@ -11511,7 +11586,7 @@ var CARD_COPY = {
11511
11586
  },
11512
11587
  errors: {
11513
11588
  SDK_CARDS_PROVIDER_ERROR: "O provedor do cart\xE3o n\xE3o est\xE1 respondendo agora. Tente de novo em alguns minutos.",
11514
- SDK_CARDS_IP_NOT_SUPPORTED: "O provedor do cart\xE3o n\xE3o aceita sua conex\xE3o atual (IPv6). Tente de novo a partir de outra rede, por exemplo Wi-Fi.",
11589
+ SDK_CARDS_IP_NOT_SUPPORTED: "N\xE3o conseguimos verificar sua conex\xE3o com o provedor do cart\xE3o. Tente de novo em alguns minutos.",
11515
11590
  SDK_CARDS_PROVIDER_USER_TAKEN: "Este e-mail j\xE1 est\xE1 cadastrado no provedor do cart\xE3o por meio de outro app. Use outro e-mail para obter um cart\xE3o aqui."
11516
11591
  },
11517
11592
  blocked: {
@@ -12837,8 +12912,8 @@ var COSIGN_COPY = {
12837
12912
  expired: "expired",
12838
12913
  expiresIn: "Expires in",
12839
12914
  checking: "Checking...",
12840
- verified: "Verified",
12841
- checkedAgainstTurnkey: "Checked against Turnkey: this is exactly what will be signed.",
12915
+ verified: "Checked",
12916
+ checkedExact: "We checked this is exactly what you're approving.",
12842
12917
  notVerified: "Not verified:",
12843
12918
  reject: "Reject",
12844
12919
  rejecting: "Rejecting...",
@@ -12862,7 +12937,9 @@ var COSIGN_COPY = {
12862
12937
  swap: "Swap",
12863
12938
  earn_deposit: "Deposit",
12864
12939
  earn_withdraw: "Withdraw",
12865
- evm_delegation: "Enable atomic transactions"
12940
+ evm_delegation: "Enable atomic transactions",
12941
+ provider_sign_in: "Confirm it's you",
12942
+ sep10: "Confirm it's you"
12866
12943
  }
12867
12944
  },
12868
12945
  es: {
@@ -12882,8 +12959,8 @@ var COSIGN_COPY = {
12882
12959
  expired: "vencida",
12883
12960
  expiresIn: "Vence en",
12884
12961
  checking: "Verificando...",
12885
- verified: "Verificada",
12886
- checkedAgainstTurnkey: "Verificada con Turnkey: esto es exactamente lo que se firmar\xE1.",
12962
+ verified: "Comprobada",
12963
+ checkedExact: "Comprobamos que esto es exactamente lo que est\xE1s aprobando.",
12887
12964
  notVerified: "Sin verificar:",
12888
12965
  reject: "Rechazar",
12889
12966
  rejecting: "Rechazando...",
@@ -12907,7 +12984,9 @@ var COSIGN_COPY = {
12907
12984
  swap: "Intercambiar",
12908
12985
  earn_deposit: "Depositar",
12909
12986
  earn_withdraw: "Retirar",
12910
- evm_delegation: "Activar transacciones at\xF3micas"
12987
+ evm_delegation: "Activar transacciones at\xF3micas",
12988
+ provider_sign_in: "Confirma que eres t\xFA",
12989
+ sep10: "Confirma que eres t\xFA"
12911
12990
  }
12912
12991
  },
12913
12992
  pt: {
@@ -12927,8 +13006,8 @@ var COSIGN_COPY = {
12927
13006
  expired: "expirada",
12928
13007
  expiresIn: "Expira em",
12929
13008
  checking: "Verificando...",
12930
- verified: "Verificada",
12931
- checkedAgainstTurnkey: "Conferida com a Turnkey: isto \xE9 exatamente o que ser\xE1 assinado.",
13009
+ verified: "Conferida",
13010
+ checkedExact: "Conferimos que isto \xE9 exatamente o que voc\xEA est\xE1 aprovando.",
12932
13011
  notVerified: "N\xE3o verificada:",
12933
13012
  reject: "Rejeitar",
12934
13013
  rejecting: "Rejeitando...",
@@ -12952,7 +13031,9 @@ var COSIGN_COPY = {
12952
13031
  swap: "Trocar",
12953
13032
  earn_deposit: "Depositar",
12954
13033
  earn_withdraw: "Sacar",
12955
- evm_delegation: "Ativar transa\xE7\xF5es at\xF4micas"
13034
+ evm_delegation: "Ativar transa\xE7\xF5es at\xF4micas",
13035
+ provider_sign_in: "Confirme que \xE9 voc\xEA",
13036
+ sep10: "Confirme que \xE9 voc\xEA"
12956
13037
  }
12957
13038
  }
12958
13039
  };
@@ -13106,7 +13187,7 @@ function CosignModalTemplate({
13106
13187
  )
13107
13188
  ] }),
13108
13189
  /* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, language }, current.id),
13109
- verified && verifiedOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: copy.checkedAgainstTurnkey }),
13190
+ verified && verifiedOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: copy.checkedExact }),
13110
13191
  deviceNotLinked ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-verify pollar-cosign-verify-bad", children: [
13111
13192
  copy.deviceNotLinked,
13112
13193
  onLinkDevice && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-link", onClick: onLinkDevice, children: copy.linkDevice })