From e27670bd8464830c2d051948fc7f0a5fbc2c034f Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Fri, 28 Apr 2023 00:48:04 +0800 Subject: --- docs/lib/ConvertKitApi.ts | 118 +++++----- docs/lib/useTurborepoMinutesSaved.ts | 76 +++---- docs/package.json | 3 +- docs/public/.drawio/.gitkeep | 1 - ...47\263\273\346\236\266\346\236\204.drawio.html" | 12 - docs/public/images/logos/color/authdog.svg | 192 ++++++++-------- docs/public/images/logos/white/authdog.svg | 242 ++++++++++----------- 7 files changed, 316 insertions(+), 328 deletions(-) delete mode 100644 docs/public/.drawio/.gitkeep delete mode 100644 "docs/public/.drawio/\346\260\264\347\263\273\346\236\266\346\236\204.drawio.html" diff --git a/docs/lib/ConvertKitApi.ts b/docs/lib/ConvertKitApi.ts index 3e35ec9..c2915a1 100644 --- a/docs/lib/ConvertKitApi.ts +++ b/docs/lib/ConvertKitApi.ts @@ -1,59 +1,59 @@ -import axios from "axios"; - -const API_KEY = process.env.CONVERTKIT_API_KEY; -const API_SECRET = process.env.CONVERTKIT_API_SECRET; - -const Http = axios.create({ - baseURL: "https://api.convertkit.com/v3", - headers: { - "Content-Type": "application/json; charset=utf-8", - }, -}); - -export function subscribeToForm({ - formId, - email, - firstName, - fields, -}: { - formId: string; - email: string; - firstName: string; - fields?: Record; -}): Promise { - return Http(`/forms/${formId}/subscribe`, { - method: "POST", - data: { api_key: API_KEY, email, first_name: firstName, fields }, - }).then((res) => res.data.subscription?.subscriber); -} - -export function updateSubscriber( - id: string, - update: Subscriber -): Promise { - return Http(`/subscribers/${id}`, { - method: "PUT", - data: { - api_secret: API_SECRET, - ...update, - }, - }).then((res) => res.data); -} - -export interface Subscriber { - id: number; - first_name: string; - email_address: string; - state: string; // maybe 'active' | 'inactive' - created_at: string; - fields: Record; -} - -export function getSubscriber(id: string): Promise { - return Http(`/subscribers/${id}`, { - method: "GET", - data: { - api_secret: API_SECRET, - }, - }).then((res) => res.data.subscriber); -} \ No newline at end of file +import axios from "axios"; + +const API_KEY = process.env.CONVERTKIT_API_KEY; +const API_SECRET = process.env.CONVERTKIT_API_SECRET; + +const Http = axios.create({ + baseURL: "https://api.convertkit.com/v3", + headers: { + "Content-Type": "application/json; charset=utf-8", + }, +}); + +export function subscribeToForm({ + formId, + email, + firstName, + fields, +}: { + formId: string; + email: string; + firstName: string; + fields?: Record; +}): Promise { + return Http(`/forms/${formId}/subscribe`, { + method: "POST", + data: { api_key: API_KEY, email, first_name: firstName, fields }, + }).then((res) => res.data.subscription?.subscriber); +} + +export function updateSubscriber( + id: string, + update: Subscriber +): Promise { + return Http(`/subscribers/${id}`, { + method: "PUT", + data: { + api_secret: API_SECRET, + ...update, + }, + }).then((res) => res.data); +} + +export interface Subscriber { + id: number; + first_name: string; + email_address: string; + state: string; // maybe 'active' | 'inactive' + created_at: string; + fields: Record; +} + +export function getSubscriber(id: string): Promise { + return Http(`/subscribers/${id}`, { + method: "GET", + data: { + api_secret: API_SECRET, + }, + }).then((res) => res.data.subscriber); +} diff --git a/docs/lib/useTurborepoMinutesSaved.ts b/docs/lib/useTurborepoMinutesSaved.ts index 5a94a91..4689ca7 100644 --- a/docs/lib/useTurborepoMinutesSaved.ts +++ b/docs/lib/useTurborepoMinutesSaved.ts @@ -1,38 +1,38 @@ -import useSWR from "swr"; -import axios from "axios"; - -const fetcher = (url) => axios.get(url).then((res) => res.data); - -const path = - "https://api.us-east.tinybird.co/v0/pipes/turborepo_time_saved_ticker.json?token=p.eyJ1IjogIjAzYzA0Y2MyLTM1YTAtNDhhNC05ZTZjLThhMWE0NGNhNjhkZiIsICJpZCI6ICJmOWIzMTU5Yi0wOTVjLTQyM2UtOWIwNS04ZDZlNzIyNjEwNzIifQ.A3TOPdm3Lhmn-1x5m6jNvulCQbbgUeQfAIO3IaaAt5k"; - -const REFRESH_INTERVAL_IN_MS = 3500; - -interface QueryResponse { - meta: { name: string; type: string }[]; - data: { - last_update_time: string; - remote_cache_minutes_saved: number; - local_cache_minutes_saved: number; - }[]; - rows: number; - statistics: { - elapsed: number; - rows_read: number; - bytes_read: number; - }; -} - -export default function useTurborepoMinutesSaved(): - | { - last_update_time: string; - remote_cache_minutes_saved: number; - local_cache_minutes_saved: number; - } - | undefined { - const swr = useSWR(path, fetcher, { - refreshInterval: REFRESH_INTERVAL_IN_MS, - }); - - return swr.data?.data[0]; -} \ No newline at end of file +import useSWR from "swr"; +import axios from "axios"; + +const fetcher = (url) => axios.get(url).then((res) => res.data); + +const path = + "https://api.us-east.tinybird.co/v0/pipes/turborepo_time_saved_ticker.json?token=p.eyJ1IjogIjAzYzA0Y2MyLTM1YTAtNDhhNC05ZTZjLThhMWE0NGNhNjhkZiIsICJpZCI6ICJmOWIzMTU5Yi0wOTVjLTQyM2UtOWIwNS04ZDZlNzIyNjEwNzIifQ.A3TOPdm3Lhmn-1x5m6jNvulCQbbgUeQfAIO3IaaAt5k"; + +const REFRESH_INTERVAL_IN_MS = 3500; + +interface QueryResponse { + meta: { name: string; type: string }[]; + data: { + last_update_time: string; + remote_cache_minutes_saved: number; + local_cache_minutes_saved: number; + }[]; + rows: number; + statistics: { + elapsed: number; + rows_read: number; + bytes_read: number; + }; +} + +export default function useTurborepoMinutesSaved(): + | { + last_update_time: string; + remote_cache_minutes_saved: number; + local_cache_minutes_saved: number; + } + | undefined { + const swr = useSWR(path, fetcher, { + refreshInterval: REFRESH_INTERVAL_IN_MS, + }); + + return swr.data?.data[0]; +} diff --git a/docs/package.json b/docs/package.json index 0c4758a..3a0af2b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,7 +12,7 @@ "schema": "turbo-types-generate ./public/schema.json" }, "author": "简律纯", - "license": "MIT", + "license": "MPL-2.0", "dependencies": { "@headlessui/react": "^1.7.3", "@heroicons/react": "1.0.6", @@ -36,6 +36,7 @@ }, "devDependencies": { "@babel/core": "7.20.12", + "@turbo/types": "workspace:*", "@types/node": "^16.11.12", "@types/react": "18.0.21", "autoprefixer": "10.4.14", diff --git a/docs/public/.drawio/.gitkeep b/docs/public/.drawio/.gitkeep deleted file mode 100644 index 8b13789..0000000 --- a/docs/public/.drawio/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git "a/docs/public/.drawio/\346\260\264\347\263\273\346\236\266\346\236\204.drawio.html" "b/docs/public/.drawio/\346\260\264\347\263\273\346\236\266\346\236\204.drawio.html" deleted file mode 100644 index bc21685..0000000 --- "a/docs/public/.drawio/\346\260\264\347\263\273\346\236\266\346\236\204.drawio.html" +++ /dev/null @@ -1,12 +0,0 @@ - - - -diagrams.net - - - - -
- - - diff --git a/docs/public/images/logos/color/authdog.svg b/docs/public/images/logos/color/authdog.svg index 7396cf3..74f798d 100644 --- a/docs/public/images/logos/color/authdog.svg +++ b/docs/public/images/logos/color/authdog.svg @@ -1,96 +1,96 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/public/images/logos/white/authdog.svg b/docs/public/images/logos/white/authdog.svg index 0226d3d..24f24b0 100644 --- a/docs/public/images/logos/white/authdog.svg +++ b/docs/public/images/logos/white/authdog.svg @@ -1,121 +1,121 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -IAM Streamlined - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +IAM Streamlined + -- cgit v1.2.3-70-g09d2