@pollar/react 0.12.1-rc.22 → 0.12.1-rc.23
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/README.md +26 -24
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +331 -275
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +332 -277
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1311,7 +1311,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
|
|
|
1311
1311
|
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
|
|
1312
1312
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1313
1313
|
"v",
|
|
1314
|
-
"0.12.1-rc.
|
|
1314
|
+
"0.12.1-rc.23"
|
|
1315
1315
|
] })
|
|
1316
1316
|
] });
|
|
1317
1317
|
};
|
|
@@ -3556,6 +3556,21 @@ function useInlineConfirmation(active) {
|
|
|
3556
3556
|
react.useEffect(() => active ? registerConfirmationHost() : void 0, [active, registerConfirmationHost]);
|
|
3557
3557
|
return active ? confirmations[0] ?? null : null;
|
|
3558
3558
|
}
|
|
3559
|
+
function useDeclineOnClose(confirmation) {
|
|
3560
|
+
const pending = react.useRef(0);
|
|
3561
|
+
const track = react.useCallback(async (call) => {
|
|
3562
|
+
pending.current += 1;
|
|
3563
|
+
try {
|
|
3564
|
+
return await call;
|
|
3565
|
+
} finally {
|
|
3566
|
+
pending.current -= 1;
|
|
3567
|
+
}
|
|
3568
|
+
}, []);
|
|
3569
|
+
const declineOnClose = react.useCallback(() => {
|
|
3570
|
+
if (pending.current > 0) confirmation?.reject();
|
|
3571
|
+
}, [confirmation]);
|
|
3572
|
+
return { track, declineOnClose };
|
|
3573
|
+
}
|
|
3559
3574
|
function assetKey2(record) {
|
|
3560
3575
|
return record.code + (record.issuer ?? "");
|
|
3561
3576
|
}
|
|
@@ -3665,12 +3680,14 @@ var KYC_COPY = {
|
|
|
3665
3680
|
en: {
|
|
3666
3681
|
errors: {
|
|
3667
3682
|
SDK_KYC_NOT_CONFIGURED: "Identity verification is not available for this app yet.",
|
|
3683
|
+
// The vendor's account ran out of credits: the operator tops it up, the app's setup is fine.
|
|
3684
|
+
"SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "Identity verification is temporarily unavailable. Please try again later.",
|
|
3668
3685
|
SDK_KYC_PROVIDER_ERROR: "The verification service is not responding right now. Please try again in a moment.",
|
|
3669
3686
|
SDK_KYC_SESSION_EXPIRED: "Your previous verification session expired. Select the provider to start a new one.",
|
|
3670
3687
|
SDK_KYC_PROVIDER_NOT_FOUND: "This verification option is no longer available. Refresh to see the current options.",
|
|
3671
3688
|
SDK_KYC_PROVIDER_NOT_ENABLED: "This verification option is no longer available. Refresh to see the current options.",
|
|
3672
3689
|
SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "This route is not set up for identity verification yet.",
|
|
3673
|
-
VALIDATION_ERROR: "This verification option
|
|
3690
|
+
VALIDATION_ERROR: "This verification option could not be started. Please try again or choose another option."
|
|
3674
3691
|
},
|
|
3675
3692
|
loadFailed: "Could not load verification options. Please refresh to try again.",
|
|
3676
3693
|
startFailed: "Could not start verification. Please try again.",
|
|
@@ -3730,12 +3747,13 @@ var KYC_COPY = {
|
|
|
3730
3747
|
es: {
|
|
3731
3748
|
errors: {
|
|
3732
3749
|
SDK_KYC_NOT_CONFIGURED: "La verificaci\xF3n de identidad todav\xEDa no est\xE1 disponible para esta app.",
|
|
3750
|
+
"SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "La verificaci\xF3n de identidad no est\xE1 disponible temporalmente. Intenta de nuevo m\xE1s tarde.",
|
|
3733
3751
|
SDK_KYC_PROVIDER_ERROR: "El servicio de verificaci\xF3n no responde en este momento. Intenta de nuevo en un momento.",
|
|
3734
3752
|
SDK_KYC_SESSION_EXPIRED: "Tu sesi\xF3n de verificaci\xF3n anterior venci\xF3. Elige el proveedor para iniciar una nueva.",
|
|
3735
3753
|
SDK_KYC_PROVIDER_NOT_FOUND: "Esta opci\xF3n de verificaci\xF3n ya no est\xE1 disponible. Actualiza para ver las opciones actuales.",
|
|
3736
3754
|
SDK_KYC_PROVIDER_NOT_ENABLED: "Esta opci\xF3n de verificaci\xF3n ya no est\xE1 disponible. Actualiza para ver las opciones actuales.",
|
|
3737
3755
|
SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "Esta ruta todav\xEDa no est\xE1 configurada para la verificaci\xF3n de identidad.",
|
|
3738
|
-
VALIDATION_ERROR: "
|
|
3756
|
+
VALIDATION_ERROR: "No se pudo iniciar esta opci\xF3n de verificaci\xF3n. Intenta de nuevo o elige otra opci\xF3n."
|
|
3739
3757
|
},
|
|
3740
3758
|
loadFailed: "No se pudieron cargar las opciones de verificaci\xF3n. Actualiza para intentar de nuevo.",
|
|
3741
3759
|
startFailed: "No se pudo iniciar la verificaci\xF3n. Intenta de nuevo.",
|
|
@@ -3795,12 +3813,13 @@ var KYC_COPY = {
|
|
|
3795
3813
|
pt: {
|
|
3796
3814
|
errors: {
|
|
3797
3815
|
SDK_KYC_NOT_CONFIGURED: "A verifica\xE7\xE3o de identidade ainda n\xE3o est\xE1 dispon\xEDvel para este app.",
|
|
3816
|
+
"SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "A verifica\xE7\xE3o de identidade est\xE1 temporariamente indispon\xEDvel. Tente de novo mais tarde.",
|
|
3798
3817
|
SDK_KYC_PROVIDER_ERROR: "O servi\xE7o de verifica\xE7\xE3o n\xE3o est\xE1 respondendo agora. Tente de novo em instantes.",
|
|
3799
3818
|
SDK_KYC_SESSION_EXPIRED: "Sua sess\xE3o de verifica\xE7\xE3o anterior expirou. Escolha o provedor para iniciar uma nova.",
|
|
3800
3819
|
SDK_KYC_PROVIDER_NOT_FOUND: "Esta op\xE7\xE3o de verifica\xE7\xE3o n\xE3o est\xE1 mais dispon\xEDvel. Atualize para ver as op\xE7\xF5es atuais.",
|
|
3801
3820
|
SDK_KYC_PROVIDER_NOT_ENABLED: "Esta op\xE7\xE3o de verifica\xE7\xE3o n\xE3o est\xE1 mais dispon\xEDvel. Atualize para ver as op\xE7\xF5es atuais.",
|
|
3802
3821
|
SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "Esta rota ainda n\xE3o est\xE1 configurada para a verifica\xE7\xE3o de identidade.",
|
|
3803
|
-
VALIDATION_ERROR: "
|
|
3822
|
+
VALIDATION_ERROR: "N\xE3o foi poss\xEDvel iniciar esta op\xE7\xE3o de verifica\xE7\xE3o. Tente de novo ou escolha outra op\xE7\xE3o."
|
|
3804
3823
|
},
|
|
3805
3824
|
loadFailed: "N\xE3o foi poss\xEDvel carregar as op\xE7\xF5es de verifica\xE7\xE3o. Atualize para tentar de novo.",
|
|
3806
3825
|
startFailed: "N\xE3o foi poss\xEDvel iniciar a verifica\xE7\xE3o. Tente de novo.",
|
|
@@ -3881,12 +3900,11 @@ function KycStatus({ status, label, className, language: languageProp }) {
|
|
|
3881
3900
|
}
|
|
3882
3901
|
);
|
|
3883
3902
|
}
|
|
3884
|
-
|
|
3885
|
-
// src/components/kyc-modal/kyc-messages.ts
|
|
3886
3903
|
function kycErrorMessage(error, phase, language = "en") {
|
|
3887
3904
|
const copy = KYC_COPY[language];
|
|
3888
3905
|
const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
3889
|
-
const
|
|
3906
|
+
const reason = core.isPollarApiError(error) && typeof error.body.reason === "string" ? error.body.reason : void 0;
|
|
3907
|
+
const known = typeof code === "string" ? reason && copy.errors[`${code}:${reason}`] || copy.errors[code] : void 0;
|
|
3890
3908
|
if (known) return known;
|
|
3891
3909
|
return phase === "load" ? copy.loadFailed : copy.startFailed;
|
|
3892
3910
|
}
|
|
@@ -4887,6 +4905,22 @@ function WalletAdapterButtons({
|
|
|
4887
4905
|
a.id
|
|
4888
4906
|
)) });
|
|
4889
4907
|
}
|
|
4908
|
+
function CloseButton({ onClick, label }) {
|
|
4909
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick, "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4910
|
+
"svg",
|
|
4911
|
+
{
|
|
4912
|
+
width: "18",
|
|
4913
|
+
height: "18",
|
|
4914
|
+
viewBox: "0 0 24 24",
|
|
4915
|
+
fill: "none",
|
|
4916
|
+
stroke: "currentColor",
|
|
4917
|
+
strokeWidth: "2.5",
|
|
4918
|
+
strokeLinecap: "round",
|
|
4919
|
+
strokeLinejoin: "round",
|
|
4920
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
4921
|
+
}
|
|
4922
|
+
) });
|
|
4923
|
+
}
|
|
4890
4924
|
function authStateToStatus(step) {
|
|
4891
4925
|
const loading = [
|
|
4892
4926
|
"creating_session",
|
|
@@ -4931,7 +4965,8 @@ function LoginModalTemplate({
|
|
|
4931
4965
|
onBack,
|
|
4932
4966
|
onCancel,
|
|
4933
4967
|
onRetry,
|
|
4934
|
-
language: languageProp
|
|
4968
|
+
language: languageProp,
|
|
4969
|
+
inline = false
|
|
4935
4970
|
}) {
|
|
4936
4971
|
const language = useInheritedLanguage(languageProp);
|
|
4937
4972
|
const copy = LOGIN_COPY[language];
|
|
@@ -4967,160 +5002,155 @@ function LoginModalTemplate({
|
|
|
4967
5002
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 19l-7-7 7-7" })
|
|
4968
5003
|
}
|
|
4969
5004
|
) });
|
|
4970
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
{
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
awaitingEmailCode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4991
|
-
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
|
|
4992
|
-
/* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: onCodeSubmit ?? (() => {
|
|
4993
|
-
}), language }, codeInputKey)
|
|
4994
|
-
] }) : activeGroup ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4995
|
-
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setActiveGroup(null) }),
|
|
4996
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4997
|
-
WalletAdapterButtons,
|
|
4998
|
-
{
|
|
4999
|
-
walletAdapters: activeGroupAdapters,
|
|
5000
|
-
onConnect: onWalletConnect ?? (() => {
|
|
5001
|
-
}),
|
|
5002
|
-
isLoading
|
|
5003
|
-
}
|
|
5004
|
-
)
|
|
5005
|
-
] }) : showPasskeyChooser ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5006
|
-
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
|
|
5007
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
5008
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: copy.createNewWallet }),
|
|
5009
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: copy.loginExistingWallet })
|
|
5010
|
-
] })
|
|
5011
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5012
|
-
emailEnabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
|
|
5013
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5014
|
-
"input",
|
|
5015
|
-
{
|
|
5016
|
-
type: "email",
|
|
5017
|
-
placeholder: copy.emailPlaceholder,
|
|
5018
|
-
value: email,
|
|
5019
|
-
disabled: isLoading,
|
|
5020
|
-
className: "pollar-input",
|
|
5021
|
-
onChange: (e) => onEmailChange?.(e.target.value),
|
|
5022
|
-
onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
|
|
5023
|
-
}
|
|
5024
|
-
),
|
|
5025
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5026
|
-
"button",
|
|
5027
|
-
{
|
|
5028
|
-
type: "button",
|
|
5029
|
-
disabled: isLoading || !email,
|
|
5030
|
-
className: "pollar-btn-primary",
|
|
5031
|
-
style: { marginTop: "0.75rem" },
|
|
5032
|
-
onClick: onEmailSubmit,
|
|
5033
|
-
children: copy.submit
|
|
5034
|
-
}
|
|
5035
|
-
)
|
|
5036
|
-
] }),
|
|
5037
|
-
emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
|
|
5038
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
|
|
5039
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
|
|
5040
|
-
] }),
|
|
5041
|
-
enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-social-list", children: [
|
|
5042
|
-
enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
|
|
5043
|
-
enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
|
|
5044
|
-
] }),
|
|
5045
|
-
(embeddedWallets || smartWallet) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
5046
|
-
embeddedWallets && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5047
|
-
walletGroups.map((g) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5048
|
-
"button",
|
|
5049
|
-
{
|
|
5050
|
-
type: "button",
|
|
5051
|
-
disabled: isLoading,
|
|
5052
|
-
className: "pollar-wallet-entry-btn",
|
|
5053
|
-
onClick: () => setActiveGroup(g.label),
|
|
5054
|
-
children: [
|
|
5055
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5056
|
-
"svg",
|
|
5057
|
-
{
|
|
5058
|
-
width: "18",
|
|
5059
|
-
height: "20",
|
|
5060
|
-
viewBox: "0 0 24 24",
|
|
5061
|
-
fill: "none",
|
|
5062
|
-
stroke: "currentColor",
|
|
5063
|
-
strokeWidth: "2",
|
|
5064
|
-
strokeLinecap: "round",
|
|
5065
|
-
strokeLinejoin: "round",
|
|
5066
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" })
|
|
5067
|
-
}
|
|
5068
|
-
),
|
|
5069
|
-
g.label
|
|
5070
|
-
]
|
|
5071
|
-
},
|
|
5072
|
-
g.label
|
|
5073
|
-
)),
|
|
5074
|
-
rootAdapters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5005
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5006
|
+
"div",
|
|
5007
|
+
{
|
|
5008
|
+
className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
|
|
5009
|
+
style: cssVars,
|
|
5010
|
+
onClick: (e) => e.stopPropagation(),
|
|
5011
|
+
children: [
|
|
5012
|
+
!inline && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onCancel, label: copy.close }),
|
|
5013
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
|
|
5014
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
|
|
5015
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
|
|
5016
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
|
|
5017
|
+
] }),
|
|
5018
|
+
awaitingEmailCode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5019
|
+
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
|
|
5020
|
+
/* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: onCodeSubmit ?? (() => {
|
|
5021
|
+
}), language }, codeInputKey)
|
|
5022
|
+
] }) : activeGroup ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5023
|
+
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setActiveGroup(null) }),
|
|
5024
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5075
5025
|
WalletAdapterButtons,
|
|
5076
5026
|
{
|
|
5077
|
-
walletAdapters:
|
|
5027
|
+
walletAdapters: activeGroupAdapters,
|
|
5078
5028
|
onConnect: onWalletConnect ?? (() => {
|
|
5079
5029
|
}),
|
|
5080
|
-
isLoading
|
|
5081
|
-
variant: "entry"
|
|
5030
|
+
isLoading
|
|
5082
5031
|
}
|
|
5083
5032
|
)
|
|
5084
|
-
] }),
|
|
5085
|
-
|
|
5086
|
-
"
|
|
5087
|
-
|
|
5088
|
-
type: "button",
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5033
|
+
] }) : showPasskeyChooser ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5034
|
+
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
|
|
5035
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
5036
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: copy.createNewWallet }),
|
|
5037
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: copy.loginExistingWallet })
|
|
5038
|
+
] })
|
|
5039
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5040
|
+
emailEnabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
|
|
5041
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5042
|
+
"input",
|
|
5043
|
+
{
|
|
5044
|
+
type: "email",
|
|
5045
|
+
placeholder: copy.emailPlaceholder,
|
|
5046
|
+
value: email,
|
|
5047
|
+
disabled: isLoading,
|
|
5048
|
+
className: "pollar-input",
|
|
5049
|
+
onChange: (e) => onEmailChange?.(e.target.value),
|
|
5050
|
+
onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
|
|
5051
|
+
}
|
|
5052
|
+
),
|
|
5053
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5054
|
+
"button",
|
|
5055
|
+
{
|
|
5056
|
+
type: "button",
|
|
5057
|
+
disabled: isLoading || !email,
|
|
5058
|
+
className: "pollar-btn-primary",
|
|
5059
|
+
style: { marginTop: "0.75rem" },
|
|
5060
|
+
onClick: onEmailSubmit,
|
|
5061
|
+
children: copy.submit
|
|
5062
|
+
}
|
|
5063
|
+
)
|
|
5064
|
+
] }),
|
|
5065
|
+
emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
|
|
5066
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
|
|
5067
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
|
|
5068
|
+
] }),
|
|
5069
|
+
enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-social-list", children: [
|
|
5070
|
+
enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
|
|
5071
|
+
enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
|
|
5072
|
+
] }),
|
|
5073
|
+
(embeddedWallets || smartWallet) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
5074
|
+
embeddedWallets && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5075
|
+
walletGroups.map((g) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5076
|
+
"button",
|
|
5095
5077
|
{
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5078
|
+
type: "button",
|
|
5079
|
+
disabled: isLoading,
|
|
5080
|
+
className: "pollar-wallet-entry-btn",
|
|
5081
|
+
onClick: () => setActiveGroup(g.label),
|
|
5082
|
+
children: [
|
|
5083
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5084
|
+
"svg",
|
|
5085
|
+
{
|
|
5086
|
+
width: "18",
|
|
5087
|
+
height: "20",
|
|
5088
|
+
viewBox: "0 0 24 24",
|
|
5089
|
+
fill: "none",
|
|
5090
|
+
stroke: "currentColor",
|
|
5091
|
+
strokeWidth: "2",
|
|
5092
|
+
strokeLinecap: "round",
|
|
5093
|
+
strokeLinejoin: "round",
|
|
5094
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" })
|
|
5095
|
+
}
|
|
5096
|
+
),
|
|
5097
|
+
g.label
|
|
5098
|
+
]
|
|
5099
|
+
},
|
|
5100
|
+
g.label
|
|
5101
|
+
)),
|
|
5102
|
+
rootAdapters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5103
|
+
WalletAdapterButtons,
|
|
5104
|
+
{
|
|
5105
|
+
walletAdapters: rootAdapters,
|
|
5106
|
+
onConnect: onWalletConnect ?? (() => {
|
|
5107
|
+
}),
|
|
5108
|
+
isLoading,
|
|
5109
|
+
variant: "entry"
|
|
5105
5110
|
}
|
|
5106
|
-
)
|
|
5107
|
-
|
|
5108
|
-
|
|
5111
|
+
)
|
|
5112
|
+
] }),
|
|
5113
|
+
smartWallet && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5114
|
+
"button",
|
|
5115
|
+
{
|
|
5116
|
+
type: "button",
|
|
5117
|
+
disabled: isLoading,
|
|
5118
|
+
className: "pollar-wallet-entry-btn",
|
|
5119
|
+
onClick: () => setShowPasskeyChooser(true),
|
|
5120
|
+
children: [
|
|
5121
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5122
|
+
"svg",
|
|
5123
|
+
{
|
|
5124
|
+
width: "18",
|
|
5125
|
+
height: "20",
|
|
5126
|
+
viewBox: "0 0 24 24",
|
|
5127
|
+
fill: "none",
|
|
5128
|
+
stroke: "currentColor",
|
|
5129
|
+
strokeWidth: "2",
|
|
5130
|
+
strokeLinecap: "round",
|
|
5131
|
+
strokeLinejoin: "round",
|
|
5132
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 8V6a4 4 0 00-8 0v2M5 8h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V9a1 1 0 011-1zm7 5v2" })
|
|
5133
|
+
}
|
|
5134
|
+
),
|
|
5135
|
+
"Smart Wallet"
|
|
5136
|
+
]
|
|
5137
|
+
}
|
|
5138
|
+
)
|
|
5139
|
+
] })
|
|
5140
|
+
] }),
|
|
5141
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5142
|
+
ModalStatusBanner,
|
|
5143
|
+
{
|
|
5144
|
+
message: statusMessage,
|
|
5145
|
+
status,
|
|
5146
|
+
onCancel,
|
|
5147
|
+
onRetry: isEmailCodeError ? void 0 : onRetry
|
|
5109
5148
|
}
|
|
5110
|
-
)
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
{
|
|
5116
|
-
message: statusMessage,
|
|
5117
|
-
status,
|
|
5118
|
-
onCancel,
|
|
5119
|
-
onRetry: isEmailCodeError ? void 0 : onRetry
|
|
5120
|
-
}
|
|
5121
|
-
),
|
|
5122
|
-
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
5123
|
-
] });
|
|
5149
|
+
),
|
|
5150
|
+
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
5151
|
+
]
|
|
5152
|
+
}
|
|
5153
|
+
);
|
|
5124
5154
|
}
|
|
5125
5155
|
function LoginModalStatus({
|
|
5126
5156
|
status,
|
|
@@ -5131,40 +5161,36 @@ function LoginModalStatus({
|
|
|
5131
5161
|
appName,
|
|
5132
5162
|
onRetry,
|
|
5133
5163
|
onCancel,
|
|
5134
|
-
language: languageProp
|
|
5164
|
+
language: languageProp,
|
|
5165
|
+
inline = false
|
|
5135
5166
|
}) {
|
|
5136
5167
|
const language = useInheritedLanguage(languageProp);
|
|
5137
5168
|
const copy = LOGIN_COPY[language];
|
|
5138
5169
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
|
|
5139
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
{
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-modal-error", children: copy.loadError }),
|
|
5164
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: copy.tryAgain })
|
|
5165
|
-
] }),
|
|
5166
|
-
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
5167
|
-
] });
|
|
5170
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5171
|
+
"div",
|
|
5172
|
+
{
|
|
5173
|
+
className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
|
|
5174
|
+
style: cssVars,
|
|
5175
|
+
onClick: (e) => e.stopPropagation(),
|
|
5176
|
+
children: [
|
|
5177
|
+
!inline && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onCancel, label: copy.close }),
|
|
5178
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
|
|
5179
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
|
|
5180
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
|
|
5181
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
|
|
5182
|
+
] }),
|
|
5183
|
+
status === "loading" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
|
|
5184
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
|
|
5185
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: copy.loading })
|
|
5186
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
5187
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-modal-error", children: copy.loadError }),
|
|
5188
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: copy.tryAgain })
|
|
5189
|
+
] }),
|
|
5190
|
+
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
5191
|
+
]
|
|
5192
|
+
}
|
|
5193
|
+
);
|
|
5168
5194
|
}
|
|
5169
5195
|
function PrivyLoginSubmodal({
|
|
5170
5196
|
adapter,
|
|
@@ -5176,7 +5202,8 @@ function PrivyLoginSubmodal({
|
|
|
5176
5202
|
onBack,
|
|
5177
5203
|
onCancel,
|
|
5178
5204
|
onAuthenticated,
|
|
5179
|
-
language
|
|
5205
|
+
language,
|
|
5206
|
+
inline = false
|
|
5180
5207
|
}) {
|
|
5181
5208
|
const copy = LOGIN_COPY[language];
|
|
5182
5209
|
const options = react.useMemo(() => adapter.getAuthOptions(), [adapter]);
|
|
@@ -5240,70 +5267,65 @@ function PrivyLoginSubmodal({
|
|
|
5240
5267
|
const showEmail = options.includes("email");
|
|
5241
5268
|
const showGoogle = options.includes("google");
|
|
5242
5269
|
const showGithub = options.includes("github");
|
|
5243
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
{
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
] })
|
|
5301
|
-
] }),
|
|
5302
|
-
/* @__PURE__ */ jsxRuntime.jsx(ModalStatusBanner, { message, status, onCancel, onRetry: void 0 }),
|
|
5303
|
-
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
5304
|
-
] });
|
|
5270
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5271
|
+
"div",
|
|
5272
|
+
{
|
|
5273
|
+
className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
|
|
5274
|
+
style: cssVars,
|
|
5275
|
+
onClick: (e) => e.stopPropagation(),
|
|
5276
|
+
children: [
|
|
5277
|
+
!inline && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onCancel, label: copy.close }),
|
|
5278
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
|
|
5279
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
|
|
5280
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
|
|
5281
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: adapter.meta.label })
|
|
5282
|
+
] }),
|
|
5283
|
+
view === "email-code" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5284
|
+
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setView("root") }),
|
|
5285
|
+
/* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: handleCodeSubmit, language })
|
|
5286
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5287
|
+
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
|
|
5288
|
+
showEmail && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
|
|
5289
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5290
|
+
"input",
|
|
5291
|
+
{
|
|
5292
|
+
type: "email",
|
|
5293
|
+
placeholder: copy.emailPlaceholder,
|
|
5294
|
+
value: email,
|
|
5295
|
+
disabled: isLoading,
|
|
5296
|
+
className: "pollar-input",
|
|
5297
|
+
onChange: (e) => setEmail(e.target.value),
|
|
5298
|
+
onKeyDown: (e) => e.key === "Enter" && handleEmailSubmit()
|
|
5299
|
+
}
|
|
5300
|
+
),
|
|
5301
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5302
|
+
"button",
|
|
5303
|
+
{
|
|
5304
|
+
type: "button",
|
|
5305
|
+
disabled: isLoading || !email,
|
|
5306
|
+
className: "pollar-btn-primary",
|
|
5307
|
+
style: { marginTop: "0.75rem" },
|
|
5308
|
+
onClick: handleEmailSubmit,
|
|
5309
|
+
children: copy.submit
|
|
5310
|
+
}
|
|
5311
|
+
)
|
|
5312
|
+
] }),
|
|
5313
|
+
showEmail && (showGoogle || showGithub) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
|
|
5314
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
|
|
5315
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
|
|
5316
|
+
] }),
|
|
5317
|
+
(showGoogle || showGithub) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-social-list", children: [
|
|
5318
|
+
showGoogle && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => handleOAuth("google") }),
|
|
5319
|
+
showGithub && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => handleOAuth("github") })
|
|
5320
|
+
] })
|
|
5321
|
+
] }),
|
|
5322
|
+
/* @__PURE__ */ jsxRuntime.jsx(ModalStatusBanner, { message, status, onCancel, onRetry: void 0 }),
|
|
5323
|
+
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
5324
|
+
]
|
|
5325
|
+
}
|
|
5326
|
+
);
|
|
5305
5327
|
}
|
|
5306
|
-
function LoginModal({ onClose }) {
|
|
5328
|
+
function LoginModal({ onClose, inline = false }) {
|
|
5307
5329
|
const [email, setEmail] = react.useState("");
|
|
5308
5330
|
const { getClient, styles, appConfig: config, configStatus, retryConfig } = usePollar();
|
|
5309
5331
|
const [authState, setAuthState] = react.useState(() => getClient().getAuthState());
|
|
@@ -5398,7 +5420,7 @@ function LoginModal({ onClose }) {
|
|
|
5398
5420
|
getClient().login({ provider });
|
|
5399
5421
|
}
|
|
5400
5422
|
}
|
|
5401
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5423
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ModalFrame, { inline, overlayStyle, onClose: handleClose, children: configStatus !== "ready" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5402
5424
|
LoginModalStatus,
|
|
5403
5425
|
{
|
|
5404
5426
|
status: configStatus === "error" ? "error" : "loading",
|
|
@@ -5409,7 +5431,8 @@ function LoginModal({ onClose }) {
|
|
|
5409
5431
|
appName: modalTitle,
|
|
5410
5432
|
onRetry: retryConfig,
|
|
5411
5433
|
onCancel: handleClose,
|
|
5412
|
-
language
|
|
5434
|
+
language,
|
|
5435
|
+
inline
|
|
5413
5436
|
}
|
|
5414
5437
|
) : interactiveAdapter ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5415
5438
|
PrivyLoginSubmodal,
|
|
@@ -5423,7 +5446,8 @@ function LoginModal({ onClose }) {
|
|
|
5423
5446
|
onBack: () => setInteractiveAdapter(null),
|
|
5424
5447
|
onCancel: handleClose,
|
|
5425
5448
|
onAuthenticated: handleInteractiveAuthenticated,
|
|
5426
|
-
language
|
|
5449
|
+
language,
|
|
5450
|
+
inline
|
|
5427
5451
|
}
|
|
5428
5452
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5429
5453
|
LoginModalTemplate,
|
|
@@ -5457,7 +5481,8 @@ function LoginModal({ onClose }) {
|
|
|
5457
5481
|
onBack: handleBack,
|
|
5458
5482
|
onCancel: handleClose,
|
|
5459
5483
|
onRetry: handleRetry,
|
|
5460
|
-
language
|
|
5484
|
+
language,
|
|
5485
|
+
inline
|
|
5461
5486
|
}
|
|
5462
5487
|
) });
|
|
5463
5488
|
}
|
|
@@ -6790,6 +6815,7 @@ var REGISTRY_COPY = {
|
|
|
6790
6815
|
rejected: "The registry did not confirm: {fields}. Check how they are written and try again.",
|
|
6791
6816
|
loadError: "Could not load your details. Please try again.",
|
|
6792
6817
|
submitError: "Could not check your details. Please try again.",
|
|
6818
|
+
registryDown: "The civil registry is not responding right now. Please try again in a few minutes.",
|
|
6793
6819
|
step: "Step {n} of {total}"
|
|
6794
6820
|
},
|
|
6795
6821
|
es: {
|
|
@@ -6812,6 +6838,7 @@ var REGISTRY_COPY = {
|
|
|
6812
6838
|
rejected: "El registro no confirm\xF3: {fields}. Revisa c\xF3mo est\xE1n escritos e intenta de nuevo.",
|
|
6813
6839
|
loadError: "No se pudieron cargar tus datos. Intenta de nuevo.",
|
|
6814
6840
|
submitError: "No se pudieron validar tus datos. Intenta de nuevo.",
|
|
6841
|
+
registryDown: "El registro civil no responde en este momento. Intenta de nuevo en unos minutos.",
|
|
6815
6842
|
step: "Paso {n} de {total}"
|
|
6816
6843
|
},
|
|
6817
6844
|
pt: {
|
|
@@ -6834,6 +6861,7 @@ var REGISTRY_COPY = {
|
|
|
6834
6861
|
rejected: "O registro n\xE3o confirmou: {fields}. Verifique como est\xE3o escritos e tente novamente.",
|
|
6835
6862
|
loadError: "N\xE3o foi poss\xEDvel carregar seus dados. Tente novamente.",
|
|
6836
6863
|
submitError: "N\xE3o foi poss\xEDvel validar seus dados. Tente novamente.",
|
|
6864
|
+
registryDown: "O registro civil n\xE3o est\xE1 respondendo agora. Tente novamente em alguns minutos.",
|
|
6837
6865
|
step: "Passo {n} de {total}"
|
|
6838
6866
|
}
|
|
6839
6867
|
};
|
|
@@ -6996,6 +7024,10 @@ var errorBody = (error) => {
|
|
|
6996
7024
|
const body = typeof error === "object" && error !== null && "body" in error ? error.body : void 0;
|
|
6997
7025
|
return typeof body === "object" && body !== null ? body : void 0;
|
|
6998
7026
|
};
|
|
7027
|
+
var isRegistryDown = (error) => {
|
|
7028
|
+
const body = errorBody(error);
|
|
7029
|
+
return errorCode(error) === "SDK_KYC_PROVIDER_ERROR" && !!body && "retryable" in body && body.retryable === true;
|
|
7030
|
+
};
|
|
6999
7031
|
function missingFieldsOf(error) {
|
|
7000
7032
|
const body = errorBody(error);
|
|
7001
7033
|
const missing = body && "missing" in body ? body.missing : void 0;
|
|
@@ -7090,6 +7122,7 @@ function RegistryCheckModal({
|
|
|
7090
7122
|
if (code === "KYC_REGISTRY_NAME_MISMATCH") {
|
|
7091
7123
|
setError(copy.nameMismatch.replace("{full}", [prefill.surname1, prefill.surname2].filter(Boolean).join(" ")));
|
|
7092
7124
|
} else if (code === "SDK_KYC_UNDER_REVIEW") setReview(true);
|
|
7125
|
+
else if (isRegistryDown(e)) setError(copy.registryDown);
|
|
7093
7126
|
else setError(copy.submitError);
|
|
7094
7127
|
} finally {
|
|
7095
7128
|
if (mounted.current) setSubmitting(false);
|
|
@@ -8018,7 +8051,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
|
|
|
8018
8051
|
onRequote: () => void handleRequote(),
|
|
8019
8052
|
onSetUpRecovery: openRecoveryModal,
|
|
8020
8053
|
recoveryMissing: recovery === null ? null : recoveryLocked,
|
|
8021
|
-
support: client.getSupportContact(),
|
|
8054
|
+
support: core.rampSupportContact(client.getSupportContact(), appConfig.application?.support),
|
|
8022
8055
|
pollTrouble,
|
|
8023
8056
|
checkingPayment: paymentCheckUntil !== null,
|
|
8024
8057
|
onCheckPayment: () => void handleCheckPayment(),
|
|
@@ -9215,6 +9248,7 @@ function SendModal({ onClose, initial }) {
|
|
|
9215
9248
|
const copy = SEND_COPY[language];
|
|
9216
9249
|
const [step, setStep] = react.useState("form");
|
|
9217
9250
|
const confirmation = useInlineConfirmation(step === "tx");
|
|
9251
|
+
const { track, declineOnClose } = useDeclineOnClose(confirmation);
|
|
9218
9252
|
const [createsAccount, setCreatesAccount] = react.useState(false);
|
|
9219
9253
|
const [checkingDestination, setCheckingDestination] = react.useState(false);
|
|
9220
9254
|
const [amount, setAmount] = react.useState(() => seededAmount(initial?.amount));
|
|
@@ -9346,14 +9380,16 @@ function SendModal({ onClose, initial }) {
|
|
|
9346
9380
|
setCreatesAccount(false);
|
|
9347
9381
|
setStep("tx");
|
|
9348
9382
|
if (selectedChain === "SOLANA" || selectedChain === "POLYGON") {
|
|
9349
|
-
await
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9383
|
+
await track(
|
|
9384
|
+
sendPayment({
|
|
9385
|
+
chain: selectedChain,
|
|
9386
|
+
destination: destination.trim(),
|
|
9387
|
+
amount: sendAmount,
|
|
9388
|
+
// A native coin carries no token id; an SPL mint or ERC-20 contract rides
|
|
9389
|
+
// in `issuer`, which the guard above proved is present.
|
|
9390
|
+
...isNativeAsset ? {} : { mint: selectedAsset.issuer }
|
|
9391
|
+
})
|
|
9392
|
+
);
|
|
9357
9393
|
return;
|
|
9358
9394
|
}
|
|
9359
9395
|
await buildTx(
|
|
@@ -9375,7 +9411,7 @@ function SendModal({ onClose, initial }) {
|
|
|
9375
9411
|
}
|
|
9376
9412
|
function handleSignAndSend() {
|
|
9377
9413
|
if (transaction.step === "built") {
|
|
9378
|
-
void signAndSubmitTx(transaction.buildData.unsignedXdr);
|
|
9414
|
+
void track(signAndSubmitTx(transaction.buildData.unsignedXdr));
|
|
9379
9415
|
}
|
|
9380
9416
|
}
|
|
9381
9417
|
function handleMax() {
|
|
@@ -9422,16 +9458,20 @@ function SendModal({ onClose, initial }) {
|
|
|
9422
9458
|
}
|
|
9423
9459
|
async function handleRetry() {
|
|
9424
9460
|
if (transaction.step === "error" && transaction.buildData) {
|
|
9425
|
-
await signAndSubmitTx(transaction.buildData.unsignedXdr);
|
|
9461
|
+
await track(signAndSubmitTx(transaction.buildData.unsignedXdr));
|
|
9426
9462
|
}
|
|
9427
9463
|
}
|
|
9464
|
+
function handleClose() {
|
|
9465
|
+
declineOnClose();
|
|
9466
|
+
onClose();
|
|
9467
|
+
}
|
|
9428
9468
|
function handleBack() {
|
|
9429
9469
|
setStep("form");
|
|
9430
9470
|
setCreatesAccount(false);
|
|
9431
9471
|
setShowXdr(false);
|
|
9432
9472
|
setCopied(false);
|
|
9433
9473
|
}
|
|
9434
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ?
|
|
9474
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9435
9475
|
SendModalTemplate,
|
|
9436
9476
|
{
|
|
9437
9477
|
theme,
|
|
@@ -9460,7 +9500,7 @@ function SendModal({ onClose, initial }) {
|
|
|
9460
9500
|
walletType,
|
|
9461
9501
|
showBack,
|
|
9462
9502
|
isInProgress,
|
|
9463
|
-
onClose,
|
|
9503
|
+
onClose: handleClose,
|
|
9464
9504
|
onBack: handleBack,
|
|
9465
9505
|
onRefresh: () => void refreshWalletBalance(),
|
|
9466
9506
|
onSelectAsset: setSelectedAsset,
|
|
@@ -10262,6 +10302,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10262
10302
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
10263
10303
|
const [step, setStep] = react.useState("form");
|
|
10264
10304
|
const confirmation = useInlineConfirmation(step === "tx");
|
|
10305
|
+
const { track, declineOnClose } = useDeclineOnClose(confirmation);
|
|
10265
10306
|
const [selectedSell, setSelectedSell] = react.useState(null);
|
|
10266
10307
|
const [selectedBuy, setSelectedBuy] = react.useState(null);
|
|
10267
10308
|
const [amount, setAmount] = react.useState(() => seededAmount(initial?.amount));
|
|
@@ -10687,7 +10728,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10687
10728
|
setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
|
|
10688
10729
|
setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
|
|
10689
10730
|
setStep("tx");
|
|
10690
|
-
await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
|
|
10731
|
+
await track(swapSolana(solanaQuote, { slippageBps, idempotencyKey: key }));
|
|
10691
10732
|
return;
|
|
10692
10733
|
}
|
|
10693
10734
|
if (!quote) {
|
|
@@ -10696,7 +10737,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10696
10737
|
}
|
|
10697
10738
|
setSentSolana(null);
|
|
10698
10739
|
setStep("tx");
|
|
10699
|
-
await swap(quote);
|
|
10740
|
+
await track(swap(quote));
|
|
10700
10741
|
}
|
|
10701
10742
|
async function handleRetry() {
|
|
10702
10743
|
if (transaction.step !== "error") return;
|
|
@@ -10706,10 +10747,10 @@ function SwapModal({ onClose, initial }) {
|
|
|
10706
10747
|
const toward = solanaQuote.destinationChain;
|
|
10707
10748
|
setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
|
|
10708
10749
|
if (selectedSell && selectedBuy) setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
|
|
10709
|
-
await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
|
|
10750
|
+
await track(swapSolana(solanaQuote, { slippageBps, idempotencyKey: key }));
|
|
10710
10751
|
return;
|
|
10711
10752
|
}
|
|
10712
|
-
if (quote) await swap(quote);
|
|
10753
|
+
if (quote) await track(swap(quote));
|
|
10713
10754
|
}
|
|
10714
10755
|
function handleMax() {
|
|
10715
10756
|
if (selectedSell?.available !== void 0) setAmount(selectedSell.available);
|
|
@@ -10733,6 +10774,10 @@ function SwapModal({ onClose, initial }) {
|
|
|
10733
10774
|
}, 2e3);
|
|
10734
10775
|
});
|
|
10735
10776
|
}
|
|
10777
|
+
function handleClose() {
|
|
10778
|
+
declineOnClose();
|
|
10779
|
+
onClose();
|
|
10780
|
+
}
|
|
10736
10781
|
function handleBack() {
|
|
10737
10782
|
setSettlement(null);
|
|
10738
10783
|
setSentSolana(null);
|
|
@@ -10740,7 +10785,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10740
10785
|
setShowXdr(false);
|
|
10741
10786
|
setCopied(false);
|
|
10742
10787
|
}
|
|
10743
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ?
|
|
10788
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10744
10789
|
SwapModalTemplate,
|
|
10745
10790
|
{
|
|
10746
10791
|
theme,
|
|
@@ -10781,7 +10826,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10781
10826
|
showBack,
|
|
10782
10827
|
isInProgress,
|
|
10783
10828
|
language,
|
|
10784
|
-
onClose,
|
|
10829
|
+
onClose: handleClose,
|
|
10785
10830
|
onBack: handleBack,
|
|
10786
10831
|
onRefresh: handleRefresh,
|
|
10787
10832
|
onSelectSell: (option) => {
|
|
@@ -11683,6 +11728,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
11683
11728
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
11684
11729
|
const [step, setStep] = react.useState("form");
|
|
11685
11730
|
const confirmation = useInlineConfirmation(step === "tx");
|
|
11731
|
+
const { track, declineOnClose } = useDeclineOnClose(confirmation);
|
|
11686
11732
|
const [tab, setTab] = react.useState(
|
|
11687
11733
|
() => oneOf(["deposit", "withdraw"], initial?.tab) ?? "deposit"
|
|
11688
11734
|
);
|
|
@@ -11855,7 +11901,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
11855
11901
|
});
|
|
11856
11902
|
setStep("tx");
|
|
11857
11903
|
if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
|
|
11858
|
-
const tl = await setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer });
|
|
11904
|
+
const tl = await track(setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer }));
|
|
11859
11905
|
if (tl.status === "error") {
|
|
11860
11906
|
setFormError(copy.trustlineFailed(assetCode, tl.details ?? copy.unknownError));
|
|
11861
11907
|
setStep("form");
|
|
@@ -11874,11 +11920,15 @@ function EarnModal({ onClose, initial }) {
|
|
|
11874
11920
|
function runEarn() {
|
|
11875
11921
|
if (onSolana) {
|
|
11876
11922
|
const params2 = { opportunity: opportunityId, amount };
|
|
11877
|
-
return tab === "deposit" ? earnSolanaDeposit(params2) : earnSolanaWithdraw(params2);
|
|
11923
|
+
return track(tab === "deposit" ? earnSolanaDeposit(params2) : earnSolanaWithdraw(params2));
|
|
11878
11924
|
}
|
|
11879
11925
|
if (!provider) return null;
|
|
11880
11926
|
const params = { provider, opportunity: opportunityId, amount };
|
|
11881
|
-
return tab === "deposit" ? earnDeposit(params) : earnWithdraw(params);
|
|
11927
|
+
return track(tab === "deposit" ? earnDeposit(params) : earnWithdraw(params));
|
|
11928
|
+
}
|
|
11929
|
+
function handleClose() {
|
|
11930
|
+
declineOnClose();
|
|
11931
|
+
onClose();
|
|
11882
11932
|
}
|
|
11883
11933
|
async function handleRetry() {
|
|
11884
11934
|
if (transaction.step !== "error" || !opportunityId) return;
|
|
@@ -11960,7 +12010,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
11960
12010
|
rows: [{ label: copy.yourPosition, value: position.balance }]
|
|
11961
12011
|
}
|
|
11962
12012
|
) : null;
|
|
11963
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ?
|
|
12013
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11964
12014
|
"div",
|
|
11965
12015
|
{
|
|
11966
12016
|
className: "pollar-modal-card pollar-send-modal",
|
|
@@ -12034,7 +12084,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
12034
12084
|
)
|
|
12035
12085
|
}
|
|
12036
12086
|
),
|
|
12037
|
-
!isInProgress && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick:
|
|
12087
|
+
!isInProgress && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleClose, "aria-label": copy.close, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
12038
12088
|
] })
|
|
12039
12089
|
] }),
|
|
12040
12090
|
step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: copy.unavailable }),
|
|
@@ -17447,6 +17497,11 @@ function KycFlow({ onApproved, country, level }) {
|
|
|
17447
17497
|
}
|
|
17448
17498
|
);
|
|
17449
17499
|
}
|
|
17500
|
+
var stay2 = () => {
|
|
17501
|
+
};
|
|
17502
|
+
function LoginFlow() {
|
|
17503
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LoginModal, { inline: true, onClose: stay2 });
|
|
17504
|
+
}
|
|
17450
17505
|
|
|
17451
17506
|
exports.BridgeModal = BridgeModal;
|
|
17452
17507
|
exports.BridgeModalTemplate = BridgeModalTemplate;
|
|
@@ -17465,6 +17520,7 @@ exports.KycFlow = KycFlow;
|
|
|
17465
17520
|
exports.KycModal = KycModal;
|
|
17466
17521
|
exports.KycModalTemplate = KycModalTemplate;
|
|
17467
17522
|
exports.KycStatus = KycStatus;
|
|
17523
|
+
exports.LoginFlow = LoginFlow;
|
|
17468
17524
|
exports.LoginModalTemplate = LoginModalTemplate;
|
|
17469
17525
|
exports.PollarProvider = PollarProvider;
|
|
17470
17526
|
exports.ProviderRegistrationModal = ProviderRegistrationModal;
|