@codeswayam/analytics 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @codeswayam/analytics
2
2
 
3
- **Version:** 0.1.0
3
+ **Version:** 0.1.1
4
4
 
5
5
  Centralized analytics and tracking package for all CodeSwayam applications. A single `<Analytics />` component that loads GTM, GA4, Meta Pixel, Hotjar, and Microsoft Clarity — plus Google Search Console verification — all configurable from the Admin Panel or environment variables.
6
6
 
@@ -0,0 +1,63 @@
1
+ export interface AnalyticsConfig {
2
+ gtmId?: string;
3
+ ga4Id?: string;
4
+ metaPixelId?: string;
5
+ gscVerification?: string;
6
+ hotjarId?: string;
7
+ clarityId?: string;
8
+ }
9
+ interface AnalyticsProps extends AnalyticsConfig {
10
+ appName?: string;
11
+ consentGranted?: boolean;
12
+ }
13
+ export declare function Analytics({ gtmId, ga4Id, metaPixelId, gscVerification, hotjarId, clarityId, appName, consentGranted, }: AnalyticsProps): import("react/jsx-runtime").JSX.Element | null;
14
+ export declare function trackEvent(eventName: string, eventData?: Record<string, any>): void;
15
+ export declare function trackPageView(url: string): void;
16
+ export declare function usePageTracking(): void;
17
+ export type SaaSConversionEvent = {
18
+ name: 'signup';
19
+ props: {
20
+ method: 'email' | 'google' | 'github';
21
+ };
22
+ } | {
23
+ name: 'trial_start';
24
+ props: {
25
+ productId: string;
26
+ planName: string;
27
+ };
28
+ } | {
29
+ name: 'subscription_started';
30
+ props: {
31
+ productId: string;
32
+ planName: string;
33
+ amount: number;
34
+ currency: string;
35
+ };
36
+ } | {
37
+ name: 'credits_purchased';
38
+ props: {
39
+ amount: number;
40
+ packId: string;
41
+ creditsCount: number;
42
+ };
43
+ } | {
44
+ name: 'agent_created';
45
+ props: {
46
+ model: string;
47
+ };
48
+ } | {
49
+ name: 'automation_created';
50
+ props: {
51
+ type: string;
52
+ };
53
+ };
54
+ export declare function trackConversion<T extends SaaSConversionEvent>(event: T): void;
55
+ declare global {
56
+ interface Window {
57
+ dataLayer: any[];
58
+ fbq: any;
59
+ gtag: (...args: any[]) => void;
60
+ }
61
+ }
62
+ export {};
63
+ //# sourceMappingURL=Analytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Analytics.d.ts","sourceRoot":"","sources":["../src/Analytics.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAe,SAAQ,eAAe;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,WAAW,EACX,eAAe,EACf,QAAQ,EACR,SAAS,EACT,OAAO,EACP,cAAqB,GACtB,EAAE,cAAc,kDA8EhB;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAI5E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,QAIxC;AAED,wBAAgB,eAAe,SAO9B;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE;QAAE,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;KAAE,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACvE;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAClH;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC9F;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE5D,wBAAgB,eAAe,CAAC,CAAC,SAAS,mBAAmB,EAAE,KAAK,EAAE,CAAC,QAEtE;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,SAAS,EAAE,GAAG,EAAE,CAAC;QACjB,GAAG,EAAE,GAAG,CAAC;QACT,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;KAChC;CACF"}
@@ -0,0 +1,55 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect } from 'react';
4
+ import { usePathname } from 'next/navigation';
5
+ import Script from 'next/script';
6
+ export function Analytics({ gtmId, ga4Id, metaPixelId, gscVerification, hotjarId, clarityId, appName, consentGranted = true, }) {
7
+ const isTrackingAllowed = consentGranted;
8
+ if (!gtmId && !ga4Id && !metaPixelId && !hotjarId && !clarityId && !gscVerification)
9
+ return null;
10
+ return (_jsxs(_Fragment, { children: [gscVerification && (_jsx("meta", { name: "google-site-verification", content: gscVerification })), isTrackingAllowed && (_jsxs(_Fragment, { children: [gtmId && (_jsxs(_Fragment, { children: [_jsx(Script, { id: "gtm-script", strategy: "afterInteractive", children: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
11
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
12
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
13
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
14
+ })(window,document,'script','dataLayer','${gtmId}');
15
+ ${appName ? `window.dataLayer=window.dataLayer||[];window.dataLayer.push({'appName':'${appName}'});` : ''}` }), _jsx("noscript", { children: _jsx("iframe", { src: `https://www.googletagmanager.com/ns.html?id=${gtmId}`, height: "0", width: "0", style: { display: 'none', visibility: 'hidden' } }) })] })), ga4Id && !gtmId && (_jsxs(_Fragment, { children: [_jsx(Script, { src: `https://www.googletagmanager.com/gtag/js?id=${ga4Id}`, strategy: "afterInteractive" }), _jsx(Script, { id: "ga4-script", strategy: "afterInteractive", children: `window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
16
+ gtag('js',new Date());gtag('config','${ga4Id}',{'send_page_view':true});` })] })), metaPixelId && (_jsxs(_Fragment, { children: [_jsx(Script, { id: "meta-pixel", strategy: "afterInteractive", children: `!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
17
+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
18
+ n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
19
+ t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
20
+ document,'script','https://connect.facebook.net/en_US/fbevents.js');
21
+ fbq('init','${metaPixelId}');fbq('track','PageView');` }), _jsx("noscript", { children: _jsx("img", { height: "1", width: "1", style: { display: 'none' }, src: `https://www.facebook.com/tr?id=${metaPixelId}&ev=PageView&noscript=1`, alt: "" }) })] })), hotjarId && (_jsx(Script, { id: "hotjar-script", strategy: "afterInteractive", children: `(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
22
+ h._hjSettings={hjid:${hotjarId},hjsv:6};a=o.getElementsByTagName('head')[0];
23
+ r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
24
+ a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');` })), clarityId && (_jsx(Script, { id: "clarity-script", strategy: "afterInteractive", children: `(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
25
+ t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
26
+ y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
27
+ })(window,document,"clarity","script","${clarityId}");` }))] }))] }));
28
+ }
29
+ export function trackEvent(eventName, eventData) {
30
+ if (typeof window === 'undefined')
31
+ return;
32
+ if (window.dataLayer)
33
+ window.dataLayer.push(Object.assign({ event: eventName }, eventData));
34
+ if (window.fbq)
35
+ window.fbq('trackCustom', eventName, eventData);
36
+ }
37
+ export function trackPageView(url) {
38
+ if (typeof window === 'undefined')
39
+ return;
40
+ if (window.dataLayer)
41
+ window.dataLayer.push({ event: 'page_view', page_path: url });
42
+ if (window.fbq)
43
+ window.fbq('track', 'PageView');
44
+ }
45
+ export function usePageTracking() {
46
+ const pathname = usePathname();
47
+ useEffect(() => {
48
+ if (!pathname)
49
+ return;
50
+ trackPageView(pathname);
51
+ }, [pathname]);
52
+ }
53
+ export function trackConversion(event) {
54
+ trackEvent(event.name, event.props);
55
+ }
@@ -0,0 +1,4 @@
1
+ export { Analytics, trackEvent, trackPageView, usePageTracking, trackConversion } from './Analytics';
2
+ export type { AnalyticsConfig, SaaSConversionEvent } from './Analytics';
3
+ export { getAnalyticsConfig, trackServerEvent } from './server';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrG,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { Analytics, trackEvent, trackPageView, usePageTracking, trackConversion } from './Analytics';
2
+ export { getAnalyticsConfig, trackServerEvent } from './server';
@@ -0,0 +1,16 @@
1
+ import type { AnalyticsConfig } from './Analytics';
2
+ /**
3
+ * Fetch analytics config for a given appId from the core-api.
4
+ * Call this in your Next.js root layout (server component).
5
+ *
6
+ * Usage:
7
+ * const config = await getAnalyticsConfig('web');
8
+ * <Analytics {...config} appName="web" />
9
+ */
10
+ export declare function getAnalyticsConfig(appId: string): Promise<AnalyticsConfig>;
11
+ /**
12
+ * Log server-side events (such as logins, registration, payment verification)
13
+ * to the core-api backend analytics collector.
14
+ */
15
+ export declare function trackServerEvent(eventName: string, eventData?: Record<string, any>, userId?: string): Promise<boolean>;
16
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAWhF;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAmBlB"}
package/dist/server.js ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Fetch analytics config for a given appId from the core-api.
3
+ * Call this in your Next.js root layout (server component).
4
+ *
5
+ * Usage:
6
+ * const config = await getAnalyticsConfig('web');
7
+ * <Analytics {...config} appName="web" />
8
+ */
9
+ export async function getAnalyticsConfig(appId) {
10
+ const apiUrl = process.env.NEXT_PUBLIC_API_URL || process.env.API_URL || 'http://localhost:3000';
11
+ try {
12
+ const res = await fetch(`${apiUrl}/admin/analytics/config/${appId}`, {
13
+ next: { revalidate: 300 },
14
+ });
15
+ if (!res.ok)
16
+ return {};
17
+ return res.json();
18
+ }
19
+ catch (_a) {
20
+ return {};
21
+ }
22
+ }
23
+ /**
24
+ * Log server-side events (such as logins, registration, payment verification)
25
+ * to the core-api backend analytics collector.
26
+ */
27
+ export async function trackServerEvent(eventName, eventData, userId) {
28
+ const apiUrl = process.env.NEXT_PUBLIC_API_URL || process.env.API_URL || 'http://localhost:3000';
29
+ try {
30
+ const res = await fetch(`${apiUrl}/admin/analytics/track`, {
31
+ method: 'POST',
32
+ headers: {
33
+ 'Content-Type': 'application/json',
34
+ },
35
+ body: JSON.stringify({
36
+ event: eventName,
37
+ userId,
38
+ properties: eventData || {},
39
+ timestamp: new Date().toISOString(),
40
+ }),
41
+ });
42
+ return res.ok;
43
+ }
44
+ catch (_a) {
45
+ return false;
46
+ }
47
+ }
package/package.json CHANGED
@@ -1,23 +1,35 @@
1
1
  {
2
2
  "name": "@codeswayam/analytics",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Centralized analytics and tracking for CodeSwayam apps",
5
- "main": "./src/index.tsx",
6
- "types": "./src/index.tsx",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.js",
16
+ "types": "./dist/index.d.ts"
17
+ }
18
+ },
7
19
  "scripts": {
8
20
  "build": "tsc",
9
- "dev": "tsc --watch"
21
+ "dev": "tsc --watch",
22
+ "prepublishOnly": "npm run build"
10
23
  },
11
24
  "dependencies": {
12
- "react": "^19.2.3",
13
- "next": "^16.2.4"
25
+ "react": "^19.2.3"
14
26
  },
15
27
  "devDependencies": {
16
28
  "@types/react": "^19",
17
29
  "typescript": "^5"
18
30
  },
19
31
  "peerDependencies": {
20
- "react": "^19.2.3",
21
- "next": "^16.2.4"
32
+ "next": ">=15.0.0",
33
+ "react": "^19.2.3"
22
34
  }
23
- }
35
+ }
package/src/Analytics.tsx DELETED
@@ -1,118 +0,0 @@
1
- 'use client';
2
-
3
- import Script from 'next/script';
4
-
5
- export interface AnalyticsConfig {
6
- gtmId?: string;
7
- ga4Id?: string;
8
- metaPixelId?: string;
9
- gscVerification?: string;
10
- hotjarId?: string;
11
- clarityId?: string;
12
- }
13
-
14
- interface AnalyticsProps extends AnalyticsConfig {
15
- appName?: string;
16
- }
17
-
18
- export function Analytics({
19
- gtmId,
20
- ga4Id,
21
- metaPixelId,
22
- gscVerification,
23
- hotjarId,
24
- clarityId,
25
- appName,
26
- }: AnalyticsProps) {
27
- if (!gtmId && !ga4Id && !metaPixelId && !hotjarId && !clarityId) return null;
28
-
29
- return (
30
- <>
31
- {gscVerification && (
32
- <meta name="google-site-verification" content={gscVerification} />
33
- )}
34
-
35
- {gtmId && (
36
- <>
37
- <Script id="gtm-script" strategy="afterInteractive">
38
- {`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
39
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
40
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
41
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
42
- })(window,document,'script','dataLayer','${gtmId}');
43
- ${appName ? `window.dataLayer=window.dataLayer||[];window.dataLayer.push({'appName':'${appName}'});` : ''}`}
44
- </Script>
45
- <noscript>
46
- <iframe src={`https://www.googletagmanager.com/ns.html?id=${gtmId}`}
47
- height="0" width="0" style={{ display: 'none', visibility: 'hidden' }} />
48
- </noscript>
49
- </>
50
- )}
51
-
52
- {ga4Id && !gtmId && (
53
- <>
54
- <Script src={`https://www.googletagmanager.com/gtag/js?id=${ga4Id}`} strategy="afterInteractive" />
55
- <Script id="ga4-script" strategy="afterInteractive">
56
- {`window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
57
- gtag('js',new Date());gtag('config','${ga4Id}',{'send_page_view':true});`}
58
- </Script>
59
- </>
60
- )}
61
-
62
- {metaPixelId && (
63
- <>
64
- <Script id="meta-pixel" strategy="afterInteractive">
65
- {`!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
66
- n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
67
- n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
68
- t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
69
- document,'script','https://connect.facebook.net/en_US/fbevents.js');
70
- fbq('init','${metaPixelId}');fbq('track','PageView');`}
71
- </Script>
72
- <noscript>
73
- <img height="1" width="1" style={{ display: 'none' }}
74
- src={`https://www.facebook.com/tr?id=${metaPixelId}&ev=PageView&noscript=1`} alt="" />
75
- </noscript>
76
- </>
77
- )}
78
-
79
- {hotjarId && (
80
- <Script id="hotjar-script" strategy="afterInteractive">
81
- {`(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
82
- h._hjSettings={hjid:${hotjarId},hjsv:6};a=o.getElementsByTagName('head')[0];
83
- r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
84
- a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');`}
85
- </Script>
86
- )}
87
-
88
- {clarityId && (
89
- <Script id="clarity-script" strategy="afterInteractive">
90
- {`(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
91
- t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
92
- y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
93
- })(window,document,"clarity","script","${clarityId}");`}
94
- </Script>
95
- )}
96
- </>
97
- );
98
- }
99
-
100
- export function trackEvent(eventName: string, eventData?: Record<string, any>) {
101
- if (typeof window === 'undefined') return;
102
- if (window.dataLayer) window.dataLayer.push({ event: eventName, ...eventData });
103
- if (window.fbq) window.fbq('trackCustom', eventName, eventData);
104
- }
105
-
106
- export function trackPageView(url: string) {
107
- if (typeof window === 'undefined') return;
108
- if (window.dataLayer) window.dataLayer.push({ event: 'page_view', page_path: url });
109
- if (window.fbq) window.fbq('track', 'PageView');
110
- }
111
-
112
- declare global {
113
- interface Window {
114
- dataLayer: any[];
115
- fbq: any;
116
- gtag: (...args: any[]) => void;
117
- }
118
- }
package/src/index.tsx DELETED
@@ -1,3 +0,0 @@
1
- export { Analytics, trackEvent, trackPageView } from './Analytics';
2
- export type { AnalyticsConfig } from './Analytics';
3
- export { getAnalyticsConfig } from './server';
package/src/server.ts DELETED
@@ -1,22 +0,0 @@
1
- import type { AnalyticsConfig } from './Analytics';
2
-
3
- /**
4
- * Fetch analytics config for a given appId from the core-api.
5
- * Call this in your Next.js root layout (server component).
6
- *
7
- * Usage:
8
- * const config = await getAnalyticsConfig('web');
9
- * <Analytics {...config} appName="web" />
10
- */
11
- export async function getAnalyticsConfig(appId: string): Promise<AnalyticsConfig> {
12
- const apiUrl = process.env.NEXT_PUBLIC_API_URL || process.env.API_URL || 'http://localhost:3000';
13
- try {
14
- const res = await fetch(`${apiUrl}/admin/analytics/config/${appId}`, {
15
- next: { revalidate: 300 },
16
- } as RequestInit);
17
- if (!res.ok) return {};
18
- return res.json();
19
- } catch {
20
- return {};
21
- }
22
- }
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2017",
4
- "lib": ["dom", "dom.iterable", "esnext"],
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "strict": true,
8
- "noEmit": true,
9
- "esModuleInterop": true,
10
- "module": "esnext",
11
- "moduleResolution": "bundler",
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "jsx": "react-jsx"
15
- },
16
- "include": ["src/**/*"],
17
- "exclude": ["node_modules"]
18
- }