diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 0ce5f5cf5..29448eb58 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -321,5 +321,7 @@ export enum Submit { MessagingTopicUpdatePermissions = 'submit_messaging_topic_update_permissions', MessagingTopicSubscriberAdd = 'submit_messaging_topic_subscriber_add', MessagingTopicSubscriberDelete = 'submit_messaging_topic_subscriber_delete', - ApplyQuickFilter = 'submit_apply_quick_filter' + ApplyQuickFilter = 'submit_apply_quick_filter', + RequestBAA = 'submit_request_baa', + RequestSoc2 = 'submit_request_soc2' } diff --git a/src/lib/components/bottomModalAlert.svelte b/src/lib/components/bottomModalAlert.svelte index c0623b24d..ec070db93 100644 --- a/src/lib/components/bottomModalAlert.svelte +++ b/src/lib/components/bottomModalAlert.svelte @@ -52,7 +52,7 @@ function handleClose() { const modalAlert = currentModalAlert; dismissBottomModalAlert(modalAlert.id); - hideNotification(modalAlert.id); + hideNotification(modalAlert.id, { coolOffPeriod: 24 * 365 }); if (modalAlert.closed) modalAlert.closed(); if (currentIndex === filteredModalAlerts.length - 1 && filteredModalAlerts.length > 1) { diff --git a/src/lib/components/progressBarBig.svelte b/src/lib/components/progressBarBig.svelte index e858e53d9..01d47ed26 100644 --- a/src/lib/components/progressBarBig.svelte +++ b/src/lib/components/progressBarBig.svelte @@ -26,7 +26,7 @@

{maxValue} - {maxUnit && maxUnit} + {maxUnit ? maxUnit : ''}

{/if} diff --git a/src/lib/helpers/sizeConvertion.ts b/src/lib/helpers/sizeConvertion.ts index 00709e4de..5d1f7c73b 100644 --- a/src/lib/helpers/sizeConvertion.ts +++ b/src/lib/helpers/sizeConvertion.ts @@ -14,6 +14,7 @@ export function calculateSize(bytes: number, decimals = 1, base: 1000 | 1024 = 1 } export function sizeToBytes(value: number, unit: Size, base = 1000) { + if (typeof value !== 'number') return 0; const index = sizes.indexOf(unit); return value * Math.pow(base, index); } diff --git a/src/lib/helpers/unit.ts b/src/lib/helpers/unit.ts index 9d14b32df..bc24429bd 100644 --- a/src/lib/helpers/unit.ts +++ b/src/lib/helpers/unit.ts @@ -70,7 +70,7 @@ export function createTimeUnitPair(initialValue = 0) { { name: 'Minutes', value: 60 }, { name: 'Seconds', value: 1 } ]; - return { ...createValueUnitPair(initialValue, units), units }; + return { ...createValueUnitPair(initialValue || 0, units), units }; } export function createByteUnitPair(initialValue = 0, base: 1000 | 1024 = 1000) { diff --git a/src/routes/(console)/account/payments/+page.ts b/src/routes/(console)/account/payments/+page.ts index d2a85ed56..983d611cb 100644 --- a/src/routes/(console)/account/payments/+page.ts +++ b/src/routes/(console)/account/payments/+page.ts @@ -10,7 +10,6 @@ export const load: PageLoad = async ({ depends }) => { sdk.forConsole.billing.listPaymentMethods(), sdk.forConsole.billing.listAddresses() ]); - return { paymentMethods, addressList diff --git a/src/routes/(console)/account/payments/billingAddress.svelte b/src/routes/(console)/account/payments/billingAddress.svelte index ad447c467..5df72574e 100644 --- a/src/routes/(console)/account/payments/billingAddress.svelte +++ b/src/routes/(console)/account/payments/billingAddress.svelte @@ -18,7 +18,6 @@ import EditAddressModal from './editAddressModal.svelte'; import type { Address } from '$lib/sdk/billing'; import { organizationList, type Organization } from '$lib/stores/organization'; - import { tooltip } from '$lib/actions/tooltip'; import { base } from '$app/paths'; import { Pill } from '$lib/elements'; @@ -29,6 +28,7 @@ let showDelete = false; let showDropdown = []; let countryList: Models.CountryList; + let showLinked = []; onMount(async () => { countryList = await sdk.forProject.locale.listCountries(); @@ -76,26 +76,28 @@ {#if linkedOrgs?.length > 0} -
-

This billing address is linked to the following organizations:

- ${linkedOrgs - .map( - (org) => - `${org.name}` - ) - .join('')} -
` - }}> - + + (showLinked[i] = !showLinked[i])}> linked to organization - + +

+ This billing address is linked to the following + organizations: +

+
+ {#each linkedOrgs as org} + + {org.name} + + {/each} +
+
+
{/if}
diff --git a/src/routes/(console)/account/payments/paymentMethods.svelte b/src/routes/(console)/account/payments/paymentMethods.svelte index 0a1e7acf6..e8f4c479a 100644 --- a/src/routes/(console)/account/payments/paymentMethods.svelte +++ b/src/routes/(console)/account/payments/paymentMethods.svelte @@ -20,7 +20,6 @@ import { paymentMethods } from '$lib/stores/billing'; import type { PaymentMethodData } from '$lib/sdk/billing'; import { organizationList, type Organization } from '$lib/stores/organization'; - import { tooltip } from '$lib/actions/tooltip'; import { base } from '$app/paths'; import EditPaymentModal from './editPaymentModal.svelte'; import DeletePaymentModal from './deletePaymentModal.svelte'; @@ -34,6 +33,7 @@ let showDelete = false; let showEdit = false; let isLinked = false; + let showLinked = []; $: orgList = $organizationList.teams as unknown as Organization[]; @@ -68,27 +68,34 @@
{#if linkedOrgs?.length > 0} -
-

This payment method is linked to the following organizations:

- ${linkedOrgs - .map( - (org) => - `${org.name}` - ) - .join('')} -
` - }}> - + + + (showLinked[i] = !showLinked[i])}> linked to organization -
+ +

+ This payment method is linked to the + following organizations: +

+
+ {#each linkedOrgs as org} + + {org.name} + + {/each} +
+
+ {/if} + Replace + { + showRemove = true; + showBillingAddressDropdown = false; + }}> + Remove + @@ -166,3 +176,6 @@ {#if showReplace} {/if} +{#if showRemove} + +{/if} diff --git a/src/routes/(console)/organization-[organization]/billing/deleteOrgPayment.svelte b/src/routes/(console)/organization-[organization]/billing/deleteOrgPayment.svelte index e2de60520..e1e9f3ee8 100644 --- a/src/routes/(console)/organization-[organization]/billing/deleteOrgPayment.svelte +++ b/src/routes/(console)/organization-[organization]/billing/deleteOrgPayment.svelte @@ -6,17 +6,17 @@ import { sdk } from '$lib/stores/sdk'; import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; import { organization } from '$lib/stores/organization'; - import { Dependencies } from '$lib/constants'; + import { BillingPlan, Dependencies } from '$lib/constants'; export let showDelete = false; export let isBackup = false; export let disabled = false; + export let hasOtherMethod = false; let error: string; async function removeDefaultMethod() { - if (!$organization.paymentMethodId || !$organization.backupPaymentMethodId) return; - showDelete = false; + if ($organization?.billingPlan !== BillingPlan.FREE && !hasOtherMethod) return; try { await sdk.forConsole.billing.removeOrganizationPaymentMethod($organization.$id); @@ -26,13 +26,16 @@ }); trackEvent(Submit.OrganizationPaymentDelete); invalidate(Dependencies.ORGANIZATION); + showDelete = false; } catch (e) { error = e.message; trackError(e, Submit.OrganizationPaymentDelete); + } finally { + showDelete = false; } } async function removeBackuptMethod() { - if (!$organization.paymentMethodId || !$organization.backupPaymentMethodId) return; + if ($organization?.billingPlan !== BillingPlan.FREE && !hasOtherMethod) return; showDelete = false; try { @@ -43,6 +46,7 @@ }); trackEvent(Submit.OrganizationBackupPaymentDelete); invalidate(Dependencies.ORGANIZATION); + showDelete = false; } catch (e) { error = e.message; trackError(e, Submit.OrganizationBackupPaymentDelete); diff --git a/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte b/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte index cba630b1b..4e7bdbcdc 100644 --- a/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte +++ b/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte @@ -10,7 +10,7 @@ DropListItem, Heading } from '$lib/components'; - import { Dependencies } from '$lib/constants'; + import { BillingPlan, Dependencies } from '$lib/constants'; import { addNotification } from '$lib/stores/notifications'; import { organization } from '$lib/stores/organization'; import { Button } from '$lib/elements/forms'; @@ -325,10 +325,12 @@ {/if} {#if showDelete && isCloud && hasStripePublicKey} + {@const hasOtherMethod = isSelectedBackup + ? !!$organization?.paymentMethodId + : !!$organization?.backupPaymentMethodId} + disabled={$organization?.billingPlan !== BillingPlan.FREE && !hasOtherMethod} /> {/if} diff --git a/src/routes/(console)/organization-[organization]/billing/removeAddress.svelte b/src/routes/(console)/organization-[organization]/billing/removeAddress.svelte new file mode 100644 index 000000000..ae83c7399 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/billing/removeAddress.svelte @@ -0,0 +1,47 @@ + + + +

+ Are you sure you want to remove the billing address from {$organization?.name}? +

+ + + + +
diff --git a/src/routes/(console)/organization-[organization]/settings/+page.svelte b/src/routes/(console)/organization-[organization]/settings/+page.svelte index 840754307..ee06bc6e8 100644 --- a/src/routes/(console)/organization-[organization]/settings/+page.svelte +++ b/src/routes/(console)/organization-[organization]/settings/+page.svelte @@ -12,6 +12,8 @@ import DownloadDPA from './downloadDPA.svelte'; import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; import { isCloud } from '$lib/system'; + import Baa from './BAA.svelte'; + import Soc2 from './Soc2.svelte'; export let data; let name: string; @@ -67,6 +69,8 @@ {#if isCloud} + + {/if} diff --git a/src/routes/(console)/organization-[organization]/settings/BAA.svelte b/src/routes/(console)/organization-[organization]/settings/BAA.svelte new file mode 100644 index 000000000..970735832 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/settings/BAA.svelte @@ -0,0 +1,36 @@ + + + +
+ BAA +
+

After requesting a BAA, we will contact you via email for the next steps.

+ + +
+ Business Associate Agreement (BAA) +
+

+ A Business Associate Agreement (BAA) is a HIPAA-required document ensuring outside + services handling patient information for a healthcare organization follow privacy + rules. +

+ +
+
+
+ + diff --git a/src/routes/(console)/organization-[organization]/settings/BAAModal.svelte b/src/routes/(console)/organization-[organization]/settings/BAAModal.svelte new file mode 100644 index 000000000..64f71e559 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/settings/BAAModal.svelte @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + diff --git a/src/routes/(console)/organization-[organization]/settings/Soc2.svelte b/src/routes/(console)/organization-[organization]/settings/Soc2.svelte new file mode 100644 index 000000000..b4c882e77 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/settings/Soc2.svelte @@ -0,0 +1,36 @@ + + + +
+ Soc-2 +
+

After requesting Soc-2, we will contact you via email for the next steps.

+ + +
+ Service Organization Control Type 2 (Soc-2) +
+

+ Soc-2 is a framework for managing and protecting sensitive information, ensuring + compliance with trust service criteria such as security, availability, processing + integrity, confidentiality, and privacy. +

+ +
+
+
+ + diff --git a/src/routes/(console)/organization-[organization]/settings/Soc2Modal.svelte b/src/routes/(console)/organization-[organization]/settings/Soc2Modal.svelte new file mode 100644 index 000000000..1a17a8c52 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/settings/Soc2Modal.svelte @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index cfa038e9f..5e716cfab 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -237,7 +237,7 @@ diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte index 3b922bc98..c7fc534de 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte @@ -59,7 +59,7 @@ Project breakdown - Project + Project Usage {#if $canSeeProjects} @@ -68,7 +68,7 @@ {#each groupByProject(metric).sort((a, b) => b.usage - a.usage) as project} - + {getProjectName(project.projectId)} {format(project.usage)} diff --git a/src/routes/(console)/project-[project]/auth/security/updateMockNumbers.svelte b/src/routes/(console)/project-[project]/auth/security/updateMockNumbers.svelte index f73df991f..9db581f0b 100644 --- a/src/routes/(console)/project-[project]/auth/security/updateMockNumbers.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updateMockNumbers.svelte @@ -22,7 +22,6 @@ let numbers: Models.MockNumber[] = $project?.authMockNumbers ?? []; let initialNumbers = []; - let projectId: string = $project.$id; $: initialNumbers = $project?.authMockNumbers?.map((num) => ({ ...num })) ?? []; $: isSubmitDisabled = JSON.stringify(numbers) === JSON.stringify(initialNumbers); @@ -39,7 +38,7 @@ async function updateMockNumbers() { try { - await sdk.forConsole.projects.updateMockNumbers(projectId, numbers); + await sdk.forConsole.projects.updateMockNumbers($project.$id, numbers); await invalidate(Dependencies.PROJECT); addNotification({ type: 'success', diff --git a/src/routes/(console)/project-[project]/auth/security/updatePasswordDictionary.svelte b/src/routes/(console)/project-[project]/auth/security/updatePasswordDictionary.svelte index 2cc776a02..67b9ad5a6 100644 --- a/src/routes/(console)/project-[project]/auth/security/updatePasswordDictionary.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updatePasswordDictionary.svelte @@ -8,13 +8,12 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - const projectId = $project.$id; - let passwordDictionary = $project.authPasswordDictionary ?? false; + let passwordDictionary = $project?.authPasswordDictionary ?? false; async function updatePasswordDictionary() { try { await sdk.forConsole.projects.updateAuthPasswordDictionary( - projectId, + $project.$id, passwordDictionary ); await invalidate(Dependencies.PROJECT); @@ -56,7 +55,7 @@ -
diff --git a/src/routes/(console)/project-[project]/auth/security/updatePasswordHistory.svelte b/src/routes/(console)/project-[project]/auth/security/updatePasswordHistory.svelte index 40bfec487..a308e9962 100644 --- a/src/routes/(console)/project-[project]/auth/security/updatePasswordHistory.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updatePasswordHistory.svelte @@ -9,15 +9,14 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - const projectId = $project.$id; - let passwordHistory = $project.authPasswordHistory < 1 ? 5 : $project.authPasswordHistory; - let passwordHistoryEnabled = ($project.authPasswordHistory ?? 0) != 0; + let passwordHistory = $project?.authPasswordHistory < 1 ? 5 : $project?.authPasswordHistory; + let passwordHistoryEnabled = ($project?.authPasswordHistory ?? 0) !== 0; let initialPasswordHistoryEnabled = passwordHistoryEnabled; async function updatePasswordHistoryLimit() { try { await sdk.forConsole.projects.updateAuthPasswordHistory( - projectId, + $project.$id, passwordHistoryEnabled ? passwordHistory : 0 ); await invalidate(Dependencies.PROJECT); @@ -67,8 +66,8 @@ diff --git a/src/routes/(console)/project-[project]/auth/security/updatePersonalDataCheck.svelte b/src/routes/(console)/project-[project]/auth/security/updatePersonalDataCheck.svelte index 2a758875f..2bee05aed 100644 --- a/src/routes/(console)/project-[project]/auth/security/updatePersonalDataCheck.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updatePersonalDataCheck.svelte @@ -9,7 +9,7 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - let authPersonalDataCheck = $project.authPersonalDataCheck ?? false; + let authPersonalDataCheck = $project?.authPersonalDataCheck ?? false; async function updatePersonalDataCheck() { try { @@ -50,7 +50,7 @@ - diff --git a/src/routes/(console)/project-[project]/auth/security/updateSessionAlerts.svelte b/src/routes/(console)/project-[project]/auth/security/updateSessionAlerts.svelte index 7ad63290c..c6f176ffa 100644 --- a/src/routes/(console)/project-[project]/auth/security/updateSessionAlerts.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updateSessionAlerts.svelte @@ -9,7 +9,7 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - let authSessionAlerts = $project.authSessionAlerts ?? false; + let authSessionAlerts = $project?.authSessionAlerts ?? false; async function updateSessionAlerts() { try { @@ -46,7 +46,7 @@ - diff --git a/src/routes/(console)/project-[project]/auth/security/updateSessionLength.svelte b/src/routes/(console)/project-[project]/auth/security/updateSessionLength.svelte index 848f2bbf8..cbac619cb 100644 --- a/src/routes/(console)/project-[project]/auth/security/updateSessionLength.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updateSessionLength.svelte @@ -9,13 +9,12 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - const projectId = $project.$id; - const { value, unit, baseValue, units } = createTimeUnitPair($project.authDuration); + const { value, unit, baseValue, units } = createTimeUnitPair($project?.authDuration); const options = units.map((v) => ({ label: v.name, value: v.name })); async function updateSessionLength() { try { - await sdk.forConsole.projects.updateAuthDuration(projectId, $baseValue); + await sdk.forConsole.projects.updateAuthDuration($project.$id, $baseValue); await invalidate(Dependencies.PROJECT); addNotification({ diff --git a/src/routes/(console)/project-[project]/auth/security/updateSessionsLimit.svelte b/src/routes/(console)/project-[project]/auth/security/updateSessionsLimit.svelte index 5fe3d16f9..2172756ba 100644 --- a/src/routes/(console)/project-[project]/auth/security/updateSessionsLimit.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updateSessionsLimit.svelte @@ -8,13 +8,11 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - const projectId = $project.$id; - - let maxSessions = $project.authSessionsLimit; + let maxSessions = $project?.authSessionsLimit; async function updateSessionsLimit() { try { - await sdk.forConsole.projects.updateAuthSessionsLimit(projectId, maxSessions); + await sdk.forConsole.projects.updateAuthSessionsLimit($project.$id, maxSessions); await invalidate(Dependencies.PROJECT); addNotification({ @@ -43,7 +41,7 @@ - + diff --git a/src/routes/(console)/project-[project]/auth/security/updateUsersLimit.svelte b/src/routes/(console)/project-[project]/auth/security/updateUsersLimit.svelte index e2ec75549..6f67ceae0 100644 --- a/src/routes/(console)/project-[project]/auth/security/updateUsersLimit.svelte +++ b/src/routes/(console)/project-[project]/auth/security/updateUsersLimit.svelte @@ -10,15 +10,13 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - const projectId = $project.$id; - - let isLimited = $project.authLimit !== 0; - let newLimit = isLimited ? $project.authLimit : 100; + let isLimited = $project?.authLimit !== 0; + let newLimit = isLimited ? $project?.authLimit : 100; $: btnDisabled = (function isBtnDisabled() { if ( - (!isLimited && $project.authLimit === 0) || - (isLimited && $project.authLimit === newLimit) + (!isLimited && $project?.authLimit === 0) || + (isLimited && $project?.authLimit === newLimit) ) { return true; } @@ -28,7 +26,7 @@ async function updateLimit() { try { - await sdk.forConsole.projects.updateAuthLimit(projectId, isLimited ? newLimit : 0); + await sdk.forConsole.projects.updateAuthLimit($project?.$id, isLimited ? newLimit : 0); await invalidate(Dependencies.PROJECT); addNotification({ type: 'success', diff --git a/src/routes/(console)/project-[project]/auth/templates/+page.svelte b/src/routes/(console)/project-[project]/auth/templates/+page.svelte index 59ccc5fa7..369080543 100644 --- a/src/routes/(console)/project-[project]/auth/templates/+page.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/+page.svelte @@ -33,11 +33,9 @@ diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte index fb6103a3c..fbd5bca71 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte @@ -16,7 +16,6 @@ import Create from './create.svelte'; import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system'; import { readOnly } from '$lib/stores/billing'; - import { project } from '../../store'; import { writable } from 'svelte/store'; import type { Column } from '$lib/helpers/types'; import Table from './table.svelte'; @@ -199,7 +198,7 @@ {/if} diff --git a/src/routes/(console)/project-[project]/messaging/topics/table.svelte b/src/routes/(console)/project-[project]/messaging/topics/table.svelte index 120df5849..971430a88 100644 --- a/src/routes/(console)/project-[project]/messaging/topics/table.svelte +++ b/src/routes/(console)/project-[project]/messaging/topics/table.svelte @@ -16,12 +16,12 @@ } from '$lib/elements/table'; import { addNotification } from '$lib/stores/notifications'; import type { PageData } from './$types'; - import { project } from '$routes/(console)/project-[project]/store'; import { invalidate } from '$app/navigation'; import { Dependencies } from '$lib/constants'; import { sdk } from '$lib/stores/sdk'; import { toLocaleDateTime } from '$lib/helpers/date'; import type { Column } from '$lib/helpers/types'; + import { page } from '$app/stores'; import { canWriteTopics } from '$lib/stores/roles'; export let columns: Column[]; @@ -75,7 +75,7 @@ {#each data.topics.topics as topic (topic.$id)} + href={`${base}/project-${$page.params.project}/messaging/topics/topic-${topic.$id}`}> {#if $canWriteTopics} {/if}