Skip to content

Commit

Permalink
refactor crisp-api, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
annarhughes committed Oct 15, 2024
1 parent e31a2ef commit e187925
Show file tree
Hide file tree
Showing 24 changed files with 374 additions and 282 deletions.
4 changes: 2 additions & 2 deletions docs/key-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ User authentication is handled by [Firebase Auth](https://firebase.google.com/do

Crisp is the messaging platform used to message the Chayn team in relation to bloom course content or other queries and support. For public users, this 1-1 chat feature is available on _live_ courses only. For partner users, This 1-1 chat feature is available to users with a `PartnerAccess` that has 1-1 chat enabled.

Users who have access to 1-1 chat also have a profile on Crisp that reflects data from our database regarding their partners, access and course progress. See [crisp-api.ts](src/api/crisp/crisp-api.ts)
Users who have access to 1-1 chat also have a profile on Crisp that reflects data from our database regarding their partners, access and course progress. See [crisp.service.ts](src/crisp/crisp.service.ts)

### Reporting

Google Data Studio is an online tool for converting data into customizable informative reports and dashboards.

The reports are generated by writing custom sql queries that return actionable data to Data Studio. Filters are applied in Data Studio allowing
data to be segregated into different time periods based on the data createdAt date
data to be segregated into different time periods based on the data createdAt date
60 changes: 0 additions & 60 deletions src/api/crisp/crisp-api.interfaces.ts

This file was deleted.

127 changes: 0 additions & 127 deletions src/api/crisp/crisp-api.ts

This file was deleted.

61 changes: 61 additions & 0 deletions src/crisp/crisp.interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { EMAIL_REMINDERS_FREQUENCY } from 'src/utils/constants';

export enum EVENT_NAME {
CHAT_MESSAGE_SENT = 'CHAT_MESSAGE_SENT',
CHAT_MESSAGE_RECEIVED = 'CHAT_MESSAGE_RECEIVED',
Expand All @@ -10,3 +12,62 @@ export interface ICreateEventLog {
event: EVENT_NAME;
userId: string;
}

export interface CrispProfileCustomFields {
signed_up_at?: string;
last_active_at?: string;
email_reminders_frequency?: EMAIL_REMINDERS_FREQUENCY;
language?: string;
marketing_permission?: boolean;
service_emails_permission?: boolean;
partners?: string;
feature_live_chat?: boolean;
feature_therapy?: boolean;
therapy_sessions_remaining?: number;
therapy_sessions_redeemed?: number;
course_hst?: string;
course_hst_sessions?: string;
course_spst?: string;
course_spst_sessions?: string;
course_dbr?: string;
course_dbr_sessions?: string;
course_iaro?: string;
course_iaro_sessions?: string;
course_rtar?: string;
course_rtar_sessions?: string;
course_rryts?: string;
course_rryts_sessions?: string;
course_ma?: string;
course_ma_sessions?: string;
course_cb?: string;
course_cb_sessions?: string;
}
export interface CrispProfileBase {
email?: string;
person?: {
nickname: string;
locales: string[];
};
segments?: string[];
notepad?: string;
active?: number;
// company?: {}
}

export interface CrispProfileBaseResponse {
error: boolean;
reason: string;
data: CrispProfileBase & {
people_id: string;
};
}

export interface NewCrispProfileBaseResponse {
data: CrispProfileBaseResponse;
}

export interface CrispProfileDataResponse {
error: boolean;
reason: string;
data: { data: CrispProfileCustomFields };
}
Loading

0 comments on commit e187925

Please sign in to comment.