@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.js
CHANGED
|
@@ -328,6 +328,22 @@ async function reportActionCompletion(apiBaseUrl, actionId, result) {
|
|
|
328
328
|
return await res.json();
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
// src/sentry.ts
|
|
332
|
+
var _mod;
|
|
333
|
+
function captureException(error) {
|
|
334
|
+
if (_mod === null) return;
|
|
335
|
+
if (_mod) {
|
|
336
|
+
_mod.captureException(error);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
import('@sentry/react').then((m) => {
|
|
340
|
+
_mod = m;
|
|
341
|
+
m.captureException(error);
|
|
342
|
+
}).catch(() => {
|
|
343
|
+
_mod = null;
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
331
347
|
// node_modules/@wagmi/core/dist/esm/version.js
|
|
332
348
|
var version = "2.22.1";
|
|
333
349
|
|
|
@@ -696,6 +712,7 @@ function isSafari() {
|
|
|
696
712
|
}
|
|
697
713
|
var POPUP_RESULT_TIMEOUT_MS = 12e4;
|
|
698
714
|
var POPUP_CLOSED_POLL_MS = 500;
|
|
715
|
+
var POPUP_CLOSED_GRACE_MS = 1e3;
|
|
699
716
|
function createPasskeyViaPopup(options) {
|
|
700
717
|
return new Promise((resolve, reject) => {
|
|
701
718
|
const channelId = `swype-pk-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -713,10 +730,16 @@ function createPasskeyViaPopup(options) {
|
|
|
713
730
|
cleanup();
|
|
714
731
|
reject(new Error("Passkey creation timed out. Please try again."));
|
|
715
732
|
}, POPUP_RESULT_TIMEOUT_MS);
|
|
733
|
+
let closedGraceTimer = null;
|
|
716
734
|
const closedPoll = setInterval(() => {
|
|
717
735
|
if (popup.closed) {
|
|
718
|
-
|
|
719
|
-
|
|
736
|
+
clearInterval(closedPoll);
|
|
737
|
+
closedGraceTimer = setTimeout(() => {
|
|
738
|
+
if (!settled) {
|
|
739
|
+
cleanup();
|
|
740
|
+
reject(new Error("Passkey setup window was closed before completing."));
|
|
741
|
+
}
|
|
742
|
+
}, POPUP_CLOSED_GRACE_MS);
|
|
720
743
|
}
|
|
721
744
|
}, POPUP_CLOSED_POLL_MS);
|
|
722
745
|
function handleResult(data) {
|
|
@@ -744,6 +767,7 @@ function createPasskeyViaPopup(options) {
|
|
|
744
767
|
function cleanup() {
|
|
745
768
|
clearTimeout(timer);
|
|
746
769
|
clearInterval(closedPoll);
|
|
770
|
+
if (closedGraceTimer) clearTimeout(closedGraceTimer);
|
|
747
771
|
window.removeEventListener("message", postMessageHandler);
|
|
748
772
|
channel?.close();
|
|
749
773
|
}
|
|
@@ -4355,8 +4379,8 @@ var PaymentErrorBoundary = class extends Component {
|
|
|
4355
4379
|
static getDerivedStateFromError() {
|
|
4356
4380
|
return { hasError: true };
|
|
4357
4381
|
}
|
|
4358
|
-
componentDidCatch(error,
|
|
4359
|
-
|
|
4382
|
+
componentDidCatch(error, _info) {
|
|
4383
|
+
captureException(error);
|
|
4360
4384
|
}
|
|
4361
4385
|
handleReset = () => {
|
|
4362
4386
|
this.setState({ hasError: false });
|
|
@@ -4674,6 +4698,7 @@ function SwypePaymentInner({
|
|
|
4674
4698
|
try {
|
|
4675
4699
|
await initOAuth({ provider });
|
|
4676
4700
|
} catch (err) {
|
|
4701
|
+
captureException(err);
|
|
4677
4702
|
setError(err instanceof Error ? err.message : "Social login failed");
|
|
4678
4703
|
}
|
|
4679
4704
|
}, [initOAuth]);
|
|
@@ -4700,6 +4725,7 @@ function SwypePaymentInner({
|
|
|
4700
4725
|
setVerificationTarget(normalizedIdentifier);
|
|
4701
4726
|
setStep("otp-verify");
|
|
4702
4727
|
} catch (err) {
|
|
4728
|
+
captureException(err);
|
|
4703
4729
|
setError(err instanceof Error ? err.message : "Failed to send verification code");
|
|
4704
4730
|
}
|
|
4705
4731
|
}, [authInput, sendEmailCode, sendSmsCode]);
|
|
@@ -4718,6 +4744,7 @@ function SwypePaymentInner({
|
|
|
4718
4744
|
await loginWithSmsCode({ code: trimmedCode });
|
|
4719
4745
|
}
|
|
4720
4746
|
} catch (err) {
|
|
4747
|
+
captureException(err);
|
|
4721
4748
|
setError(err instanceof Error ? err.message : "Failed to verify code");
|
|
4722
4749
|
}
|
|
4723
4750
|
}, [verificationTarget, otpCode, loginWithEmailCode, loginWithSmsCode]);
|
|
@@ -4736,6 +4763,7 @@ function SwypePaymentInner({
|
|
|
4736
4763
|
await sendSmsCode({ phoneNumber: verificationTarget.value });
|
|
4737
4764
|
}
|
|
4738
4765
|
} catch (err) {
|
|
4766
|
+
captureException(err);
|
|
4739
4767
|
setError(err instanceof Error ? err.message : "Failed to resend code");
|
|
4740
4768
|
}
|
|
4741
4769
|
}, [verificationTarget, sendEmailCode, sendSmsCode]);
|
|
@@ -4950,6 +4978,7 @@ function SwypePaymentInner({
|
|
|
4950
4978
|
}
|
|
4951
4979
|
} catch (err) {
|
|
4952
4980
|
if (!cancelled) {
|
|
4981
|
+
captureException(err);
|
|
4953
4982
|
setError(err instanceof Error ? err.message : "Failed to load data");
|
|
4954
4983
|
}
|
|
4955
4984
|
} finally {
|
|
@@ -4992,6 +5021,7 @@ function SwypePaymentInner({
|
|
|
4992
5021
|
if (!hasProcessingTimedOut(processingStartedAtRef.current, Date.now())) return;
|
|
4993
5022
|
const status = getTransferStatus(polling.transfer, transfer);
|
|
4994
5023
|
const msg = buildProcessingTimeoutMessage(status);
|
|
5024
|
+
captureException(new Error(msg));
|
|
4995
5025
|
polling.stopPolling();
|
|
4996
5026
|
setStep("deposit");
|
|
4997
5027
|
setError(msg);
|
|
@@ -5216,6 +5246,7 @@ function SwypePaymentInner({
|
|
|
5216
5246
|
setTransfer(signedTransfer);
|
|
5217
5247
|
polling.startPolling(t.id);
|
|
5218
5248
|
} catch (err) {
|
|
5249
|
+
captureException(err);
|
|
5219
5250
|
const msg = err instanceof Error ? err.message : "Transfer failed";
|
|
5220
5251
|
setError(msg);
|
|
5221
5252
|
onError?.(msg);
|
|
@@ -5294,6 +5325,7 @@ function SwypePaymentInner({
|
|
|
5294
5325
|
triggerDeeplink(uri);
|
|
5295
5326
|
}
|
|
5296
5327
|
} catch (err) {
|
|
5328
|
+
captureException(err);
|
|
5297
5329
|
const msg = err instanceof Error ? err.message : "Failed to increase limit";
|
|
5298
5330
|
setError(msg);
|
|
5299
5331
|
onError?.(msg);
|
|
@@ -5348,6 +5380,7 @@ function SwypePaymentInner({
|
|
|
5348
5380
|
if (err instanceof PasskeyIframeBlockedError) {
|
|
5349
5381
|
setPasskeyPopupNeeded(true);
|
|
5350
5382
|
} else {
|
|
5383
|
+
captureException(err);
|
|
5351
5384
|
setError(err instanceof Error ? err.message : "Failed to register passkey");
|
|
5352
5385
|
}
|
|
5353
5386
|
} finally {
|
|
@@ -5366,6 +5399,7 @@ function SwypePaymentInner({
|
|
|
5366
5399
|
const { credentialId, publicKey } = await createPasskeyViaPopup(popupOptions);
|
|
5367
5400
|
await completePasskeyRegistration(credentialId, publicKey);
|
|
5368
5401
|
} catch (err) {
|
|
5402
|
+
captureException(err);
|
|
5369
5403
|
setError(err instanceof Error ? err.message : "Failed to register passkey");
|
|
5370
5404
|
} finally {
|
|
5371
5405
|
setRegisteringPasskey(false);
|
|
@@ -5453,6 +5487,7 @@ function SwypePaymentInner({
|
|
|
5453
5487
|
setStep("processing");
|
|
5454
5488
|
polling.startPolling(t.id);
|
|
5455
5489
|
} catch (err) {
|
|
5490
|
+
captureException(err);
|
|
5456
5491
|
const msg = err instanceof Error ? err.message : "Failed to sign transfer";
|
|
5457
5492
|
setError(msg);
|
|
5458
5493
|
onError?.(msg);
|