@salesforce/webapp-template-app-react-template-vibe-experimental 1.36.3

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 (132) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/.a4drules/build-validation.md +81 -0
  3. package/dist/.a4drules/code-quality.md +150 -0
  4. package/dist/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
  5. package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +212 -0
  6. package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
  7. package/dist/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
  8. package/dist/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
  9. package/dist/.a4drules/graphql.md +408 -0
  10. package/dist/.a4drules/images.md +13 -0
  11. package/dist/.a4drules/react.md +361 -0
  12. package/dist/.a4drules/react_image_processing.md +45 -0
  13. package/dist/.a4drules/skills/install-feature/SKILL.md +67 -0
  14. package/dist/.a4drules/skills/install-feature/scripts/copy-feature-assets.sh +36 -0
  15. package/dist/.a4drules/typescript.md +224 -0
  16. package/dist/.forceignore +15 -0
  17. package/dist/.husky/pre-commit +4 -0
  18. package/dist/.prettierignore +11 -0
  19. package/dist/.prettierrc +17 -0
  20. package/dist/CHANGELOG.md +533 -0
  21. package/dist/README.md +18 -0
  22. package/dist/config/project-scratch-def.json +13 -0
  23. package/dist/force-app/main/default/classes/WebAppAuthUtils.cls +68 -0
  24. package/dist/force-app/main/default/classes/WebAppAuthUtils.cls-meta.xml +5 -0
  25. package/dist/force-app/main/default/classes/WebAppChangePassword.cls +77 -0
  26. package/dist/force-app/main/default/classes/WebAppChangePassword.cls-meta.xml +5 -0
  27. package/dist/force-app/main/default/classes/WebAppForgotPassword.cls +71 -0
  28. package/dist/force-app/main/default/classes/WebAppForgotPassword.cls-meta.xml +5 -0
  29. package/dist/force-app/main/default/classes/WebAppLogin.cls +97 -0
  30. package/dist/force-app/main/default/classes/WebAppLogin.cls-meta.xml +5 -0
  31. package/dist/force-app/main/default/classes/WebAppRegistration.cls +162 -0
  32. package/dist/force-app/main/default/classes/WebAppRegistration.cls-meta.xml +5 -0
  33. package/dist/force-app/main/default/digitalExperienceConfigs/appreacttemplatevibe1.digitalExperienceConfig +8 -0
  34. package/dist/force-app/main/default/digitalExperiences/site/appreacttemplatevibe1/appreacttemplatevibe1.digitalExperience-meta.xml +11 -0
  35. package/dist/force-app/main/default/digitalExperiences/site/appreacttemplatevibe1/sfdc_cms__site/appreacttemplatevibe1/_meta.json +5 -0
  36. package/dist/force-app/main/default/digitalExperiences/site/appreacttemplatevibe1/sfdc_cms__site/appreacttemplatevibe1/content.json +10 -0
  37. package/dist/force-app/main/default/networks/appreacttemplatevibe.network +60 -0
  38. package/dist/force-app/main/default/package.xml +20 -0
  39. package/dist/force-app/main/default/sites/appreacttemplatevibe.site +31 -0
  40. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/.graphqlrc.yml +2 -0
  41. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/.prettierignore +9 -0
  42. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/.prettierrc +11 -0
  43. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/appreacttemplatevibe.webapplication-meta.xml +7 -0
  44. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/build/vite.config.d.ts +2 -0
  45. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/build/vite.config.js +94 -0
  46. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/codegen.yml +12 -0
  47. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/e2e/app.spec.ts +24 -0
  48. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/eslint.config.js +141 -0
  49. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/index.html +13 -0
  50. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/package-lock.json +13999 -0
  51. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/package.json +67 -0
  52. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/playwright.config.ts +24 -0
  53. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/scripts/get-graphql-schema.mjs +68 -0
  54. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/scripts/rewrite-e2e-assets.mjs +23 -0
  55. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/HomePage.tsx +231 -0
  56. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/api/graphql-operations-types.ts +129 -0
  57. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/api/utils/accounts.ts +33 -0
  58. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
  59. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/app.tsx +16 -0
  60. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/appLayout.tsx +17 -0
  61. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/icons/book.svg +3 -0
  62. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/icons/copy.svg +4 -0
  63. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/icons/rocket.svg +3 -0
  64. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/icons/star.svg +3 -0
  65. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/images/codey-1.png +0 -0
  66. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/images/codey-2.png +0 -0
  67. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/images/codey-3.png +0 -0
  68. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/assets/images/vibe-codey.svg +194 -0
  69. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/AccountsTable.tsx +134 -0
  70. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/AgentforceConversationClient.tsx +72 -0
  71. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/Footer.test.tsx +35 -0
  72. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/Footer.tsx +68 -0
  73. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/Hero.test.tsx +44 -0
  74. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/Hero.tsx +61 -0
  75. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/PromptCard.test.tsx +57 -0
  76. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/PromptCard.tsx +301 -0
  77. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/PromptHighlight.test.tsx +85 -0
  78. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/PromptHighlight.tsx +73 -0
  79. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/alerts/status-alert.tsx +45 -0
  80. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/auth/authentication-route.tsx +21 -0
  81. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/auth/private-route.tsx +36 -0
  82. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/footers/footer-link.tsx +36 -0
  83. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/forms/auth-form.tsx +81 -0
  84. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/forms/submit-button.tsx +49 -0
  85. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/layout/card-layout.tsx +23 -0
  86. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/layout/centered-page-layout.tsx +73 -0
  87. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/layout/loading-page.tsx +46 -0
  88. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/alert.tsx +65 -0
  89. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/button.tsx +54 -0
  90. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/card.tsx +77 -0
  91. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/field.tsx +111 -0
  92. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/index.ts +71 -0
  93. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/input.tsx +19 -0
  94. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/label.tsx +19 -0
  95. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/pagination.tsx +99 -0
  96. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/select.tsx +151 -0
  97. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/skeleton.tsx +7 -0
  98. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/spinner.tsx +26 -0
  99. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/table.tsx +114 -0
  100. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/components/ui/tabs.tsx +115 -0
  101. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/context/AuthContext.tsx +83 -0
  102. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/hooks/form.tsx +116 -0
  103. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/index.ts +6 -0
  104. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/lib/utils.ts +6 -0
  105. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/ChangePassword.tsx +98 -0
  106. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/ForgotPassword.tsx +67 -0
  107. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Home.tsx +12 -0
  108. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Login.tsx +89 -0
  109. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/NotFound.tsx +18 -0
  110. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Profile.tsx +146 -0
  111. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Register.tsx +130 -0
  112. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/ResetPassword.tsx +101 -0
  113. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/routes.tsx +71 -0
  114. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/styles/global.css +270 -0
  115. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/testCmp.tsx +9 -0
  116. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/types/conversation.ts +21 -0
  117. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/utils/authenticationConfig.ts +52 -0
  118. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/utils/helpers.ts +187 -0
  119. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/tsconfig.json +36 -0
  120. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/tsconfig.node.json +13 -0
  121. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/vite-env.d.ts +1 -0
  122. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/vite.config.ts +102 -0
  123. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/vitest-env.d.ts +2 -0
  124. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/vitest.config.ts +11 -0
  125. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/vitest.setup.ts +1 -0
  126. package/dist/force-app/main/default/webapplications/appreacttemplatevibe/webapplication.json +7 -0
  127. package/dist/jest.config.js +6 -0
  128. package/dist/package.json +38 -0
  129. package/dist/scripts/apex/hello.apex +10 -0
  130. package/dist/scripts/soql/account.soql +6 -0
  131. package/dist/sfdx-project.json +12 -0
  132. package/package.json +46 -0
@@ -0,0 +1,187 @@
1
+ import { AUTH_REDIRECT_PARAM } from "./authenticationConfig";
2
+ import { z } from "zod";
3
+
4
+ /** Email field validation */
5
+ export const emailSchema = z.string().trim().email("Please enter a valid email address");
6
+
7
+ /** Password field validation (minimum 8 characters) */
8
+ export const passwordSchema = z.string().min(8, "Password must be at least 8 characters");
9
+
10
+ /**
11
+ * Shared schema for new password + confirmation fields.
12
+ * Validates password length and matching confirmation.
13
+ */
14
+ export const newPasswordSchema = z
15
+ .object({
16
+ newPassword: passwordSchema,
17
+ confirmPassword: z.string().min(1, "Please confirm your password"),
18
+ })
19
+ .refine((data) => data.newPassword === data.confirmPassword, {
20
+ message: "Passwords do not match",
21
+ path: ["confirmPassword"],
22
+ });
23
+
24
+ /**
25
+ *
26
+ * Extracts the startUrl from URLSearchParams, defaulting to '/'.
27
+ *
28
+ * SECURITY NOTE: This function strictly validates the URL to prevent
29
+ * Open Redirect vulnerabilities. It allows only relative paths.
30
+ *
31
+ * @param searchParams - The URLSearchParams object from useSearchParams()
32
+ * @returns The start URL for post-authentication redirect
33
+ */
34
+ export function getStartUrl(searchParams: URLSearchParams): string {
35
+ // 1. Check for the standard redirect parameter
36
+ const url = searchParams.get(AUTH_REDIRECT_PARAM);
37
+ // 2. Security Check: Validation Logic
38
+ if (url && isValidRedirect(url)) {
39
+ return url;
40
+ }
41
+ // 3. Fallback: Default to root
42
+ return "/";
43
+ }
44
+
45
+ /**
46
+ * [Dev Note] Security: Validates that the redirect URL is a relative path
47
+ * to prevent Open Redirect vulnerabilities.
48
+ *
49
+ * Security Checks:
50
+ * 1. Rejects protocol-relative URLs (//)
51
+ * 2. Rejects backslash usage which some browsers treat as slashes (/\)
52
+ * 3. Rejects control characters
53
+ */
54
+ function isValidRedirect(url: string): boolean {
55
+ // Basic structure check
56
+ if (!url.startsWith("/") || url.startsWith("//")) return false;
57
+ // Security: Reject backslashes to prevent /\example.com bypasses
58
+ if (url.includes("\\")) return false;
59
+ // Robustness: Ensure it doesn't contain whitespace/control characters
60
+ if (/[^\u0021-\u00ff]/.test(url)) return false;
61
+ return true;
62
+ }
63
+
64
+ /**
65
+ * MAINTAINABILITY: Robust error extraction.
66
+ * Handles strings, objects, and standard Error instances.
67
+ *
68
+ * @param err - The error object (unknown type)
69
+ * @param fallback - Fallback message if error doesn't have a message property
70
+ * @returns The error message string
71
+ */
72
+ export function getErrorMessage(err: unknown, fallback: string): string {
73
+ if (err instanceof Error) return err.message;
74
+ if (typeof err === "string") return err;
75
+ // Check if it's an object with a message property
76
+ if (typeof err === "object" && err !== null && "message" in err) {
77
+ return String((err as { message: unknown }).message);
78
+ }
79
+ return fallback;
80
+ }
81
+
82
+ /**
83
+ * [Dev Note] Helper to parse the fetch Response.
84
+ * It handles the distinction between success (JSON) and failure (throwing Error).
85
+ */
86
+ export async function handleApiResponse<T = unknown>(
87
+ response: Response,
88
+ fallbackError: string,
89
+ ): Promise<T> {
90
+ // 1. Robustness: Handle 204 No Content gracefully
91
+ if (response.status === 204) {
92
+ return {} as T;
93
+ }
94
+
95
+ let data: any = null;
96
+
97
+ const contentType = response.headers.get("content-type");
98
+ if (contentType?.includes("application/json")) {
99
+ data = await response.json();
100
+ } else {
101
+ // [Dev Note] If Salesforce returns HTML (e.g. standard error page),
102
+ // we consume text to avoid parsing errors.
103
+ await response.text();
104
+ }
105
+
106
+ if (!response.ok) {
107
+ // [Dev Note] Throwing here allows the calling component to catch and
108
+ // display the error via getErrorMessage()
109
+ throw new Error(parseApiResponseError(data, fallbackError));
110
+ }
111
+
112
+ return data as T;
113
+ }
114
+
115
+ /**
116
+ * Shared response type for authentication endpoints (login/register).
117
+ * Success responses contain `success: true` and `redirectUrl`.
118
+ * Error responses contain `errors` array.
119
+ */
120
+ export interface AuthResponse {
121
+ success?: boolean;
122
+ redirectUrl?: string | null;
123
+ errors?: string[];
124
+ }
125
+
126
+ /**
127
+ * UI API Record response structure.
128
+ */
129
+ export type RecordResponse = {
130
+ fields: Record<
131
+ string,
132
+ {
133
+ value: string;
134
+ }
135
+ >;
136
+ };
137
+
138
+ /**
139
+ * [Dev Note] The UI API returns a complex nested structure.
140
+ * This helper flattens it to a simple object for easier form binding.
141
+ * Flattens { fields: { FieldName: { displayValue, value } } } to { FieldName: value }
142
+ *
143
+ * @param data - The RecordResponse with field objects.
144
+ * @throws {Error} If data is not a valid RecordResponse.
145
+ * @returns Flattened object with field values.
146
+ */
147
+ export function flattenUiApiRecord<T>(data: RecordResponse): T {
148
+ if (!data?.fields) {
149
+ throw new Error(parseApiResponseError(data));
150
+ }
151
+
152
+ return Object.fromEntries(
153
+ Object.entries(data.fields).map(([key, field]) => [key, field?.value ?? null]),
154
+ ) as T;
155
+ }
156
+
157
+ /**
158
+ * [Dev Note] Salesforce APIs may return errors as an array or a single object.
159
+ * This helper standardizes the extraction of the error message string.
160
+ *
161
+ * @param data - The response data.
162
+ * @param fallbackError - Fallback error message if response doesn't have a message property
163
+ * @returns The error message string
164
+ */
165
+ function parseApiResponseError(
166
+ data: any,
167
+ fallbackError: string = "An unknown error occurred",
168
+ ): string {
169
+ if (data?.message) {
170
+ return data.message;
171
+ }
172
+ if (data?.error) {
173
+ return data.error;
174
+ }
175
+ if (data?.errors && Array.isArray(data.errors) && data.errors.length > 0) {
176
+ return data.errors.join(" ") || fallbackError;
177
+ }
178
+ if (Array.isArray(data) && data.length > 0) {
179
+ return (
180
+ data
181
+ .map((e) => e?.message)
182
+ .filter(Boolean)
183
+ .join(" ") || fallbackError
184
+ );
185
+ }
186
+ return fallbackError;
187
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+
23
+ /* Path mapping */
24
+ "baseUrl": ".",
25
+ "paths": {
26
+ "@/*": ["./src/*"],
27
+ "@api/*": ["./src/api/*"],
28
+ "@components/*": ["./src/components/*"],
29
+ "@utils/*": ["./src/utils/*"],
30
+ "@styles/*": ["./src/styles/*"],
31
+ "@assets/*": ["./src/assets/*"]
32
+ }
33
+ },
34
+ "include": ["src", "vite-env.d.ts", "vitest-env.d.ts"],
35
+ "references": [{ "path": "./tsconfig.node.json" }]
36
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "skipLibCheck": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "outDir": "./build"
11
+ },
12
+ "include": ["vite.config.ts"]
13
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,102 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import path from 'path';
4
+ import { resolve } from 'path';
5
+ import tailwindcss from '@tailwindcss/vite';
6
+ import salesforce from '@salesforce/vite-plugin-webapp-experimental';
7
+ import codegen from 'vite-plugin-graphql-codegen';
8
+
9
+ export default defineConfig(({ mode }) => {
10
+ return {
11
+ // Ensure root base for e2e/static serve; plugin may override when deployed under a path
12
+ base: '/',
13
+ plugins: [
14
+ tailwindcss(),
15
+ react(),
16
+ salesforce(),
17
+ codegen({
18
+ // Path to the codegen config file
19
+ configFilePathOverride: resolve(__dirname, 'codegen.yml'),
20
+ // Run codegen on dev server start
21
+ runOnStart: true,
22
+ // Don't run codegen on build for now
23
+ runOnBuild: false,
24
+ // Enable file watcher during development
25
+ enableWatcher: true,
26
+ // Fail build if codegen errors
27
+ throwOnBuild: true,
28
+ }),
29
+ ],
30
+
31
+ // Build configuration for MPA
32
+ build: {
33
+ outDir: resolve(__dirname, 'dist'),
34
+ assetsDir: 'assets',
35
+ sourcemap: false,
36
+ },
37
+
38
+ // Resolve aliases (shared between build and test)
39
+ resolve: {
40
+ dedupe: ['react', 'react-dom'],
41
+ alias: {
42
+ '@': path.resolve(__dirname, './src'),
43
+ '@api': path.resolve(__dirname, './src/api'),
44
+ '@components': path.resolve(__dirname, './src/components'),
45
+ '@utils': path.resolve(__dirname, './src/utils'),
46
+ '@styles': path.resolve(__dirname, './src/styles'),
47
+ '@assets': path.resolve(__dirname, './src/assets'),
48
+ },
49
+ },
50
+
51
+ // Vitest configuration
52
+ test: {
53
+ // Override root for tests (build uses src/pages as root)
54
+ root: resolve(__dirname),
55
+
56
+ // Use jsdom environment for React component testing
57
+ environment: 'jsdom',
58
+
59
+ // Setup files to run before each test
60
+ setupFiles: ['./src/test/setup.ts'],
61
+
62
+ // Global test patterns
63
+ include: [
64
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
65
+ 'src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
66
+ ],
67
+
68
+ // Coverage configuration
69
+ coverage: {
70
+ provider: 'v8',
71
+ reporter: ['text', 'html', 'clover', 'json'],
72
+ exclude: [
73
+ 'node_modules/',
74
+ 'src/test/',
75
+ 'src/**/*.d.ts',
76
+ 'src/main.tsx',
77
+ 'src/vite-env.d.ts',
78
+ 'src/components/**/index.ts',
79
+ '**/*.config.ts',
80
+ 'build/',
81
+ 'dist/',
82
+ 'coverage/',
83
+ 'eslint.config.js',
84
+ ],
85
+ thresholds: {
86
+ global: {
87
+ branches: 85,
88
+ functions: 85,
89
+ lines: 85,
90
+ statements: 85,
91
+ },
92
+ },
93
+ },
94
+
95
+ // Test timeout
96
+ testTimeout: 10000,
97
+
98
+ // Globals for easier testing
99
+ globals: true,
100
+ },
101
+ };
102
+ });
@@ -0,0 +1,2 @@
1
+ /// <reference types="vitest" />
2
+ /// <reference types="@testing-library/jest-dom" />
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ test: {
7
+ globals: true,
8
+ environment: 'jsdom',
9
+ setupFiles: './vitest.setup.ts',
10
+ },
11
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,7 @@
1
+ {
2
+ "outputDir": "dist",
3
+ "routing": {
4
+ "trailingSlash": "never",
5
+ "fallback": "/index.html"
6
+ }
7
+ }
@@ -0,0 +1,6 @@
1
+ const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config');
2
+
3
+ module.exports = {
4
+ ...jestConfig,
5
+ modulePathIgnorePatterns: ['<rootDir>/.localdevserver']
6
+ };
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
3
+ "version": "1.36.3",
4
+ "description": "Base SFDX project template",
5
+ "private": true,
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "scripts": {
10
+ "build": "echo 'No build required for base-sfdx-project'",
11
+ "clean": "echo 'No clean required for base-sfdx-project'",
12
+ "lint": "eslint **/{aura,lwc}/**/*.js",
13
+ "test": "npm run test:unit",
14
+ "test:coverage": "npm run test",
15
+ "test:unit": "sfdx-lwc-jest -- --passWithNoTests",
16
+ "test:unit:watch": "sfdx-lwc-jest --watch",
17
+ "test:unit:debug": "sfdx-lwc-jest --debug",
18
+ "test:unit:coverage": "sfdx-lwc-jest --coverage",
19
+ "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
20
+ "prettier:verify": "prettier --check \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
21
+ "precommit": "lint-staged"
22
+ },
23
+ "devDependencies": {
24
+ "@lwc/eslint-plugin-lwc": "^2.0.0",
25
+ "@prettier/plugin-xml": "^3.2.2",
26
+ "@salesforce/eslint-config-lwc": "^3.2.3",
27
+ "@salesforce/eslint-plugin-aura": "^2.0.0",
28
+ "@salesforce/eslint-plugin-lightning": "^1.0.0",
29
+ "@salesforce/sfdx-lwc-jest": "^7.0.1",
30
+ "eslint": "8.57.1",
31
+ "eslint-plugin-import": "^2.25.4",
32
+ "eslint-plugin-jest": "^28.8.1",
33
+ "husky": "^9.1.5",
34
+ "lint-staged": "^15.1.0",
35
+ "prettier": "^3.1.0",
36
+ "prettier-plugin-apex": "^2.0.1"
37
+ }
38
+ }
@@ -0,0 +1,10 @@
1
+ // Use .apex files to store anonymous Apex.
2
+ // You can execute anonymous Apex in VS Code by selecting the
3
+ // apex text and running the command:
4
+ // SFDX: Execute Anonymous Apex with Currently Selected Text
5
+ // You can also execute the entire file by running the command:
6
+ // SFDX: Execute Anonymous Apex with Editor Contents
7
+
8
+ string tempvar = 'Enter_your_name_here';
9
+ System.debug('Hello World!');
10
+ System.debug('My name is ' + tempvar);
@@ -0,0 +1,6 @@
1
+ // Use .soql files to store SOQL queries.
2
+ // You can execute queries in VS Code by selecting the
3
+ // query text and running the command:
4
+ // SFDX: Execute SOQL Query with Currently Selected Text
5
+
6
+ SELECT Id, Name FROM Account
@@ -0,0 +1,12 @@
1
+ {
2
+ "packageDirectories": [
3
+ {
4
+ "path": "force-app",
5
+ "default": true
6
+ }
7
+ ],
8
+ "name": "MyProject",
9
+ "namespace": "",
10
+ "sfdcLoginUrl": "https://login.salesforce.com",
11
+ "sourceApiVersion": "66.0"
12
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@salesforce/webapp-template-app-react-template-vibe-experimental",
3
+ "version": "1.36.3",
4
+ "description": "Vibe coding starter app template",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "author": "",
7
+ "type": "module",
8
+ "main": "index.js",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "scripts": {
16
+ "clean": "rm -rf dist",
17
+ "build": "npx tsx ../../cli/src/index.ts apply-patches packages/template/app/appreacttemplatevibe packages/template/base-app/base-react-app packages/template/app/appreacttemplatevibe/dist --reset",
18
+ "test": "npm run build && cd dist/force-app/main/default/webapplications/appreacttemplatevibe && npm ci && npm run build",
19
+ "test:coverage": "npm run test",
20
+ "dev": "cd dist/force-app/main/default/webapplications/appreacttemplatevibe && npm install && npm run dev",
21
+ "watch": "npx tsx ../../cli/src/index.ts watch-patches packages/template/app/appreacttemplatevibe packages/template/base-app/base-react-app packages/template/app/appreacttemplatevibe/dist"
22
+ },
23
+ "devDependencies": {
24
+ "@testing-library/jest-dom": "^6.6.3",
25
+ "@testing-library/react": "^16.1.0",
26
+ "@testing-library/user-event": "^14.5.2",
27
+ "@types/react": "^19.2.7",
28
+ "@types/react-dom": "^19.2.3",
29
+ "@vitest/ui": "^4.0.17",
30
+ "jsdom": "^25.0.1",
31
+ "react-dom": "^19.2.1",
32
+ "react-router": "^7.10.1",
33
+ "vitest": "^4.0.17"
34
+ },
35
+ "nx": {
36
+ "targets": {
37
+ "build": {
38
+ "executor": "@salesforce/webapp-template-cli-experimental:apply-patches"
39
+ },
40
+ "test": {
41
+ "executor": "@salesforce/webapp-template-cli-experimental:build-dist-app"
42
+ }
43
+ }
44
+ },
45
+ "gitHead": "7eef94f53086bb08b0545f5f61d3cbfed3fe0197"
46
+ }