skyllful-auth-integration 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +84 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,85 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUserInfo = getUserInfo;
4
+ /**
5
+ * Displays a full-page error screen when authentication fails
6
+ */
7
+ function showErrorPage() {
8
+ const errorHTML = `
9
+ <div style="
10
+ position: fixed;
11
+ top: 0;
12
+ left: 0;
13
+ width: 100%;
14
+ height: 100%;
15
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
20
+ z-index: 999999;
21
+ ">
22
+ <div style="
23
+ background: white;
24
+ border-radius: 12px;
25
+ padding: 48px;
26
+ max-width: 500px;
27
+ box-shadow: 0 20px 60px rgba(0,0,0,0.3);
28
+ text-align: center;
29
+ ">
30
+ <div style="
31
+ width: 80px;
32
+ height: 80px;
33
+ background: #fee;
34
+ border-radius: 50%;
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ margin: 0 auto 24px;
39
+ ">
40
+ <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="#e53e3e" stroke-width="2">
41
+ <circle cx="12" cy="12" r="10"></circle>
42
+ <line x1="12" y1="8" x2="12" y2="12"></line>
43
+ <line x1="12" y1="16" x2="12.01" y2="16"></line>
44
+ </svg>
45
+ </div>
46
+
47
+ <h1 style="
48
+ margin: 0 0 16px;
49
+ font-size: 28px;
50
+ font-weight: 600;
51
+ color: #1a202c;
52
+ ">Authentication Required</h1>
53
+
54
+ <p style="
55
+ margin: 0 0 32px;
56
+ font-size: 16px;
57
+ line-height: 1.6;
58
+ color: #4a5568;
59
+ ">Please make sure you are authenticated and have the right permissions to access this application.</p>
60
+
61
+ <div style="
62
+ padding-top: 24px;
63
+ border-top: 1px solid #e2e8f0;
64
+ ">
65
+ <p style="
66
+ margin: 0 0 12px;
67
+ font-size: 14px;
68
+ color: #718096;
69
+ ">Need help?</p>
70
+ <a href="mailto:support@example.com" style="
71
+ display: inline-block;
72
+ color: #667eea;
73
+ text-decoration: none;
74
+ font-weight: 500;
75
+ font-size: 14px;
76
+ ">Contact Support</a>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ `;
81
+ document.body.innerHTML = errorHTML;
82
+ }
4
83
  /**
5
84
  * Get user information from the current browser URL
6
85
  * Note: This function only works in browser environments
@@ -15,6 +94,11 @@ async function getUserInfo() {
15
94
  const firstName = params.get('firstName') || '';
16
95
  const lastName = params.get('lastName') || '';
17
96
  const permissionsStr = params.get('permissions') || '';
97
+ // Check if required parameters are missing
98
+ if (!userId || !firstName || !lastName) {
99
+ showErrorPage();
100
+ throw new Error('Missing required authentication parameters');
101
+ }
18
102
  const permissions = permissionsStr
19
103
  ? permissionsStr.split(',').map(p => p.trim().toLowerCase()).filter(p => p)
20
104
  : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skyllful-auth-integration",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Parse authentication parameters from URL and extract user information",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",