@pradip1995/segment-login-popup 0.1.1 → 0.1.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pradip1995/segment-login-popup",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.0",
37
+ "@pradip1995/segment-primitives": "^0.4.3",
38
38
  "@pradip1995/segment-tokens": "^0.3.7"
39
39
  },
40
40
  "devDependencies": {
@@ -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
- setError(err instanceof Error ? err.message : "Failed to send code")
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
- setError(err instanceof Error ? err.message : "Verification failed")
166
+ if (isNextRedirect(err)) throw err
167
+ setError(safeErrorMessage(err, "Verification failed"))
165
168
  setVerifying(false)
166
169
  }
167
170
  }
package/src/manifest.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import type { SegmentManifest } from "@pradip1995/plugin-sdk"
2
2
 
3
- const manifest: SegmentManifest = {
3
+ const manifest: SegmentManifest & { chromeSlot?: string } = {
4
4
  id: "login-popup",
5
5
  type: "segment",
6
6
  version: "0.1.0",
7
7
  compatibleFramework: ["^1.0.0"],
8
8
  dataKey: "loginPopup",
9
+ chromeSlot: "loginPopup",
9
10
  }
10
11
 
11
12
  export default manifest