mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge branch 'main' into refactor/more-default-units
This commit is contained in:
+135
-10
@@ -3,15 +3,14 @@ import googleAnalytics from '@analytics/google-analytics';
|
||||
import { get } from 'svelte/store';
|
||||
import { page } from '$app/stores';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { growthEndpoint, Mode } from '$lib/constants';
|
||||
import { AppwriteException } from '@aw-labs/appwrite-console';
|
||||
import { ENV, MODE, VARS } from '$lib/system';
|
||||
|
||||
const isDevelopment =
|
||||
import.meta.env.DEV || import.meta.env?.VITE_VERCEL_ENV?.toString() === 'preview';
|
||||
const analytics = Analytics({
|
||||
app: 'appwrite',
|
||||
plugins: [
|
||||
googleAnalytics({
|
||||
measurementIds: [import.meta.env.VITE_GA_PROJECT?.toString() || 'G-R4YJ9JN8L4']
|
||||
measurementIds: [VARS.GOOGLE_ANALYTICS ?? 'G-R4YJ9JN8L4']
|
||||
})
|
||||
]
|
||||
});
|
||||
@@ -21,9 +20,17 @@ export function trackEvent(name: string, data: object = null): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const path = get(page).route.id;
|
||||
const currentPage = get(page);
|
||||
const path = currentPage.route.id;
|
||||
|
||||
if (isDevelopment) {
|
||||
if (currentPage.params?.project) {
|
||||
data = {
|
||||
...data,
|
||||
project: currentPage.params.project
|
||||
};
|
||||
}
|
||||
|
||||
if (ENV.DEV || ENV.PREVIEW) {
|
||||
console.debug(`[Analytics] Event ${name} ${path}`, data);
|
||||
} else {
|
||||
analytics.track(name, { ...data, path });
|
||||
@@ -31,12 +38,21 @@ export function trackEvent(name: string, data: object = null): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function trackError(exception: Error, event: Submit): void {
|
||||
if (exception instanceof AppwriteException && exception.type) {
|
||||
trackEvent(Submit.Error, {
|
||||
type: exception.type,
|
||||
form: event
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function trackPageView(path: string) {
|
||||
if (!isTrackingAllowed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDevelopment) {
|
||||
if (ENV.DEV || ENV.PREVIEW) {
|
||||
console.debug(`[Analytics] Pageview ${path}`);
|
||||
} else {
|
||||
analytics.page({
|
||||
@@ -46,14 +62,14 @@ export function trackPageView(path: string) {
|
||||
}
|
||||
|
||||
function sendEventToGrowth(event: string, path: string, data: object = null): void {
|
||||
if (!growthEndpoint) return;
|
||||
if (!VARS.GROWTH_ENDPOINT) return;
|
||||
const userStore = get(user);
|
||||
let email: string, name: string;
|
||||
if (userStore) {
|
||||
email = userStore.email;
|
||||
name = userStore.name;
|
||||
}
|
||||
fetch(`${growthEndpoint}/analytics`, {
|
||||
fetch(`${VARS.GROWTH_ENDPOINT}/analytics`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -62,7 +78,7 @@ function sendEventToGrowth(event: string, path: string, data: object = null): vo
|
||||
action: event,
|
||||
label: event,
|
||||
url: window.location.origin + path,
|
||||
account: import.meta.env.VITE_CONSOLE_MODE?.toString() || Mode.SELF_HOSTED,
|
||||
account: MODE,
|
||||
data: {
|
||||
email,
|
||||
name,
|
||||
@@ -73,6 +89,9 @@ function sendEventToGrowth(event: string, path: string, data: object = null): vo
|
||||
}
|
||||
|
||||
function isTrackingAllowed() {
|
||||
if (ENV.TEST) {
|
||||
return;
|
||||
}
|
||||
if (window.navigator?.doNotTrack) {
|
||||
if (navigator.doNotTrack === '1' || navigator.doNotTrack === 'yes') {
|
||||
return false;
|
||||
@@ -83,3 +102,109 @@ function isTrackingAllowed() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export enum Submit {
|
||||
Error = 'submit_error',
|
||||
AccountCreate = 'submit_account_create',
|
||||
AccountLogin = 'submit_account_login',
|
||||
AccountLogout = 'submit_account_logout',
|
||||
AccountRecover = 'submit_account_recover',
|
||||
AccountUpdateName = 'submit_account_update_name',
|
||||
AccountUpdateEmail = 'submit_account_update_email',
|
||||
AccountUpdatePassword = 'submit_account_update_password',
|
||||
AccountDelete = 'submit_account_delete',
|
||||
AccountDeleteSession = 'submit_account_delete_session',
|
||||
AccountDeleteAllSessions = 'submit_account_delete_all_sessions',
|
||||
UserCreate = 'submit_user_create',
|
||||
UserDelete = 'submit_user_delete',
|
||||
UserUpdateEmail = 'submit_user_update_email',
|
||||
UserUpdateName = 'submit_user_update_name',
|
||||
UserUpdatePassword = 'submit_user_update_password',
|
||||
UserUpdatePhone = 'submit_user_update_phone',
|
||||
UserUpdatePreferences = 'submit_user_update_preferences',
|
||||
UserUpdateStatus = 'submit_user_update_status',
|
||||
UserUpdateVerificationEmail = 'submit_user_update_verification_email',
|
||||
UserUpdateVerificationPhone = 'submit_user_update_verification_phone',
|
||||
OrganizationCreate = 'submit_organization_create',
|
||||
OrganizationDelete = 'submit_organization_delete',
|
||||
OrganizationUpdateName = 'submit_organization_update_name',
|
||||
ProjectCreate = 'submit_project_create',
|
||||
ProjectDelete = 'submit_project_delete',
|
||||
ProjectUpdateName = 'submit_project_update_name',
|
||||
ProjectService = 'submit_project_service',
|
||||
MemberCreate = 'submit_member_create',
|
||||
MemberDelete = 'submit_member_delete',
|
||||
MembershipUpdateStatus = 'submit_membership_update_status',
|
||||
ProviderUpdate = 'submit_provider_update',
|
||||
TeamCreate = 'submit_team_create',
|
||||
TeamDelete = 'submit_team_delete',
|
||||
TeamUpdateName = 'submit_team_update_name',
|
||||
AuthLimitUpdate = 'submit_auth_limit_update',
|
||||
AuthStatusUpdate = 'submit_auth_status_update',
|
||||
SessionsLengthUpdate = 'submit_sessions_length_update',
|
||||
SessionsLimitUpdate = 'submit_sessions_limit_update',
|
||||
SessionDelete = 'submit_session_delete',
|
||||
SessionDeleteAll = 'submit_session_delete_all',
|
||||
DatabaseCreate = 'submit_database_create',
|
||||
DatabaseDelete = 'submit_database_delete',
|
||||
DatabaseUpdateName = 'submit_database_update_name',
|
||||
AttributeCreate = 'submit_attribute_create',
|
||||
AttributeDelete = 'submit_attribute_delete',
|
||||
DocumentCreate = 'submit_document_create',
|
||||
DocumentDelete = 'submit_document_delete',
|
||||
DocumentUpdate = 'submit_document_update',
|
||||
DocumentUpdatePermissions = 'submit_document_update_permissions',
|
||||
IndexCreate = 'submit_index_create',
|
||||
IndexDelete = 'submit_index_delete',
|
||||
CollectionCreate = 'submit_collection_create',
|
||||
CollectionDelete = 'submit_collection_delete',
|
||||
CollectionUpdateName = 'submit_collection_update_name',
|
||||
CollectionUpdatePermissions = 'submit_collection_update_permissions',
|
||||
CollectionUpdateSecurity = 'submit_collection_update_security',
|
||||
CollectionUpdateEnabled = 'submit_collection_update_enabled',
|
||||
FunctionCreate = 'submit_function_create',
|
||||
FunctionDelete = 'submit_function_delete',
|
||||
FunctionUpdateName = 'submit_function_update_name',
|
||||
FunctionUpdatePermissions = 'submit_function_update_permissions',
|
||||
FunctionUpdateSchedule = 'submit_function_update_schedule',
|
||||
FunctionUpdateTimeout = 'submit_function_update_timeout',
|
||||
FunctionUpdateEvents = 'submit_function_update_events',
|
||||
DeploymentCreate = 'submit_deployment_create',
|
||||
DeploymentDelete = 'submit_deployment_delete',
|
||||
DeploymentUpdate = 'submit_deployment_update',
|
||||
ExecutionCreate = 'submit_execution_create',
|
||||
VariableCreate = 'submit_variable_create',
|
||||
VariableDelete = 'submit_variable_delete',
|
||||
VariableUpdate = 'submit_variable_update',
|
||||
KeyCreate = 'submit_key_create',
|
||||
KeyDelete = 'submit_key_delete',
|
||||
KeyUpdateName = 'submit_key_update_name',
|
||||
KeyUpdateScopes = 'submit_key_update_scopes',
|
||||
KeyUpdateExpire = 'submit_key_update_expire',
|
||||
PlatformCreate = 'submit_platform_create',
|
||||
PlatformDelete = 'submit_platform_delete',
|
||||
PlatformUpdate = 'submit_platform_update',
|
||||
DomainCreate = 'submit_domain_create',
|
||||
DomainDelete = 'submit_domain_delete',
|
||||
DomainUpdateVerification = 'submit_domain_update_verification',
|
||||
WebhookCreate = 'submit_webhook_create',
|
||||
WebhookDelete = 'submit_webhook_delete',
|
||||
WebhookUpdateSignature = 'submit_webhook_update_signature',
|
||||
WebhookUpdateUrl = 'submit_webhook_update_url',
|
||||
WebhookUpdateEvents = 'submit_webhook_update_events',
|
||||
WebhookUpdateName = 'submit_webhook_update_name',
|
||||
WebhookUpdateSecurity = 'submit_webhook_update_security',
|
||||
BucketCreate = 'submit_bucket_create',
|
||||
BucketDelete = 'submit_bucket_delete',
|
||||
BucketUpdateEnabled = 'submit_bucket_update_enabled',
|
||||
BucketUpdateName = 'submit_bucket_update_name',
|
||||
BucketUpdatePermissions = 'submit_bucket_update_permissions',
|
||||
BucketUpdateSecurity = 'submit_bucket_update_security',
|
||||
BucketUpdateFileSecurity = 'submit_bucket_update_file_security',
|
||||
BucketUpdateSize = 'submit_bucket_update_size',
|
||||
BucketUpdateCompression = 'submit_bucket_update_compression',
|
||||
BucketUpdateExtensions = 'submit_bucket_update_extensions',
|
||||
FileCreate = 'submit_file_create',
|
||||
FileDelete = 'submit_file_delete',
|
||||
FileUpdatePermissions = 'submit_file_update_permissions'
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
export let value: string;
|
||||
export let event: string = null;
|
||||
export let eventContext = 'click_id_tag';
|
||||
export let appendTo: Parameters<typeof tooltip>['1']['appendTo'] = undefined;
|
||||
|
||||
let content = 'Click to copy';
|
||||
@@ -24,7 +25,7 @@
|
||||
}
|
||||
|
||||
if (event) {
|
||||
trackEvent('click_id_tag', {
|
||||
trackEvent(eventContext, {
|
||||
name: event
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="options-list">
|
||||
<button
|
||||
type="button"
|
||||
class="input-button"
|
||||
class="options-list-button"
|
||||
aria-label="Click to copy."
|
||||
on:click={handleCopy}
|
||||
on:mouseenter={() => setTimeout(() => (content = 'Click to copy'))}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
type EventService
|
||||
} from '$lib/constants';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
// Props
|
||||
export let show = false;
|
||||
@@ -43,14 +44,20 @@
|
||||
|
||||
function create() {
|
||||
show = false;
|
||||
trackEvent('events_add', {
|
||||
value: inputValue
|
||||
});
|
||||
dispatch('created', inputValue);
|
||||
}
|
||||
|
||||
function select(field: 'service', value: EventService);
|
||||
function select(field: 'resource', value: EventResource);
|
||||
function select(field: 'action', value: EventAction);
|
||||
function select(field: 'attribute', value: string);
|
||||
function select(field: string, value: string | EventService | EventResource | EventAction) {
|
||||
function select(field: 'service', value: EventService): void;
|
||||
function select(field: 'resource', value: EventResource): void;
|
||||
function select(field: 'action', value: EventAction): void;
|
||||
function select(field: 'attribute', value: string): void;
|
||||
function select(
|
||||
field: string,
|
||||
value: string | EventService | EventResource | EventAction
|
||||
): void {
|
||||
if (typeof value === 'string') {
|
||||
selected[field as 'attribute'] = selected[field] === value ? null : value;
|
||||
} else {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
await feedback.submitFeedback('feedback-nps', message, name, email, value);
|
||||
console.log(value, message);
|
||||
feedback.switchType('general');
|
||||
} catch (error) {
|
||||
feedback.switchType('general');
|
||||
|
||||
@@ -90,8 +90,14 @@
|
||||
<span class="user-profile-empty-column" />
|
||||
<span class="user-profile-info is-only-desktop">
|
||||
{#if isUser}
|
||||
<p class="text u-x-small">{data?.email}</p>
|
||||
<p class="text u-x-small">{data?.phone}</p>
|
||||
<div class="u-grid u-gap-4">
|
||||
{#if data?.email}
|
||||
<p class="text u-x-small">Email: {data?.email}</p>
|
||||
{/if}
|
||||
{#if data?.phone}
|
||||
<p class="text u-x-small">Phone: {data?.phone}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if isTeam}
|
||||
<p class="text u-x-small">Members: {data?.total}</p>
|
||||
{/if}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { onMount } from 'svelte';
|
||||
import { onDestroy } from 'svelte';
|
||||
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
$: valueChange(search);
|
||||
|
||||
const valueChange = (value: string) => {
|
||||
function valueChange(value: string) {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(async () => {
|
||||
const url = new URL($page.url);
|
||||
@@ -45,10 +46,10 @@
|
||||
}
|
||||
|
||||
url.search = value;
|
||||
|
||||
trackEvent('search');
|
||||
goto(url, { keepFocus: true });
|
||||
}, debounce);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="u-flex u-gap-12 common-section u-main-space-between">
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { Copy } from '.';
|
||||
|
||||
export let show = false;
|
||||
export let value: string;
|
||||
export let copyEvent: string = null;
|
||||
</script>
|
||||
|
||||
<div class="interactive-text-output" class:is-textarea={show}>
|
||||
@@ -17,11 +19,14 @@
|
||||
class="interactive-text-output-button"
|
||||
aria-label="show hidden text"
|
||||
type="button"
|
||||
on:click={() => (show = !show)}
|
||||
on:click={() => {
|
||||
show = !show;
|
||||
trackEvent(`click_secret_${show ? 'show' : 'hide'}`);
|
||||
}}
|
||||
use:tooltip={{ content: show ? 'Hide secret' : 'Show secret', hideOnClick: false }}>
|
||||
<span class:icon-eye-off={show} class:icon-eye={!show} aria-hidden="true" />
|
||||
</button>
|
||||
<Copy {value}>
|
||||
<Copy {value} event={copyEvent} eventContext="click_secret_copy">
|
||||
<button class="interactive-text-output-button" aria-label="copy text" type="button">
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
</button>
|
||||
|
||||
@@ -2,13 +2,6 @@ export const PAGE_LIMIT = 12; // default page limit
|
||||
export const CARD_LIMIT = 6; // default card limit
|
||||
export const INTERVAL = 5 * 60000; // default interval to check for feedback
|
||||
|
||||
export enum Mode {
|
||||
CLOUD = 'cloud',
|
||||
SELF_HOSTED = 'self-hosted'
|
||||
}
|
||||
|
||||
export const growthEndpoint = import.meta.env.VITE_APPWRITE_GROWTH_ENDPOINT;
|
||||
|
||||
export enum Dependencies {
|
||||
ORGANIZATION = 'dependency:organization',
|
||||
PROJECT = 'dependency:project',
|
||||
@@ -251,7 +244,7 @@ export const eventServices: Array<EventService> = [
|
||||
resources: [
|
||||
{ name: 'recovery', actions: [{ name: 'create' }, { name: 'delete' }] },
|
||||
{ name: 'sessions', actions: [{ name: 'create' }, { name: 'delete' }] },
|
||||
{ name: 'verifications', actions: [{ name: 'create' }, { name: 'delete' }] }
|
||||
{ name: 'verification', actions: [{ name: 'create' }, { name: 'delete' }] }
|
||||
],
|
||||
actions: [
|
||||
{ name: 'create' },
|
||||
|
||||
@@ -23,3 +23,4 @@ export { default as InputURL } from './inputURL.svelte';
|
||||
export { default as InputId } from './inputId.svelte';
|
||||
export { default as InputSecret } from './inputSecret.svelte';
|
||||
export { default as Helper } from './helper.svelte';
|
||||
export { default as Label } from './label.svelte';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let optionalText: string | undefined = undefined;
|
||||
@@ -27,12 +27,9 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
{#if optionalText}
|
||||
<span class="optional">{optionalText}</span>
|
||||
{/if}
|
||||
</label>
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -48,7 +48,10 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -39,12 +39,9 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
<span class:u-hide={!showLabel || !optionalText} class="optional">
|
||||
{optionalText}
|
||||
</span>
|
||||
</label>
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper" style="--amount-of-buttons:1; --button-size: 1rem">
|
||||
<input
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -47,7 +47,10 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -41,7 +41,10 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { Trim } from '$lib/components';
|
||||
import { humanFileSize } from '$lib/helpers/sizeConvertion';
|
||||
import { Helper } from '.';
|
||||
|
||||
export let label: string = null;
|
||||
export let files: FileList;
|
||||
export let list = new DataTransfer();
|
||||
export let allowedFileExtensions: string[] = [];
|
||||
export let maxSize: number = null;
|
||||
export let required = false;
|
||||
export let error: string = null;
|
||||
|
||||
let input: HTMLInputElement;
|
||||
let hovering = false;
|
||||
@@ -29,6 +32,20 @@
|
||||
hovering = true;
|
||||
}
|
||||
|
||||
const handleInvalid = (event: Event) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (input.validity.valueMissing) {
|
||||
error = 'This field is required';
|
||||
return;
|
||||
}
|
||||
error = input.validationMessage;
|
||||
};
|
||||
|
||||
$: if (files) {
|
||||
error = null;
|
||||
}
|
||||
|
||||
$: fileArray = files?.length ? Array.from(files) : [];
|
||||
</script>
|
||||
|
||||
@@ -37,7 +54,9 @@
|
||||
bind:this={input}
|
||||
accept={allowedFileExtensions.map((n) => `.${n}`).join(',')}
|
||||
type="file"
|
||||
style="display: none" />
|
||||
style="display: none"
|
||||
{required}
|
||||
on:invalid={handleInvalid} />
|
||||
|
||||
<div>
|
||||
{#if label}
|
||||
@@ -117,4 +136,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let optionalText: string | undefined = undefined;
|
||||
@@ -52,12 +52,9 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
{#if optionalText}
|
||||
<span class="optional">{optionalText}</span>
|
||||
{/if}
|
||||
</label>
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let id: string;
|
||||
export let label: string;
|
||||
@@ -47,7 +47,10 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
{#if showInPlainText}
|
||||
<input
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -46,7 +46,9 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -40,7 +40,9 @@
|
||||
bind:group
|
||||
bind:this={element}
|
||||
on:invalid={handleInvalid} />
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { FormItem } from '.';
|
||||
import { FormItem, Label } from '.';
|
||||
|
||||
export let id: string;
|
||||
export let label: string;
|
||||
@@ -11,7 +11,10 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper" style=" --amount-of-buttons: 1;">
|
||||
{#if showInPlainText}
|
||||
<div
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let id: string;
|
||||
export let label: string;
|
||||
@@ -27,18 +27,23 @@
|
||||
error = element.validationMessage;
|
||||
};
|
||||
|
||||
$: if (element && required && !value) {
|
||||
element.setCustomValidity('This field is required');
|
||||
}
|
||||
|
||||
$: if (element && required && value) {
|
||||
element.setCustomValidity('');
|
||||
}
|
||||
|
||||
$: if (value) {
|
||||
error = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
{#if optionalText}
|
||||
<span class="optional">{optionalText}</span>
|
||||
{/if}
|
||||
</label>
|
||||
</Label>
|
||||
|
||||
<div class="select">
|
||||
<select
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { last } from '$lib/helpers/array';
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let id: string;
|
||||
export let label: string;
|
||||
@@ -77,7 +77,10 @@
|
||||
value={tags.join(',')}
|
||||
{required}
|
||||
on:invalid={handleInvalid} />
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<div class="tags-input">
|
||||
<div class="tags">
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { tooltip as tooltipAction } from '$lib/actions/tooltip';
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let optionalText: string | undefined = undefined;
|
||||
@@ -43,20 +42,9 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>
|
||||
<Label {required} {tooltip} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
{#if tooltip}
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
use:tooltipAction={{
|
||||
content: tooltip
|
||||
}} />
|
||||
{/if}
|
||||
{#if optionalText}
|
||||
<span class="optional">{optionalText}</span>
|
||||
{/if}
|
||||
</label>
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
@@ -72,6 +60,13 @@
|
||||
bind:value
|
||||
bind:this={element}
|
||||
on:invalid={handleInvalid} />
|
||||
{#if maxlength}
|
||||
<span class="text-counter">
|
||||
<span class="text-counter-count">{value?.length ?? 0}</span>
|
||||
<span class="text-counter-separator" />
|
||||
<span class="text-counter-max">{maxlength}</span>
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -37,7 +37,10 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<textarea
|
||||
{id}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper } from '.';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
@@ -50,7 +50,10 @@
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<label class:u-hide={!showLabel} class="label" for={id}>{label}</label>
|
||||
<Label {required} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<script lang="ts">
|
||||
interface $$Props extends Partial<HTMLLabelElement> {
|
||||
required?: boolean;
|
||||
optionalText?: string | undefined;
|
||||
hide?: boolean;
|
||||
tooltip?: string;
|
||||
for?: string;
|
||||
}
|
||||
|
||||
export let required: $$Props['required'] = false;
|
||||
export let optionalText: $$Props['optionalText'] = undefined;
|
||||
export let hide: $$Props['hide'] = false;
|
||||
export let tooltip: $$Props['tooltip'] = null;
|
||||
</script>
|
||||
|
||||
<label class:is-required={required} class:u-hide={hide} class="label" {...$$restProps}>
|
||||
<slot />
|
||||
</label>
|
||||
|
||||
{#if optionalText}
|
||||
<span class="optional">{optionalText}</span>
|
||||
{/if}
|
||||
|
||||
{#if tooltip}
|
||||
<button class="tooltip" aria-label="variables info">
|
||||
<span class="icon-info" aria-hidden="true" />
|
||||
<span class="tooltip-popup" role="tooltip">
|
||||
<p class="text">
|
||||
{tooltip}
|
||||
</p>
|
||||
</span>
|
||||
</button>
|
||||
{/if}
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { EmptySearch, Pagination, Trim } from '$lib/components';
|
||||
import { AvatarInitials, EmptySearch, Pagination, Trim } from '$lib/components';
|
||||
import {
|
||||
TableBody,
|
||||
TableHeader,
|
||||
@@ -11,24 +11,19 @@
|
||||
} from '$lib/elements/table';
|
||||
import { Container } from '$lib/layout';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
|
||||
export let logs: Models.LogList;
|
||||
export let path: string;
|
||||
export let offset = 0;
|
||||
|
||||
const getBrowser = (clientCode: string) => {
|
||||
return sdkForConsole.avatars.getBrowser(clientCode, 40, 40);
|
||||
};
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
{#if logs.total}
|
||||
<TableScroll>
|
||||
<TableHeader>
|
||||
<TableCellHead width={150}>Client</TableCellHead>
|
||||
<TableCellHead width={100}>User</TableCellHead>
|
||||
<TableCellHead width={100}>Event</TableCellHead>
|
||||
<TableCellHead width={80}>Location</TableCellHead>
|
||||
<TableCellHead width={90}>IP</TableCellHead>
|
||||
@@ -38,28 +33,22 @@
|
||||
{#each logs.logs as log}
|
||||
<TableRow>
|
||||
<TableCell title="Client">
|
||||
{#if log.clientName}
|
||||
<div class="u-flex u-cross-center u-gap-12">
|
||||
<div class="avatar is-small">
|
||||
<img
|
||||
height="20"
|
||||
width="20"
|
||||
src={getBrowser(log.clientCode).toString()}
|
||||
alt={log.clientName} />
|
||||
<div class="u-flex u-cross-center u-gap-12">
|
||||
{#if log.userEmail}
|
||||
{#if log.userName}
|
||||
<AvatarInitials size={32} name={log.userName} />
|
||||
<Trim>{log.userName}</Trim>
|
||||
{:else}
|
||||
<AvatarInitials size={32} name={log.userEmail} />
|
||||
<Trim>{log.userEmail}</Trim>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="avatar is-size-small ">
|
||||
<span class="icon-anonymous" aria-hidden="true" />
|
||||
</div>
|
||||
<Trim>
|
||||
{log.clientName}
|
||||
{log.clientVersion}
|
||||
on {log.osName}
|
||||
{log.osVersion}
|
||||
</Trim>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="u-flex u-cross-center u-gap-12">
|
||||
<span class="avatar is-color-empty" />
|
||||
<p class="text u-trim">Unknown</p>
|
||||
</div>
|
||||
{/if}
|
||||
<span class="text u-trim">{log.userName ?? 'Anonymous'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCellText title="Event">{log.event}</TableCellText>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
let showFeedback = false;
|
||||
import { slide } from 'svelte/transition';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
async function logout() {
|
||||
await sdkForConsole.account.deleteSession('current');
|
||||
trackEvent('submit_account_logout');
|
||||
trackEvent(Submit.AccountLogout);
|
||||
await goto(`${base}/login`);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
import { Steps } from '$lib/components';
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -31,6 +33,9 @@
|
||||
const openDialog = document.querySelectorAll('dialog[open]');
|
||||
if (event.key === 'Escape' && !showExitModal && !openDialog?.length) {
|
||||
event.preventDefault();
|
||||
trackEvent('wizard_exit', {
|
||||
from: 'escape'
|
||||
});
|
||||
dispatch('exit');
|
||||
wizard.hide();
|
||||
}
|
||||
@@ -40,6 +45,9 @@
|
||||
if (confirmExit) {
|
||||
showExitModal = true;
|
||||
} else {
|
||||
trackEvent('wizard_exit', {
|
||||
from: 'button'
|
||||
});
|
||||
dispatch('exit');
|
||||
wizard.hide();
|
||||
}
|
||||
@@ -67,8 +75,10 @@
|
||||
|
||||
wizard.setInterceptor(null);
|
||||
if (isLastStep) {
|
||||
trackEvent('wizard_finish');
|
||||
dispatch('finish');
|
||||
} else {
|
||||
trackEvent('wizard_next');
|
||||
currentStep++;
|
||||
}
|
||||
}
|
||||
@@ -129,10 +139,16 @@
|
||||
<Button secondary on:click={handleExit}>Cancel</Button>
|
||||
<Button submit>Next</Button>
|
||||
{:else if isLastStep}
|
||||
<Button secondary on:click={() => currentStep--}>Back</Button>
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => currentStep--}
|
||||
on:click={() => trackEvent('wizard_back')}>Back</Button>
|
||||
<Button submit>{finalAction}</Button>
|
||||
{:else}
|
||||
<Button secondary on:click={() => currentStep--}>Back</Button>
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => currentStep--}
|
||||
on:click={() => trackEvent('wizard_back')}>Back</Button>
|
||||
<Button submit>Next</Button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -142,7 +158,14 @@
|
||||
</section>
|
||||
|
||||
{#if showExitModal}
|
||||
<WizardExitModal bind:show={showExitModal} on:exit={() => wizard.hide()}>
|
||||
<WizardExitModal
|
||||
bind:show={showExitModal}
|
||||
on:exit={() => {
|
||||
trackEvent('wizard_exit', {
|
||||
from: 'prompt'
|
||||
});
|
||||
wizard.hide();
|
||||
}}>
|
||||
<slot name="exit">this process</slot>
|
||||
</WizardExitModal>
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { growthEndpoint } from '$lib/constants';
|
||||
import { VARS } from '$lib/system';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export type AppStore = {
|
||||
@@ -60,8 +60,8 @@ function createFeedbackStore() {
|
||||
email?: string,
|
||||
value?: number
|
||||
) => {
|
||||
if (!growthEndpoint) return;
|
||||
const response = await fetch(`${growthEndpoint}/feedback`, {
|
||||
if (!VARS.GROWTH_ENDPOINT) return;
|
||||
const response = await fetch(`${VARS.GROWTH_ENDPOINT}/feedback`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { VARS } from '$lib/system';
|
||||
import {
|
||||
Account,
|
||||
Avatars,
|
||||
@@ -12,8 +13,7 @@ import {
|
||||
Users
|
||||
} from '@aw-labs/appwrite-console';
|
||||
|
||||
const endpoint =
|
||||
import.meta.env.VITE_APPWRITE_ENDPOINT?.toString() ?? `${window?.location?.origin}/v1`;
|
||||
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`;
|
||||
const clientConsole = new Client();
|
||||
clientConsole.setEndpoint(endpoint).setProject('console');
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import type { SvelteComponent } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
@@ -24,7 +25,7 @@ function createWizardStore() {
|
||||
n.show = true;
|
||||
n.component = component;
|
||||
n.media = media;
|
||||
|
||||
trackEvent('wizard_start');
|
||||
return n;
|
||||
}),
|
||||
setInterceptor: (callback: WizardStore['interceptor']) => {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
export enum Mode {
|
||||
CLOUD = 'cloud',
|
||||
SELF_HOSTED = 'self-hosted'
|
||||
}
|
||||
|
||||
export const VARS = {
|
||||
APPWRITE_ENDPOINT: import.meta.env?.VITE_APPWRITE_ENDPOINT?.toString() as string | undefined,
|
||||
GROWTH_ENDPOINT: import.meta.env?.VITE_APPWRITE_GROWTH_ENDPOINT?.toString() as
|
||||
| string
|
||||
| undefined,
|
||||
CONSOLE_MODE: import.meta.env?.VITE_CONSOLE_MODE?.toString() as string | undefined,
|
||||
VERCEL_ENV: import.meta.env?.VITE_VERCEL_ENV?.toString() as string | undefined,
|
||||
GOOGLE_ANALYTICS: import.meta.env?.VITE_GA_PROJECT?.toString() as string | undefined
|
||||
};
|
||||
|
||||
export const ENV = {
|
||||
DEV: import.meta.env.DEV,
|
||||
PROD: import.meta.env.PROD,
|
||||
PREVIEW: VARS.VERCEL_ENV === 'preview',
|
||||
TEST: !!import.meta.env?.VITEST
|
||||
};
|
||||
|
||||
export const MODE = VARS.CONSOLE_MODE === Mode.CLOUD ? Mode.CLOUD : Mode.SELF_HOSTED;
|
||||
@@ -72,7 +72,9 @@
|
||||
});
|
||||
|
||||
afterNavigate((navigation) => {
|
||||
trackPageView(navigation.to.route.id);
|
||||
if (navigation.type !== 'enter' && navigation.from?.route?.id !== navigation.to.route.id) {
|
||||
trackPageView(navigation.to.route.id);
|
||||
}
|
||||
});
|
||||
|
||||
$: {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import Delete from './delete.svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
let name: string = null,
|
||||
email: string = null,
|
||||
@@ -32,12 +32,13 @@
|
||||
message: 'Name has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_account_update_name');
|
||||
trackEvent(Submit.AccountUpdateName);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.AccountUpdateName);
|
||||
}
|
||||
}
|
||||
async function updateEmail() {
|
||||
@@ -48,12 +49,13 @@
|
||||
message: 'Email has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_account_update_email');
|
||||
trackEvent(Submit.AccountUpdateEmail);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.AccountUpdateEmail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,12 +67,13 @@
|
||||
message: 'Password has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_account_update_password');
|
||||
trackEvent(Submit.AccountUpdatePassword);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.AccountUpdatePassword);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -18,12 +18,13 @@
|
||||
type: 'success',
|
||||
message: `Account was deleted `
|
||||
});
|
||||
trackEvent('submit_account_delete');
|
||||
trackEvent(Submit.AccountDelete);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.AccountDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { Tab, Tabs } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { isTabSelected } from '$lib/helpers/load';
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
async function logout() {
|
||||
await sdkForConsole.account.deleteSession('current');
|
||||
trackEvent('submit_account_logout');
|
||||
trackEvent(Submit.AccountLogout);
|
||||
await goto(`${base}/login`);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import type { PageData } from './$types';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { base } from '$app/paths';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
const logout = async (session: Models.Session) => {
|
||||
await sdkForConsole.account.deleteSession(session.$id);
|
||||
trackEvent('submit_account_delete_session');
|
||||
trackEvent(Submit.AccountDeleteSession);
|
||||
if (session.current) {
|
||||
await goto(`${base}/login`);
|
||||
}
|
||||
@@ -36,7 +36,7 @@
|
||||
};
|
||||
const logoutAll = async () => {
|
||||
await sdkForConsole.account.deleteSessions();
|
||||
trackEvent('submit_account_delete_all_sessions');
|
||||
trackEvent(Submit.AccountDeleteAllSessions);
|
||||
await goto(`${base}/login`);
|
||||
invalidate(Dependencies.ACCOUNT_SESSIONS);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
|
||||
export let show = false;
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
|
||||
const create = async () => {
|
||||
try {
|
||||
const org = await sdkForConsole.teams.create(id ?? 'unique()', name);
|
||||
const org = await sdkForConsole.teams.create(id ?? ID.unique(), name);
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
dispatch('created');
|
||||
await goto(`/console/organization-${org.$id}`);
|
||||
@@ -28,12 +29,15 @@
|
||||
type: 'success',
|
||||
message: `${name} has been created`
|
||||
});
|
||||
trackEvent('submit_organization_create');
|
||||
trackEvent(Submit.OrganizationCreate, {
|
||||
customId: !!id
|
||||
});
|
||||
name = null;
|
||||
id = null;
|
||||
show = false;
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.OrganizationCreate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Card } from '$lib/components';
|
||||
import CustomId from '$lib/components/customId.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
@@ -29,13 +29,17 @@
|
||||
);
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
goto(`/console/project-${project.$id}`);
|
||||
trackEvent('submit_project_create');
|
||||
} catch ({ message }) {
|
||||
trackEvent(Submit.ProjectCreate, {
|
||||
customId: !!id,
|
||||
teamId: org.$id
|
||||
});
|
||||
} catch (error) {
|
||||
loading = false;
|
||||
addNotification({
|
||||
message,
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.ProjectCreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let showCreate = false;
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
type: 'success',
|
||||
message: `Invite has been sent to ${email}`
|
||||
});
|
||||
trackEvent('submit_member_create');
|
||||
trackEvent(Submit.MemberCreate);
|
||||
dispatch('created', team);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.MemberCreate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { InputText, Button, FormList } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let show = false;
|
||||
@@ -23,21 +24,25 @@
|
||||
try {
|
||||
isCreating = true;
|
||||
const project = await sdkForConsole.projects.create(
|
||||
id ?? 'unique()',
|
||||
id ?? ID.unique(),
|
||||
name,
|
||||
teamId,
|
||||
'default'
|
||||
);
|
||||
dispatch('created', project);
|
||||
trackEvent('submit_project_create');
|
||||
trackEvent(Submit.ProjectCreate, {
|
||||
customId: !!id,
|
||||
teamId
|
||||
});
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${name} has been created`
|
||||
});
|
||||
await goto(`/console/project-${project.$id}`);
|
||||
} catch ({ message }) {
|
||||
} catch (e) {
|
||||
isCreating = false;
|
||||
error = message;
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProjectCreate);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
type: 'success',
|
||||
message: `${selectedMember.userName} was deleted from ${selectedMember.teamName}`
|
||||
});
|
||||
trackEvent('submit_member_delete');
|
||||
trackEvent(Submit.MemberDelete);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.MemberDelete);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let showDelete = false;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
type: 'success',
|
||||
message: `${$organization.name} has been deleted`
|
||||
});
|
||||
trackEvent('submit_organization_delete');
|
||||
trackEvent(Submit.OrganizationDelete);
|
||||
if ($organizationList?.total > 1) {
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
goto(`${base}/console/`);
|
||||
@@ -32,6 +32,7 @@
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.OrganizationDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
import Delete from '../../deleteMember.svelte';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import type { PageData } from './$types';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -43,12 +43,13 @@
|
||||
type: 'success',
|
||||
message: `Invite has been sent to ${member.userEmail}`
|
||||
});
|
||||
trackEvent('submit_member_create');
|
||||
trackEvent(Submit.MemberCreate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error
|
||||
});
|
||||
trackError(error, Submit.MemberCreate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { onMount } from 'svelte';
|
||||
import Delete from '../deleteOrganization.svelte';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
let name: string;
|
||||
let showDelete = false;
|
||||
@@ -26,12 +26,13 @@
|
||||
message: 'Name has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_organization_update_name');
|
||||
trackEvent(Submit.OrganizationUpdateName);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.OrganizationUpdateName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -42,14 +42,15 @@
|
||||
provider.enabled ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_provider_update', {
|
||||
trackEvent(Submit.ProviderUpdate, {
|
||||
provider,
|
||||
enabled
|
||||
});
|
||||
provider = null;
|
||||
invalidate(Dependencies.PROJECT);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProviderUpdate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -40,14 +40,15 @@
|
||||
provider.enabled ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_provider_update', {
|
||||
trackEvent(Submit.ProviderUpdate, {
|
||||
provider,
|
||||
enabled
|
||||
});
|
||||
provider = null;
|
||||
invalidate(Dependencies.PROJECT);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProviderUpdate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -40,14 +40,15 @@
|
||||
provider.enabled ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_provider_update', {
|
||||
trackEvent(Submit.ProviderUpdate, {
|
||||
provider,
|
||||
enabled
|
||||
});
|
||||
provider = null;
|
||||
invalidate(Dependencies.PROJECT);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProviderUpdate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { InputText, Button, FormList } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let showCreate = false;
|
||||
@@ -16,7 +17,7 @@
|
||||
|
||||
const create = async () => {
|
||||
try {
|
||||
const team = await sdkForProject.teams.create(id ?? 'unique()', name);
|
||||
const team = await sdkForProject.teams.create(id ?? ID.unique(), name);
|
||||
name = '';
|
||||
showCreate = false;
|
||||
showCustomId = false;
|
||||
@@ -24,10 +25,13 @@
|
||||
type: 'success',
|
||||
message: `${team.name} has been created`
|
||||
});
|
||||
trackEvent('submit_team_create');
|
||||
trackEvent(Submit.TeamCreate, {
|
||||
customId: !!id
|
||||
});
|
||||
dispatch('created', team);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.TeamCreate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements/';
|
||||
import {
|
||||
@@ -12,6 +12,7 @@
|
||||
} from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let showCreate = false;
|
||||
@@ -25,7 +26,7 @@
|
||||
const create = async () => {
|
||||
try {
|
||||
const user = await sdkForProject.users.create(
|
||||
id ?? 'unique()',
|
||||
id ?? ID.unique(),
|
||||
mail,
|
||||
phone,
|
||||
pass,
|
||||
@@ -38,10 +39,13 @@
|
||||
type: 'success',
|
||||
message: `${user.name ? user.name : 'User'} has been created`
|
||||
});
|
||||
trackEvent('submit_user_create');
|
||||
trackEvent(Submit.UserCreate, {
|
||||
customId: !!id
|
||||
});
|
||||
dispatch('created', user);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.UserCreate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -40,14 +40,15 @@
|
||||
provider.enabled ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_provider_update', {
|
||||
trackEvent(Submit.ProviderUpdate, {
|
||||
provider,
|
||||
enabled
|
||||
});
|
||||
provider = null;
|
||||
invalidate(Dependencies.PROJECT);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProviderUpdate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -41,14 +41,15 @@
|
||||
provider.enabled ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_provider_update', {
|
||||
trackEvent(Submit.ProviderUpdate, {
|
||||
provider,
|
||||
enabled
|
||||
});
|
||||
provider = null;
|
||||
invalidate(Dependencies.PROJECT);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProviderUpdate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -41,14 +41,15 @@
|
||||
provider.enabled ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_provider_update', {
|
||||
trackEvent(Submit.ProviderUpdate, {
|
||||
provider,
|
||||
enabled
|
||||
});
|
||||
provider = null;
|
||||
invalidate(Dependencies.PROJECT);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProviderUpdate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -44,14 +44,15 @@
|
||||
provider.enabled ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_provider_update', {
|
||||
trackEvent(Submit.ProviderUpdate, {
|
||||
provider,
|
||||
enabled
|
||||
});
|
||||
provider = null;
|
||||
invalidate(Dependencies.PROJECT);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ProviderUpdate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, InputNumber, InputSelect } from '$lib/elements/forms';
|
||||
@@ -30,12 +30,13 @@
|
||||
type: 'success',
|
||||
message: 'Updated project users limit successfully'
|
||||
});
|
||||
trackEvent('submit_session_length_update');
|
||||
trackEvent(Submit.SessionsLengthUpdate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.SessionsLengthUpdate);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Button, Form, InputNumber } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -18,12 +18,13 @@
|
||||
type: 'success',
|
||||
message: 'Sessions limit has been updated'
|
||||
});
|
||||
trackEvent('submit_sessions_limit_update');
|
||||
trackEvent(Submit.SessionsLimitUpdate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.SessionsLimitUpdate);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
@@ -37,13 +37,14 @@
|
||||
type: 'success',
|
||||
message: 'Updated project users limit successfully'
|
||||
});
|
||||
trackEvent('submit_auth_limit_update');
|
||||
trackEvent(Submit.AuthLimitUpdate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
submitting = false;
|
||||
trackError(error, Submit.AuthLimitUpdate);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { app } from '$lib/stores/app';
|
||||
import { page } from '$app/stores';
|
||||
import type { Provider } from '$lib/stores/oauth-providers';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
const projectId = $page.params.project;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
box.value ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
trackEvent('submit_auth_status_update', {
|
||||
trackEvent(Submit.AuthStatusUpdate, {
|
||||
method: box.method,
|
||||
value: box.value
|
||||
});
|
||||
@@ -39,6 +39,7 @@
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.AuthStatusUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import DeleteTeam from './deleteTeam.svelte';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
let showDelete = false;
|
||||
let teamName: string = null;
|
||||
@@ -28,12 +28,13 @@
|
||||
message: 'Name has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_team_update_name');
|
||||
trackEvent(Submit.TeamUpdateName);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.TeamUpdateName);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal, Alert } from '$lib/components';
|
||||
import { Button, InputEmail, InputText, InputTags, FormList } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -30,13 +30,14 @@
|
||||
type: 'success',
|
||||
message: `${name ? name : email} created successfully`
|
||||
});
|
||||
trackEvent('submit_member_create');
|
||||
trackEvent(Submit.MemberCreate);
|
||||
email = name = '';
|
||||
roles = [];
|
||||
showCreate = false;
|
||||
dispatch('created', user);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.MemberCreate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -23,7 +23,7 @@
|
||||
);
|
||||
showDelete = false;
|
||||
dispatch('deleted');
|
||||
trackEvent('submit_member_delete');
|
||||
trackEvent(Submit.MemberDelete);
|
||||
await goto(
|
||||
`${base}/console/project-${$page.params.project}/auth/teams/team-${selectedMembership.teamId}/members`
|
||||
);
|
||||
@@ -32,6 +32,7 @@
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.MemberDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -16,13 +16,14 @@
|
||||
try {
|
||||
await sdkForProject.teams.delete(team.$id);
|
||||
showDelete = false;
|
||||
trackEvent('submit_team_delete');
|
||||
trackEvent(Submit.TeamDelete);
|
||||
await goto(`${base}/console/project-${$page.params.project}/auth/teams`);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.TeamDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@
|
||||
<TableRowLink
|
||||
href={`${base}/console/project-${project}/auth/user-${membership.userId}`}>
|
||||
<TableCellText title="Name">
|
||||
<div class="u-flex u-gap-12">
|
||||
<div class="u-flex u-gap-12 u-cross-center">
|
||||
<AvatarInitials size={32} name={membership.userName} />
|
||||
<span>{membership.userName ? membership.userName : 'n/a'}</span>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -20,12 +20,13 @@
|
||||
type: 'success',
|
||||
message: 'All sessions have been deleted'
|
||||
});
|
||||
trackEvent('submit_session_delete_all');
|
||||
trackEvent(Submit.SessionDeleteAll);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.SessionDeleteAll);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -26,7 +26,7 @@
|
||||
type: 'success',
|
||||
message: `Membership has been deleted`
|
||||
});
|
||||
trackEvent('submit_member_delete');
|
||||
trackEvent(Submit.MemberDelete);
|
||||
await goto(
|
||||
`${base}/console/project-${$page.params.project}/auth/user-${selectedMembership.userId}/memberships`
|
||||
);
|
||||
@@ -35,6 +35,7 @@
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.MemberDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -19,12 +19,13 @@
|
||||
type: 'success',
|
||||
message: 'Session has been deleted'
|
||||
});
|
||||
trackEvent('submit_session_delete');
|
||||
trackEvent(Submit.SessionDelete);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.SessionDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { user } from './store';
|
||||
import { project } from '../../store';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let showDelete = false;
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
type: 'success',
|
||||
message: `${$user.name ? $user.name : 'User'} has been deleted`
|
||||
});
|
||||
trackEvent('submit_user_delete');
|
||||
trackEvent(Submit.UserDelete);
|
||||
await goto(`${base}/console/project-${$page.params.project}/auth`);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.UserDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form, InputEmail } from '$lib/elements/forms';
|
||||
@@ -22,12 +22,13 @@
|
||||
message: 'Email has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_email');
|
||||
trackEvent(Submit.UserUpdateEmail);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdateEmail);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
@@ -22,12 +22,13 @@
|
||||
message: 'Name has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_name');
|
||||
trackEvent(Submit.UserUpdateName);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdateName);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Button, Form, InputPassword } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -16,12 +16,13 @@
|
||||
message: 'Password has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_password');
|
||||
trackEvent(Submit.UserUpdatePassword);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdatePassword);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form, InputPhone } from '$lib/elements/forms';
|
||||
@@ -22,12 +22,13 @@
|
||||
message: 'Phone has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_phone');
|
||||
trackEvent(Submit.UserUpdatePhone);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdatePhone);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
@@ -43,12 +43,13 @@
|
||||
message: 'Preferences have been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_preferences');
|
||||
trackEvent(Submit.UserUpdatePreferences);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdatePreferences);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { AvatarInitials, CardGrid, DropList, DropListItem, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
@@ -23,12 +23,13 @@
|
||||
}`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_verification_email');
|
||||
trackEvent(Submit.UserUpdateVerificationEmail);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdateVerificationEmail);
|
||||
}
|
||||
}
|
||||
async function updateVerificationPhone() {
|
||||
@@ -42,12 +43,13 @@
|
||||
}`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_verification_phone');
|
||||
trackEvent(Submit.UserUpdateVerificationPhone);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdateVerificationPhone);
|
||||
}
|
||||
}
|
||||
async function updateStatus() {
|
||||
@@ -60,12 +62,13 @@
|
||||
}`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_user_update_status');
|
||||
trackEvent(Submit.UserUpdateStatus);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.UserUpdateStatus);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button, InputText, FormList } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let showCreate = false;
|
||||
@@ -16,19 +18,23 @@
|
||||
|
||||
const create = async () => {
|
||||
try {
|
||||
const database = await sdkForProject.databases.create(id ? id : 'unique()', name);
|
||||
const database = await sdkForProject.databases.create(id ? id : ID.unique(), name);
|
||||
showCreate = false;
|
||||
dispatch('created', database);
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${name} has been created`
|
||||
});
|
||||
trackEvent(Submit.DatabaseCreate, {
|
||||
customId: !!id
|
||||
});
|
||||
name = id = null;
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.DatabaseCreate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -9,7 +9,7 @@
|
||||
import type { Attributes } from '../store';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let showDelete = false;
|
||||
export let selectedAttribute: Attributes;
|
||||
@@ -28,7 +28,7 @@
|
||||
type: 'success',
|
||||
message: `Attribute has been deleted`
|
||||
});
|
||||
trackEvent('submit_attribute_delete');
|
||||
trackEvent(Submit.AttributeDelete);
|
||||
await goto(
|
||||
`${base}/console/project-${$page.params.project}/databases/database-${databaseId}/collection-${$page.params.collection}/attributes`
|
||||
);
|
||||
@@ -37,6 +37,7 @@
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.AttributeDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -8,7 +8,7 @@
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { base } from '$app/paths';
|
||||
import type { Attributes } from './store';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let showCreate = false;
|
||||
|
||||
@@ -36,12 +36,13 @@
|
||||
message: `Attribute ${key} has been created`
|
||||
});
|
||||
showCreate = false;
|
||||
trackEvent('submit_attribute_create');
|
||||
trackEvent(Submit.AttributeCreate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.AttributeCreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -12,7 +12,8 @@
|
||||
import { createDocument } from './wizard/store';
|
||||
import type { WizardStepsType } from '$lib/layout/wizard.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
|
||||
const databaseId = $page.params.database;
|
||||
const collectionId = $page.params.collection;
|
||||
@@ -35,7 +36,7 @@
|
||||
await sdkForProject.databases.createDocument(
|
||||
databaseId,
|
||||
collectionId,
|
||||
$createDocument.id ?? 'unique()',
|
||||
$createDocument.id ?? ID.unique(),
|
||||
$createDocument.document,
|
||||
$createDocument.permissions
|
||||
);
|
||||
@@ -44,7 +45,9 @@
|
||||
message: 'Document has been created',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_document_create');
|
||||
trackEvent(Submit.DocumentCreate, {
|
||||
customId: !!$createDocument.id
|
||||
});
|
||||
invalidate(Dependencies.DOCUMENTS);
|
||||
|
||||
createDocument.reset();
|
||||
@@ -54,6 +57,7 @@
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.DocumentCreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,7 @@
|
||||
import { Permissions } from '$lib/components/permissions';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { collection } from '../store';
|
||||
|
||||
let showDelete = false;
|
||||
@@ -35,12 +35,13 @@
|
||||
message: 'Permissions have been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_document_update_permission');
|
||||
trackEvent(Submit.DocumentUpdatePermissions);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.DocumentUpdatePermissions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -10,7 +10,7 @@
|
||||
export let attributes: Attributes[] = [];
|
||||
export let formValues: object = {};
|
||||
export let customId: string | null | undefined = undefined;
|
||||
export let gap: '16' | '32' = '32';
|
||||
export let gap: '16' | '24' | '32' = '32';
|
||||
|
||||
let showCustomId = false;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{#if attributes.length}
|
||||
<ul class={`form-list u-gap-${gap}`}>
|
||||
{#each attributes as attribute}
|
||||
{@const label = attribute.required ? `${attribute.key}*` : attribute.key}
|
||||
{@const label = attribute.key}
|
||||
{#if attribute.array}
|
||||
{#if formValues[attribute.key].length === 0}
|
||||
<div class="u-flex u-cross-center u-main-space-between">
|
||||
@@ -71,6 +71,7 @@
|
||||
</div>
|
||||
<div class="form-item-part u-cross-child-end">
|
||||
<Button
|
||||
noMargin
|
||||
text
|
||||
on:click={() => removeArrayItem(attribute.key, index)}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
@@ -78,11 +79,11 @@
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
<Button text noMargin on:click={() => addArrayItem(attribute.key)}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text"> Add item</span>
|
||||
</Button>
|
||||
</ul>
|
||||
<Button text noMargin on:click={() => addArrayItem(attribute.key)}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text"> Add item</span>
|
||||
</Button>
|
||||
{/if}
|
||||
{:else}
|
||||
<FormList>
|
||||
|
||||
+1
@@ -22,5 +22,6 @@
|
||||
{id}
|
||||
{label}
|
||||
{optionalText}
|
||||
required={attribute.required}
|
||||
placeholder="Select a value"
|
||||
showLabel={!!label?.length} />
|
||||
|
||||
+1
@@ -13,6 +13,7 @@
|
||||
{id}
|
||||
{label}
|
||||
{optionalText}
|
||||
placeholder="Enter string"
|
||||
showLabel={!!label?.length}
|
||||
required={attribute.required}
|
||||
maxlength={attribute.size}
|
||||
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -25,7 +25,7 @@
|
||||
type: 'success',
|
||||
message: `Document has been deleted`
|
||||
});
|
||||
trackEvent('submit_document_delete');
|
||||
trackEvent(Submit.DocumentDelete);
|
||||
await goto(
|
||||
`${base}/console/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}`
|
||||
);
|
||||
@@ -34,6 +34,7 @@
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.DocumentDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+3
-4
@@ -11,7 +11,7 @@
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import AttributeForm from './attributeForm.svelte';
|
||||
|
||||
let disableUpdate = true;
|
||||
@@ -62,9 +62,7 @@
|
||||
|
||||
currentDoc = JSON.stringify($work);
|
||||
invalidate(Dependencies.DOCUMENT);
|
||||
trackEvent('submit_document_update', {
|
||||
type: 'android'
|
||||
});
|
||||
trackEvent(Submit.DocumentUpdate);
|
||||
disableUpdate = true;
|
||||
addNotification({
|
||||
message: 'Document was updated!',
|
||||
@@ -75,6 +73,7 @@
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.DocumentUpdate);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, FormList, InputSelect, InputText } from '$lib/elements/forms';
|
||||
@@ -80,12 +80,13 @@
|
||||
message: 'Index has been created',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_index_create');
|
||||
trackEvent(Submit.IndexCreate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.IndexCreate);
|
||||
} finally {
|
||||
showCreateIndex = false;
|
||||
creating = false;
|
||||
|
||||
+3
-2
@@ -7,7 +7,7 @@
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let showDelete = false;
|
||||
export let selectedIndex: Models.Index;
|
||||
@@ -28,12 +28,13 @@
|
||||
message: `Index has been deleted`
|
||||
});
|
||||
dispatch('deleted');
|
||||
trackEvent('submit_index_delete');
|
||||
trackEvent(Submit.IndexDelete);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.IndexDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -21,7 +21,7 @@
|
||||
type: 'success',
|
||||
message: `${$collection.name} has been deleted`
|
||||
});
|
||||
trackEvent('submit_collection_delete');
|
||||
trackEvent(Submit.CollectionDelete);
|
||||
await goto(
|
||||
`${base}/console/project-${$page.params.project}/databases/database-${$page.params.database}`
|
||||
);
|
||||
@@ -30,6 +30,7 @@
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.CollectionDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
@@ -33,12 +33,13 @@
|
||||
message: 'Name has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_collection_update_name');
|
||||
trackEvent(Submit.CollectionUpdateName);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.CollectionUpdateName);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Permissions } from '$lib/components/permissions';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
@@ -38,12 +38,13 @@
|
||||
message: 'Permissions have been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_collection_update_permissions');
|
||||
trackEvent(Submit.CollectionUpdatePermissions);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.CollectionUpdatePermissions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, FormList, InputSwitch } from '$lib/elements/forms';
|
||||
@@ -33,12 +33,13 @@
|
||||
message: 'Security has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_collection_update_security');
|
||||
trackEvent(Submit.CollectionUpdateSecurity);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.CollectionUpdateSecurity);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, InputSwitch } from '$lib/elements/forms';
|
||||
@@ -34,12 +34,13 @@
|
||||
message: `${$collection.name} has been updated`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_collection_update_enabled');
|
||||
trackEvent(Submit.CollectionUpdateEnabled);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.CollectionUpdateEnabled);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+2
-1
@@ -13,5 +13,6 @@
|
||||
<AttributeForm
|
||||
bind:formValues={$createDocument.document}
|
||||
attributes={$createDocument.attributes}
|
||||
bind:customId={$createDocument.id} />
|
||||
bind:customId={$createDocument.id}
|
||||
gap="24" />
|
||||
</WizardStep>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button, InputText, FormList } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let showCreate = false;
|
||||
@@ -22,7 +23,7 @@
|
||||
try {
|
||||
const collection = await sdkForProject.databases.createCollection(
|
||||
databaseId,
|
||||
id ? id : 'unique()',
|
||||
id ? id : ID.unique(),
|
||||
name
|
||||
);
|
||||
showCreate = false;
|
||||
@@ -32,12 +33,15 @@
|
||||
message: `${name} has been created`
|
||||
});
|
||||
name = id = null;
|
||||
trackEvent('submit_database_create');
|
||||
trackEvent(Submit.CollectionCreate, {
|
||||
customId: !!id
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.CollectionCreate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -21,12 +21,13 @@
|
||||
message: `${$database.name} has been deleted`
|
||||
});
|
||||
await goto(`${base}/console/project-${$page.params.project}/databases`);
|
||||
trackEvent('submit_database_delete');
|
||||
trackEvent(Submit.DatabaseDelete);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.DatabaseDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+3
-2
@@ -11,7 +11,7 @@
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import Delete from '../delete.svelte';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
let showDelete = false;
|
||||
let showError: false | 'name' | 'email' | 'password' = false;
|
||||
@@ -37,9 +37,10 @@
|
||||
message: 'Name has been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_database_update_name');
|
||||
trackEvent(Submit.DatabaseUpdateName);
|
||||
} catch (error) {
|
||||
addError('name', error.message, 'error');
|
||||
trackError(error, Submit.DatabaseUpdateName);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<GridItem1
|
||||
href={`${base}/console/project-${project}/functions/function-${func.$id}`}>
|
||||
<svelte:fragment slot="title">
|
||||
<div class="u-flex u-gap-32 u-cross-center">
|
||||
<div class="u-flex u-gap-16 u-cross-center">
|
||||
<div class="avatar is-medium">
|
||||
<img
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
|
||||
const projectId = $page.params.project;
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
async function create() {
|
||||
try {
|
||||
const response = await sdkForProject.functions.create(
|
||||
$createFunction.id ?? 'unique()',
|
||||
$createFunction.id ?? ID.unique(),
|
||||
$createFunction.name,
|
||||
$createFunction.execute,
|
||||
$createFunction.runtime,
|
||||
@@ -43,13 +44,16 @@
|
||||
message: `${$createFunction.name} has been created`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent('submit_function_create');
|
||||
trackEvent(Submit.FunctionCreate, {
|
||||
customId: !!$createFunction.id
|
||||
});
|
||||
wizard.hide();
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.FunctionCreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@
|
||||
<div class="common-section">
|
||||
<Heading tag="h3" size="7">Inactive</Heading>
|
||||
</div>
|
||||
{#if data.deployments.total > 1}
|
||||
{#if data.deployments.total > 1 || (!activeDeployment && data.deployments.total === 1)}
|
||||
<TableScroll>
|
||||
<TableHeader>
|
||||
<TableCellHead width={90}>Deployment ID</TableCellHead>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -24,12 +24,13 @@
|
||||
message: `Deployment has been activated`
|
||||
});
|
||||
dispatch('activated');
|
||||
trackEvent('submit_deployment_update');
|
||||
trackEvent(Submit.DeploymentUpdate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.DeploymentUpdate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user