Glancer_Testform.tsx2 matches
2import { useState } from "https://esm.sh/react@18.2.0";
34export function FormContent({ data, content }) {
5// const { content, contentURL, docsURL } = config;
6// console.log("content: ", content);
29<h2>Cobrowse & mask fields on forms</h2>
30<p>
31Glance cobrowse provides a โhookโ function to allow customers to
32customize page and element masking during a cobrowse session.
33</p>
Glancer_TestenrichAgent.ts1 match
6});
78export async function enrichAgent(id: string, data: any) {
9// console.log(data);
10const properties = (data.length === 0)
Glancer_TestdemoCache.ts1 match
11// this cron updates a blob that the ../../shared/utils/pollEnabledStatus.ts hits during demos
12// that blob determines whether or not the cobrowsing button is ON or OFF
13export default async function (interval: Interval) {
14// every page in the "Glancer demo" database should have it's own blob, so we have a cache for each demo
15// this cron saves a blob for every page in the Demos DB
Glancer_Test.cursorrules12 matches
45- Ask clarifying questions when requirements are ambiguous
6- Provide complete, functional solutions rather than skeleton implementations
7- Test your logic against edge cases before presenting the final solution
8- Ensure all code follows Val Town's specific platform requirements
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
19- Follow modern ES6+ conventions and functional programming practices if possible
2021## Types of triggers
2829```ts
30export default async function (req: Request) {
31return new Response("Hello World");
32}
4243```ts
44export default async function () {
45// Scheduled task code
46}
5657```ts
58export default async function (email: Email) {
59// Process email
60}
66## Val Town Standard Libraries
6768Val Town provides several hosted services and utility functions.
6970### Blob Storage
120```
121122## Val Town Utility Functions
123124Val Town provides several utility functions to help with common project tasks.
125126### Importing Utilities
200โ โโโ database/
201โ โ โโโ migrations.ts # Schema definitions
202โ โ โโโ queries.ts # DB query functions
203โ โ โโโ README.md
204โ โโโ routes/ # Route modules
219โโโ shared/
220โโโ README.md
221โโโ utils.ts # Shared types and functions
222```
223226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
229```ts
230import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering
262- Export clear query functions with proper TypeScript typing
263264## Common Gotchas and Solutions
Glancer_Testchess.tsx1 match
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
23export function ChessEmbedIframe({ config }) {
4const { content, contentURL, docsURL } = config;
5return (
Glancer_Testcheckout.tsx1 match
2import { useState } from "https://esm.sh/react@18.2.0";
34export function CheckoutContent({ data, content }) {
5// const { content, contentURL, docsURL } = config;
6// console.log("content: ", content);
1export async function blobKeyForDemoCache(url: string, id: string) {
2// convert url param to a URL object so we can get the path
3const newURL = new URL(url);
Glancer_TestApp.tsx3 matches
18}
19// Simple hook for mobile menu toggle
20function useMobileMenu() {
21const [isOpen, setIsOpen] = useState(false);
22const toggleMenu = () => setIsOpen(!isOpen);
2627// Simple hook for tracking current hash for active nav styling
28function useCurrentHash() {
29const [currentHash, setCurrentHash] = useState(() =>
30window.location.hash.slice(1)
43}
4445export function App({ initialData }: AppProps) {
46// initialData
47const { demoData, loading, error } = initialData;
GlancerstartSession.ts3 matches
1export async function startSession() {
2GLANCE.Cobrowse.Visitor.startSession("GLANCE_KEYTYPE_RANDOM");
3}
4// If you forget to add functions called by events
5// to the global scope (e.g., `onclick="startSession();"`),
6// then those functions won't be in the global scope,
7// and the onclick will fail with Uncaught ReferenceError.
8window.startSession = startSession;
Glancerslugify.ts1 match
1export default function slugify(str: string) {
2return str
3.toString()