@base44-preview/sdk 0.8.31-pr.178.8fbfe3b → 0.8.31-pr.178.d362125
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/accounts.js
CHANGED
|
@@ -36,12 +36,21 @@ export function createAccountsModule(axios, appId) {
|
|
|
36
36
|
return;
|
|
37
37
|
window.location.reload();
|
|
38
38
|
},
|
|
39
|
+
setActiveAccount(accountId) {
|
|
40
|
+
setStoredActiveAccountId(appId, accountId);
|
|
41
|
+
},
|
|
39
42
|
clearActiveAccount() {
|
|
40
43
|
setStoredActiveAccountId(appId, null);
|
|
41
44
|
},
|
|
42
45
|
async listMine() {
|
|
43
46
|
return axios.get(`${base}/me`);
|
|
44
47
|
},
|
|
48
|
+
async getPublicAccount(slug) {
|
|
49
|
+
return axios.get(`${base}/public/by-slug/${enc(slug)}`);
|
|
50
|
+
},
|
|
51
|
+
async joinAccount(slug) {
|
|
52
|
+
return axios.post(`${base}/by-slug/${enc(slug)}/join`, {});
|
|
53
|
+
},
|
|
45
54
|
async create(params) {
|
|
46
55
|
return axios.post(base, params);
|
|
47
56
|
},
|
|
@@ -32,6 +32,17 @@ export interface MyAccountsResponse {
|
|
|
32
32
|
accounts: Account[];
|
|
33
33
|
active_account_id: string | null;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Public, unauthenticated view of an account (its landing page), resolved by
|
|
37
|
+
* slug. Carries identity plus only the builder-designated public custom fields.
|
|
38
|
+
*/
|
|
39
|
+
export interface PublicAccount {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
slug: string | null;
|
|
43
|
+
/** Builder-flagged public companion fields (e.g. logo, tagline). */
|
|
44
|
+
data: Record<string, unknown>;
|
|
45
|
+
}
|
|
35
46
|
/** A user's membership in an account. */
|
|
36
47
|
export interface AccountMembership {
|
|
37
48
|
id: string;
|
|
@@ -95,19 +106,45 @@ export interface AccountsModule {
|
|
|
95
106
|
* @param accountId - The account to switch to.
|
|
96
107
|
*/
|
|
97
108
|
switchAccount(accountId: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Persist the active account WITHOUT reloading the page.
|
|
111
|
+
*
|
|
112
|
+
* Use on the public landing page to select the account before redirecting to
|
|
113
|
+
* login, so the app resolves that account after the visitor returns. For
|
|
114
|
+
* switching accounts inside the running app, use {@link switchAccount} (which
|
|
115
|
+
* reloads so all data follows the new account).
|
|
116
|
+
*/
|
|
117
|
+
setActiveAccount(accountId: string): void;
|
|
98
118
|
/** Clear the stored active account (the backend falls back to the default). */
|
|
99
119
|
clearActiveAccount(): void;
|
|
100
120
|
/** List the accounts the current user belongs to, plus the active one. */
|
|
101
121
|
listMine(): Promise<MyAccountsResponse>;
|
|
102
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Resolve a public account by its slug (unauthenticated) for its landing page.
|
|
124
|
+
* @param slug - The account's URL slug.
|
|
125
|
+
*/
|
|
126
|
+
getPublicAccount(slug: string): Promise<PublicAccount>;
|
|
127
|
+
/**
|
|
128
|
+
* Self-join an account by slug (the current user becomes a member). Requires
|
|
129
|
+
* login and that the app enables public joining; otherwise rejects.
|
|
130
|
+
* @param slug - The account's URL slug.
|
|
131
|
+
*/
|
|
132
|
+
joinAccount(slug: string): Promise<AccountMembership>;
|
|
133
|
+
/**
|
|
134
|
+
* Create a new account; the current user becomes its owner.
|
|
135
|
+
* @param params.slug - Optional public landing-page URL segment; auto-derived
|
|
136
|
+
* from the name when omitted.
|
|
137
|
+
*/
|
|
103
138
|
create(params: {
|
|
104
139
|
name: string;
|
|
105
140
|
data?: Record<string, unknown>;
|
|
141
|
+
slug?: string;
|
|
106
142
|
}): Promise<Account>;
|
|
107
|
-
/** Rename and/or update an account's custom fields (managers only). */
|
|
143
|
+
/** Rename, change the landing-page slug, and/or update an account's custom fields (managers only). */
|
|
108
144
|
update(accountId: string, params: {
|
|
109
145
|
name?: string;
|
|
110
146
|
data?: Record<string, unknown>;
|
|
147
|
+
slug?: string;
|
|
111
148
|
}): Promise<Account>;
|
|
112
149
|
/**
|
|
113
150
|
* List an account's members (any active member).
|