mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: analytics for auth
This commit is contained in:
1 parent
072417c140
commit
6f1762ffd3
31 files changed
+311
-49
No files matched your search
@@ -2,7 +2,7 @@ import type { Action } from 'svelte/action';
|
||||
|
||||
export type AnalyticsActionParam = {
|
||||
name: string;
|
||||
action: string;
|
||||
action?: string;
|
||||
category?: string;
|
||||
label?: string;
|
||||
parameters?: Record<string, string>;
|
||||
@@ -22,6 +22,16 @@ export const event: Action<HTMLElement, Partial<AnalyticsActionParam>> = (node,
|
||||
});
|
||||
};
|
||||
|
||||
export function sendEvent(event: {
|
||||
action: string;
|
||||
label?: string;
|
||||
category?: string;
|
||||
data?: object;
|
||||
}): void {
|
||||
console.log(`send event ${event.action}`)
|
||||
//TODO: implement analytics
|
||||
}
|
||||
|
||||
const isTrackingAllowed = () => {
|
||||
if (!('gtag' in window)) {
|
||||
return false;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
{:else}
|
||||
<button
|
||||
on:click|preventDefault
|
||||
data-event={`create_${target}`}
|
||||
type="button"
|
||||
class="card u-grid u-cross-center u-width-full-line dashed">
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
|
||||
|
||||
@@ -153,8 +153,6 @@
|
||||
inputData = null;
|
||||
showInput = false;
|
||||
}
|
||||
|
||||
//TODO: remove inline style
|
||||
</script>
|
||||
|
||||
<Modal bind:show on:submit={create} size="big">
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
export let fullWidth = false;
|
||||
export let ariaLabel: string = null;
|
||||
export let noMargin = false;
|
||||
export let event: string = null;
|
||||
</script>
|
||||
|
||||
{#if href}
|
||||
@@ -25,7 +26,8 @@
|
||||
class:is-danger={danger}
|
||||
class:is-full-width={fullWidth}
|
||||
class:u-padding-inline-0={noMargin}
|
||||
aria-label={ariaLabel}>
|
||||
aria-label={ariaLabel}
|
||||
data-event={event}>
|
||||
<slot />
|
||||
</a>
|
||||
{:else}
|
||||
@@ -40,7 +42,8 @@
|
||||
class:is-full-width={fullWidth}
|
||||
class:u-padding-inline-0={noMargin}
|
||||
type={submit ? 'submit' : 'button'}
|
||||
aria-label={ariaLabel}>
|
||||
aria-label={ariaLabel}
|
||||
data-event={event}>
|
||||
<slot />
|
||||
</button>
|
||||
{/if}
|
||||
@@ -11,6 +11,7 @@
|
||||
import { Progress, Notifications } from '$lib/layout';
|
||||
import { loading } from './store';
|
||||
import Loading from './loading.svelte';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
if (browser) {
|
||||
window.VERCEL_ANALYTICS_ID = import.meta.env.VERCEL_ANALYTICS_ID?.toString() ?? false;
|
||||
@@ -52,6 +53,21 @@
|
||||
}
|
||||
});
|
||||
|
||||
function track(event: MouseEvent) {
|
||||
const target = event.target as HTMLElement;
|
||||
|
||||
if (target.hasAttribute('data-event')) {
|
||||
const value = target.getAttribute('data-event');
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
sendEvent({
|
||||
action: `click_${value}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$: {
|
||||
if (browser) {
|
||||
if ($app.theme === 'auto') {
|
||||
@@ -86,6 +102,7 @@
|
||||
</script>
|
||||
{/if}
|
||||
</svelte:head>
|
||||
<svelte:window on:click={track} />
|
||||
|
||||
<Notifications />
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -24,7 +25,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDelete} on:submit={deleteAccount} warning>
|
||||
<Modal
|
||||
bind:show={showDelete}
|
||||
on:submit={deleteAccount}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_account_delete'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete Account</svelte:fragment>
|
||||
<p>Are you sure you want to delete your account?</p>
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let show = false;
|
||||
|
||||
@@ -36,7 +37,15 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={create} size="big" bind:show>
|
||||
<Modal
|
||||
{error}
|
||||
on:submit={create}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_organization_create'
|
||||
})}
|
||||
size="big"
|
||||
bind:show>
|
||||
<svelte:fragment slot="header">Create New Organization</svelte:fragment>
|
||||
<FormList>
|
||||
<InputText
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let showCreate = false;
|
||||
|
||||
@@ -44,7 +45,15 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal {error} size="big" bind:show={showCreate} on:submit={create}>
|
||||
<Modal
|
||||
{error}
|
||||
size="big"
|
||||
bind:show={showCreate}
|
||||
on:submit={create}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_organization_member_invite'
|
||||
})}>
|
||||
<svelte:fragment slot="header">Invite Member</svelte:fragment>
|
||||
<FormList>
|
||||
<InputEmail
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { InputText, Button, FormList } from '$lib/elements/forms';
|
||||
@@ -41,7 +42,15 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={create} size="big" bind:show>
|
||||
<Modal
|
||||
{error}
|
||||
on:submit={create}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_project_create'
|
||||
})}
|
||||
size="big"
|
||||
bind:show>
|
||||
<svelte:fragment slot="header">Create Project</svelte:fragment>
|
||||
<FormList>
|
||||
<InputText
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
@@ -40,7 +41,14 @@
|
||||
$: isUser = selectedMember?.userId === $user?.$id;
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDelete} on:submit={deleteMembership} warning>
|
||||
<Modal
|
||||
bind:show={showDelete}
|
||||
on:submit={deleteMembership}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_organization_member_delete'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">
|
||||
{isUser ? 'Leave Organization' : 'Delete Member'}
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let showDelete = false;
|
||||
|
||||
@@ -34,7 +35,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal on:submit={deleteOrg} bind:show={showDelete} warning>
|
||||
<Modal
|
||||
on:submit={deleteOrg}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_organization_delete'
|
||||
})}
|
||||
bind:show={showDelete}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete Organization</svelte:fragment>
|
||||
<p>
|
||||
Are you sure you want to delete <b>{$organization.name}</b>? All projects ({$organization.total})
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -51,7 +52,19 @@
|
||||
$: secret = keyID && teamID && p8 ? JSON.stringify({ keyID, teamID, p8 }) : provider.secret;
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={update} size="big" show on:close>
|
||||
<Modal
|
||||
{error}
|
||||
on:submit={update}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_provider_update',
|
||||
data: {
|
||||
provider
|
||||
}
|
||||
})}
|
||||
size="big"
|
||||
show
|
||||
on:close>
|
||||
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
|
||||
<FormList>
|
||||
<p>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -52,7 +53,19 @@
|
||||
: provider.secret;
|
||||
</script>
|
||||
|
||||
<Modal {error} size="big" show on:submit={update} on:close>
|
||||
<Modal
|
||||
{error}
|
||||
size="big"
|
||||
show
|
||||
on:submit={update}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_provider_update',
|
||||
data: {
|
||||
provider
|
||||
}
|
||||
})}
|
||||
on:close>
|
||||
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
|
||||
<FormList>
|
||||
<p>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { InputText, Button, FormList } from '$lib/elements/forms';
|
||||
@@ -35,7 +36,15 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal {error} size="big" bind:show={showCreate} on:submit={create}>
|
||||
<Modal
|
||||
{error}
|
||||
size="big"
|
||||
bind:show={showCreate}
|
||||
on:submit={create}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_team_create'
|
||||
})}>
|
||||
<svelte:fragment slot="header">Create Team</svelte:fragment>
|
||||
<FormList>
|
||||
<InputText
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements/';
|
||||
import {
|
||||
@@ -52,7 +53,15 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal {error} size="big" bind:show={showCreate} on:submit={create}>
|
||||
<Modal
|
||||
{error}
|
||||
size="big"
|
||||
bind:show={showCreate}
|
||||
on:submit={create}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_create'
|
||||
})}>
|
||||
<svelte:fragment slot="header">Create User</svelte:fragment>
|
||||
<FormList>
|
||||
<InputText
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -48,7 +49,19 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal {error} size="big" show on:submit={update} on:close>
|
||||
<Modal
|
||||
{error}
|
||||
size="big"
|
||||
show
|
||||
on:submit={update}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_provider_update',
|
||||
data: {
|
||||
provider
|
||||
}
|
||||
})}
|
||||
on:close>
|
||||
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
|
||||
<FormList>
|
||||
<p>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -51,7 +52,19 @@
|
||||
clientSecret && tenantID ? JSON.stringify({ clientSecret, tenantID }) : provider.secret;
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={update} size="big" show on:close>
|
||||
<Modal
|
||||
{error}
|
||||
on:submit={update}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_provider_update',
|
||||
data: {
|
||||
provider
|
||||
}
|
||||
})}
|
||||
size="big"
|
||||
show
|
||||
on:close>
|
||||
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
|
||||
<FormList>
|
||||
<p>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let provider: Provider;
|
||||
|
||||
@@ -55,7 +56,19 @@
|
||||
: provider.secret;
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={update} size="big" show on:close>
|
||||
<Modal
|
||||
{error}
|
||||
on:submit={update}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_provider_update',
|
||||
data: {
|
||||
provider
|
||||
}
|
||||
})}
|
||||
size="big"
|
||||
show
|
||||
on:close>
|
||||
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
|
||||
<FormList>
|
||||
<p>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
type: 'team'
|
||||
}
|
||||
}}>
|
||||
<Button on:click={() => (showCreate = true)}>
|
||||
<Button on:click={() => (showCreate = true)} event="create_team">
|
||||
<span class="icon-plus" aria-hidden="true" /> <span class="text">Create team</span>
|
||||
</Button>
|
||||
</span>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import DeleteTeam from './deleteTeam.svelte';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
let showDelete = false;
|
||||
let teamName: string = null;
|
||||
@@ -52,7 +53,12 @@
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
|
||||
<Form on:submit={updateName}>
|
||||
<Form
|
||||
on:submit={updateName}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_team_update_name'
|
||||
})}>
|
||||
<CardGrid>
|
||||
<Heading tag="h6" size="7">Update Name</Heading>
|
||||
|
||||
@@ -68,11 +74,7 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button
|
||||
disabled={teamName === $team.name || !teamName}
|
||||
on:click={() => {
|
||||
updateName();
|
||||
}}>Update</Button>
|
||||
<Button submit disabled={teamName === $team.name || !teamName}>Update</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Form>
|
||||
@@ -99,7 +101,8 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button secondary on:click={() => (showDelete = true)}>Delete</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)} event="delete_team"
|
||||
>Delete</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Container>
|
||||
|
||||
+10
-1
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { sendEvent } 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';
|
||||
@@ -39,7 +40,15 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={create} size="big" bind:show={showCreate}>
|
||||
<Modal
|
||||
{error}
|
||||
on:submit={create}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_member_create'
|
||||
})}
|
||||
size="big"
|
||||
bind:show={showCreate}>
|
||||
<svelte:fragment slot="header">Create Membership</svelte:fragment>
|
||||
<FormList>
|
||||
<InputEmail
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -34,7 +35,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDelete} on:submit={deleteMembership} warning>
|
||||
<Modal
|
||||
bind:show={showDelete}
|
||||
on:submit={deleteMembership}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_member_delete'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete Member</svelte:fragment>
|
||||
<p>
|
||||
Are you sure you want to delete <b>{selectedMembership.userName}</b> from '{selectedMembership.teamName}'?
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -25,7 +26,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDelete} on:submit={deleteTeam} warning>
|
||||
<Modal
|
||||
bind:show={showDelete}
|
||||
on:submit={deleteTeam}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_team_delete'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete Team</svelte:fragment>
|
||||
|
||||
<p>
|
||||
|
||||
+8
-5
@@ -12,7 +12,7 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Container } from '$lib/layout';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import type { PageData } from './$types';
|
||||
@@ -28,14 +28,14 @@
|
||||
|
||||
const project = $page.params.project;
|
||||
|
||||
async function memberCreated(event: CustomEvent<Models.Membership>) {
|
||||
await goto(`${base}/console/project-${project}/auth/teams-${event.detail.teamId}/members`);
|
||||
async function memberCreated() {
|
||||
invalidate(Dependencies.MEMBERSHIPS);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<SearchQuery search={data.search} placeholder="Search by ID">
|
||||
<Button on:click={() => (showCreate = true)}>
|
||||
<Button on:click={() => (showCreate = true)} event="create_membership">
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Create membership</span>
|
||||
</Button>
|
||||
@@ -70,7 +70,10 @@
|
||||
selectedMembership = membership;
|
||||
showDelete = true;
|
||||
}}>
|
||||
<span class="icon-trash" aria-hidden="true" />
|
||||
<span
|
||||
class="icon-trash"
|
||||
data-event="delete_membership"
|
||||
aria-hidden="true" />
|
||||
</button>
|
||||
</TableCellText>
|
||||
</TableRowLink>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
$: if (prefs) {
|
||||
if (JSON.stringify(prefs) !== JSON.stringify(Object.entries($user.prefs))) {
|
||||
@@ -61,7 +62,7 @@
|
||||
showVerifcationDropdown = false;
|
||||
try {
|
||||
await sdkForProject.users.updateEmailVerification($user.$id, !$user.emailVerification);
|
||||
$user.emailVerification = !$user.emailVerification;
|
||||
invalidate(Dependencies.USER);
|
||||
addNotification({
|
||||
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
|
||||
$user.emailVerification ? 'verified' : 'unverified'
|
||||
@@ -73,6 +74,10 @@
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
} finally {
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_verification_email'
|
||||
});
|
||||
}
|
||||
}
|
||||
async function updateVerificationPhone() {
|
||||
@@ -91,6 +96,10 @@
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
} finally {
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_verification_phone'
|
||||
});
|
||||
}
|
||||
}
|
||||
async function updateStatus() {
|
||||
@@ -103,6 +112,9 @@
|
||||
}`,
|
||||
type: 'success'
|
||||
});
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_status'
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
@@ -246,8 +258,8 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button text={$user.status} secondary={!$user.status} on:click={() => updateStatus()}
|
||||
>{$user.status ? 'Block account' : 'Unblock account'}
|
||||
<Button text={$user.status} secondary={!$user.status} on:click={() => updateStatus()}>
|
||||
{$user.status ? 'Block account' : 'Unblock account'}
|
||||
</Button>
|
||||
{#if $user.status}
|
||||
{#if $user.phone && $user.email}
|
||||
@@ -280,7 +292,12 @@
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
|
||||
<Form on:submit={updateName}>
|
||||
<Form
|
||||
on:submit={updateName}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_name'
|
||||
})}>
|
||||
<CardGrid>
|
||||
<Heading tag="h6" size="7">Update Name</Heading>
|
||||
|
||||
@@ -301,7 +318,12 @@
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
<Form on:submit={updateEmail}>
|
||||
<Form
|
||||
on:submit={updateEmail}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_email'
|
||||
})}>
|
||||
<CardGrid>
|
||||
<Heading tag="h6" size="7">Update Email</Heading>
|
||||
<svelte:fragment slot="aside">
|
||||
@@ -321,7 +343,12 @@
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
<Form on:submit={updatePhone}>
|
||||
<Form
|
||||
on:submit={updatePhone}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_phone'
|
||||
})}>
|
||||
<CardGrid>
|
||||
<Heading tag="h6" size="7">Update Phone</Heading>
|
||||
<svelte:fragment slot="aside">
|
||||
@@ -341,7 +368,12 @@
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
<Form on:submit={updatePassword}>
|
||||
<Form
|
||||
on:submit={updatePassword}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_password'
|
||||
})}>
|
||||
<CardGrid>
|
||||
<div>
|
||||
<Heading tag="h6" size="7">Update Password</Heading>
|
||||
@@ -369,7 +401,12 @@
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
<Form on:submit={updatePrefs}>
|
||||
<Form
|
||||
on:submit={updatePrefs}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_update_preferences'
|
||||
})}>
|
||||
<CardGrid>
|
||||
<Heading tag="h6" size="7">User Preferences</Heading>
|
||||
<p>
|
||||
@@ -483,7 +520,7 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button secondary on:click={() => (showDelete = true)}>Delete</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)} event="delete_user">Delete</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Container>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -28,7 +29,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDeleteAll} on:submit={deleteAllSessions} warning>
|
||||
<Modal
|
||||
bind:show={showDeleteAll}
|
||||
on:submit={deleteAllSessions}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_session_delete_all'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete All Sessions</svelte:fragment>
|
||||
<p>
|
||||
Are you sure you want to delete <b>all of {$user.name}'s sessions?</b>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -37,7 +38,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDelete} on:submit={deleteMembership} warning>
|
||||
<Modal
|
||||
bind:show={showDelete}
|
||||
on:submit={deleteMembership}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_member_delete'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete Member</svelte:fragment>
|
||||
{#if selectedMembership}
|
||||
<p>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -27,7 +28,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDelete} on:submit={deleteSession} warning>
|
||||
<Modal
|
||||
bind:show={showDelete}
|
||||
on:submit={deleteSession}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_session_delete'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete Sessions</svelte:fragment>
|
||||
|
||||
<p>Are you sure you want to delete this session?</p>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { user } from './store';
|
||||
import { project } from '../../store';
|
||||
import { sendEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let showDelete = false;
|
||||
|
||||
@@ -29,7 +30,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal bind:show={showDelete} on:submit={deleteUser} warning>
|
||||
<Modal
|
||||
bind:show={showDelete}
|
||||
on:submit={deleteUser}
|
||||
on:submit={() =>
|
||||
sendEvent({
|
||||
action: 'submit_auth_user_delete'
|
||||
})}
|
||||
warning>
|
||||
<svelte:fragment slot="header">Delete User</svelte:fragment>
|
||||
<p>Are you sure you want to delete <b>{$user.name}</b> from '{$project.name}'?</p>
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@
|
||||
selectedMembership = membership;
|
||||
showDelete = true;
|
||||
}}>
|
||||
<span class="icon-trash" aria-hidden="true" />
|
||||
<span class="icon-trash" aria-hidden="true" data-event="delete_membership" />
|
||||
</button>
|
||||
</TableCell>
|
||||
</TableRowLink>
|
||||
|
||||
@@ -95,7 +95,6 @@
|
||||
{/if}
|
||||
<div class="u-flex u-margin-block-start-32 u-main-space-between">
|
||||
<p class="text">Total results: {data.sessions.total}</p>
|
||||
<!-- <Pagination limit={PAGE_LIMIT} bind:offset={$offset} sum={data.sessions.total} /> -->
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
|
||||
Reference in new issue
Block a user