@pradip1995/segment-login-popup 0.1.1 → 0.1.2
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/package.json +2 -2
- package/src/login-popup.tsx +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pradip1995/segment-login-popup",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@pradip1995/commerce-auth": "^4.0.0",
|
|
35
35
|
"@pradip1995/commerce-core": "^4.0.0",
|
|
36
36
|
"@pradip1995/segment-login-template": "^0.5.2",
|
|
37
|
-
"@pradip1995/segment-primitives": "^0.4.
|
|
37
|
+
"@pradip1995/segment-primitives": "^0.4.3",
|
|
38
38
|
"@pradip1995/segment-tokens": "^0.3.7"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
package/src/login-popup.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import Image from "next/image"
|
|
|
5
5
|
import { createPortal } from "react-dom"
|
|
6
6
|
import { useRouter } from "next/navigation"
|
|
7
7
|
import LocalizedLink from "@pradip1995/segment-primitives/localized-link"
|
|
8
|
+
import { isNextRedirect, safeErrorMessage } from "@pradip1995/segment-primitives/is-next-redirect"
|
|
8
9
|
import GoogleAuthSection from "@pradip1995/segment-login-template/google-auth-section"
|
|
9
10
|
import OtpInput from "@pradip1995/segment-login-template/otp-input"
|
|
10
11
|
import {
|
|
@@ -124,7 +125,8 @@ export default function LoginPopup({ countryCode = "in" }: { countryCode?: strin
|
|
|
124
125
|
setOtp("")
|
|
125
126
|
setResendIn(30)
|
|
126
127
|
} catch (err) {
|
|
127
|
-
|
|
128
|
+
if (isNextRedirect(err)) throw err
|
|
129
|
+
setError(safeErrorMessage(err, "Failed to send code"))
|
|
128
130
|
if (!options?.resend) {
|
|
129
131
|
setUiStep("identifier")
|
|
130
132
|
}
|
|
@@ -161,7 +163,8 @@ export default function LoginPopup({ countryCode = "in" }: { countryCode?: strin
|
|
|
161
163
|
resetFlow()
|
|
162
164
|
router.refresh()
|
|
163
165
|
} catch (err) {
|
|
164
|
-
|
|
166
|
+
if (isNextRedirect(err)) throw err
|
|
167
|
+
setError(safeErrorMessage(err, "Verification failed"))
|
|
165
168
|
setVerifying(false)
|
|
166
169
|
}
|
|
167
170
|
}
|