From 66ac5495211aeedbfff2fed4943b979f16a4b8f0 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Wed, 30 Jul 2025 23:04:42 +0700 Subject: [PATCH] feat: instagram, only english labels --- .npmrc | 2 +- apps/frontend/next.config.js | 12 ++--- apps/frontend/src/app/global-error.tsx | 5 ++ .../integrations/social/instagram.provider.ts | 46 ++++++++++++++++++- 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/.npmrc b/.npmrc index c651c781..2de02d59 100644 --- a/.npmrc +++ b/.npmrc @@ -2,4 +2,4 @@ ignore-workspace-root-check=true node-linker=hoisted restrict-manifest-changes=true sync-injected-deps-after-scripts[]=build -inject-workspace-packages=true \ No newline at end of file +inject-workspace-packages=true diff --git a/apps/frontend/next.config.js b/apps/frontend/next.config.js index 91480e47..3cc9bb9c 100644 --- a/apps/frontend/next.config.js +++ b/apps/frontend/next.config.js @@ -42,10 +42,8 @@ const nextConfig = { ]; }, }; -export default !!process.env.SENTRY_ORG - ? withSentryConfig(nextConfig, { - org: process.env.SENTRY_ORG, - project: process.env.SENTRY_PROJECT, - authToken: process.env.SENTRY_AUTH_TOKEN, - }) - : nextConfig; +export default withSentryConfig(nextConfig, { + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, +}); diff --git a/apps/frontend/src/app/global-error.tsx b/apps/frontend/src/app/global-error.tsx index 395e9ed2..b014f08c 100644 --- a/apps/frontend/src/app/global-error.tsx +++ b/apps/frontend/src/app/global-error.tsx @@ -2,13 +2,18 @@ import * as Sentry from '@sentry/nextjs'; import NextError from 'next/error'; import { useEffect } from 'react'; +import { useVariables } from '@gitroom/react/helpers/variable.context'; export default function GlobalError({ error, }: { error: Error & { digest?: string }; }) { + const { sentryDsn } = useVariables(); useEffect(() => { + if (!sentryDsn) { + return; + } Sentry.captureException(error); }, [error]); return ( diff --git a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts index 2ca9b079..f4a01c9e 100644 --- a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts @@ -615,6 +615,48 @@ export class InstagramProvider return arr; } + private setTitle(name: string) { + switch (name) { + case "likes": { + return 'Likes'; + } + + case "followers": { + return 'Followers'; + } + + case "reach": { + return 'Reach'; + } + + case "follower_count": { + return 'Follower Count'; + } + + case "views": { + return 'Views'; + } + + case "comments": { + return 'Comments'; + } + + case "shares": { + return 'Shares'; + } + + case "saves": { + return 'Saves'; + } + + case "replies": { + return 'Replies'; + } + } + + return ""; + } + async analytics( id: string, accessToken: string, @@ -639,7 +681,7 @@ export class InstagramProvider analytics.push( ...(data?.map((d: any) => ({ - label: d.title, + label: this.setTitle(d.name), percentageChange: 5, data: d.values.map((v: any) => ({ total: v.value, @@ -650,7 +692,7 @@ export class InstagramProvider analytics.push( ...data2.map((d: any) => ({ - label: d.title, + label: this.setTitle(d.name), percentageChange: 5, data: [ {