import { useMemo } from "react";
export type SortDir = "asc" | "desc";
export interface SortConfig<T> {
key: keyof T;
dir: SortDir;
import React from 'react'
import ReactDOM from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import App from './App'
import './index.css'
import { useEffect, useState } from "react";
export function useDebouncedValue(value, delay = 300) {
const [debounced, setDebounced] = useState(value);
useEffect(() => {
export const initialCart = { items: {} };
export function cartReducer(state, action) {
switch (action.type) {
case 'ADD_ITEM': {
const { product, qty = 1 } = action;
import { Injectable, computed, signal } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class LoadingService {
private readonly activeRequests = signal(0);
export const MAX_VISIBLE = 4;
const DEFAULTS = {
variant: "info",
duration: 4000,
};
export interface UseClipboardResult {
copied: boolean;
error: Error | null;
copy: (value: string) => Promise<boolean>;
}
export interface Todo {
id: string;
title: string;
done: boolean;
pending: boolean;
}
export interface CartItem {
sku: string;
name: string;
unitPrice: number; // cents
qty: number;
}
# Backend configuration with S3 + DynamoDB locking
terraform {
backend "s3" {
bucket = "company-terraform-state"
key = "services/web-app/terraform.tfstate"
region = "us-east-1"
export const required = (msg = 'This field is required') => (value) =>
value && value.trim() !== '' ? '' : msg;
export const minLength = (n, msg) => (value) =>
value && value.length >= n ? '' : msg || `Must be at least ${n} characters`;
import { useCallback, useEffect, useState } from "react";
type Patch = Record<string, string | null | undefined>;
function readParams(): URLSearchParams {
return new URLSearchParams(window.location.search);