Skip to content

Commit e2e208f

Browse files
committed
Merge branch 'main' into feat-bucket-transformations-settings
2 parents 81c4568 + 6b3409d commit e2e208f

10 files changed

Lines changed: 156 additions & 38 deletions

File tree

src/lib/sdk/billing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export class Billing {
490490
name: string,
491491
billingPlan: string,
492492
paymentMethodId: string,
493-
billingAddressId: string = null,
493+
billingAddressId: string = undefined,
494494
couponId: string = null,
495495
invites: Array<string> = [],
496496
budget: number = undefined,
@@ -628,6 +628,7 @@ export class Billing {
628628
budget,
629629
taxId
630630
};
631+
631632
const uri = new URL(this.client.config.endpoint + path);
632633
return await this.client.call(
633634
'patch',

src/routes/(console)/apply-credit/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
name,
135135
billingPlan,
136136
paymentMethodId,
137-
null,
137+
undefined,
138138
couponData.code ? couponData.code : null,
139139
collaborators,
140140
billingBudget,
@@ -148,7 +148,7 @@
148148
selectedOrg.$id,
149149
billingPlan,
150150
paymentMethodId,
151-
null,
151+
undefined,
152152
couponData.code ? couponData.code : null,
153153
collaborators
154154
);

src/routes/(console)/create-organization/+page.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
ID.unique(),
113113
name,
114114
BillingPlan.FREE,
115-
null,
116115
null
117116
);
118117
} else {
@@ -121,7 +120,7 @@
121120
name,
122121
selectedPlan,
123122
paymentMethodId,
124-
null,
123+
undefined,
125124
selectedCoupon?.code,
126125
collaborators,
127126
billingBudget,

src/routes/(console)/onboarding/create-organization/+page.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
ID.unique(),
2626
organizationName,
2727
BillingPlan.FREE,
28-
null,
2928
null
3029
);
3130

src/routes/(console)/onboarding/create-project/+page.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const load: PageLoad = async ({ parent }) => {
2929
ID.unique(),
3030
'Personal projects',
3131
BillingPlan.FREE,
32-
null,
3332
null
3433
);
3534
trackEvent(Submit.OrganizationCreate, {

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@
173173
await sdk.forConsole.billing.updatePlan(
174174
data.organization.$id,
175175
selectedPlan,
176-
paymentMethodId,
177-
null
176+
paymentMethodId
178177
);
179178
180179
// 2) If the target plan has a project limit, apply selected projects now
@@ -254,7 +253,7 @@
254253
data.organization.$id,
255254
selectedPlan,
256255
paymentMethodId,
257-
null,
256+
undefined,
258257
selectedCoupon?.code,
259258
newCollaborators,
260259
billingBudget,

src/routes/(console)/supportWizard.svelte

Lines changed: 145 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<script lang="ts">
22
import { Wizard } from '$lib/layout';
3-
import { Icon, Layout, Tag, Typography, Button, Card } from '@appwrite.io/pink-svelte';
3+
import { Icon, Input, Layout, Popover, Tag, Typography, Card } from '@appwrite.io/pink-svelte';
44
import { supportData, isSupportOnline } from './wizard/support/store';
5-
import { onMount } from 'svelte';
5+
import { onMount, onDestroy } from 'svelte';
66
import { sdk } from '$lib/stores/sdk';
7-
import { Form, InputSelect, InputText, InputTextarea } from '$lib/elements/forms/index.js';
8-
7+
import {
8+
Form,
9+
InputSelect,
10+
InputText,
11+
InputTextarea,
12+
Button
13+
} from '$lib/elements/forms/index.js';
14+
import { Query } from '@appwrite.io/console';
915
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
1016
import {
1117
localeTimezoneName,
@@ -18,29 +24,83 @@
1824
import { user } from '$lib/stores/user';
1925
import { wizard } from '$lib/stores/wizard';
2026
import { VARS } from '$lib/system';
21-
import { onDestroy } from 'svelte';
22-
import { IconCheckCircle, IconXCircle } from '@appwrite.io/pink-icons-svelte';
27+
import { IconCheckCircle, IconXCircle, IconInfo } from '@appwrite.io/pink-icons-svelte';
28+
29+
let projectOptions = $state<Array<{ value: string; label: string }>>([]);
2330
24-
let projectOptions: Array<{ value: string; label: string }>;
31+
// Category options with display names
32+
const categories = [
33+
{ value: 'general', label: 'General' },
34+
{ value: 'billing', label: 'Billing' },
35+
{ value: 'technical', label: 'Technical' }
36+
];
37+
38+
// Topic options based on category
39+
const topicsByCategory = {
40+
general: ['Security', 'Compliance', 'Performance'],
41+
billing: ['Invoices', 'Plans'],
42+
technical: [
43+
'Auth',
44+
'Databases',
45+
'Storage',
46+
'Functions',
47+
'Realtime',
48+
'Messaging',
49+
'Migrations',
50+
'Webhooks',
51+
'SDKs',
52+
'Console'
53+
]
54+
};
55+
56+
// Severity options
57+
const severityOptions = [
58+
{ value: 'critical', label: 'Critical' },
59+
{ value: 'high', label: 'High' },
60+
{ value: 'medium', label: 'Medium' },
61+
{ value: 'low', label: 'Low' },
62+
{ value: 'question', label: 'Question' }
63+
];
2564
2665
onMount(async () => {
27-
const projectList = await sdk.forConsole.projects.list();
66+
// Filter projects by organization ID using server-side queries
67+
const projectList = await sdk.forConsole.projects.list({
68+
queries: $organization?.$id ? [Query.equal('teamId', $organization.$id)] : []
69+
});
2870
projectOptions = projectList.projects.map((project) => ({
2971
value: project.$id,
3072
label: project.name
3173
}));
3274
});
3375
76+
// Cleanup on component destroy
3477
onDestroy(() => {
3578
$supportData = {
3679
message: null,
3780
subject: null,
38-
category: 'general',
81+
category: 'technical',
82+
topic: undefined,
83+
severity: 'question',
3984
file: null
4085
};
4186
});
4287
88+
// Update topic options when category changes
89+
const topicOptions = $derived(
90+
($supportData.category ? topicsByCategory[$supportData.category] || [] : []).map(
91+
(topic) => ({
92+
value: topic.toLowerCase(),
93+
label: topic
94+
})
95+
)
96+
);
97+
4398
async function handleSubmit() {
99+
// Create category-topic tag
100+
const categoryTopicTag = $supportData.topic
101+
? `${$supportData.category}-${$supportData.topic}`.toLowerCase()
102+
: $supportData.category.toLowerCase();
103+
44104
const response = await fetch(`${VARS.GROWTH_ENDPOINT}/support`, {
45105
method: 'POST',
46106
headers: {
@@ -51,13 +111,13 @@
51111
subject: $supportData.subject,
52112
firstName: ($user?.name || 'Unknown').slice(0, 40),
53113
message: $supportData.message,
54-
tags: ['cloud'],
114+
tags: [categoryTopicTag],
55115
customFields: [
56116
{ id: '41612', value: $supportData.category },
57-
{ id: '48493', value: $user?.name ?? '' },
58117
{ id: '48492', value: $organization?.$id ?? '' },
59118
{ id: '48491', value: $supportData?.project ?? '' },
60-
{ id: '48490', value: $user?.$id ?? '' }
119+
{ id: '56023', value: $supportData?.severity ?? '' },
120+
{ id: '56024', value: $organization?.billingPlan ?? '' }
61121
]
62122
})
63123
});
@@ -84,7 +144,9 @@
84144
$supportData = {
85145
message: null,
86146
subject: null,
87-
category: 'general',
147+
category: 'technical',
148+
topic: undefined,
149+
severity: undefined,
88150
file: null,
89151
project: null
90152
};
@@ -99,10 +161,43 @@
99161
endDay: 'Friday' as WeekDay
100162
};
101163
102-
$: supportTimings = `${utcHourToLocaleHour(workTimings.start)} - ${utcHourToLocaleHour(workTimings.end)} ${localeTimezoneName()}`;
103-
$: supportWeekDays = `${utcWeekDayToLocaleWeekDay(workTimings.startDay, workTimings.start)} - ${utcWeekDayToLocaleWeekDay(workTimings.endDay, workTimings.end)}`;
164+
const supportTimings = $derived(
165+
`${utcHourToLocaleHour(workTimings.start)} - ${utcHourToLocaleHour(workTimings.end)} ${localeTimezoneName()}`
166+
);
167+
const supportWeekDays = $derived(
168+
`${utcWeekDayToLocaleWeekDay(workTimings.startDay, workTimings.start)} - ${utcWeekDayToLocaleWeekDay(workTimings.endDay, workTimings.end)}`
169+
);
104170
</script>
105171

172+
{#snippet severityPopover()}
173+
<Popover let:toggle>
174+
<Button extraCompact size="s" on:click={toggle}>
175+
<Icon size="s" icon={IconInfo} />
176+
</Button>
177+
<div slot="tooltip" style="max-width: 400px;">
178+
<Layout.Stack gap="s">
179+
<Typography.Text>
180+
<b>Critical:</b> System is down or a critical component is non-functional, causing
181+
a complete stoppage of work or significant business impact.
182+
</Typography.Text>
183+
<Typography.Text>
184+
<b>High:</b> Major functionality is impaired, but a workaround is available, or a
185+
critical component is significantly degraded.
186+
</Typography.Text>
187+
<Typography.Text>
188+
<b>Medium:</b> Minor functionality is impaired without significant business impact.
189+
</Typography.Text>
190+
<Typography.Text>
191+
<b>Low:</b> Issue has minor impact on business operations; workaround is not necessary.
192+
</Typography.Text>
193+
<Typography.Text>
194+
<b>Question:</b> Requests for information, general guidance, or feature requests.
195+
</Typography.Text>
196+
</Layout.Stack>
197+
</div>
198+
</Popover>
199+
{/snippet}
200+
106201
<Wizard title="Contact us" confirmExit={true}>
107202
<Form onSubmit={handleSubmit}>
108203
<Layout.Stack gap="xl">
@@ -113,24 +208,48 @@
113208
</Layout.Stack>
114209
<Layout.Stack gap="s">
115210
<Typography.Text color="--fgcolor-neutral-secondary"
116-
>Choose a topic</Typography.Text>
211+
>Choose a category</Typography.Text>
117212
<Layout.Stack gap="s" direction="row">
118-
{#each ['general', 'billing', 'technical'] as category}
213+
{#each categories as category}
119214
<Tag
120215
on:click={() => {
121-
$supportData.category = category;
216+
if ($supportData.category !== category.value) {
217+
$supportData.topic = undefined;
218+
}
219+
$supportData.category = category.value;
122220
}}
123-
selected={$supportData.category === category}>{category}</Tag>
221+
selected={$supportData.category === category.value}
222+
>{category.label}</Tag>
124223
{/each}
125224
</Layout.Stack>
126225
</Layout.Stack>
127-
<InputSelect
128-
required
226+
{#if topicOptions.length > 0}
227+
{#key $supportData.category}
228+
<Input.ComboBox
229+
id="topic"
230+
label="Choose a topic"
231+
placeholder="Select topic"
232+
bind:value={$supportData.topic}
233+
options={topicOptions} />
234+
{/key}
235+
{/if}
236+
<Input.ComboBox
129237
id="project"
130238
label="Choose a project"
131239
options={projectOptions ?? []}
132240
bind:value={$supportData.project}
133241
placeholder="Select project" />
242+
<InputSelect
243+
id="severity"
244+
label="Severity"
245+
options={severityOptions}
246+
bind:value={$supportData.severity}
247+
required
248+
placeholder="Select severity">
249+
<div slot="info">
250+
{@render severityPopover()}
251+
</div>
252+
</InputSelect>
134253
<InputText
135254
id="subject"
136255
label="Subject"
@@ -143,15 +262,16 @@
143262
bind:value={$supportData.message}
144263
placeholder="Type here..."
145264
label="Tell us a bit more"
265+
required
146266
maxlength={4096} />
147267
<Layout.Stack direction="row" justifyContent="flex-end" gap="s">
148-
<Button.Button
268+
<Button
149269
size="s"
150-
variant="secondary"
270+
secondary
151271
on:click={() => {
152272
wizard.hide();
153-
}}>Cancel</Button.Button>
154-
<Button.Button size="s">Submit</Button.Button>
273+
}}>Cancel</Button>
274+
<Button submit size="s">Submit</Button>
155275
</Layout.Stack>
156276
</Layout.Stack>
157277
</Form>

src/routes/(console)/wizard/support/store.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ export type SupportData = {
44
message: string;
55
subject: string;
66
category: string;
7+
topic?: string;
8+
severity?: string;
79
file?: File | null;
810
project?: string;
911
};
1012

1113
export const supportData = writable<SupportData>({
1214
message: '',
1315
subject: '',
14-
category: 'general',
16+
category: 'technical',
17+
severity: 'question',
1518
file: null
1619
});
1720

src/routes/(public)/functions/deploy/+page.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export const load: PageLoad = async ({ parent, url }) => {
7878
ID.unique(),
7979
'Personal Projects',
8080
BillingPlan.FREE,
81-
null,
8281
null
8382
);
8483
} else {

src/routes/(public)/template-[template]/+page.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const load = async ({ parent, url, params }) => {
4949
ID.unique(),
5050
'Personal project',
5151
BillingPlan.FREE,
52-
null,
5352
null
5453
);
5554
}

0 commit comments

Comments
 (0)