Skip to content

Commit

Permalink
chore: release 1.71.1 (#1960)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored Oct 19, 2023
2 parents 26a3197 + dafb913 commit 7da314c
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 48 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@

> All notable changes to this project will be documented in this file
### [1.71.1-beta.2](https://github.com/open-sauced/insights/compare/v1.71.1-beta.1...v1.71.1-beta.2) (2023-10-19)


### 🐛 Bug Fixes

* add missing info for posthog ([#1958](https://github.com/open-sauced/insights/issues/1958)) ([eb073c0](https://github.com/open-sauced/insights/commit/eb073c0396af337eadcef9a4abab6d6534a02083))
* added more info for Posthog analytics ([23f2316](https://github.com/open-sauced/insights/commit/23f2316e9c39b4ae893aa68398dfed84a4203b85))

### [1.71.1-beta.1](https://github.com/open-sauced/insights/compare/v1.71.0...v1.71.1-beta.1) (2023-10-19)


### 🐛 Bug Fixes

* remove typo error ([cbff543](https://github.com/open-sauced/insights/commit/cbff543fbee4145da56d09cab0ed75c94f804510))
* remove typo error ([#1957](https://github.com/open-sauced/insights/issues/1957)) ([9179cd6](https://github.com/open-sauced/insights/commit/9179cd609bc8a462a3cd14f26dae8b768aecfbfe))

## [1.71.0](https://github.com/open-sauced/insights/compare/v1.70.0...v1.71.0) (2023-10-19)


Expand Down
10 changes: 7 additions & 3 deletions components/molecules/FilterHeader/filter-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@ import ContextThumbnail from "components/atoms/ContextThumbnail/context-thumbnai
import SuperativeSelector from "components/molecules/SuperlativeSelector/superlative-selector";

import useFilterOptions from "lib/hooks/useFilterOptions";
import { useAnalytics } from "lib/utils/analytics";
import { captureAnalytics } from "lib/utils/analytics";
import useFilterPrefetch from "lib/hooks/useFilterPrefetch";
import topicNameFormatting from "lib/utils/topic-name-formatting";
import FilterCardSelect from "components/molecules/FilterCardSelect/filter-card-select";
import getTopicThumbnail from "lib/utils/getTopicThumbnail";
import { interestsType } from "lib/utils/getInterestOptions";
import { getInterestOptions } from "lib/utils/getInterestOptions";
import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import { useFetchUser } from "lib/hooks/useFetchUser";

const HeaderFilter = () => {
const router = useRouter();
const { captureAnalytics } = useAnalytics();
const filterOptions = useFilterOptions();
const topicOptions = getInterestOptions();

const { filterValues } = useFilterPrefetch();
const { filterName, toolName, selectedFilter } = router.query;
const { user } = useSupabaseAuth();
const { data: userInfo } = useFetchUser(user?.user_metadata.user_name);

const filterBtnRouting = (filter: string) => {
captureAnalytics({ title: "Filters", property: "toolsFilter", value: `${filter} applied` });
captureAnalytics({ title: "Filters", property: "toolsFilter", value: `${filter} applied`, userInfo });
return router.push(`/${filterName}/${toolName}/filter/${filter.toLocaleLowerCase()}`);
};

Expand Down
17 changes: 13 additions & 4 deletions components/organisms/ToolsDisplay/tools-display.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from "react";
import { useAnalytics } from "lib/utils/analytics";
import React, { useEffect } from "react";
import { captureAnalytics } from "lib/utils/analytics";
import useSession from "lib/hooks/useSession";
import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import { useFetchUser } from "lib/hooks/useFetchUser";
import Contributors from "../Contributors/contributors";
import Dashboard from "../Dashboard/dashboard";
import Reports from "../Reports/reports";
Expand All @@ -13,9 +15,16 @@ interface ToolProps {

const Tool = ({ tool, repositories }: ToolProps): JSX.Element => {
const { hasReports, waitlisted } = useSession();
const { captureAnalytics } = useAnalytics();
const { user } = useSupabaseAuth();
const { data: userInfo, isLoading } = useFetchUser(user?.user_metadata.user_name);

captureAnalytics({ title: "Tools Display", property: "tools", value: `${tool} selected` });
useEffect(() => {
if (isLoading) {
return;
}

captureAnalytics({ title: "Tools Display", property: "tools", value: `${tool} selected`, userInfo });
}, [tool, userInfo, isLoading]);

switch (tool) {
case "Dashboard":
Expand Down
38 changes: 20 additions & 18 deletions lib/utils/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import posthog from "posthog-js";
import useSupabaseAuth from "lib/hooks/useSupabaseAuth";

interface AnalyticEvent {
title: string;
property: string;
value: string;
userInfo: DbUser | undefined;
}

function initiateAnalytics() {
Expand All @@ -15,27 +15,29 @@ function initiateAnalytics() {
/**
* Captures an analytic event
*
* @param {string} title - The title of the event
* @param {string} property - The property of the event
* @param {string} value - The value of the event
* @param title - The title of the event
* @param property - The property of the event
* @param value - The value of the event
* @param userInfo - The user info for the currently logged in user. Undefined if no user is logged in.
*
*/
function useAnalytics() {
const { user } = useSupabaseAuth();
async function captureAnalytics({ title, property, value, userInfo }: AnalyticEvent) {
const analyticsObject: Record<string, string> = {};

analyticsObject[property] = value;

return {
captureAnalytics({ title, property, value }: AnalyticEvent) {
const analyticsObject: Record<string, string> = {};
// if a user is not logged in, Posthog will generate an anonymous ID
if (userInfo) {
let userProperties = {};

analyticsObject[property] = value;
const { company, coupon_code, is_open_sauced_member, is_onboarded, role } = userInfo;

// if a user is not logged in, Posthog will generate an anonymous ID
if (user) {
posthog.identify(user.user_metadata.sub);
}
// A pro user is anyone with a role of 50 or higher
userProperties = { company, coupon_code, is_open_sauced_member, is_onboarded, is_pro_user: role >= 50 };
posthog.identify(`${userInfo.id}`, userProperties);
}

posthog.capture(title, analyticsObject);
},
};
posthog.capture(title, analyticsObject);
}

export { initiateAnalytics, useAnalytics };
export { initiateAnalytics, captureAnalytics };
4 changes: 2 additions & 2 deletions npm-shrinkwrap.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 @@ -2,7 +2,7 @@
"name": "@open-sauced/insights",
"description": "🍕The dashboard for open source discovery.",
"keywords": [],
"version": "1.71.0",
"version": "1.71.1-beta.2",
"author": "Brian Douglas <[email protected]>",
"private": true,
"license": "Apache 2.0",
Expand Down
2 changes: 1 addition & 1 deletion pages/hub/lists/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const ListsHub: WithPageLayout = () => {
<Text>
Are you sure you want to delete <span className="font-bold text-light-slate-12">{listNameToDelete}</span>?
</Text>
<Text>If you have data on this list that your team is using, they will loose access</Text>
<Text>If you have data on this list that your team is using, they will lose access</Text>
<Text>
<span className="font-bold text-light-slate-12">This action cannot be undone</span>
</Text>
Expand Down
62 changes: 43 additions & 19 deletions pages/start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ import Button from "components/atoms/Button/button";
import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import { setQueryParams } from "lib/utils/query-params";
import useSession from "lib/hooks/useSession";
import { useAnalytics } from "lib/utils/analytics";
import { captureAnalytics } from "lib/utils/analytics";

import useStore from "lib/store";
import { getInterestOptions } from "lib/utils/getInterestOptions";
import LanguagePill from "components/atoms/LanguagePill/LanguagePill";

import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "components/atoms/Select/select";
import { timezones } from "lib/utils/timezones";
import { useFetchUser } from "lib/hooks/useFetchUser";

type handleLoginStep = () => void;
type stepKeys = "1" | "2" | "3";
Expand All @@ -45,13 +46,20 @@ interface LoginStep1Props {
}

const LoginStep1: React.FC<LoginStep1Props> = ({ user }) => {
const { captureAnalytics } = useAnalytics();
const { data: userInfo, isLoading } = useFetchUser(user?.user_metadata.user_name);

captureAnalytics({
title: "User Onboarding",
property: "onboardingStep1",
value: "visited",
});
useEffect(() => {
if (isLoading) {
return;
}

captureAnalytics({
title: "User Onboarding",
property: "onboardingStep1",
value: "visited",
userInfo,
});
}, [userInfo, isLoading]);

const router = useRouter();
const { onboarded } = useSession();
Expand Down Expand Up @@ -121,15 +129,23 @@ interface LoginStep2Props {
}

const LoginStep2: React.FC<LoginStep2Props> = ({ handleUpdateInterests: handleUpdateInterestsParent }) => {
const { captureAnalytics } = useAnalytics();
const [selectedInterests, setSelectedInterests] = useState<string[]>([]);
const interestArray = getInterestOptions();
const { user } = useSupabaseAuth();
const { data: userInfo, isLoading } = useFetchUser(user?.user_metadata.user_name);

captureAnalytics({
title: "User Onboarding",
property: "onboardingStep2",
value: "visited",
});
useEffect(() => {
if (isLoading) {
return;
}

captureAnalytics({
title: "User Onboarding",
property: "onboardingStep2",
value: "visited",
userInfo,
});
}, [userInfo, isLoading]);

const handleSelectInterest = (interest: string) => {
if (selectedInterests.length > 0 && selectedInterests.includes(interest)) {
Expand Down Expand Up @@ -186,13 +202,21 @@ interface LoginStep3Props {
}

const LoginStep3: React.FC<LoginStep3Props> = ({ interests, user }) => {
const { captureAnalytics } = useAnalytics();
const { data: userInfo, isLoading } = useFetchUser(user?.user_metadata.user_name);

useEffect(() => {
if (isLoading) {
return;
}

captureAnalytics({
title: "User Onboarding",
property: "onboardingStep3",
value: "visited",
userInfo,
});
}, [userInfo, isLoading]);

captureAnalytics({
title: "User Onboarding",
property: "onboardingStep3",
value: "visited",
});
const store = useStore();
const router = useRouter();
const { sessionToken } = useSupabaseAuth();
Expand Down

0 comments on commit 7da314c

Please sign in to comment.