Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"dependencies": {
"@tanstack/react-query": "^5.83.0",
"attio": "0.0.1-experimental.20250813.2",
"attio": "0.0.1-experimental.20250829.2",
"event-target-polyfill": "^0.0.4",
"match-sorter": "8.0.3",
"react": "19.0.0",
Expand Down
34 changes: 34 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type {App} from "attio/client"

import {companyLogCustomerRequestAction} from "./record/actions/company-log-customer-request-action"
import {companyViewCompanyAction} from "./record/actions/company-view-company-action"
import {dealLogCustomerRequestAction} from "./record/actions/deal-log-customer-request-action"
import {personLogCustomerRequestAction} from "./record/actions/person-log-customer-request-action"
import {companyCustomerRequestCount} from "./record/widgets/company-customer-request-count-widget"
import {customerRequestTextSelectionCallInsightAction} from "./text-selection/customer-request-call-insight-action"
import {customerRequestTextSelectionCallSummaryAction} from "./text-selection/customer-request-call-summary-action"
import {customerRequestTranscriptSelectionAction} from "./text-selection/customer-request-transcript-action"

export const app: App = {
record: {
actions: [
companyLogCustomerRequestAction,
companyViewCompanyAction,
dealLogCustomerRequestAction,
personLogCustomerRequestAction,
],
bulkActions: [],
widgets: [companyCustomerRequestCount],
},
callRecording: {
insight: {
textActions: [customerRequestTextSelectionCallInsightAction],
},
summary: {
textActions: [customerRequestTextSelectionCallSummaryAction],
},
transcript: {
textActions: [customerRequestTranscriptSelectionAction],
},
},
}
4 changes: 2 additions & 2 deletions src/record/actions/company-log-customer-request-action.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type {RecordAction} from "attio/client"
import type {App} from "attio/client"
import {showDialog} from "attio/client"
import {LogCustomerRequestDialog} from "../../components/log-customer-request-dialog"
import ensureConnection from "../../utils/ensure-connection.server"
import {ensureCustomerRequestsEnabled} from "../../utils/ensure-customer-requests-enabled"

export const recordAction: RecordAction = {
export const companyLogCustomerRequestAction: App.Record.Action = {
id: "company-log-customer-request-action",
onTrigger: async ({recordId}) => {
await ensureConnection()
Expand Down
6 changes: 3 additions & 3 deletions src/record/actions/company-view-company-action.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {showToast, type RecordAction} from "attio/client"

import type {App} from "attio/client"
import {showToast} from "attio/client"
import {viewCompanyInLinear} from "../../utils/view-company-in-linear"

export const recordAction: RecordAction = {
export const companyViewCompanyAction: App.Record.Action = {
id: "company-view-company-action",
onTrigger: async ({recordId}) => {
await viewCompanyInLinear(recordId).catch((error) => {
Expand Down
4 changes: 2 additions & 2 deletions src/record/actions/deal-log-customer-request-action.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {RecordAction} from "attio/client"
import type {App} from "attio/client"
import {runQuery, showDialog, showToast} from "attio/client"
import {LogCustomerRequestDialog} from "../../components/log-customer-request-dialog"
import GetCompanyIdByDealId from "../../graphql/get-company-id-by-deal-id.graphql"
import ensureConnection from "../../utils/ensure-connection.server"
import {ensureCustomerRequestsEnabled} from "../../utils/ensure-customer-requests-enabled"

export const recordAction: RecordAction = {
export const dealLogCustomerRequestAction: App.Record.Action = {
id: "deal-log-customer-request-action",
onTrigger: async ({recordId}) => {
await ensureConnection()
Expand Down
4 changes: 2 additions & 2 deletions src/record/actions/person-log-customer-request-action.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {RecordAction} from "attio/client"
import type {App} from "attio/client"
import {runQuery, showDialog, showToast} from "attio/client"
import {LogCustomerRequestDialog} from "../../components/log-customer-request-dialog"
import GetCompanyByPersonId from "../../graphql/get-company-id-by-person-id.graphql"
import ensureConnection from "../../utils/ensure-connection.server"
import {ensureCustomerRequestsEnabled} from "../../utils/ensure-customer-requests-enabled"

export const recordAction: RecordAction = {
export const personLogCustomerRequestAction: App.Record.Action = {
id: "person-log-customer-request-action",
onTrigger: async ({recordId}) => {
await ensureConnection()
Expand Down
4 changes: 2 additions & 2 deletions src/record/widgets/company-customer-request-count-widget.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type {RecordWidget} from "attio/client"
import {runQuery, showToast, Widget} from "attio/client"
import React from "react"
import "event-target-polyfill"
import "yet-another-abortcontroller-polyfill"

import {QueryClient, QueryClientProvider, useSuspenseQuery} from "@tanstack/react-query"
import type {App} from "attio/client"
import GetCompanyById from "../../graphql/get-company-by-id.graphql"
import {createCustomerUrl} from "../../linear/customers/create-customer-url"
import getCustomerByCompanyRecordId from "../../linear/customers/get-customer-by-company-record-id.server"
Expand Down Expand Up @@ -59,7 +59,7 @@ const LoadingWidget = ({recordId}: {recordId: string}) => {
)
}

export const recordWidget: RecordWidget = {
export const companyCustomerRequestCount: App.Record.Widget = {
id: "company-customer-request-count",
label: "Customer requests",
color: "#5e6ad2",
Expand Down
5 changes: 3 additions & 2 deletions src/text-selection/customer-request-call-insight-action.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {type CallRecordingInsightTextSelectionAction, showDialog} from "attio/client"
import type {App} from "attio/client"
import {showDialog} from "attio/client"
import {LogCustomerRequestDialog} from "../components/log-customer-request-dialog"

export const callRecordingInsightTextSelectionAction: CallRecordingInsightTextSelectionAction = {
export const customerRequestTextSelectionCallInsightAction: App.CallRecording.Insight.TextAction = {
id: "customer-request-text-selection-call-insight-action",
label: "Log customer request",
onTrigger: async ({markdown}) => {
Expand Down
5 changes: 3 additions & 2 deletions src/text-selection/customer-request-call-summary-action.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {type CallRecordingSummaryTextSelectionAction, showDialog} from "attio/client"
import type {App} from "attio/client"
import {showDialog} from "attio/client"
import {LogCustomerRequestDialog} from "../components/log-customer-request-dialog"

export const callRecordingSummaryTextSelectionAction: CallRecordingSummaryTextSelectionAction = {
export const customerRequestTextSelectionCallSummaryAction: App.CallRecording.Summary.TextAction = {
id: "customer-request-text-selection-call-summary-action",
label: "Log customer request",
onTrigger: async ({markdown}) => {
Expand Down
58 changes: 29 additions & 29 deletions src/text-selection/customer-request-transcript-action.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {type CallRecordingTranscriptTextSelectionAction, showDialog} from "attio/client"
import type {App} from "attio/client"
import {showDialog} from "attio/client"
import {LogCustomerRequestDialog} from "../components/log-customer-request-dialog"

export const callRecordingTranscriptTextSelectionAction: CallRecordingTranscriptTextSelectionAction =
{
id: "customer-request-transcript-selection-action",
label: "Log customer request",
onTrigger: async ({
transcript,
url,
}: {
transcript: {speaker: string; text: string}[]
url: string
}) => {
await showDialog({
title: "Log customer request",
Dialog: ({hideDialog}: {hideDialog: () => void}) => {
const quote = transcript
.map(({speaker, text}) => `> **${speaker}**: ${text}`)
.join("\n> \n")
return (
<LogCustomerRequestDialog
description={`## Transcript\n${quote}\n`}
attachmentUrl={url}
onDone={hideDialog}
/>
)
},
})
},
}
export const customerRequestTranscriptSelectionAction: App.CallRecording.Transcript.TextAction = {
id: "customer-request-transcript-selection-action",
label: "Log customer request",
onTrigger: async ({
transcript,
url,
}: {
transcript: {speaker: string; text: string}[]
url: string
}) => {
await showDialog({
title: "Log customer request",
Dialog: ({hideDialog}: {hideDialog: () => void}) => {
const quote = transcript
.map(({speaker, text}) => `> **${speaker}**: ${text}`)
.join("\n> \n")
return (
<LogCustomerRequestDialog
description={`## Transcript\n${quote}\n`}
attachmentUrl={url}
onDone={hideDialog}
/>
)
},
})
},
}