@swype-org/react-sdk 0.1.81 → 0.1.83
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.cjs +39 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/package.json +10 -3
package/dist/index.cjs
CHANGED
|
@@ -331,6 +331,22 @@ async function reportActionCompletion(apiBaseUrl, actionId, result) {
|
|
|
331
331
|
return await res.json();
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
// src/sentry.ts
|
|
335
|
+
var _mod;
|
|
336
|
+
function captureException(error) {
|
|
337
|
+
if (_mod === null) return;
|
|
338
|
+
if (_mod) {
|
|
339
|
+
_mod.captureException(error);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
import('@sentry/react').then((m) => {
|
|
343
|
+
_mod = m;
|
|
344
|
+
m.captureException(error);
|
|
345
|
+
}).catch(() => {
|
|
346
|
+
_mod = null;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
334
350
|
// node_modules/@wagmi/core/dist/esm/version.js
|
|
335
351
|
var version = "2.22.1";
|
|
336
352
|
|
|
@@ -699,6 +715,7 @@ function isSafari() {
|
|
|
699
715
|
}
|
|
700
716
|
var POPUP_RESULT_TIMEOUT_MS = 12e4;
|
|
701
717
|
var POPUP_CLOSED_POLL_MS = 500;
|
|
718
|
+
var POPUP_CLOSED_GRACE_MS = 1e3;
|
|
702
719
|
function createPasskeyViaPopup(options) {
|
|
703
720
|
return new Promise((resolve, reject) => {
|
|
704
721
|
const channelId = `swype-pk-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -716,10 +733,16 @@ function createPasskeyViaPopup(options) {
|
|
|
716
733
|
cleanup();
|
|
717
734
|
reject(new Error("Passkey creation timed out. Please try again."));
|
|
718
735
|
}, POPUP_RESULT_TIMEOUT_MS);
|
|
736
|
+
let closedGraceTimer = null;
|
|
719
737
|
const closedPoll = setInterval(() => {
|
|
720
738
|
if (popup.closed) {
|
|
721
|
-
|
|
722
|
-
|
|
739
|
+
clearInterval(closedPoll);
|
|
740
|
+
closedGraceTimer = setTimeout(() => {
|
|
741
|
+
if (!settled) {
|
|
742
|
+
cleanup();
|
|
743
|
+
reject(new Error("Passkey setup window was closed before completing."));
|
|
744
|
+
}
|
|
745
|
+
}, POPUP_CLOSED_GRACE_MS);
|
|
723
746
|
}
|
|
724
747
|
}, POPUP_CLOSED_POLL_MS);
|
|
725
748
|
function handleResult(data) {
|
|
@@ -747,6 +770,7 @@ function createPasskeyViaPopup(options) {
|
|
|
747
770
|
function cleanup() {
|
|
748
771
|
clearTimeout(timer);
|
|
749
772
|
clearInterval(closedPoll);
|
|
773
|
+
if (closedGraceTimer) clearTimeout(closedGraceTimer);
|
|
750
774
|
window.removeEventListener("message", postMessageHandler);
|
|
751
775
|
channel?.close();
|
|
752
776
|
}
|
|
@@ -4358,8 +4382,8 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
4358
4382
|
static getDerivedStateFromError() {
|
|
4359
4383
|
return { hasError: true };
|
|
4360
4384
|
}
|
|
4361
|
-
componentDidCatch(error,
|
|
4362
|
-
|
|
4385
|
+
componentDidCatch(error, _info) {
|
|
4386
|
+
captureException(error);
|
|
4363
4387
|
}
|
|
4364
4388
|
handleReset = () => {
|
|
4365
4389
|
this.setState({ hasError: false });
|
|
@@ -4677,6 +4701,7 @@ function SwypePaymentInner({
|
|
|
4677
4701
|
try {
|
|
4678
4702
|
await initOAuth({ provider });
|
|
4679
4703
|
} catch (err) {
|
|
4704
|
+
captureException(err);
|
|
4680
4705
|
setError(err instanceof Error ? err.message : "Social login failed");
|
|
4681
4706
|
}
|
|
4682
4707
|
}, [initOAuth]);
|
|
@@ -4703,6 +4728,7 @@ function SwypePaymentInner({
|
|
|
4703
4728
|
setVerificationTarget(normalizedIdentifier);
|
|
4704
4729
|
setStep("otp-verify");
|
|
4705
4730
|
} catch (err) {
|
|
4731
|
+
captureException(err);
|
|
4706
4732
|
setError(err instanceof Error ? err.message : "Failed to send verification code");
|
|
4707
4733
|
}
|
|
4708
4734
|
}, [authInput, sendEmailCode, sendSmsCode]);
|
|
@@ -4721,6 +4747,7 @@ function SwypePaymentInner({
|
|
|
4721
4747
|
await loginWithSmsCode({ code: trimmedCode });
|
|
4722
4748
|
}
|
|
4723
4749
|
} catch (err) {
|
|
4750
|
+
captureException(err);
|
|
4724
4751
|
setError(err instanceof Error ? err.message : "Failed to verify code");
|
|
4725
4752
|
}
|
|
4726
4753
|
}, [verificationTarget, otpCode, loginWithEmailCode, loginWithSmsCode]);
|
|
@@ -4739,6 +4766,7 @@ function SwypePaymentInner({
|
|
|
4739
4766
|
await sendSmsCode({ phoneNumber: verificationTarget.value });
|
|
4740
4767
|
}
|
|
4741
4768
|
} catch (err) {
|
|
4769
|
+
captureException(err);
|
|
4742
4770
|
setError(err instanceof Error ? err.message : "Failed to resend code");
|
|
4743
4771
|
}
|
|
4744
4772
|
}, [verificationTarget, sendEmailCode, sendSmsCode]);
|
|
@@ -4953,6 +4981,7 @@ function SwypePaymentInner({
|
|
|
4953
4981
|
}
|
|
4954
4982
|
} catch (err) {
|
|
4955
4983
|
if (!cancelled) {
|
|
4984
|
+
captureException(err);
|
|
4956
4985
|
setError(err instanceof Error ? err.message : "Failed to load data");
|
|
4957
4986
|
}
|
|
4958
4987
|
} finally {
|
|
@@ -4995,6 +5024,7 @@ function SwypePaymentInner({
|
|
|
4995
5024
|
if (!hasProcessingTimedOut(processingStartedAtRef.current, Date.now())) return;
|
|
4996
5025
|
const status = getTransferStatus(polling.transfer, transfer);
|
|
4997
5026
|
const msg = buildProcessingTimeoutMessage(status);
|
|
5027
|
+
captureException(new Error(msg));
|
|
4998
5028
|
polling.stopPolling();
|
|
4999
5029
|
setStep("deposit");
|
|
5000
5030
|
setError(msg);
|
|
@@ -5219,6 +5249,7 @@ function SwypePaymentInner({
|
|
|
5219
5249
|
setTransfer(signedTransfer);
|
|
5220
5250
|
polling.startPolling(t.id);
|
|
5221
5251
|
} catch (err) {
|
|
5252
|
+
captureException(err);
|
|
5222
5253
|
const msg = err instanceof Error ? err.message : "Transfer failed";
|
|
5223
5254
|
setError(msg);
|
|
5224
5255
|
onError?.(msg);
|
|
@@ -5297,6 +5328,7 @@ function SwypePaymentInner({
|
|
|
5297
5328
|
triggerDeeplink(uri);
|
|
5298
5329
|
}
|
|
5299
5330
|
} catch (err) {
|
|
5331
|
+
captureException(err);
|
|
5300
5332
|
const msg = err instanceof Error ? err.message : "Failed to increase limit";
|
|
5301
5333
|
setError(msg);
|
|
5302
5334
|
onError?.(msg);
|
|
@@ -5351,6 +5383,7 @@ function SwypePaymentInner({
|
|
|
5351
5383
|
if (err instanceof PasskeyIframeBlockedError) {
|
|
5352
5384
|
setPasskeyPopupNeeded(true);
|
|
5353
5385
|
} else {
|
|
5386
|
+
captureException(err);
|
|
5354
5387
|
setError(err instanceof Error ? err.message : "Failed to register passkey");
|
|
5355
5388
|
}
|
|
5356
5389
|
} finally {
|
|
@@ -5369,6 +5402,7 @@ function SwypePaymentInner({
|
|
|
5369
5402
|
const { credentialId, publicKey } = await createPasskeyViaPopup(popupOptions);
|
|
5370
5403
|
await completePasskeyRegistration(credentialId, publicKey);
|
|
5371
5404
|
} catch (err) {
|
|
5405
|
+
captureException(err);
|
|
5372
5406
|
setError(err instanceof Error ? err.message : "Failed to register passkey");
|
|
5373
5407
|
} finally {
|
|
5374
5408
|
setRegisteringPasskey(false);
|
|
@@ -5456,6 +5490,7 @@ function SwypePaymentInner({
|
|
|
5456
5490
|
setStep("processing");
|
|
5457
5491
|
polling.startPolling(t.id);
|
|
5458
5492
|
} catch (err) {
|
|
5493
|
+
captureException(err);
|
|
5459
5494
|
const msg = err instanceof Error ? err.message : "Failed to sign transfer";
|
|
5460
5495
|
setError(msg);
|
|
5461
5496
|
onError?.(msg);
|