-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit de45bd5
Showing
24 changed files
with
11,795 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
src/settings.json | ||
src/settings | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
/build-tmp | ||
|
||
# misc | ||
.DS_Store | ||
.idea | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
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,18 @@ | ||
# {{applicationName}} # | ||
by {{author}} | ||
|
||
A short description will be displayed in application list. | ||
|
||
![These are screenshots for your app](meta/screen1.png) | ||
![Just update the png files](meta/screen2.png) | ||
![And you're good to go](meta/screen3.png) | ||
|
||
This is a full description. All content starting from here will be displayed at the information section on app page. Markdown syntax is supported: [link](http://google.com) | ||
|
||
Description file is not always published with the app. To publish the description run `omg app upload-description <app name>` or `yarn upload-description`. | ||
|
||
## Headers: | ||
- lists | ||
- are | ||
- also | ||
- supported |
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,44 @@ | ||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### `yarn start` | ||
|
||
Runs the app in the development mode.<br /> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br /> | ||
You will also see any lint errors in the console. | ||
|
||
### `yarn test` | ||
|
||
Launches the test runner in the interactive watch mode.<br /> | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
### `yarn build` | ||
|
||
Builds the app for production to the `build` folder.<br /> | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.<br /> | ||
Your app is ready to be deployed! | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
### `yarn eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
||
## Learn More | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). |
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,10 @@ | ||
{ | ||
"app": { | ||
"gridApp": { | ||
"settings": { | ||
"productName": "Foo bar", | ||
"productPrice": "1.23 USD" | ||
} | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,62 @@ | ||
{ | ||
"name": "vnx-test-org-1.demo-session-creation-screen", | ||
"version": "0.1.0", | ||
"private": true, | ||
"homepage": "./", | ||
"scripts": { | ||
"bootstrap": "mkdirp src/settings && ncp default.settings.json src/settings/index.json", | ||
"start": "yarn schema && cross-env REACT_APP_MESSAGING_URL=ws://localhost:8088 react-scripts start", | ||
"schema": "mkdirp build && npx ts-schema src/schema.ts build && yarn analytics-schema", | ||
"analytics-schema": "npx tsc src/analytics-schema.ts --moduleResolution node --skipLibCheck --outFile /dev/stdout -m amd | node -e 'a={};eval(\"define=(_,d,c)=>{c(a,a,...d.slice(2).map(require));console.log(JSON.stringify(a.default))};\"+require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\"))' > build/analytics-schema.json", | ||
"prodbuild": "cross-env GENERATE_SOURCEMAP=false react-scripts build && ncp package.json build/", | ||
"build": "rimraf build && yarn prodbuild && yarn schema && omg app build", | ||
"eject": "react-scripts eject", | ||
"pub": "omg app publish", | ||
"settings": "omg app settings", | ||
"upload-description": "omg app upload-description", | ||
"connect": "omg dev ws" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"dependencies": { | ||
"@ombori/ga-messaging": "^2.90.2", | ||
"@ombori/ga-settings": "^3.11.3", | ||
"@ombori/grid-reports": "^3.11.2", | ||
"@ombori/grid-signals-react": "^3.11.3", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"styled-components": "^5.3.5", | ||
"typescript": "^4.7.4" | ||
}, | ||
"devDependencies": { | ||
"@ombori/ts-schema": "^2.231.1", | ||
"@testing-library/jest-dom": "^4.2.4", | ||
"@testing-library/react": "^9.3.2", | ||
"@testing-library/user-event": "^7.1.2", | ||
"@types/jest": "^28.1.4", | ||
"@types/node": "^18.0.3", | ||
"@types/react": "^18.0.15", | ||
"@types/react-dom": "^18.0.6", | ||
"@types/styled-components": "^5.1.25", | ||
"cross-env": "^7.0.3", | ||
"json-schema-defaults": "^0.4.0", | ||
"mkdirp": "^1.0.4", | ||
"ncp": "^2.0.0", | ||
"react-scripts": "5.0.1", | ||
"rimraf": "^3.0.2" | ||
}, | ||
"description": "demo-session-creation-screen" | ||
} |
Binary file not shown.
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,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
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,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: / |
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,18 @@ | ||
import { AnalyticsSchema, CardType, SessionInteractionType } from '@ombori/grid-reports'; | ||
|
||
/** | ||
* This file declares customized analytics reports that would be displayed for an application. | ||
*/ | ||
|
||
const analyticsSchema: AnalyticsSchema = { | ||
groups: [ | ||
{ | ||
name: 'Overview', | ||
cards: [ | ||
{ type: CardType.Sessions, interactionType: SessionInteractionType.Interactive }, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
export default analyticsSchema; |
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,106 @@ | ||
import React, { useEffect, useCallback, useState } from 'react'; | ||
import { getInstance as gs } from '@ombori/grid-signals-react'; | ||
import styled from 'styled-components'; | ||
import { useSettings } from '@ombori/ga-settings'; | ||
import { useHeartbeat } from '@ombori/ga-messaging'; | ||
import logo from './logo.svg'; | ||
|
||
import { Schema as Settings } from './schema'; | ||
|
||
function App() { | ||
useHeartbeat(); | ||
const [productCount, setProductCount] = useState(0); | ||
const settings = useSettings<Settings>(); | ||
|
||
const productName = settings?.productName; | ||
const productPrice = settings?.productPrice; | ||
|
||
useEffect(() => { | ||
if (productName) { | ||
gs().sendContentView({ title: productName }); | ||
} | ||
}, [productName]); | ||
|
||
useEffect(() => { | ||
const startSessionSubscription = async () => { | ||
const sessionState = await gs().subscribeSessionState((sessionState) => { | ||
setProductCount(sessionState.CART['TEMPORARY-PRODUCT-ID-123']); | ||
}); | ||
|
||
return () => { | ||
sessionState.stop(); | ||
} | ||
} | ||
|
||
startSessionSubscription(); | ||
}, []); | ||
|
||
const onAddToCart = useCallback(() => { | ||
gs().sendCartAdd({ productId: 'TEMPORARY-PRODUCT-ID-123', quantity: 1 }) | ||
}, []); | ||
|
||
if (!settings) { | ||
return <Container>Loading gridapp settings...</Container> | ||
} | ||
|
||
return ( | ||
<Container> | ||
<ProductInfo> | ||
<Logo src={logo} alt="logo" /> | ||
<p>Product name: {productName}</p> | ||
<p>Product price: {productPrice}</p> | ||
<Button onClick={onAddToCart}>Add to Cart</Button> | ||
</ProductInfo> | ||
<RealTimeInfo> | ||
<p>Real Cart Subscription</p> | ||
<p>{productName} count: {productCount}</p> | ||
</RealTimeInfo> | ||
</Container> | ||
); | ||
} | ||
|
||
const Container = styled.div` | ||
text-align: center; | ||
background-color: #282c34; | ||
height: 100%; | ||
position: absolute; | ||
display: flex; | ||
flex-direction: row; | ||
width: 100%; | ||
color: white; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 1.5vmin); | ||
`; | ||
|
||
const ProductInfo = styled.header` | ||
display: flex; | ||
flex-direction: column; | ||
flex: 1; | ||
padding-bottom: 64px; | ||
border-right: solid 1px white; | ||
`; | ||
|
||
const Logo = styled.img` | ||
height: 40vmin; | ||
pointer-events: none; | ||
`; | ||
|
||
const Button = styled.button` | ||
padding: 16px 32px; | ||
margin-top: 24px; | ||
align-self: center; | ||
border-radius: 8px; | ||
`; | ||
|
||
const RealTimeInfo = styled.footer` | ||
display: flex; | ||
height: 100%; | ||
flex: 1; | ||
flex-direction: column; | ||
pointer-events: none; | ||
align-items: center; | ||
justify-content: center; | ||
`; | ||
|
||
export default App; |
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,22 @@ | ||
body { | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', | ||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', | ||
sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
code { | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', | ||
monospace; | ||
} | ||
|
||
.init { | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
align-items: center; | ||
justify-content: center; | ||
} |
Oops, something went wrong.