@salesforce/templates 66.10.2 → 66.10.4

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 (64) hide show
  1. package/lib/generators/uiBundleGenerator.d.ts +1 -0
  2. package/lib/generators/uiBundleGenerator.js +13 -0
  3. package/lib/generators/uiBundleGenerator.js.map +1 -1
  4. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package-lock.json +646 -812
  5. package/lib/templates/project/reactinternalapp/CHANGELOG.md +186 -0
  6. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package-lock.json +784 -996
  7. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package.json +4 -3
  8. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/scripts/get-graphql-schema.mjs +8 -5
  9. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/api/graphqlClient.ts +24 -8
  10. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/AgentforceConversationClient.tsx +13 -1
  11. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx +4 -2
  12. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/types/conversation.ts +1 -0
  13. package/lib/templates/project/reactinternalapp/_p_/_m_/permissionsets/reactinternalapp_Access.permissionset-meta.xml +4 -0
  14. package/lib/templates/project/reactinternalapp/package.json +5 -1
  15. package/lib/templates/project/reactinternalapp/scripts/org-setup-config-schema.mjs +96 -0
  16. package/lib/templates/project/reactinternalapp/scripts/org-setup.mjs +410 -177
  17. package/lib/templates/project/reactinternalapp/scripts/validate-org-setup-config.mjs +38 -0
  18. package/lib/templates/uiBundles/angularbasic/.forceignore +15 -0
  19. package/lib/templates/uiBundles/angularbasic/.postcssrc.json +5 -0
  20. package/lib/templates/uiBundles/angularbasic/.prettierignore +8 -0
  21. package/lib/templates/uiBundles/angularbasic/.prettierrc +12 -0
  22. package/lib/templates/uiBundles/angularbasic/CHANGELOG.md +4 -0
  23. package/lib/templates/uiBundles/angularbasic/README.md +85 -0
  24. package/lib/templates/uiBundles/angularbasic/_uibundle.uibundle-meta.xml +7 -0
  25. package/lib/templates/uiBundles/angularbasic/angular.json +94 -0
  26. package/lib/templates/uiBundles/angularbasic/esbuild/api-version.mjs +17 -0
  27. package/lib/templates/uiBundles/angularbasic/eslint.config.js +56 -0
  28. package/lib/templates/uiBundles/angularbasic/middleware/html.mjs +3 -0
  29. package/lib/templates/uiBundles/angularbasic/middleware/proxy.mjs +12 -0
  30. package/lib/templates/uiBundles/angularbasic/package-lock.json +14070 -0
  31. package/lib/templates/uiBundles/angularbasic/package.json +52 -0
  32. package/lib/templates/uiBundles/angularbasic/playwright.config.ts +25 -0
  33. package/lib/templates/uiBundles/angularbasic/public/favicon.ico +0 -0
  34. package/lib/templates/uiBundles/angularbasic/scripts/rewrite-e2e-assets.mjs +30 -0
  35. package/lib/templates/uiBundles/angularbasic/src/app/api/graphql-client.service.spec.ts +154 -0
  36. package/lib/templates/uiBundles/angularbasic/src/app/api/graphql-client.service.ts +51 -0
  37. package/lib/templates/uiBundles/angularbasic/src/app/app.config.ts +8 -0
  38. package/lib/templates/uiBundles/angularbasic/src/app/app.css +0 -0
  39. package/lib/templates/uiBundles/angularbasic/src/app/app.html +1 -0
  40. package/lib/templates/uiBundles/angularbasic/src/app/app.routes.ts +21 -0
  41. package/lib/templates/uiBundles/angularbasic/src/app/app.spec.ts +18 -0
  42. package/lib/templates/uiBundles/angularbasic/src/app/app.ts +10 -0
  43. package/lib/templates/uiBundles/angularbasic/src/app/layout/app-layout.component.html +50 -0
  44. package/lib/templates/uiBundles/angularbasic/src/app/layout/app-layout.component.spec.ts +63 -0
  45. package/lib/templates/uiBundles/angularbasic/src/app/layout/app-layout.component.ts +21 -0
  46. package/lib/templates/uiBundles/angularbasic/src/app/pages/home/home.component.html +6 -0
  47. package/lib/templates/uiBundles/angularbasic/src/app/pages/home/home.component.spec.ts +23 -0
  48. package/lib/templates/uiBundles/angularbasic/src/app/pages/home/home.component.ts +7 -0
  49. package/lib/templates/uiBundles/angularbasic/src/app/pages/not-found/not-found.component.html +12 -0
  50. package/lib/templates/uiBundles/angularbasic/src/app/pages/not-found/not-found.component.spec.ts +33 -0
  51. package/lib/templates/uiBundles/angularbasic/src/app/pages/not-found/not-found.component.ts +9 -0
  52. package/lib/templates/uiBundles/angularbasic/src/index.html +13 -0
  53. package/lib/templates/uiBundles/angularbasic/src/main.ts +5 -0
  54. package/lib/templates/uiBundles/angularbasic/src/styles.css +12 -0
  55. package/lib/templates/uiBundles/angularbasic/src/types/sf-globals.d.ts +9 -0
  56. package/lib/templates/uiBundles/angularbasic/tsconfig.app.json +11 -0
  57. package/lib/templates/uiBundles/angularbasic/tsconfig.json +33 -0
  58. package/lib/templates/uiBundles/angularbasic/tsconfig.spec.json +10 -0
  59. package/lib/templates/uiBundles/angularbasic/ui-bundle.json +7 -0
  60. package/lib/templates/uiBundles/reactbasic/package-lock.json +784 -996
  61. package/lib/templates/uiBundles/reactbasic/package.json +4 -3
  62. package/lib/templates/uiBundles/reactbasic/scripts/get-graphql-schema.mjs +8 -5
  63. package/lib/templates/uiBundles/reactbasic/src/api/graphqlClient.ts +24 -8
  64. package/package.json +6 -5
@@ -18,8 +18,8 @@
18
18
  "graphql:schema": "node scripts/get-graphql-schema.mjs"
19
19
  },
20
20
  "dependencies": {
21
- "@salesforce/platform-sdk": "^10.12.2",
22
- "@salesforce/ui-bundle": "^10.12.2",
21
+ "@salesforce/platform-sdk": "^10.24.0",
22
+ "@salesforce/ui-bundle": "^10.24.0",
23
23
  "@tailwindcss/vite": "^4.1.17",
24
24
  "class-variance-authority": "^0.7.1",
25
25
  "clsx": "^2.1.1",
@@ -45,7 +45,8 @@
45
45
  "@graphql-eslint/eslint-plugin": "^4.1.0",
46
46
  "@graphql-tools/utils": "^11.0.0",
47
47
  "@playwright/test": "^1.49.0",
48
- "@salesforce/vite-plugin-ui-bundle": "^10.12.2",
48
+ "@salesforce/graphiti": "^10.24.0",
49
+ "@salesforce/vite-plugin-ui-bundle": "^10.24.0",
49
50
  "@testing-library/jest-dom": "^6.6.3",
50
51
  "@testing-library/react": "^16.1.0",
51
52
  "@testing-library/user-event": "^14.5.2",
@@ -15,13 +15,16 @@ import { buildClientSchema, getIntrospectionQuery, printSchema } from 'graphql';
15
15
  import { pruneSchema } from '@graphql-tools/utils';
16
16
 
17
17
  const DEFAULT_SCHEMA_PATH = '../../../../../schema.graphql';
18
+ const TARGET_ORG = process.env.SF_TARGET_ORG || undefined;
18
19
 
19
20
  async function executeSalesforceGraphQLQuery(query, variables, operationName) {
20
- const {
21
- rawInstanceUrl: instanceUrl,
22
- apiVersion,
23
- accessToken,
24
- } = await getOrgInfo();
21
+ const orgInfo = await getOrgInfo(TARGET_ORG);
22
+ if (!orgInfo) {
23
+ throw new Error(
24
+ 'Could not resolve a Salesforce org. Set SF_TARGET_ORG or a default org.'
25
+ );
26
+ }
27
+ const { rawInstanceUrl: instanceUrl, apiVersion, accessToken } = orgInfo;
25
28
 
26
29
  const targetUrl = `${instanceUrl}/services/data/v${apiVersion}/graphql`;
27
30
 
@@ -1,19 +1,35 @@
1
1
  /**
2
- * Thin GraphQL client: createDataSDK + sdk.graphql.query with centralized
3
- * error handling. Use with gql-tagged queries and generated operation types
4
- * for type-safe calls.
2
+ * Thin GraphQL client: createDataSDK + sdk.graphql with centralized error
3
+ * handling. Mutations are routed to sdk.graphql.mutate and everything else to
4
+ * sdk.graphql.query (the SDK rejects an operation sent to the wrong method).
5
+ * Use with gql-tagged queries and generated operation types for type-safe calls.
5
6
  */
6
7
  import { createDataSDK } from '@salesforce/platform-sdk';
7
8
 
9
+ /**
10
+ * True when the operation's first definition is a `mutation`. Strips GraphQL
11
+ * comments first so a leading `# ...` line can't mask the keyword. Queries
12
+ * (named or anonymous `{ ... }` shorthand) and subscriptions fall through to
13
+ * query().
14
+ */
15
+ function isMutation(operation: string): boolean {
16
+ return /^\s*mutation\b/.test(operation.replace(/#[^\n\r]*/g, ''));
17
+ }
18
+
8
19
  export async function executeGraphQL<TData, TVariables>(
9
- query: string,
20
+ operation: string,
10
21
  variables?: TVariables
11
22
  ): Promise<TData> {
12
23
  const data = await createDataSDK();
13
- const result = await data.graphql!.query<TData, TVariables>({
14
- query: query,
15
- variables: variables,
16
- });
24
+ const result = isMutation(operation)
25
+ ? await data.graphql!.mutate<TData, TVariables>({
26
+ mutation: operation,
27
+ variables: variables,
28
+ })
29
+ : await data.graphql!.query<TData, TVariables>({
30
+ query: operation,
31
+ variables: variables,
32
+ });
17
33
 
18
34
  if (result.errors?.length) {
19
35
  const msg = result.errors.map(e => e.message).join('; ');
@@ -69,6 +69,7 @@ export function AgentforceConversationClient({
69
69
  width,
70
70
  height,
71
71
  styleTokens,
72
+ isFileBased,
72
73
  salesforceOrigin,
73
74
  frontdoorUrl,
74
75
  onReady,
@@ -89,10 +90,21 @@ export function AgentforceConversationClient({
89
90
  ...(agentId !== undefined && { agentId }),
90
91
  ...(agentLabel !== undefined && { agentLabel }),
91
92
  ...(styleTokens !== undefined && { styleTokens }),
93
+ ...(isFileBased !== undefined && { isFileBased }),
92
94
  renderingConfig,
93
95
  channel: "Vibes",
94
96
  };
95
- }, [agentId, agentLabel, inlineProp, headerEnabled, showHeaderIcon, width, height, styleTokens]);
97
+ }, [
98
+ agentId,
99
+ agentLabel,
100
+ inlineProp,
101
+ headerEnabled,
102
+ showHeaderIcon,
103
+ width,
104
+ height,
105
+ styleTokens,
106
+ isFileBased,
107
+ ]);
96
108
 
97
109
  const inline = normalizedAgentforceClientConfig?.renderingConfig?.mode === "inline";
98
110
 
@@ -156,7 +156,9 @@ function AccountDetailContent({ account }: { account: AccountNode }) {
156
156
  <FieldItem label="Industry">{fieldValue(account.Industry)}</FieldItem>
157
157
  <FieldItem label="Annual Revenue">{fieldValue(account.AnnualRevenue)}</FieldItem>
158
158
  </FieldRow>
159
- <FieldItem label="Description">{fieldValue(account.Description)}</FieldItem>
159
+ <dl>
160
+ <FieldItem label="Description">{fieldValue(account.Description)}</FieldItem>
161
+ </dl>
160
162
  </Section>
161
163
 
162
164
  <Separator />
@@ -216,7 +218,7 @@ function FieldItem({ label, children }: { label: string; children: React.ReactNo
216
218
  }
217
219
 
218
220
  function FieldRow({ children }: { children: React.ReactNode }) {
219
- return <div className="grid grid-cols-2 gap-x-8 gap-y-4">{children}</div>;
221
+ return <dl className="grid grid-cols-2 gap-x-8 gap-y-4">{children}</dl>;
220
222
  }
221
223
 
222
224
  function Section({ title, children }: { title: string; children: React.ReactNode }) {
@@ -33,6 +33,7 @@ export interface AgentforceConversationClientProps {
33
33
  height?: string | number;
34
34
  /** Theme overrides for the chat UI. */
35
35
  styleTokens?: StyleTokens;
36
+ isFileBased?: boolean;
36
37
  /** Optional. If not provided, resolved internally (e.g. from /__lo/frontdoor in dev, window.location.origin in prod). */
37
38
  salesforceOrigin?: string;
38
39
  /** Optional. If not provided, resolved internally in dev via /__lo/frontdoor. */
@@ -6,4 +6,8 @@
6
6
  </applicationVisibilities>
7
7
  <hasActivationRequired>false</hasActivationRequired>
8
8
  <label>reactinternalapp Access</label>
9
+ <userPermissions>
10
+ <enabled>true</enabled>
11
+ <name>ApiEnabled</name>
12
+ </userPermissions>
9
13
  </PermissionSet>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/ui-bundle-template-base-sfdx-project",
3
- "version": "10.12.2",
3
+ "version": "10.24.0",
4
4
  "description": "Base SFDX project template",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "publishConfig": {
@@ -11,6 +11,7 @@
11
11
  "build": "echo 'No build required for base-sfdx-project'",
12
12
  "clean": "echo 'No clean required for base-sfdx-project'",
13
13
  "lint": "eslint --no-error-on-unmatched-pattern **/{aura,lwc}/**/*.js",
14
+ "validate:org-setup-config": "node scripts/validate-org-setup-config.mjs",
14
15
  "test": "npm run test:unit",
15
16
  "test:coverage": "npm run test",
16
17
  "test:unit": "sfdx-lwc-jest -- --passWithNoTests",
@@ -22,6 +23,9 @@
22
23
  "precommit": "lint-staged",
23
24
  "setup": "node scripts/org-setup.mjs"
24
25
  },
26
+ "dependencies": {
27
+ "zod": "^3.24.1"
28
+ },
25
29
  "devDependencies": {
26
30
  "@lwc/eslint-plugin-lwc": "^3.3.0",
27
31
  "@prettier/plugin-xml": "^3.2.2",
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Shared schema + validator for org-setup.config.json (W-23043729).
3
+ *
4
+ * Authored ONCE, used at TWO moments:
5
+ * (a) build / CI time — `scripts/validate-org-setup-config.mjs` validates every
6
+ * org-setup.config.json this repo ships, failing the build on any violation.
7
+ * (b) setup runtime — `org-setup.mjs` calls `validateConfig` once in main(),
8
+ * before any step runs, to catch the developer's local post-scaffold edits.
9
+ *
10
+ * `validateConfig` is pure: it parses + validates and RETURNS a result. Each call
11
+ * site owns its own print/exit, so the build gate can report every bad file and
12
+ * the runtime can exit immediately — and the validator stays unit-testable.
13
+ *
14
+ * The zod schema uses `.strict()` at every level so unknown keys (e.g. the
15
+ * `permsetAssignment` singular typo) are rejected rather than silently ignored.
16
+ */
17
+
18
+ import { z } from 'zod';
19
+
20
+ /** Closed set of assignee values — no arbitrary usernames. */
21
+ const Assignee = z.enum(['currentUser', 'guestUser', 'skip']);
22
+
23
+ // No siteName: for guestUser the site is derived from the single
24
+ // networks/<siteName>.network-meta.xml the app ships (see spec §5.2).
25
+ const Assignment = z
26
+ .object({
27
+ assignee: Assignee,
28
+ })
29
+ .strict();
30
+
31
+ export const ConfigSchema = z
32
+ .object({
33
+ permsetAssignments: z
34
+ .object({
35
+ // guestUser is valid here — siteName is derived, not per-assignment.
36
+ defaultAssignee: Assignee.default('skip'),
37
+ assignments: z.record(z.string(), Assignment).default({}),
38
+ })
39
+ .strict()
40
+ .optional(),
41
+ role: z
42
+ .object({
43
+ assignee: z.literal('currentUser'), // only value the role code honors
44
+ roleName: z.string().min(1),
45
+ })
46
+ .strict()
47
+ .optional(),
48
+ selfRegistration: z
49
+ .object({
50
+ // No siteName: the site is derived from the single
51
+ // networks/<siteName>.network-meta.xml the app ships (see spec §5.2),
52
+ // exactly like the guestUser permset path.
53
+ selfRegProfile: z.string().min(1),
54
+ accountName: z.string().min(1),
55
+ })
56
+ .strict()
57
+ .optional(),
58
+ })
59
+ .strict();
60
+
61
+ /**
62
+ * Render a single zod issue as a "path: message" line. Empty path (a root-level
63
+ * problem) renders as "<root>: message".
64
+ */
65
+ function formatIssue(issue) {
66
+ const path = issue.path.length > 0 ? issue.path.join('.') : '<root>';
67
+ return `${path}: ${issue.message}`;
68
+ }
69
+
70
+ /**
71
+ * Parse + validate a raw org-setup.config.json string.
72
+ *
73
+ * @param {string} rawText raw file contents (not yet JSON-parsed)
74
+ * @param {string} [configPath] path used only for error messages
75
+ * @returns {{ ok: true, data: object } | { ok: false, errors: string[] }}
76
+ * On success, `data` is the parsed + defaulted config. On failure, `errors`
77
+ * is a non-empty list of human-readable messages (JSON parse error or zod
78
+ * issues). The caller decides whether to print/exit.
79
+ */
80
+ export function validateConfig(rawText, configPath) {
81
+ const where = configPath ? ` (${configPath})` : '';
82
+
83
+ let parsed;
84
+ try {
85
+ parsed = JSON.parse(rawText);
86
+ } catch (err) {
87
+ return { ok: false, errors: [`malformed JSON${where}: ${err.message}`] };
88
+ }
89
+
90
+ const result = ConfigSchema.safeParse(parsed);
91
+ if (!result.success) {
92
+ return { ok: false, errors: result.error.issues.map(formatIssue) };
93
+ }
94
+
95
+ return { ok: true, data: result.data };
96
+ }