@lovable.dev/cloud-auth-js
Advanced tools
+49
-3
@@ -91,2 +91,10 @@ "use strict"; | ||
| } | ||
| function isDevice() { | ||
| const ua = navigator.userAgent; | ||
| if (/iPhone|iPad|iPod|Android/i.test(ua)) | ||
| return true; | ||
| if (/Macintosh/i.test(ua) && navigator.maxTouchPoints > 1) | ||
| return true; | ||
| return false; | ||
| } | ||
| function generateState() { | ||
@@ -109,5 +117,4 @@ if (typeof crypto !== "undefined" && crypto.getRandomValues) { | ||
| const ua = navigator.userAgent; | ||
| const isMobile = /iPhone|iPad|iPod|Android/i.test(ua); | ||
| const isMobileApp = /LovableApp\//.test(ua); | ||
| const isDesktopApp = /lovable-?desktop\//i.test(ua); | ||
| const isDesktopApp = !isMobileApp && /lovable/i.test(ua); | ||
| const state = generateState(); | ||
@@ -137,3 +144,3 @@ let redirectUri = opts.redirect_uri ?? window.location.origin; | ||
| let popup; | ||
| if (isMobile) { | ||
| if (isDevice()) { | ||
| popup = window.open(url, "_blank"); | ||
@@ -193,3 +200,42 @@ } else { | ||
| // package.json | ||
| var package_default = { | ||
| name: "@lovable.dev/cloud-auth-js", | ||
| version: "1.1.1", | ||
| description: "Lovable Cloud Auth JS", | ||
| main: "./dist/index.cjs", | ||
| module: "./dist/index.js", | ||
| types: "./dist/index.d.ts", | ||
| type: "module", | ||
| files: [ | ||
| "dist" | ||
| ], | ||
| scripts: { | ||
| build: "tsup src/index.ts --format cjs,esm --dts --outDir dist", | ||
| dev: "tsup src/index.ts --format cjs,esm --dts --watch", | ||
| test: "vitest run", | ||
| typecheck: "tsgo --noEmit", | ||
| prepublishOnly: "npm run clean && npm run build", | ||
| clean: "rimraf dist" | ||
| }, | ||
| keywords: [ | ||
| "lovable", | ||
| "oauth", | ||
| "authentication" | ||
| ], | ||
| license: "MIT", | ||
| devDependencies: { | ||
| "@types/node": "^22", | ||
| jsdom: "^26", | ||
| rimraf: "^5.0.0", | ||
| tsup: "^7.2.0", | ||
| typescript: "^5", | ||
| vitest: "^4.1.0" | ||
| } | ||
| }; | ||
| // src/index.ts | ||
| if (typeof window !== "undefined") { | ||
| window.__lovable_cloud_auth_js_version = package_default.version; | ||
| } | ||
| function createLovableAuth(config = {}) { | ||
@@ -196,0 +242,0 @@ return createAuth(config); |
+49
-3
@@ -65,2 +65,10 @@ // src/auth.ts | ||
| } | ||
| function isDevice() { | ||
| const ua = navigator.userAgent; | ||
| if (/iPhone|iPad|iPod|Android/i.test(ua)) | ||
| return true; | ||
| if (/Macintosh/i.test(ua) && navigator.maxTouchPoints > 1) | ||
| return true; | ||
| return false; | ||
| } | ||
| function generateState() { | ||
@@ -83,5 +91,4 @@ if (typeof crypto !== "undefined" && crypto.getRandomValues) { | ||
| const ua = navigator.userAgent; | ||
| const isMobile = /iPhone|iPad|iPod|Android/i.test(ua); | ||
| const isMobileApp = /LovableApp\//.test(ua); | ||
| const isDesktopApp = /lovable-?desktop\//i.test(ua); | ||
| const isDesktopApp = !isMobileApp && /lovable/i.test(ua); | ||
| const state = generateState(); | ||
@@ -111,3 +118,3 @@ let redirectUri = opts.redirect_uri ?? window.location.origin; | ||
| let popup; | ||
| if (isMobile) { | ||
| if (isDevice()) { | ||
| popup = window.open(url, "_blank"); | ||
@@ -167,3 +174,42 @@ } else { | ||
| // package.json | ||
| var package_default = { | ||
| name: "@lovable.dev/cloud-auth-js", | ||
| version: "1.1.1", | ||
| description: "Lovable Cloud Auth JS", | ||
| main: "./dist/index.cjs", | ||
| module: "./dist/index.js", | ||
| types: "./dist/index.d.ts", | ||
| type: "module", | ||
| files: [ | ||
| "dist" | ||
| ], | ||
| scripts: { | ||
| build: "tsup src/index.ts --format cjs,esm --dts --outDir dist", | ||
| dev: "tsup src/index.ts --format cjs,esm --dts --watch", | ||
| test: "vitest run", | ||
| typecheck: "tsgo --noEmit", | ||
| prepublishOnly: "npm run clean && npm run build", | ||
| clean: "rimraf dist" | ||
| }, | ||
| keywords: [ | ||
| "lovable", | ||
| "oauth", | ||
| "authentication" | ||
| ], | ||
| license: "MIT", | ||
| devDependencies: { | ||
| "@types/node": "^22", | ||
| jsdom: "^26", | ||
| rimraf: "^5.0.0", | ||
| tsup: "^7.2.0", | ||
| typescript: "^5", | ||
| vitest: "^4.1.0" | ||
| } | ||
| }; | ||
| // src/index.ts | ||
| if (typeof window !== "undefined") { | ||
| window.__lovable_cloud_auth_js_version = package_default.version; | ||
| } | ||
| function createLovableAuth(config = {}) { | ||
@@ -170,0 +216,0 @@ return createAuth(config); |
+1
-1
| { | ||
| "name": "@lovable.dev/cloud-auth-js", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "Lovable Cloud Auth JS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
20558
11.56%484
22.84%1
Infinity%