@striae-org/striae 4.0.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/app/components/actions/confirm-export.ts +4 -2
  2. package/app/components/actions/generate-pdf.ts +10 -2
  3. package/app/components/audit/user-audit-viewer.tsx +121 -940
  4. package/app/components/audit/user-audit.module.css +20 -0
  5. package/app/components/audit/viewer/audit-activity-summary.tsx +52 -0
  6. package/app/components/audit/viewer/audit-entries-list.tsx +200 -0
  7. package/app/components/audit/viewer/audit-filters-panel.tsx +306 -0
  8. package/app/components/audit/viewer/audit-user-info-card.tsx +44 -0
  9. package/app/components/audit/viewer/audit-viewer-header.tsx +55 -0
  10. package/app/components/audit/viewer/audit-viewer-utils.ts +121 -0
  11. package/app/components/audit/viewer/types.ts +1 -0
  12. package/app/components/audit/viewer/use-audit-viewer-data.ts +166 -0
  13. package/app/components/audit/viewer/use-audit-viewer-export.ts +176 -0
  14. package/app/components/audit/viewer/use-audit-viewer-filters.ts +141 -0
  15. package/app/components/auth/mfa-enrollment.module.css +13 -5
  16. package/app/components/auth/mfa-verification.module.css +13 -5
  17. package/app/components/canvas/canvas.tsx +3 -0
  18. package/app/components/canvas/confirmation/confirmation.tsx +13 -37
  19. package/app/components/public-signing-key-modal/public-signing-key-modal.module.css +1 -0
  20. package/app/components/public-signing-key-modal/public-signing-key-modal.tsx +8 -37
  21. package/app/components/sidebar/case-export/case-export.tsx +9 -34
  22. package/app/components/sidebar/case-import/case-import.module.css +2 -0
  23. package/app/components/sidebar/case-import/case-import.tsx +10 -34
  24. package/app/components/sidebar/cases/cases-modal.module.css +44 -9
  25. package/app/components/sidebar/cases/cases-modal.tsx +16 -14
  26. package/app/components/sidebar/files/files-modal.module.css +45 -10
  27. package/app/components/sidebar/files/files-modal.tsx +16 -16
  28. package/app/components/sidebar/notes/notes-modal.tsx +17 -15
  29. package/app/components/sidebar/notes/notes.module.css +2 -0
  30. package/app/components/sidebar/sidebar.module.css +2 -2
  31. package/app/components/toast/toast.module.css +2 -1
  32. package/app/components/toast/toast.tsx +16 -11
  33. package/app/components/user/delete-account.tsx +10 -31
  34. package/app/components/user/inactivity-warning.module.css +8 -6
  35. package/app/components/user/manage-profile.module.css +2 -0
  36. package/app/components/user/manage-profile.tsx +85 -30
  37. package/app/hooks/useOverlayDismiss.ts +68 -0
  38. package/app/routes/auth/login.example.tsx +19 -8
  39. package/app/routes/auth/passwordReset.module.css +23 -13
  40. package/app/routes/striae/striae.tsx +8 -1
  41. package/app/routes.ts +7 -0
  42. package/app/services/audit/audit-export-csv.ts +2 -0
  43. package/app/services/audit/audit.service.ts +29 -5
  44. package/app/services/audit/builders/audit-entry-builder.ts +2 -1
  45. package/app/services/audit/builders/audit-event-builders-user-security.ts +4 -2
  46. package/app/services/audit/builders/audit-event-builders-workflow.ts +6 -0
  47. package/app/types/audit.ts +2 -1
  48. package/app/types/user.ts +1 -0
  49. package/app/utils/data/permissions.ts +1 -0
  50. package/functions/api/pdf/[[path]].ts +32 -1
  51. package/load-context.ts +9 -0
  52. package/package.json +5 -1
  53. package/primershear.emails.example +6 -0
  54. package/scripts/deploy-pages-secrets.sh +6 -0
  55. package/scripts/deploy-primershear-emails.sh +166 -0
  56. package/worker-configuration.d.ts +7493 -7491
  57. package/workers/audit-worker/wrangler.jsonc.example +1 -1
  58. package/workers/data-worker/wrangler.jsonc.example +1 -1
  59. package/workers/image-worker/wrangler.jsonc.example +1 -1
  60. package/workers/keys-worker/wrangler.jsonc.example +1 -1
  61. package/workers/pdf-worker/src/pdf-worker.example.ts +3 -0
  62. package/workers/pdf-worker/src/report-types.ts +3 -0
  63. package/workers/pdf-worker/wrangler.jsonc.example +1 -1
  64. package/workers/user-worker/src/user-worker.example.ts +6 -1
  65. package/workers/user-worker/wrangler.jsonc.example +1 -1
  66. package/wrangler.toml.example +1 -1
@@ -0,0 +1,166 @@
1
+ #!/bin/bash
2
+
3
+ # ============================================
4
+ # PRIMERSHEAR EMAIL LIST DEPLOYMENT SCRIPT
5
+ # ============================================
6
+ # Reads primershear.emails, updates PRIMERSHEAR_EMAILS in .env,
7
+ # then deploys that secret directly to Cloudflare Pages.
8
+ #
9
+ # Usage:
10
+ # bash ./scripts/deploy-primershear-emails.sh [--production-only|--preview-only|--env-only]
11
+ #
12
+ # Options:
13
+ # --production-only Deploy to production Pages environment only
14
+ # --preview-only Deploy to preview Pages environment only
15
+ # --env-only Update .env only; do not deploy to Cloudflare
16
+ # -h, --help Show this help message
17
+
18
+ set -e
19
+ set -o pipefail
20
+
21
+ RED='\033[0;31m'
22
+ GREEN='\033[0;32m'
23
+ YELLOW='\033[1;33m'
24
+ BLUE='\033[0;34m'
25
+ NC='\033[0m'
26
+
27
+ echo -e "${BLUE}📧 PrimerShear Email List Deployment${NC}"
28
+ echo "======================================"
29
+
30
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
31
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
32
+ cd "$PROJECT_ROOT"
33
+
34
+ trap 'echo -e "\n${RED}❌ deploy-primershear-emails.sh failed near line ${LINENO}${NC}"' ERR
35
+
36
+ # ── Argument parsing ─────────────────────────────────────────────────────────
37
+
38
+ deploy_production=true
39
+ deploy_preview=true
40
+ env_only=false
41
+
42
+ for arg in "$@"; do
43
+ case "$arg" in
44
+ -h|--help)
45
+ echo "Usage: bash ./scripts/deploy-primershear-emails.sh [--production-only|--preview-only|--env-only]"
46
+ echo ""
47
+ echo "Options:"
48
+ echo " --production-only Deploy to production Pages environment only"
49
+ echo " --preview-only Deploy to preview Pages environment only"
50
+ echo " --env-only Update .env only; do not deploy to Cloudflare"
51
+ echo " -h, --help Show this help message"
52
+ exit 0
53
+ ;;
54
+ --production-only)
55
+ deploy_production=true
56
+ deploy_preview=false
57
+ ;;
58
+ --preview-only)
59
+ deploy_production=false
60
+ deploy_preview=true
61
+ ;;
62
+ --env-only)
63
+ env_only=true
64
+ ;;
65
+ *)
66
+ echo -e "${RED}❌ Unknown option: $arg${NC}"
67
+ echo "Use --help to see supported options."
68
+ exit 1
69
+ ;;
70
+ esac
71
+ done
72
+
73
+ # ── Read emails file ──────────────────────────────────────────────────────────
74
+
75
+ EMAILS_FILE="$PROJECT_ROOT/primershear.emails"
76
+
77
+ if [ ! -f "$EMAILS_FILE" ]; then
78
+ echo -e "${RED}❌ primershear.emails not found at: $EMAILS_FILE${NC}"
79
+ echo -e "${YELLOW} Create it with one email address per line.${NC}"
80
+ exit 1
81
+ fi
82
+
83
+ # Strip comment lines and blank lines, then join with commas
84
+ PRIMERSHEAR_EMAILS=$(grep -v '^\s*#' "$EMAILS_FILE" | grep -v '^\s*$' | paste -sd ',' -)
85
+
86
+ if [ -z "$PRIMERSHEAR_EMAILS" ]; then
87
+ echo -e "${YELLOW}⚠️ primershear.emails contains no active email addresses.${NC}"
88
+ echo -e "${YELLOW} The secret will be set to an empty string, disabling the feature.${NC}"
89
+ fi
90
+
91
+ EMAIL_COUNT=$(echo "$PRIMERSHEAR_EMAILS" | tr ',' '\n' | grep -c '[^[:space:]]' || true)
92
+ echo -e "${GREEN}✅ Loaded $EMAIL_COUNT email address(es) from primershear.emails${NC}"
93
+
94
+ # ── Update .env ───────────────────────────────────────────────────────────────
95
+
96
+ ENV_FILE="$PROJECT_ROOT/.env"
97
+
98
+ if [ ! -f "$ENV_FILE" ]; then
99
+ echo -e "${RED}❌ .env not found. Run deploy-config first.${NC}"
100
+ exit 1
101
+ fi
102
+
103
+ # Replace the PRIMERSHEAR_EMAILS= line in .env (handles both empty and populated values)
104
+ if grep -q '^PRIMERSHEAR_EMAILS=' "$ENV_FILE"; then
105
+ # Use a temp file to avoid sed -i portability issues across macOS/Linux
106
+ local_tmp=$(mktemp)
107
+ sed "s|^PRIMERSHEAR_EMAILS=.*|PRIMERSHEAR_EMAILS=${PRIMERSHEAR_EMAILS}|" "$ENV_FILE" > "$local_tmp"
108
+ mv "$local_tmp" "$ENV_FILE"
109
+ echo -e "${GREEN}✅ Updated PRIMERSHEAR_EMAILS in .env${NC}"
110
+ else
111
+ echo "" >> "$ENV_FILE"
112
+ echo "PRIMERSHEAR_EMAILS=${PRIMERSHEAR_EMAILS}" >> "$ENV_FILE"
113
+ echo -e "${GREEN}✅ Appended PRIMERSHEAR_EMAILS to .env${NC}"
114
+ fi
115
+
116
+ if [ "$env_only" = "true" ]; then
117
+ echo -e "\n${GREEN}🎉 .env updated. Skipping Cloudflare deployment (--env-only).${NC}"
118
+ exit 0
119
+ fi
120
+
121
+ # ── Deploy to Cloudflare Pages ────────────────────────────────────────────────
122
+
123
+ if ! command -v wrangler > /dev/null 2>&1; then
124
+ echo -e "${RED}❌ wrangler is not installed or not in PATH${NC}"
125
+ exit 1
126
+ fi
127
+
128
+ source "$ENV_FILE"
129
+
130
+ PAGES_PROJECT_NAME=$(echo "$PAGES_PROJECT_NAME" | tr -d '\r')
131
+ if [ -z "$PAGES_PROJECT_NAME" ]; then
132
+ echo -e "${RED}❌ PAGES_PROJECT_NAME is missing from .env${NC}"
133
+ exit 1
134
+ fi
135
+
136
+ set_secret() {
137
+ local pages_env=$1
138
+ echo -e "${YELLOW} Setting PRIMERSHEAR_EMAILS for $pages_env...${NC}"
139
+ if [ "$pages_env" = "production" ]; then
140
+ printf '%s' "$PRIMERSHEAR_EMAILS" | wrangler pages secret put PRIMERSHEAR_EMAILS \
141
+ --project-name "$PAGES_PROJECT_NAME"
142
+ else
143
+ printf '%s' "$PRIMERSHEAR_EMAILS" | wrangler pages secret put PRIMERSHEAR_EMAILS \
144
+ --project-name "$PAGES_PROJECT_NAME" --env "$pages_env"
145
+ fi
146
+ }
147
+
148
+ if [ "$deploy_production" = "true" ]; then
149
+ set_secret "production"
150
+ echo -e "${GREEN}✅ PRIMERSHEAR_EMAILS deployed to production${NC}"
151
+ fi
152
+
153
+ if [ "$deploy_preview" = "true" ]; then
154
+ set_secret "preview"
155
+ echo -e "${GREEN}✅ PRIMERSHEAR_EMAILS deployed to preview${NC}"
156
+ fi
157
+
158
+ # Deploy Pages so the new secret takes effect immediately
159
+ echo -e "\n${YELLOW}🚀 Building and deploying Pages to activate new secret...${NC}"
160
+ if ! npm run deploy; then
161
+ echo -e "${RED}❌ Pages deployment failed${NC}"
162
+ exit 1
163
+ fi
164
+ echo -e "${GREEN}✅ Pages deployment complete${NC}"
165
+
166
+ echo -e "\n${GREEN}🎉 PrimerShear email list deployment complete!${NC}"