mirror repo (WIP)

Need to remove secrets before entire repo can be made public.
This commit is contained in:
Brandon Thomas
2025-09-18 22:55:03 -04:00
commit 0daf83dba9
8735 changed files with 2963896 additions and 0 deletions
@@ -0,0 +1,50 @@
{
"extends": [
"../../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.json"
],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": [
"error",
{
"ignoredFiles": [
"{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}",
"{projectRoot}/vite.config.{js,ts,mjs,mts}"
]
}
]
}
}
]
}
@@ -0,0 +1,7 @@
# google-analytics
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build google-analytics` to build the library.
@@ -0,0 +1,4 @@
export * from './lib/gtag-login.js';
export * from './lib/gtag-logout.js';
export * from './lib/gtag-event.js';
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
+24
View File
@@ -0,0 +1,24 @@
const o = "G-Y4Y8KMLPQ7", t = function(g) {
console.debug("gtagLogin", o, g), window.gtag(
"config",
o,
{
user_id: g
}
);
}, i = function() {
console.debug("gtagLogout", o), window.gtag(
"config",
o,
{
user_id: null
}
);
}, c = function(g, n) {
console.debug("gtagEvent", g, n), n ? window.gtag("event", g, n) : window.gtag("event", g);
};
export {
c as gtagEvent,
t as gtagLogin,
i as gtagLogout
};
@@ -0,0 +1,4 @@
export declare const gtagEvent: (eventName: string, args?: {
[key: string]: string;
}) => void;
//# sourceMappingURL=gtag-event.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"gtag-event.d.ts","sourceRoot":"","sources":["../../src/lib/gtag-event.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAY,WAAW,MAAM,EAAE,OAAO;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,SAOpF,CAAA"}
@@ -0,0 +1,2 @@
export declare const gtagLogin: (userToken: string) => void;
//# sourceMappingURL=gtag-login.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"gtag-login.d.ts","sourceRoot":"","sources":["../../src/lib/gtag-login.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAY,WAAW,MAAM,SAOlD,CAAA"}
@@ -0,0 +1,2 @@
export declare const gtagLogout: () => void;
//# sourceMappingURL=gtag-logout.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"gtag-logout.d.ts","sourceRoot":"","sources":["../../src/lib/gtag-logout.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAOtB,CAAA"}
@@ -0,0 +1,2 @@
export declare const TAG_ID = "G-Y4Y8KMLPQ7";
//# sourceMappingURL=tag-id.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"tag-id.d.ts","sourceRoot":"","sources":["../../src/lib/tag-id.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
{
"name": "@storyteller/google-analytics",
"version": "0.0.1",
"private": true,
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"development": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
},
"dependencies": {}
}
@@ -0,0 +1,4 @@
export * from './lib/gtag-login.js';
export * from './lib/gtag-logout.js';
export * from './lib/gtag-event.js';
@@ -0,0 +1,10 @@
// Send an event with name and "args". Args is a string-to-string map.
export const gtagEvent = function(eventName: string, args?: { [key: string]: string }) {
console.debug("gtagEvent", eventName, args);
if (!args) {
(window as any).gtag('event', eventName);
} else {
(window as any).gtag('event', eventName, args);
}
}
@@ -0,0 +1,10 @@
import { TAG_ID } from './tag-id.js';
export const gtagLogin = function(userToken: string) {
console.debug("gtagLogin", TAG_ID, userToken);
(window as any).gtag(
'config', TAG_ID, {
'user_id': userToken
});
}
@@ -0,0 +1,10 @@
import { TAG_ID } from './tag-id.js';
export const gtagLogout = function() {
console.debug("gtagLogout", TAG_ID);
(window as any).gtag(
'config', TAG_ID, {
'user_id': null
});
}
@@ -0,0 +1 @@
export const TAG_ID = 'G-Y4Y8KMLPQ7';
@@ -0,0 +1,10 @@
{
"extends": "../../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
@@ -0,0 +1,21 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
"emitDeclarationOnly": true,
"module": "nodenext",
"moduleResolution": "nodenext",
"forceConsistentCasingInFileNames": true,
"types": [
"node",
"vite/client"
]
},
"include": [
"src/**/*.ts"
],
"references": []
}
@@ -0,0 +1,37 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import * as path from 'path';
export default defineConfig(() => ({
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/analytics/google-analytics',
plugins: [dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: './dist',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: '@storyteller/google-analytics',
fileName: 'index',
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es' as const]
},
rollupOptions: {
// External packages that should not be bundled into your library.
external: []
},
},
}));