@base44-preview/sdk 0.8.19-pr.132.2bf3dc4 → 0.8.19-pr.133.511000e
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/modules/auth.js
CHANGED
|
@@ -37,9 +37,18 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
37
37
|
loginWithProvider(provider, fromUrl = "/") {
|
|
38
38
|
// Build the full redirect URL
|
|
39
39
|
const redirectUrl = new URL(fromUrl, window.location.origin).toString();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const queryParams = `app_id=${appId}&from_url=${encodeURIComponent(redirectUrl)}`;
|
|
41
|
+
// SSO uses a different URL structure with appId in the path
|
|
42
|
+
let authPath;
|
|
43
|
+
if (provider === "sso") {
|
|
44
|
+
authPath = `/apps/${appId}/auth/sso/login`;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Google is the default provider, so no provider path segment needed
|
|
48
|
+
const providerPath = provider === "google" ? "" : `/${provider}`;
|
|
49
|
+
authPath = `/apps/auth${providerPath}/login`;
|
|
50
|
+
}
|
|
51
|
+
const loginUrl = `${options.appBaseUrl}/api${authPath}?${queryParams}`;
|
|
43
52
|
// Redirect to the provider login page
|
|
44
53
|
window.location.href = loginUrl;
|
|
45
54
|
},
|
|
@@ -185,8 +185,9 @@ export interface AuthModule {
|
|
|
185
185
|
* - `'microsoft'` - {@link https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow | Microsoft OAuth}. Enable Microsoft in your app's authentication settings before specifying this provider.
|
|
186
186
|
* - `'facebook'` - {@link https://developers.facebook.com/docs/facebook-login | Facebook Login}. Enable Facebook in your app's authentication settings before using.
|
|
187
187
|
* - `'apple'` - {@link https://developer.apple.com/sign-in-with-apple/ | Sign in with Apple}. Enable Apple in your app's authentication settings before using this provider.
|
|
188
|
+
* - `'sso'` - Enterprise SSO. Enable SSO in your app's authentication settings before using this provider.
|
|
188
189
|
*
|
|
189
|
-
* @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`, or `'
|
|
190
|
+
* @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`, `'apple'`, or `'sso'`.
|
|
190
191
|
* @param fromUrl - URL to redirect to after successful authentication. Defaults to `'/'`.
|
|
191
192
|
*
|
|
192
193
|
* @example
|
|
@@ -206,6 +207,12 @@ export interface AuthModule {
|
|
|
206
207
|
* // Apple
|
|
207
208
|
* base44.auth.loginWithProvider('apple', '/dashboard');
|
|
208
209
|
* ```
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* // SSO
|
|
214
|
+
* base44.auth.loginWithProvider('sso', '/dashboard');
|
|
215
|
+
* ```
|
|
209
216
|
*/
|
|
210
217
|
loginWithProvider(provider: string, fromUrl?: string): void;
|
|
211
218
|
/**
|
package/package.json
CHANGED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export type NotificationChannel = "email" | "sms" | "push" | "in_app";
|
|
2
|
-
export type NotificationPriority = "low" | "normal" | "high" | "urgent";
|
|
3
|
-
/**
|
|
4
|
-
* A notification recipient.
|
|
5
|
-
*/
|
|
6
|
-
export type NotificationRecipient = {
|
|
7
|
-
userId: string;
|
|
8
|
-
channels?: NotificationChannel[];
|
|
9
|
-
};
|
|
10
|
-
export type NotificationTemplate = {
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
subject?: string;
|
|
14
|
-
body: string;
|
|
15
|
-
channel: NotificationChannel;
|
|
16
|
-
};
|
|
17
|
-
export type SendNotificationParams = {
|
|
18
|
-
recipientId: string;
|
|
19
|
-
templateId?: string;
|
|
20
|
-
channel: NotificationChannel;
|
|
21
|
-
subject?: string;
|
|
22
|
-
body: string;
|
|
23
|
-
priority?: NotificationPriority;
|
|
24
|
-
metadata?: Record<string, string | number | boolean>;
|
|
25
|
-
scheduledAt?: string;
|
|
26
|
-
};
|
|
27
|
-
export type BulkNotificationParams = {
|
|
28
|
-
recipientIds: string[];
|
|
29
|
-
templateId: string;
|
|
30
|
-
channel: NotificationChannel;
|
|
31
|
-
variables?: Record<string, string>;
|
|
32
|
-
priority?: NotificationPriority;
|
|
33
|
-
};
|
|
34
|
-
export type NotificationResult = {
|
|
35
|
-
id: string;
|
|
36
|
-
status: "queued" | "sent" | "delivered" | "failed";
|
|
37
|
-
sentAt?: string;
|
|
38
|
-
error?: string;
|
|
39
|
-
};
|
|
40
|
-
export type NotificationPreferences = {
|
|
41
|
-
userId: string;
|
|
42
|
-
enabledChannels: NotificationChannel[];
|
|
43
|
-
quietHoursStart?: string;
|
|
44
|
-
quietHoursEnd?: string;
|
|
45
|
-
unsubscribedTopics: string[];
|
|
46
|
-
};
|
|
47
|
-
export type ListNotificationsParams = {
|
|
48
|
-
status?: "queued" | "sent" | "delivered" | "failed";
|
|
49
|
-
channel?: NotificationChannel;
|
|
50
|
-
limit?: number;
|
|
51
|
-
skip?: number;
|
|
52
|
-
};
|
|
53
|
-
export interface NotificationsModule {
|
|
54
|
-
send(params: SendNotificationParams): Promise<NotificationResult>;
|
|
55
|
-
sendBulk(params: BulkNotificationParams): Promise<NotificationResult[]>;
|
|
56
|
-
getPreferences(userId: string): Promise<NotificationPreferences>;
|
|
57
|
-
updatePreferences(userId: string, preferences: Partial<Omit<NotificationPreferences, "userId">>): Promise<NotificationPreferences>;
|
|
58
|
-
list(params?: ListNotificationsParams): Promise<NotificationResult[]>;
|
|
59
|
-
/**
|
|
60
|
-
* Cancels a scheduled notification before it is sent.
|
|
61
|
-
*
|
|
62
|
-
* @param notificationId - The ID of the notification to cancel.
|
|
63
|
-
* @returns Promise resolving to `true` if the notification was successfully cancelled.
|
|
64
|
-
*/
|
|
65
|
-
cancel(notificationId: string): Promise<boolean>;
|
|
66
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|