@swype-org/react-sdk 0.1.34 → 0.1.35
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 +24 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3780,6 +3780,7 @@ function SwypePayment({
|
|
|
3780
3780
|
const [selectSourceChainName, setSelectSourceChainName] = useState("");
|
|
3781
3781
|
const [selectSourceTokenSymbol, setSelectSourceTokenSymbol] = useState("");
|
|
3782
3782
|
const initializedSelectSourceActionRef = useRef(null);
|
|
3783
|
+
const preSelectSourceStepRef = useRef(null);
|
|
3783
3784
|
const authExecutor = useAuthorizationExecutor();
|
|
3784
3785
|
const polling = useTransferPolling();
|
|
3785
3786
|
const transferSigning = useTransferSigning();
|
|
@@ -3795,7 +3796,7 @@ function SwypePayment({
|
|
|
3795
3796
|
setVerificationTarget(null);
|
|
3796
3797
|
setOtpCode("");
|
|
3797
3798
|
}, []);
|
|
3798
|
-
|
|
3799
|
+
useCallback(async (provider) => {
|
|
3799
3800
|
setError(null);
|
|
3800
3801
|
try {
|
|
3801
3802
|
await initOAuth({ provider });
|
|
@@ -4059,12 +4060,30 @@ function SwypePayment({
|
|
|
4059
4060
|
initializedSelectSourceActionRef.current = pendingSelectSourceAction.id;
|
|
4060
4061
|
}, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
|
|
4061
4062
|
useEffect(() => {
|
|
4062
|
-
if (pendingSelectSourceAction && step === "processing") {
|
|
4063
|
+
if (pendingSelectSourceAction && (step === "processing" || step === "setup-status")) {
|
|
4064
|
+
preSelectSourceStepRef.current = step;
|
|
4063
4065
|
setStep("select-source");
|
|
4064
4066
|
} else if (!pendingSelectSourceAction && step === "select-source") {
|
|
4065
|
-
setStep("processing");
|
|
4067
|
+
setStep(preSelectSourceStepRef.current ?? "processing");
|
|
4068
|
+
preSelectSourceStepRef.current = null;
|
|
4066
4069
|
}
|
|
4067
4070
|
}, [pendingSelectSourceAction, step]);
|
|
4071
|
+
const SETUP_ACTION_LABELS = useMemo(() => ({
|
|
4072
|
+
OPEN_PROVIDER: "Connecting wallet",
|
|
4073
|
+
SELECT_SOURCE: "Selecting source",
|
|
4074
|
+
SWITCH_CHAIN: "Switching network",
|
|
4075
|
+
APPROVE_PERMIT2: "Approving tokens",
|
|
4076
|
+
SIGN_PERMIT2: "Signing permit",
|
|
4077
|
+
DEPLOY_SMART_ACCOUNT: "Setting up account",
|
|
4078
|
+
CREATE_SMART_ACCOUNT: "Creating account"
|
|
4079
|
+
}), []);
|
|
4080
|
+
useEffect(() => {
|
|
4081
|
+
if (step !== "setup-status") return;
|
|
4082
|
+
const actionType = authExecutor.currentAction?.type;
|
|
4083
|
+
if (!actionType) return;
|
|
4084
|
+
const label = SETUP_ACTION_LABELS[actionType];
|
|
4085
|
+
if (label) setSetupStepLabel(label);
|
|
4086
|
+
}, [step, authExecutor.currentAction, SETUP_ACTION_LABELS]);
|
|
4068
4087
|
const handleSelectSourceChainChange = useCallback(
|
|
4069
4088
|
(chainName) => {
|
|
4070
4089
|
setSelectSourceChainName(chainName);
|
|
@@ -4243,7 +4262,7 @@ function SwypePayment({
|
|
|
4243
4262
|
setOneTapLimit(limit);
|
|
4244
4263
|
setStep("setup-status");
|
|
4245
4264
|
setSetupComplete(false);
|
|
4246
|
-
setSetupStepLabel("
|
|
4265
|
+
setSetupStepLabel("Preparing");
|
|
4247
4266
|
setError(null);
|
|
4248
4267
|
try {
|
|
4249
4268
|
const token = await getAccessToken();
|
|
@@ -4354,8 +4373,7 @@ function SwypePayment({
|
|
|
4354
4373
|
sending: activeOtpStatus === "sending-code",
|
|
4355
4374
|
error,
|
|
4356
4375
|
onBack,
|
|
4357
|
-
merchantInitials: merchantName ? merchantName.slice(0, 2).toUpperCase() : void 0
|
|
4358
|
-
onSocialLogin: handleSocialLogin
|
|
4376
|
+
merchantInitials: merchantName ? merchantName.slice(0, 2).toUpperCase() : void 0
|
|
4359
4377
|
}
|
|
4360
4378
|
);
|
|
4361
4379
|
}
|