@pollar/react 0.12.1-rc.19 → 0.12.1-rc.22
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.css +41 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +76 -52
- package/dist/index.d.ts +76 -52
- package/dist/index.js +144 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +145 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, rampRailLabel, describeRampAction, rampStepTitle, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampNoRouteText, rampFieldError, rampFieldValid, rampLegNote, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
|
|
2
|
+
import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, rampRailLabel, describeRampAction, rampStepTitle, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampNoRouteText, rampFieldError, rampFieldValid, rampFailureReason, rampLegNote, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampFailureNeedsSupport, rampSupportCopy, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, isKycSettled, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
|
|
3
3
|
import { createContext, forwardRef, useState, useCallback, useEffect, useMemo, useRef, useContext, useSyncExternalStore, useId, useLayoutEffect, Component } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
@@ -1309,7 +1309,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
|
|
|
1309
1309
|
/* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
|
|
1310
1310
|
/* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
|
|
1311
1311
|
"v",
|
|
1312
|
-
"0.12.1-rc.
|
|
1312
|
+
"0.12.1-rc.22"
|
|
1313
1313
|
] })
|
|
1314
1314
|
] });
|
|
1315
1315
|
};
|
|
@@ -3710,7 +3710,7 @@ var KYC_COPY = {
|
|
|
3710
3710
|
formHere: "The identity verification form will appear here.",
|
|
3711
3711
|
opensHere: "Identity verification will open here.",
|
|
3712
3712
|
opensInBrowser: "Verification opens in your browser. Finish the steps there, then come back here to check your status.",
|
|
3713
|
-
finished: "
|
|
3713
|
+
finished: "This moves on by itself when the verification finishes. Done already? Check your status.",
|
|
3714
3714
|
checkStatus: "Check status",
|
|
3715
3715
|
checking: "Checking verification status\u2026",
|
|
3716
3716
|
approved: "Approved",
|
|
@@ -3775,7 +3775,7 @@ var KYC_COPY = {
|
|
|
3775
3775
|
formHere: "El formulario de verificaci\xF3n de identidad aparecer\xE1 aqu\xED.",
|
|
3776
3776
|
opensHere: "La verificaci\xF3n de identidad se abrir\xE1 aqu\xED.",
|
|
3777
3777
|
opensInBrowser: "La verificaci\xF3n se abre en tu navegador. Termina los pasos all\xED y luego vuelve aqu\xED para consultar tu estado.",
|
|
3778
|
-
finished: "\
|
|
3778
|
+
finished: "Esto avanza solo cuando termine la verificaci\xF3n. \xBFYa terminaste? Consulta tu estado.",
|
|
3779
3779
|
checkStatus: "Consultar estado",
|
|
3780
3780
|
checking: "Consultando el estado de la verificaci\xF3n\u2026",
|
|
3781
3781
|
approved: "Aprobado",
|
|
@@ -3840,7 +3840,7 @@ var KYC_COPY = {
|
|
|
3840
3840
|
formHere: "O formul\xE1rio de verifica\xE7\xE3o de identidade vai aparecer aqui.",
|
|
3841
3841
|
opensHere: "A verifica\xE7\xE3o de identidade vai abrir aqui.",
|
|
3842
3842
|
opensInBrowser: "A verifica\xE7\xE3o abre no seu navegador. Conclua as etapas l\xE1 e depois volte aqui para consultar seu status.",
|
|
3843
|
-
finished: "
|
|
3843
|
+
finished: "Isto avan\xE7a sozinho quando a verifica\xE7\xE3o terminar. J\xE1 concluiu? Consulte seu status.",
|
|
3844
3844
|
checkStatus: "Consultar status",
|
|
3845
3845
|
checking: "Consultando o status da verifica\xE7\xE3o\u2026",
|
|
3846
3846
|
approved: "Aprovada",
|
|
@@ -3915,7 +3915,8 @@ function KycModalTemplate({
|
|
|
3915
3915
|
onStartAgain,
|
|
3916
3916
|
onRefresh,
|
|
3917
3917
|
onClose,
|
|
3918
|
-
language = deviceLanguage()
|
|
3918
|
+
language = deviceLanguage(),
|
|
3919
|
+
inline = false
|
|
3919
3920
|
}) {
|
|
3920
3921
|
const copy = KYC_COPY[language];
|
|
3921
3922
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
|
|
@@ -3923,9 +3924,9 @@ function KycModalTemplate({
|
|
|
3923
3924
|
return /* @__PURE__ */ jsxs(
|
|
3924
3925
|
"div",
|
|
3925
3926
|
{
|
|
3926
|
-
className: `pollar-modal-card pollar-kyc-modal ${step === "verifying" ? "pollar-kyc-modal--verifying" : ""}`,
|
|
3927
|
-
role: "dialog",
|
|
3928
|
-
"aria-modal":
|
|
3927
|
+
className: `pollar-modal-card pollar-kyc-modal ${step === "verifying" ? "pollar-kyc-modal--verifying" : ""} ${inline ? "pollar-modal-card--inline" : ""}`,
|
|
3928
|
+
role: inline ? "region" : "dialog",
|
|
3929
|
+
"aria-modal": inline ? void 0 : true,
|
|
3929
3930
|
"aria-label": copy.title,
|
|
3930
3931
|
style: cssVars,
|
|
3931
3932
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -3973,7 +3974,7 @@ function KycModalTemplate({
|
|
|
3973
3974
|
)
|
|
3974
3975
|
}
|
|
3975
3976
|
),
|
|
3976
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
3977
|
+
!inline && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
3977
3978
|
] })
|
|
3978
3979
|
] }),
|
|
3979
3980
|
error && /* @__PURE__ */ jsx("p", { className: "pollar-kyc-error", role: "alert", children: error }),
|
|
@@ -4019,7 +4020,7 @@ function KycModalTemplate({
|
|
|
4019
4020
|
/* @__PURE__ */ jsxs("div", { className: "pollar-kyc-footer", children: [
|
|
4020
4021
|
/* @__PURE__ */ jsx("p", { children: copy.finished }),
|
|
4021
4022
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
|
|
4022
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: copy.close }),
|
|
4023
|
+
!inline && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: copy.close }),
|
|
4023
4024
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onDoneVerifying, children: copy.checkStatus })
|
|
4024
4025
|
] })
|
|
4025
4026
|
] })
|
|
@@ -4051,7 +4052,7 @@ function KycModalTemplate({
|
|
|
4051
4052
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
|
|
4052
4053
|
kycStatus === "expired" && onStartAgain && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onStartAgain, disabled: busy, children: copy.startAgain }),
|
|
4053
4054
|
kycStatus !== "approved" && kycStatus !== "rejected" && kycStatus !== "expired" && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onDoneVerifying, children: copy.checkAgain }),
|
|
4054
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: copy.close })
|
|
4055
|
+
!inline && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: copy.close })
|
|
4055
4056
|
] })
|
|
4056
4057
|
] }),
|
|
4057
4058
|
/* @__PURE__ */ jsx(PollarModalFooter, { language })
|
|
@@ -4059,6 +4060,17 @@ function KycModalTemplate({
|
|
|
4059
4060
|
}
|
|
4060
4061
|
);
|
|
4061
4062
|
}
|
|
4063
|
+
function ModalFrame({
|
|
4064
|
+
inline,
|
|
4065
|
+
overlayStyle,
|
|
4066
|
+
onClose,
|
|
4067
|
+
children
|
|
4068
|
+
}) {
|
|
4069
|
+
if (inline) return /* @__PURE__ */ jsx("div", { className: "pollar-inline-frame", children });
|
|
4070
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { ...overlayStyle && { style: overlayStyle }, onClick: onClose, children });
|
|
4071
|
+
}
|
|
4072
|
+
var WATCH_INTERVAL_MS = 4e3;
|
|
4073
|
+
var WATCH_WINDOW_MS = 30 * 6e4;
|
|
4062
4074
|
function newIdempotencyKey() {
|
|
4063
4075
|
const c = globalThis.crypto;
|
|
4064
4076
|
if (c && typeof c.randomUUID === "function") return c.randomUUID();
|
|
@@ -4072,7 +4084,8 @@ function KycModal({
|
|
|
4072
4084
|
corridorId,
|
|
4073
4085
|
cardProviderId,
|
|
4074
4086
|
providerId,
|
|
4075
|
-
language: languageProp
|
|
4087
|
+
language: languageProp,
|
|
4088
|
+
inline = false
|
|
4076
4089
|
}) {
|
|
4077
4090
|
const { getClient, styles } = usePollar();
|
|
4078
4091
|
const language = useModalLanguage(languageProp);
|
|
@@ -4180,6 +4193,30 @@ function KycModal({
|
|
|
4180
4193
|
void handleSelectProvider({ id: providerId, name: copy.title, flow: "iframe", levels: [level] }, false);
|
|
4181
4194
|
});
|
|
4182
4195
|
}, [loadProviders, providerId]);
|
|
4196
|
+
const finishRef = useRef(finishWith);
|
|
4197
|
+
finishRef.current = finishWith;
|
|
4198
|
+
useEffect(() => {
|
|
4199
|
+
if (step !== "verifying" || !selectedProvider) return;
|
|
4200
|
+
const optionId = selectedProvider.id;
|
|
4201
|
+
const until = Date.now() + WATCH_WINDOW_MS;
|
|
4202
|
+
let stopped = false;
|
|
4203
|
+
let timer;
|
|
4204
|
+
const tick = async () => {
|
|
4205
|
+
if (stopped || Date.now() > until) return;
|
|
4206
|
+
const read = await readStatus(optionId).catch(() => null);
|
|
4207
|
+
if (stopped) return;
|
|
4208
|
+
if (read && isKycSettled(read)) {
|
|
4209
|
+
finishRef.current(read);
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
timer = setTimeout(() => void tick(), WATCH_INTERVAL_MS);
|
|
4213
|
+
};
|
|
4214
|
+
timer = setTimeout(() => void tick(), WATCH_INTERVAL_MS);
|
|
4215
|
+
return () => {
|
|
4216
|
+
stopped = true;
|
|
4217
|
+
if (timer) clearTimeout(timer);
|
|
4218
|
+
};
|
|
4219
|
+
}, [step, selectedProvider]);
|
|
4183
4220
|
async function handleDoneVerifying() {
|
|
4184
4221
|
if (!selectedProvider) return;
|
|
4185
4222
|
setError(null);
|
|
@@ -4206,7 +4243,7 @@ function KycModal({
|
|
|
4206
4243
|
if (selectedProvider) void handleSelectProvider(selectedProvider);
|
|
4207
4244
|
else setStep("select_provider");
|
|
4208
4245
|
}
|
|
4209
|
-
return /* @__PURE__ */ jsx(
|
|
4246
|
+
return /* @__PURE__ */ jsx(ModalFrame, { inline, overlayStyle, onClose, children: /* @__PURE__ */ jsx(
|
|
4210
4247
|
KycModalTemplate,
|
|
4211
4248
|
{
|
|
4212
4249
|
theme,
|
|
@@ -4228,7 +4265,8 @@ function KycModal({
|
|
|
4228
4265
|
onStartAgain: handleStartAgain,
|
|
4229
4266
|
onRefresh: () => void loadProviders(),
|
|
4230
4267
|
onClose,
|
|
4231
|
-
language
|
|
4268
|
+
language,
|
|
4269
|
+
inline
|
|
4232
4270
|
}
|
|
4233
4271
|
) });
|
|
4234
4272
|
}
|
|
@@ -4309,7 +4347,8 @@ function RequirementFormModal({
|
|
|
4309
4347
|
progress,
|
|
4310
4348
|
onClose,
|
|
4311
4349
|
onSubmitted,
|
|
4312
|
-
language: languageProp
|
|
4350
|
+
language: languageProp,
|
|
4351
|
+
inline = false
|
|
4313
4352
|
}) {
|
|
4314
4353
|
const { getClient, styles } = usePollar();
|
|
4315
4354
|
const client = getClient();
|
|
@@ -4375,12 +4414,12 @@ function RequirementFormModal({
|
|
|
4375
4414
|
if (mounted.current) setSubmitting(false);
|
|
4376
4415
|
}
|
|
4377
4416
|
}
|
|
4378
|
-
return /* @__PURE__ */ jsx(
|
|
4417
|
+
return /* @__PURE__ */ jsx(ModalFrame, { inline, overlayStyle, onClose, children: /* @__PURE__ */ jsxs(
|
|
4379
4418
|
"div",
|
|
4380
4419
|
{
|
|
4381
|
-
className:
|
|
4382
|
-
role: "dialog",
|
|
4383
|
-
"aria-modal":
|
|
4420
|
+
className: `pollar-modal-card pollar-form-modal ${inline ? "pollar-modal-card--inline" : ""}`,
|
|
4421
|
+
role: inline ? "region" : "dialog",
|
|
4422
|
+
"aria-modal": inline ? void 0 : true,
|
|
4384
4423
|
"aria-label": form?.name ?? copy.title,
|
|
4385
4424
|
style: cssVars,
|
|
4386
4425
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -4390,7 +4429,7 @@ function RequirementFormModal({
|
|
|
4390
4429
|
/* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: form?.name ?? copy.title }),
|
|
4391
4430
|
progress && /* @__PURE__ */ jsx("p", { className: "pollar-form-subtitle", children: copy.step.replace("{n}", String(progress.position)).replace("{total}", String(progress.total)) })
|
|
4392
4431
|
] }),
|
|
4393
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
4432
|
+
!inline && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
4394
4433
|
] }),
|
|
4395
4434
|
error && /* @__PURE__ */ jsx("p", { className: "pollar-form-error", role: "alert", children: error }),
|
|
4396
4435
|
!form && !error && /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
|
|
@@ -4449,7 +4488,7 @@ function RequirementFormModal({
|
|
|
4449
4488
|
] }, field.key);
|
|
4450
4489
|
}),
|
|
4451
4490
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
|
|
4452
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, disabled: submitting, children: copy.close }),
|
|
4491
|
+
!inline && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, disabled: submitting, children: copy.close }),
|
|
4453
4492
|
/* @__PURE__ */ jsx("button", { type: "submit", className: "pollar-btn-primary", disabled: submitting, children: submitting ? copy.submitting : copy.submit })
|
|
4454
4493
|
] })
|
|
4455
4494
|
]
|
|
@@ -4460,7 +4499,7 @@ function RequirementFormModal({
|
|
|
4460
4499
|
}
|
|
4461
4500
|
) });
|
|
4462
4501
|
}
|
|
4463
|
-
function AppKycFlow({ onClose, country, level, onApproved }) {
|
|
4502
|
+
function AppKycFlow({ onClose, country, level, onApproved, inline = false }) {
|
|
4464
4503
|
const { getClient } = usePollar();
|
|
4465
4504
|
const client = getClient();
|
|
4466
4505
|
const [state, setState] = useState({ kind: "loading" });
|
|
@@ -4496,6 +4535,7 @@ function AppKycFlow({ onClose, country, level, onApproved }) {
|
|
|
4496
4535
|
firstRead.current = false;
|
|
4497
4536
|
if (requirements.next) return setState({ kind: "step", step: requirements.next });
|
|
4498
4537
|
onApproved?.();
|
|
4538
|
+
if (inline) return setState({ kind: "complete" });
|
|
4499
4539
|
const providerId = first ? await approvedOption(requirements.steps) : null;
|
|
4500
4540
|
if (!mounted.current) return;
|
|
4501
4541
|
if (providerId) setState({ kind: "done", providerId });
|
|
@@ -4509,12 +4549,13 @@ function AppKycFlow({ onClose, country, level, onApproved }) {
|
|
|
4509
4549
|
useEffect(() => {
|
|
4510
4550
|
void load();
|
|
4511
4551
|
}, [load]);
|
|
4512
|
-
if (state.kind === "loading") return null;
|
|
4552
|
+
if (state.kind === "loading" || state.kind === "complete") return null;
|
|
4513
4553
|
if (state.kind === "options") {
|
|
4514
4554
|
return /* @__PURE__ */ jsx(
|
|
4515
4555
|
KycModal,
|
|
4516
4556
|
{
|
|
4517
4557
|
onClose,
|
|
4558
|
+
inline,
|
|
4518
4559
|
...country !== void 0 && { country },
|
|
4519
4560
|
...level !== void 0 && { level },
|
|
4520
4561
|
...onApproved !== void 0 && { onApproved }
|
|
@@ -4522,7 +4563,7 @@ function AppKycFlow({ onClose, country, level, onApproved }) {
|
|
|
4522
4563
|
);
|
|
4523
4564
|
}
|
|
4524
4565
|
if (state.kind === "done") {
|
|
4525
|
-
return /* @__PURE__ */ jsx(KycModal, { onClose, providerId: state.providerId, ...country !== void 0 && { country } });
|
|
4566
|
+
return /* @__PURE__ */ jsx(KycModal, { onClose, inline, providerId: state.providerId, ...country !== void 0 && { country } });
|
|
4526
4567
|
}
|
|
4527
4568
|
const { step } = state;
|
|
4528
4569
|
const progress = { position: step.completed + 1, total: step.total };
|
|
@@ -4532,6 +4573,7 @@ function AppKycFlow({ onClose, country, level, onApproved }) {
|
|
|
4532
4573
|
{
|
|
4533
4574
|
formId: step.optionId,
|
|
4534
4575
|
progress,
|
|
4576
|
+
inline,
|
|
4535
4577
|
onClose,
|
|
4536
4578
|
onSubmitted: () => void load()
|
|
4537
4579
|
},
|
|
@@ -4542,10 +4584,12 @@ function AppKycFlow({ onClose, country, level, onApproved }) {
|
|
|
4542
4584
|
KycModal,
|
|
4543
4585
|
{
|
|
4544
4586
|
providerId: step.optionId,
|
|
4587
|
+
inline,
|
|
4545
4588
|
...country !== void 0 && { country },
|
|
4546
4589
|
...level !== void 0 && { level },
|
|
4547
4590
|
onApproved: () => {
|
|
4548
4591
|
kycStepDone.current = true;
|
|
4592
|
+
if (inline) void load();
|
|
4549
4593
|
},
|
|
4550
4594
|
onClose: () => {
|
|
4551
4595
|
if (kycStepDone.current) void load();
|
|
@@ -6084,6 +6128,7 @@ function RampWidgetTemplate({
|
|
|
6084
6128
|
onRequote,
|
|
6085
6129
|
onSetUpRecovery,
|
|
6086
6130
|
recoveryMissing = null,
|
|
6131
|
+
support = null,
|
|
6087
6132
|
checkingPayment = false,
|
|
6088
6133
|
onCheckPayment,
|
|
6089
6134
|
pollTrouble = false,
|
|
@@ -6565,7 +6610,7 @@ function RampWidgetTemplate({
|
|
|
6565
6610
|
step === "status" && order && view && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment", children: [
|
|
6566
6611
|
/* @__PURE__ */ jsx("ol", { className: "pollar-ramp-legs", "aria-label": copy.progress, children: order.legs.map((leg) => {
|
|
6567
6612
|
const status = rampLegStatus(leg);
|
|
6568
|
-
const note = rampLegNote(leg, language);
|
|
6613
|
+
const note = (status === "failed" && leg.failure ? rampFailureReason(leg.failure, language) : null) ?? rampLegNote(leg, language);
|
|
6569
6614
|
return /* @__PURE__ */ jsxs("li", { className: "pollar-ramp-leg", "data-status": status, children: [
|
|
6570
6615
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-dot", "aria-hidden": true }),
|
|
6571
6616
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-title", children: rampLegTitle(leg, language) }),
|
|
@@ -6596,6 +6641,7 @@ function RampWidgetTemplate({
|
|
|
6596
6641
|
order.failure && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
6597
6642
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: copy.whatToDo }),
|
|
6598
6643
|
/* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: rampOrderResolutionText(order, language) }),
|
|
6644
|
+
rampFailureNeedsSupport(order.failure) && /* @__PURE__ */ jsx(SupportContact, { support, orderId: order.id, language }),
|
|
6599
6645
|
stopped && !settled && waitsOnRecovery && recoveryMissing !== false && onSetUpRecovery && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onSetUpRecovery, children: copy.setUpRecovery }),
|
|
6600
6646
|
stopped && !settled && waitsOnRecovery && recoveryMissing === true && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.recoveryNote }),
|
|
6601
6647
|
stopped && !settled && asksNewQuote && onRequote && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRequote, children: copy.newQuote }),
|
|
@@ -6699,6 +6745,26 @@ function RampWidgetTemplate({
|
|
|
6699
6745
|
/* @__PURE__ */ jsx(PollarModalFooter, {})
|
|
6700
6746
|
] });
|
|
6701
6747
|
}
|
|
6748
|
+
function SupportContact({
|
|
6749
|
+
support,
|
|
6750
|
+
orderId,
|
|
6751
|
+
language
|
|
6752
|
+
}) {
|
|
6753
|
+
const copy = rampSupportCopy(language);
|
|
6754
|
+
const url = support?.url && /^https:\/\//i.test(support.url) ? support.url : null;
|
|
6755
|
+
const email = support?.email && /^[^\s@]+@[^\s@]+$/.test(support.email) ? support.email : null;
|
|
6756
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-support", children: [
|
|
6757
|
+
(url || email) && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-support-links", children: [
|
|
6758
|
+
url && /* @__PURE__ */ jsx("a", { className: "pollar-btn-secondary", href: url, target: "_blank", rel: "noopener noreferrer", children: copy.action }),
|
|
6759
|
+
email && /* @__PURE__ */ jsx("a", { className: "pollar-ramp-support-email", href: `mailto:${email}?subject=${encodeURIComponent(orderId)}`, children: email })
|
|
6760
|
+
] }),
|
|
6761
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-ramp-support-order", children: [
|
|
6762
|
+
/* @__PURE__ */ jsx("span", { children: copy.orderId }),
|
|
6763
|
+
/* @__PURE__ */ jsx("code", { children: orderId }),
|
|
6764
|
+
/* @__PURE__ */ jsx(CopyButton, { value: orderId, language })
|
|
6765
|
+
] })
|
|
6766
|
+
] });
|
|
6767
|
+
}
|
|
6702
6768
|
|
|
6703
6769
|
// src/components/registry-check-modal/registry-copy.ts
|
|
6704
6770
|
var REGISTRY_COPY = {
|
|
@@ -7950,6 +8016,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
|
|
|
7950
8016
|
onRequote: () => void handleRequote(),
|
|
7951
8017
|
onSetUpRecovery: openRecoveryModal,
|
|
7952
8018
|
recoveryMissing: recovery === null ? null : recoveryLocked,
|
|
8019
|
+
support: client.getSupportContact(),
|
|
7953
8020
|
pollTrouble,
|
|
7954
8021
|
checkingPayment: paymentCheckUntil !== null,
|
|
7955
8022
|
onCheckPayment: () => void handleCheckPayment(),
|
|
@@ -9719,6 +9786,7 @@ function SwapModalTemplate({
|
|
|
9719
9786
|
usdcAcross = false,
|
|
9720
9787
|
settlement = null,
|
|
9721
9788
|
confirmation = null,
|
|
9789
|
+
review = null,
|
|
9722
9790
|
network,
|
|
9723
9791
|
provider,
|
|
9724
9792
|
providers,
|
|
@@ -9771,7 +9839,7 @@ function SwapModalTemplate({
|
|
|
9771
9839
|
}
|
|
9772
9840
|
] : []
|
|
9773
9841
|
] : [];
|
|
9774
|
-
const txReview = step === "tx" ? txStatusReview({ transaction, explorerUrl, confirmation, network, extraRows: settlementRows, language }) : null;
|
|
9842
|
+
const txReview = step === "tx" ? txStatusReview({ transaction, review, explorerUrl, confirmation, network, extraRows: settlementRows, language }) : null;
|
|
9775
9843
|
const [customOpen, setCustomOpen] = useState(false);
|
|
9776
9844
|
const [customCode, setCustomCode] = useState("");
|
|
9777
9845
|
const [customIssuer, setCustomIssuer] = useState("");
|
|
@@ -10113,6 +10181,7 @@ function SwapModalTemplate({
|
|
|
10113
10181
|
onRetry,
|
|
10114
10182
|
onDone,
|
|
10115
10183
|
confirmation,
|
|
10184
|
+
review,
|
|
10116
10185
|
network,
|
|
10117
10186
|
extraRows: settlementRows,
|
|
10118
10187
|
...settlement ? { outcomeNote: { text: settlement.text, failed: settlement.kind === "failed" } } : {}
|
|
@@ -10212,6 +10281,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10212
10281
|
const [formError, setFormError] = useState("");
|
|
10213
10282
|
const [showXdr, setShowXdr] = useState(false);
|
|
10214
10283
|
const [copied, setCopied] = useState(false);
|
|
10284
|
+
const [sentSolana, setSentSolana] = useState(null);
|
|
10215
10285
|
const copyTimerRef = useRef(null);
|
|
10216
10286
|
const slippageBps = 50;
|
|
10217
10287
|
useEffect(() => {
|
|
@@ -10533,6 +10603,34 @@ function SwapModal({ onClose, initial }) {
|
|
|
10533
10603
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
10534
10604
|
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
|
|
10535
10605
|
const explorerUrl = !hash ? null : chain === "SOLANA" ? `https://solscan.io/tx/${hash}${network === "testnet" ? "?cluster=devnet" : ""}` : `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}`;
|
|
10606
|
+
const solanaReview = useMemo(() => {
|
|
10607
|
+
if (!sentSolana) return null;
|
|
10608
|
+
const { quote: sent, sell, buy } = sentSolana;
|
|
10609
|
+
const toward = sent.destinationChain && sent.destinationChain !== "SOLANA" ? sent.destinationChain : void 0;
|
|
10610
|
+
return reviewFromRequest(
|
|
10611
|
+
{
|
|
10612
|
+
chain: "SOLANA",
|
|
10613
|
+
network,
|
|
10614
|
+
operation: "swap",
|
|
10615
|
+
details: {
|
|
10616
|
+
provider: sent.provider,
|
|
10617
|
+
inputMint: sent.inputMint,
|
|
10618
|
+
outputMint: sent.outputMint,
|
|
10619
|
+
inAmount: sent.inAmount,
|
|
10620
|
+
outAmount: sent.outAmount,
|
|
10621
|
+
minOut: sent.minOut,
|
|
10622
|
+
...toward && { destinationChain: toward },
|
|
10623
|
+
inputSymbol: sell.code,
|
|
10624
|
+
outputSymbol: buy.code,
|
|
10625
|
+
...sell.decimals !== void 0 && { inputDecimals: sell.decimals },
|
|
10626
|
+
...(sent.outputDecimals ?? buy.decimals) !== void 0 && { outputDecimals: sent.outputDecimals ?? buy.decimals }
|
|
10627
|
+
},
|
|
10628
|
+
fallbackTitle: CONFIRM_COPY[language].operations.swap ?? copy.title
|
|
10629
|
+
},
|
|
10630
|
+
TX_REVIEW_COPY[language]
|
|
10631
|
+
);
|
|
10632
|
+
}, [sentSolana, network, language, copy.title]);
|
|
10633
|
+
const stepReview = solanaReview && !buildData && !confirmation ? solanaReview : null;
|
|
10536
10634
|
const settlementView = (() => {
|
|
10537
10635
|
if (!settlement || transaction.step !== "success") return null;
|
|
10538
10636
|
const chainName = settlement.chain === "POLYGON" ? "Polygon" : "Solana";
|
|
@@ -10585,6 +10683,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10585
10683
|
const key = newSwapKey();
|
|
10586
10684
|
const toward = solanaQuote.destinationChain;
|
|
10587
10685
|
setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
|
|
10686
|
+
setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
|
|
10588
10687
|
setStep("tx");
|
|
10589
10688
|
await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
|
|
10590
10689
|
return;
|
|
@@ -10593,6 +10692,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10593
10692
|
setFormError(copy.noRouteForPair);
|
|
10594
10693
|
return;
|
|
10595
10694
|
}
|
|
10695
|
+
setSentSolana(null);
|
|
10596
10696
|
setStep("tx");
|
|
10597
10697
|
await swap(quote);
|
|
10598
10698
|
}
|
|
@@ -10603,6 +10703,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10603
10703
|
const key = newSwapKey();
|
|
10604
10704
|
const toward = solanaQuote.destinationChain;
|
|
10605
10705
|
setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
|
|
10706
|
+
if (selectedSell && selectedBuy) setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
|
|
10606
10707
|
await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
|
|
10607
10708
|
return;
|
|
10608
10709
|
}
|
|
@@ -10632,6 +10733,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10632
10733
|
}
|
|
10633
10734
|
function handleBack() {
|
|
10634
10735
|
setSettlement(null);
|
|
10736
|
+
setSentSolana(null);
|
|
10635
10737
|
setStep("form");
|
|
10636
10738
|
setShowXdr(false);
|
|
10637
10739
|
setCopied(false);
|
|
@@ -10656,6 +10758,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10656
10758
|
usdcAcross,
|
|
10657
10759
|
settlement: settlementView,
|
|
10658
10760
|
confirmation,
|
|
10761
|
+
review: stepReview,
|
|
10659
10762
|
network,
|
|
10660
10763
|
provider,
|
|
10661
10764
|
providers,
|
|
@@ -17328,7 +17431,21 @@ function WalletButton() {
|
|
|
17328
17431
|
}
|
|
17329
17432
|
);
|
|
17330
17433
|
}
|
|
17434
|
+
var stay = () => {
|
|
17435
|
+
};
|
|
17436
|
+
function KycFlow({ onApproved, country, level }) {
|
|
17437
|
+
return /* @__PURE__ */ jsx(
|
|
17438
|
+
AppKycFlow,
|
|
17439
|
+
{
|
|
17440
|
+
inline: true,
|
|
17441
|
+
onClose: stay,
|
|
17442
|
+
...onApproved !== void 0 && { onApproved },
|
|
17443
|
+
...country !== void 0 && { country },
|
|
17444
|
+
...level !== void 0 && { level }
|
|
17445
|
+
}
|
|
17446
|
+
);
|
|
17447
|
+
}
|
|
17331
17448
|
|
|
17332
|
-
export { BridgeModal, BridgeModalTemplate, CardModal, ChainSelect, CosignModal, CosignModalTemplate, CustodyMigrationModal, CustodyMigrationModalTemplate, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, ProviderRegistrationModal, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, RecoveryModal, RecoveryModalTemplate, RegistryCheckModal, RejectedRouteDisplay, RequirementFormModal, RouteDisplay, SendModal, SendModalTemplate, SessionsModal, SessionsModalTemplate, SwapModal, SwapModalTemplate, TransactionModalTemplate, TxHistoryModalTemplate, TxStatusView, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, WalletButtonTemplate, addressForChain, browserPasskeyCeremony, browserPasskeySigner, browserRecoveryPasskey, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };
|
|
17449
|
+
export { BridgeModal, BridgeModalTemplate, CardModal, ChainSelect, CosignModal, CosignModalTemplate, CustodyMigrationModal, CustodyMigrationModalTemplate, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, KycFlow, KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, ProviderRegistrationModal, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, RecoveryModal, RecoveryModalTemplate, RegistryCheckModal, RejectedRouteDisplay, RequirementFormModal, RouteDisplay, SendModal, SendModalTemplate, SessionsModal, SessionsModalTemplate, SwapModal, SwapModalTemplate, TransactionModalTemplate, TxHistoryModalTemplate, TxStatusView, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, WalletButtonTemplate, addressForChain, browserPasskeyCeremony, browserPasskeySigner, browserRecoveryPasskey, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };
|
|
17333
17450
|
//# sourceMappingURL=index.mjs.map
|
|
17334
17451
|
//# sourceMappingURL=index.mjs.map
|