Skip to content

Commit c601562

Browse files
Merge pull request #2898 from appwrite/feat-baa
Feat baa
2 parents a363ed6 + 8be2c4c commit c601562

12 files changed

Lines changed: 509 additions & 154 deletions

File tree

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"dependencies": {
2222
"@ai-sdk/svelte": "^1.1.24",
23-
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@467cd21",
23+
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@24e07fc",
2424
"@appwrite.io/pink-icons": "0.25.0",
2525
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
2626
"@appwrite.io/pink-legacy": "^1.0.3",

src/lib/actions/analytics.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ export enum Submit {
428428
MessagingTopicSubscriberDelete = 'submit_messaging_topic_subscriber_delete',
429429
ApplyQuickFilter = 'submit_apply_quick_filter',
430430
RequestBAA = 'submit_request_baa',
431+
BAAAddonEnable = 'submit_baa_addon_enable',
432+
BAAAddonDisable = 'submit_baa_addon_disable',
431433
RequestSoc2 = 'submit_request_soc2',
432434
SiteCreate = 'submit_site_create',
433435
SiteDelete = 'submit_site_delete',

src/lib/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ export enum Dependencies {
8585
MESSAGING_TOPIC_SUBSCRIBERS = 'dependency:messaging_topic_subscribers',
8686
SITE = 'dependency:site',
8787
SITES = 'dependency:sites',
88-
SITES_DOMAINS = 'dependency:sites_domains'
88+
SITES_DOMAINS = 'dependency:sites_domains',
89+
ADDONS = 'dependency:addons'
8990
}
9091

9192
export const defaultScopes: string[] = [

src/routes/(console)/organization-[organization]/billing/+page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const load: PageLoad = async ({ parent, depends, url, route }) => {
2525
depends(Dependencies.CREDIT);
2626
depends(Dependencies.INVOICES);
2727
depends(Dependencies.ADDRESS);
28+
depends(Dependencies.ADDONS);
2829
// aggregation reloads on page param changes
2930
depends(Dependencies.BILLING_AGGREGATION);
3031

src/routes/(console)/organization-[organization]/billing/planSummary.svelte

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,17 @@
249249
};
250250
251251
// addons (additional members, projects, etc.)
252+
const billingAddonNames: Record<string, string> = {
253+
addon_baa: 'HIPAA BAA'
254+
};
255+
252256
const addons = (currentAggregation?.resources || [])
253-
.filter((r) => r.amount > 0 && currentPlan?.addons?.[r.resourceId]?.price > 0)
257+
.filter(
258+
(r) =>
259+
r.amount > 0 &&
260+
(currentPlan?.addons?.[r.resourceId]?.price > 0 ||
261+
r.resourceId.startsWith('addon_'))
262+
)
254263
.map((addon) => ({
255264
id: `addon-${addon.resourceId}`,
256265
expandable: false,
@@ -260,7 +269,8 @@
260269
? 'Additional members'
261270
: addon.resourceId === 'projects'
262271
? 'Additional projects'
263-
: `${addon.resourceId} overage (${formatNum(addon.value)})`,
272+
: (billingAddonNames[addon.resourceId] ??
273+
`${addon.resourceId} overage (${formatNum(addon.value)})`),
264274
usage: '',
265275
price: formatCurrency(addon.amount)
266276
},

src/routes/(console)/organization-[organization]/settings/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
{#if isCloud}
7777
<DownloadDPA />
78-
<Baa locale={data.locale} countryList={data.countryList} />
78+
<Baa addons={data.addons} addonPrice={data.addonPrice} />
7979
<Soc2 locale={data.locale} countryList={data.countryList} />
8080
{/if}
8181

src/routes/(console)/organization-[organization]/settings/+page.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,45 @@
11
import type { PageLoad } from './$types';
22
import { Dependencies } from '$lib/constants';
33
import { sdk } from '$lib/stores/sdk';
4-
import { Query } from '@appwrite.io/console';
4+
import { Addon, Query } from '@appwrite.io/console';
55
import { isCloud } from '$lib/system';
66

77
export const load: PageLoad = async ({ depends, params, parent }) => {
88
const { countryList, locale } = await parent();
99
depends(Dependencies.ORGANIZATION);
10+
depends(Dependencies.ADDONS);
1011

11-
const [projects, invoices] = await Promise.all([
12+
const [projects, invoices, addons, addonPrice] = await Promise.all([
1213
sdk.forConsole.projects.list({
1314
queries: [Query.equal('teamId', params.organization), Query.select(['$id', 'name'])]
1415
}),
1516
isCloud
1617
? sdk.forConsole.organizations.listInvoices({
1718
organizationId: params.organization
1819
})
19-
: undefined
20+
: undefined,
21+
isCloud
22+
? sdk.forConsole.organizations
23+
.listAddons({
24+
organizationId: params.organization
25+
})
26+
.catch(() => null)
27+
: null,
28+
isCloud
29+
? sdk.forConsole.organizations
30+
.getAddonPrice({
31+
organizationId: params.organization,
32+
addon: Addon.Baa
33+
})
34+
.catch(() => null)
35+
: null
2036
]);
2137

2238
return {
2339
projects,
2440
invoices,
41+
addons,
42+
addonPrice,
2543
countryList,
2644
locale
2745
};

0 commit comments

Comments
 (0)