-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
107 changed files
with
3,884 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@segment/analytics-next': patch | ||
--- | ||
|
||
Add edgeFunction to CDNSettings type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@segment/analytics-next': minor | ||
--- | ||
|
||
Export segment plugin and arg resolvers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
'@segment/analytics-signals': patch | ||
--- | ||
Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ reports/* | |
playwright-report/ | ||
playwright/.cache/ | ||
tmp.tsconfig.json | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
packages/signals/browser-signals/src/core/buffer/__tests__/buffer.test.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
packages/signals/browser-signals/src/core/signals/__tests__/client.test.ts
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
packages/signals/browser-signals/src/core/signals/client.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/signals/browser-signals/src/test-helpers/mocks/analytics-mock.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react", | ||
"@babel/preset-typescript" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Configure + rename this file to .env | ||
|
||
WRITEKEY=your-write-key | ||
STAGE=false |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Signals Example | ||
|
||
### Instructions | ||
- `cd packages/signals/signal-example` | ||
- `yarn install` | ||
- `yarn . build` | ||
- Rename: `.env.example` -> `.env` (set `WRITEKEY=XXX` in `.env`) | ||
- `yarn dev` | ||
- If you make a change on another package that is not showing up, you can run `yarn . build` to rebuild all of the example's dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@internal/signals-example", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
".": "yarn run -T turbo run --filter=@segment/signals-example...", | ||
"dev": "webpack serve", | ||
"build": "webpack" | ||
}, | ||
"dependencies": { | ||
"@segment/analytics-next": "workspace:^", | ||
"@segment/analytics-signals": "workspace:^", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"react-router-dom": "^6.23.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.22.11", | ||
"@babel/preset-env": "^7.22.10", | ||
"@babel/preset-react": "^7.24.6", | ||
"@babel/preset-typescript": "^7.22.11", | ||
"@types/react": "^18.0.0", | ||
"@types/react-dom": "^18", | ||
"babel-loader": "^8.0.0", | ||
"css-loader": "^7.1.2", | ||
"dotenv-webpack": "^8.1.0", | ||
"html-webpack-plugin": "^5.6.0", | ||
"style-loader": "^4.0.0", | ||
"typescript": "^4.7.0", | ||
"webpack": "^5.76.0", | ||
"webpack-cli": "^4.8.0", | ||
"webpack-dev-server": "^4.15.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>React TypeScript App</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import '../lib/analytics' | ||
import React, { useEffect } from 'react' | ||
import { loadAnalytics } from '../lib/analytics' | ||
import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom' | ||
import { HomePage } from '../pages/Home' | ||
import { OtherPage } from '../pages/Other' | ||
|
||
const App: React.FC = () => { | ||
useEffect(() => { | ||
void loadAnalytics() | ||
}, []) | ||
|
||
return ( | ||
<Router> | ||
<nav> | ||
<Link to="/">Home</Link> | ||
<Link to="/other">Other</Link> | ||
</nav> | ||
<Routes> | ||
<Route path="/" element={<HomePage />} /> | ||
<Route path="/other" element={<OtherPage />} /> | ||
</Routes> | ||
</Router> | ||
) | ||
} | ||
|
||
export default App |
64 changes: 64 additions & 0 deletions
64
packages/signals/signals-example/src/components/ComplexForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React, { FormEventHandler, useState } from 'react' | ||
|
||
const ComplexForm = () => { | ||
const [inputField, setInputField] = useState('') | ||
const [selectField, setSelectField] = useState('') | ||
|
||
const handleSubmit: FormEventHandler<HTMLFormElement> = (event) => { | ||
event.preventDefault() | ||
const formData = { | ||
inputField, | ||
selectField, | ||
} | ||
console.log('Submitting form:', JSON.stringify(formData)) | ||
fetch('/parrot', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(formData), | ||
}) | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
console.log('Form submitted successfully:', data) | ||
}) | ||
.catch((error) => { | ||
console.error('Error submitting form:', error) | ||
}) | ||
console.log({ inputField, selectField }) | ||
} | ||
|
||
return ( | ||
<div> | ||
<button data-custom-attr="some-custom-attribute">Example Button</button> | ||
<form onSubmit={handleSubmit}> | ||
<div> | ||
<label htmlFor="ex-input">Input Field:</label> | ||
<input | ||
id="ex-input" | ||
type="text" | ||
value={inputField} | ||
onChange={(e) => setInputField(e.target.value)} | ||
/> | ||
</div> | ||
<div> | ||
<label htmlFor="ex-select">Select Field:</label> | ||
<select | ||
id="ex-select" | ||
value={selectField} | ||
onChange={(e) => setSelectField(e.target.value)} | ||
> | ||
<option value="" disabled> | ||
Select | ||
</option> | ||
<option value="Option 1">Option 1</option> | ||
<option value="Option 2">Option 2</option> | ||
</select> | ||
</div> | ||
<button type="submit">Submit</button> | ||
</form> | ||
</div> | ||
) | ||
} | ||
|
||
export default ComplexForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import App from './components/App' | ||
import './styles.css' | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')) |
Oops, something went wrong.