@salesforce/plugin-templates 57.1.2 → 57.4.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.
package/README.md CHANGED
@@ -132,6 +132,7 @@ Congrats, you are debugging!
132
132
  - [`sf template generate project`](#sf-template-generate-project)
133
133
  - [`sf template generate static-resource`](#sf-template-generate-static-resource)
134
134
  - [`sf template generate ui-bundle`](#sf-template-generate-ui-bundle)
135
+ - [`sf template generate ui-embedding`](#sf-template-generate-ui-embedding)
135
136
  - [`sf template generate visualforce component`](#sf-template-generate-visualforce-component)
136
137
  - [`sf template generate visualforce page`](#sf-template-generate-visualforce-page)
137
138
 
@@ -177,7 +178,7 @@ FLAG DESCRIPTIONS
177
178
  directory.
178
179
  ```
179
180
 
180
- _See code: [src/commands/template/generate/analytics/template.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/analytics/template.ts)_
181
+ _See code: [src/commands/template/generate/analytics/template.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/analytics/template.ts)_
181
182
 
182
183
  ## `sf template generate apex class`
183
184
 
@@ -239,7 +240,7 @@ FLAG DESCRIPTIONS
239
240
  Supplied parameter values or default values are filled into a copy of the template.
240
241
  ```
241
242
 
242
- _See code: [src/commands/template/generate/apex/class.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/apex/class.ts)_
243
+ _See code: [src/commands/template/generate/apex/class.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/apex/class.ts)_
243
244
 
244
245
  ## `sf template generate apex trigger`
245
246
 
@@ -309,7 +310,7 @@ FLAG DESCRIPTIONS
309
310
  Supplied parameter values or default values are filled into a copy of the template.
310
311
  ```
311
312
 
312
- _See code: [src/commands/template/generate/apex/trigger.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/apex/trigger.ts)_
313
+ _See code: [src/commands/template/generate/apex/trigger.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/apex/trigger.ts)_
313
314
 
314
315
  ## `sf template generate digital-experience site`
315
316
 
@@ -363,7 +364,7 @@ FLAG DESCRIPTIONS
363
364
  project, defaults to the current directory.
364
365
  ```
365
366
 
366
- _See code: [src/commands/template/generate/digital-experience/site.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/digital-experience/site.ts)_
367
+ _See code: [src/commands/template/generate/digital-experience/site.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/digital-experience/site.ts)_
367
368
 
368
369
  ## `sf template generate flexipage`
369
370
 
@@ -445,7 +446,7 @@ FLAG DESCRIPTIONS
445
446
  'Custom_Object__c'. This sets the `sobjectType` field in the FlexiPage metadata.
446
447
  ```
447
448
 
448
- _See code: [src/commands/template/generate/flexipage/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/flexipage/index.ts)_
449
+ _See code: [src/commands/template/generate/flexipage/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/flexipage/index.ts)_
449
450
 
450
451
  ## `sf template generate lightning app`
451
452
 
@@ -503,7 +504,7 @@ FLAG DESCRIPTIONS
503
504
  field in the DX project's "sfdx-project.json" file.
504
505
  ```
505
506
 
506
- _See code: [src/commands/template/generate/lightning/app.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/lightning/app.ts)_
507
+ _See code: [src/commands/template/generate/lightning/app.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/lightning/app.ts)_
507
508
 
508
509
  ## `sf template generate lightning component`
509
510
 
@@ -580,7 +581,7 @@ FLAG DESCRIPTIONS
580
581
  field in the DX project's "sfdx-project.json" file.
581
582
  ```
582
583
 
583
- _See code: [src/commands/template/generate/lightning/component.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/lightning/component.ts)_
584
+ _See code: [src/commands/template/generate/lightning/component.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/lightning/component.ts)_
584
585
 
585
586
  ## `sf template generate lightning event`
586
587
 
@@ -638,7 +639,7 @@ FLAG DESCRIPTIONS
638
639
  field in the DX project's "sfdx-project.json" file.
639
640
  ```
640
641
 
641
- _See code: [src/commands/template/generate/lightning/event.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/lightning/event.ts)_
642
+ _See code: [src/commands/template/generate/lightning/event.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/lightning/event.ts)_
642
643
 
643
644
  ## `sf template generate lightning interface`
644
645
 
@@ -696,7 +697,7 @@ FLAG DESCRIPTIONS
696
697
  field in the DX project's "sfdx-project.json" file.
697
698
  ```
698
699
 
699
- _See code: [src/commands/template/generate/lightning/interface.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/lightning/interface.ts)_
700
+ _See code: [src/commands/template/generate/lightning/interface.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/lightning/interface.ts)_
700
701
 
701
702
  ## `sf template generate lightning test`
702
703
 
@@ -754,7 +755,7 @@ FLAG DESCRIPTIONS
754
755
  field in the DX project's "sfdx-project.json" file.
755
756
  ```
756
757
 
757
- _See code: [src/commands/template/generate/lightning/test.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/lightning/test.ts)_
758
+ _See code: [src/commands/template/generate/lightning/test.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/lightning/test.ts)_
758
759
 
759
760
  ## `sf template generate project`
760
761
 
@@ -886,7 +887,7 @@ FLAG DESCRIPTIONS
886
887
  server-side type stripping.
887
888
  ```
888
889
 
889
- _See code: [src/commands/template/generate/project/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/project/index.ts)_
890
+ _See code: [src/commands/template/generate/project/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/project/index.ts)_
890
891
 
891
892
  ## `sf template generate static-resource`
892
893
 
@@ -949,7 +950,7 @@ FLAG DESCRIPTIONS
949
950
  etc.
950
951
  ```
951
952
 
952
- _See code: [src/commands/template/generate/static-resource/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/static-resource/index.ts)_
953
+ _See code: [src/commands/template/generate/static-resource/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/static-resource/index.ts)_
953
954
 
954
955
  ## `sf template generate ui-bundle`
955
956
 
@@ -1038,7 +1039,86 @@ FLAG DESCRIPTIONS
1038
1039
  Supplied parameter values or default values are filled into a copy of the template.
1039
1040
  ```
1040
1041
 
1041
- _See code: [src/commands/template/generate/ui-bundle/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/ui-bundle/index.ts)_
1042
+ _See code: [src/commands/template/generate/ui-bundle/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/ui-bundle/index.ts)_
1043
+
1044
+ ## `sf template generate ui-embedding`
1045
+
1046
+ Generate a Lightning Web Component (LWC) bundle that wraps the <lightning-ui-embedding> base component.
1047
+
1048
+ ```
1049
+ USAGE
1050
+ $ sf template generate ui-embedding -n <value> -s <value> --sandbox
1051
+ allow-forms|allow-modals|allow-orientation-lock|allow-pointer-lock|allow-popups|allow-popups-to-escape-sandbox|allow
1052
+ -presentation|allow-same-origin|allow-scripts|allow-storage-access-by-user-activation|allow-top-navigation|allow-top
1053
+ -navigation-by-user-activation... --title <value> [--json] [--flags-dir <value>] [-d <value>] [--api-version
1054
+ <value>]
1055
+
1056
+ FLAGS
1057
+ -d, --output-dir=<value> [default: .] Directory for saving the created files.
1058
+ -n, --name=<value> (required) Name of the generated component; must be in PascalCase format.
1059
+ -s, --src=<value> (required) Absolute HTTPS URL that the iframe will load.
1060
+ --api-version=<value> Override the api version used for api requests made by this command
1061
+ --sandbox=<option>... (required) Iframe sandbox token. Specify this flag multiple times to set more than one
1062
+ token.
1063
+ <options: allow-forms|allow-modals|allow-orientation-lock|allow-pointer-lock|allow-popups|a
1064
+ llow-popups-to-escape-sandbox|allow-presentation|allow-same-origin|allow-scripts|allow-stor
1065
+ age-access-by-user-activation|allow-top-navigation|allow-top-navigation-by-user-activation>
1066
+ --title=<value> (required) Accessible title for the embedded iframe.
1067
+
1068
+ GLOBAL FLAGS
1069
+ --flags-dir=<value> Import flag values from a directory.
1070
+ --json Format output as json.
1071
+
1072
+ DESCRIPTION
1073
+ Generate a Lightning Web Component (LWC) bundle that wraps the <lightning-ui-embedding> base component.
1074
+
1075
+ The generated LWC bundle consumes the first-party <lightning-ui-embedding> component, which is pre-wired with the
1076
+ three required attributes: the embedding URL (--src), iframe sandbox tokens, and an accessible iframe title (--title).
1077
+
1078
+ The generated LWC bundle contains four files (.html, .js, .js-meta.xml, .css) in a directory named with the camelCased
1079
+ component name. The bundle must live under a parent folder named "lwc".
1080
+
1081
+ EXAMPLES
1082
+ Generate an embedding wrapper LWC in the current directory:
1083
+
1084
+ $ sf template generate ui-embedding --name MyEmbeddingWrapper --src https://app.example.com --sandbox \
1085
+ allow-forms --title "Expense Report Embedding"
1086
+
1087
+ Generate an embedding wrapper LWC in the "force-app/main/default/lwc" directory with multiple sandbox tokens:
1088
+
1089
+ $ sf template generate ui-embedding --name MyEmbeddingWrapper --src https://app.example.com --sandbox \
1090
+ allow-forms --sandbox allow-scripts --title "Expense Report Embedding" --output-dir force-app/main/default/lwc
1091
+
1092
+ FLAG DESCRIPTIONS
1093
+ -d, --output-dir=<value> Directory for saving the created files.
1094
+
1095
+ The location can be an absolute path or relative to the current working directory. The default is the current
1096
+ directory.
1097
+
1098
+ -n, --name=<value> Name of the generated component; must be in PascalCase format.
1099
+
1100
+ The component name is also used (camelCased) as the LWC folder name and file stem. Must contain only alphanumeric
1101
+ characters and start with a letter.
1102
+
1103
+ -s, --src=<value> Absolute HTTPS URL that the iframe will load.
1104
+
1105
+ The URL is bound to the <lightning-ui-embedding> "src" attribute as a reactive property in the generated LWC. Must
1106
+ use HTTPS; plain HTTP is allowed only for localhost or 127.0.0.1 (for local development).
1107
+
1108
+ --sandbox=allow-forms|allow-modals|allow-orientation-lock|allow-pointer-lock|allow-popups|allow-popups-to-escape-sandbox|allow-presentation|allow-same-origin|allow-scripts|allow-storage-access-by-user-activation|allow-top-navigation|allow-top-navigation-by-user-activation...
1109
+
1110
+ Iframe sandbox token. Specify this flag multiple times to set more than one token.
1111
+
1112
+ Each token is written into the space-separated "sandbox" attribute on <lightning-ui-embedding>. Only W3C-defined
1113
+ sandbox tokens are accepted.
1114
+
1115
+ --title=<value> Accessible title for the embedded iframe.
1116
+
1117
+ Written to the "shell-title" attribute on <lightning-ui-embedding> and used as the iframe's accessible name
1118
+ (announced by screen readers).
1119
+ ```
1120
+
1121
+ _See code: [src/commands/template/generate/ui-embedding/index.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/ui-embedding/index.ts)_
1042
1122
 
1043
1123
  ## `sf template generate visualforce component`
1044
1124
 
@@ -1095,7 +1175,7 @@ FLAG DESCRIPTIONS
1095
1175
  Supplied parameter values or default values are filled into a copy of the template.
1096
1176
  ```
1097
1177
 
1098
- _See code: [src/commands/template/generate/visualforce/component.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/visualforce/component.ts)_
1178
+ _See code: [src/commands/template/generate/visualforce/component.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/visualforce/component.ts)_
1099
1179
 
1100
1180
  ## `sf template generate visualforce page`
1101
1181
 
@@ -1146,6 +1226,6 @@ FLAG DESCRIPTIONS
1146
1226
  The name can be up to 40 characters and must start with a letter.
1147
1227
  ```
1148
1228
 
1149
- _See code: [src/commands/template/generate/visualforce/page.ts](https://github.com/salesforcecli/plugin-templates/blob/57.1.2/src/commands/template/generate/visualforce/page.ts)_
1229
+ _See code: [src/commands/template/generate/visualforce/page.ts](https://github.com/salesforcecli/plugin-templates/blob/57.4.0/src/commands/template/generate/visualforce/page.ts)_
1150
1230
 
1151
1231
  <!-- commandsstop -->
@@ -0,0 +1,60 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { CreateOutput, LightningOutOptions } from '@salesforce/templates';
3
+ /** Flat flag shape read by {@link mergeLightningOutInputs} — a structural subset of the parsed oclif flags. */
4
+ type LightningOutFlags = {
5
+ 'app-name'?: string;
6
+ 'eca-name'?: string;
7
+ runtime?: 'LWR_CORE' | 'CLWR';
8
+ 'host-domains'?: string[];
9
+ components?: string[];
10
+ 'eca-contact-email'?: string;
11
+ 'eca-callback-url'?: string;
12
+ 'output-dir'?: string;
13
+ };
14
+ /** Parse the --definition-file JSON, surfacing a clear error on malformed or non-object input. */
15
+ export declare function readDefinition(file: string): Record<string, unknown>;
16
+ /**
17
+ * Validate the types of --definition-file fields before they reach the generator, so wrong-typed
18
+ * JSON (e.g. `"appName": 123`) yields an actionable error here rather than an internal TypeError
19
+ * from the generator (which calls `.trim()` on string fields). A field is skipped when the matching
20
+ * flag overrides it, since flags always arrive as strings and win per-key (see mergeLightningOutInputs).
21
+ */
22
+ export declare function validateDefinitionShape(defn: Record<string, unknown>, flags: LightningOutFlags): void;
23
+ /**
24
+ * Merge the --definition-file JSON with individual flags into one LightningOutOptions, with
25
+ * per-key precedence (flags win over the file) and wholesale list-replace semantics for
26
+ * hostDomains/components (never merge/concat). All structural validation (required-ness, shape,
27
+ * formats) is the generator's job — this function only resolves precedence.
28
+ */
29
+ export declare function mergeLightningOutInputs(defn: Record<string, unknown>, flags: LightningOutFlags): {
30
+ opts: LightningOutOptions;
31
+ unknownKeys: string[];
32
+ };
33
+ /** True when a project sourceApiVersion is present and below the v68.0 deploy floor. Pure; testable. */
34
+ export declare function isBelowApiFloor(projApi: string | undefined): boolean;
35
+ /**
36
+ * Quote a path for safe copy-paste into a POSIX shell when it contains whitespace or quote chars,
37
+ * so the suggested deploy command survives output dirs such as "/tmp/Lightning Out".
38
+ */
39
+ export declare function shellQuoteArg(p: string): string;
40
+ export default class LightningOut extends SfCommand<CreateOutput> {
41
+ static readonly summary: string;
42
+ static readonly description: string;
43
+ static readonly examples: string[];
44
+ static readonly state = "beta";
45
+ static readonly hidden = true;
46
+ static readonly flags: {
47
+ 'app-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
48
+ 'eca-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
49
+ runtime: import("@oclif/core/interfaces").OptionFlag<"LWR_CORE" | "CLWR" | undefined, import("@oclif/core/interfaces").CustomOptions>;
50
+ 'host-domains': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
51
+ components: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
52
+ 'eca-contact-email': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
53
+ 'eca-callback-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
54
+ 'definition-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
55
+ 'output-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
56
+ loglevel: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
57
+ };
58
+ run(): Promise<CreateOutput>;
59
+ }
60
+ export {};
@@ -0,0 +1,179 @@
1
+ /*
2
+ * Copyright 2025, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import * as fs from 'node:fs';
17
+ import { Flags, loglevel, SfCommand, Ux } from '@salesforce/sf-plugins-core';
18
+ import { TemplateType } from '@salesforce/templates';
19
+ import { Messages, SfProject } from '@salesforce/core';
20
+ import { getCustomTemplates, runGenerator } from '../../../../utils/templateCommand.js';
21
+ import { outputDirFlagLightning } from '../../../../utils/flags.js';
22
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
23
+ const messages = Messages.loadMessages('@salesforce/plugin-templates', 'lightningOut');
24
+ /** Parse the --definition-file JSON, surfacing a clear error on malformed or non-object input. */
25
+ export function readDefinition(file) {
26
+ let parsed;
27
+ try {
28
+ parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
29
+ }
30
+ catch (e) {
31
+ throw messages.createError('error.definition-file-json', [file, e.message]);
32
+ }
33
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
34
+ throw messages.createError('error.definition-file-not-object', [file]);
35
+ }
36
+ return parsed;
37
+ }
38
+ /** True when a value is an array whose every element is a string. */
39
+ function isStringArray(v) {
40
+ return Array.isArray(v) && v.every((x) => typeof x === 'string');
41
+ }
42
+ /**
43
+ * Validate the types of --definition-file fields before they reach the generator, so wrong-typed
44
+ * JSON (e.g. `"appName": 123`) yields an actionable error here rather than an internal TypeError
45
+ * from the generator (which calls `.trim()` on string fields). A field is skipped when the matching
46
+ * flag overrides it, since flags always arrive as strings and win per-key (see mergeLightningOutInputs).
47
+ */
48
+ export function validateDefinitionShape(defn, flags) {
49
+ const requireString = (overridden, val, key) => {
50
+ if (!overridden && val !== undefined && typeof val !== 'string') {
51
+ throw messages.createError('error.definition-file-field-type', [key, 'a string']);
52
+ }
53
+ };
54
+ const requireStringArray = (overridden, val, key) => {
55
+ if (!overridden && val !== undefined && !isStringArray(val)) {
56
+ throw messages.createError('error.definition-file-field-type', [key, 'an array of strings']);
57
+ }
58
+ };
59
+ requireString(flags['app-name'] !== undefined, defn.appName, 'appName');
60
+ requireString(flags.runtime !== undefined, defn.runtime, 'runtime');
61
+ requireStringArray(flags['host-domains'] !== undefined, defn.hostDomains, 'hostDomains');
62
+ requireStringArray(flags.components !== undefined, defn.components, 'components');
63
+ if (defn.eca !== undefined) {
64
+ if (typeof defn.eca !== 'object' || defn.eca === null || Array.isArray(defn.eca)) {
65
+ throw messages.createError('error.definition-file-field-type', ['eca', 'an object']);
66
+ }
67
+ const eca = defn.eca;
68
+ requireString(flags['eca-name'] !== undefined, eca.name, 'eca.name');
69
+ requireString(flags['eca-contact-email'] !== undefined, eca.contactEmail, 'eca.contactEmail');
70
+ requireString(flags['eca-callback-url'] !== undefined, eca.callbackUrl, 'eca.callbackUrl');
71
+ }
72
+ }
73
+ /**
74
+ * Merge the --definition-file JSON with individual flags into one LightningOutOptions, with
75
+ * per-key precedence (flags win over the file) and wholesale list-replace semantics for
76
+ * hostDomains/components (never merge/concat). All structural validation (required-ness, shape,
77
+ * formats) is the generator's job — this function only resolves precedence.
78
+ */
79
+ export function mergeLightningOutInputs(defn, flags) {
80
+ const known = new Set(['appName', 'runtime', 'hostDomains', 'components', 'eca']);
81
+ const unknownKeys = Object.keys(defn).filter((k) => !known.has(k));
82
+ const ecaDefn = (defn.eca ?? {});
83
+ const opts = {
84
+ appName: flags['app-name'] ?? defn.appName,
85
+ runtime: (flags.runtime ?? defn.runtime),
86
+ hostDomains: flags['host-domains'] ?? defn.hostDomains ?? [],
87
+ components: flags.components ?? defn.components,
88
+ eca: {
89
+ name: flags['eca-name'] ?? ecaDefn.name,
90
+ contactEmail: flags['eca-contact-email'] ?? ecaDefn.contactEmail,
91
+ callbackUrl: flags['eca-callback-url'] ?? ecaDefn.callbackUrl,
92
+ },
93
+ outputdir: flags['output-dir'],
94
+ };
95
+ return { opts, unknownKeys };
96
+ }
97
+ /**
98
+ * Resolve the local DX project's `sourceApiVersion`, used only for a CLI-side advisory warning
99
+ * (the generator itself has no project context). Returns undefined when there's no DX project —
100
+ * generating outside a project must not error.
101
+ */
102
+ async function getSourceApiVersion() {
103
+ try {
104
+ const project = await SfProject.resolve();
105
+ const projectJson = await project.resolveProjectConfig();
106
+ return projectJson.sourceApiVersion;
107
+ }
108
+ catch (e) {
109
+ return undefined;
110
+ }
111
+ }
112
+ /** True when a project sourceApiVersion is present and below the v68.0 deploy floor. Pure; testable. */
113
+ export function isBelowApiFloor(projApi) {
114
+ return !!projApi && Number(projApi) < 68;
115
+ }
116
+ /**
117
+ * Quote a path for safe copy-paste into a POSIX shell when it contains whitespace or quote chars,
118
+ * so the suggested deploy command survives output dirs such as "/tmp/Lightning Out".
119
+ */
120
+ export function shellQuoteArg(p) {
121
+ return /[\s"'\\]/.test(p) ? `'${p.replace(/'/g, "'\\''")}'` : p;
122
+ }
123
+ export default class LightningOut extends SfCommand {
124
+ static summary = messages.getMessage('summary');
125
+ static description = messages.getMessage('description');
126
+ static examples = messages.getMessages('examples');
127
+ static state = 'beta';
128
+ static hidden = true;
129
+ static flags = {
130
+ 'app-name': Flags.string({ summary: messages.getMessage('flags.app-name.summary'), required: false }),
131
+ 'eca-name': Flags.string({ summary: messages.getMessage('flags.eca-name.summary'), required: false }),
132
+ runtime: Flags.option({
133
+ options: ['LWR_CORE', 'CLWR'],
134
+ summary: messages.getMessage('flags.runtime.summary'),
135
+ })(),
136
+ 'host-domains': Flags.string({ summary: messages.getMessage('flags.host-domains.summary'), multiple: true }),
137
+ components: Flags.string({ summary: messages.getMessage('flags.components.summary'), multiple: true }),
138
+ 'eca-contact-email': Flags.string({ summary: messages.getMessage('flags.eca-contact-email.summary') }),
139
+ 'eca-callback-url': Flags.string({ summary: messages.getMessage('flags.eca-callback-url.summary') }),
140
+ 'definition-file': Flags.file({ exists: true, summary: messages.getMessage('flags.definition-file.summary') }),
141
+ 'output-dir': outputDirFlagLightning,
142
+ loglevel,
143
+ };
144
+ async run() {
145
+ const { flags } = await this.parse(LightningOut);
146
+ const defn = flags['definition-file'] ? readDefinition(flags['definition-file']) : {};
147
+ validateDefinitionShape(defn, flags);
148
+ const { opts, unknownKeys } = mergeLightningOutInputs(defn, flags);
149
+ unknownKeys.forEach((k) => this.warn(messages.getMessage('warning.unknown-definition-key', [k])));
150
+ const result = await runGenerator({
151
+ templateType: TemplateType.LightningOut,
152
+ opts,
153
+ ux: new Ux({ jsonEnabled: this.jsonEnabled() }),
154
+ templates: getCustomTemplates(this.configAggregator),
155
+ });
156
+ // CLI-side sourceApiVersion floor check (the generator has no project context).
157
+ const projApi = await getSourceApiVersion();
158
+ const belowFloor = isBelowApiFloor(projApi);
159
+ if (belowFloor) {
160
+ this.warn(messages.getMessage('warning.source-api-version', [String(projApi)]));
161
+ }
162
+ // Success guidance (suppressed automatically under --json).
163
+ // Only pin --api-version to the 68.0 deploy floor when the project is below it; otherwise omit
164
+ // the optional flag so the user's own (>= floor) project default applies rather than being downgraded.
165
+ const outputDir = opts.outputdir ?? '.';
166
+ const apiVersionSuffix = belowFloor ? ' --api-version 68.0' : '';
167
+ this.log(messages.getMessage('success.next-step', [outputDir, shellQuoteArg(outputDir), apiVersionSuffix]));
168
+ this.info(messages.getMessage('success.app-id'));
169
+ this.info(messages.getMessage('success.dont-delete'));
170
+ this.info(messages.getMessage('success.eca-overwrite', [opts.eca.name ?? '']));
171
+ this.info(messages.getMessage('success.components-exist'));
172
+ // frontdoor.jsp handoff is a CLWR-only concern; don't show it for LWR_CORE runs.
173
+ if (opts.runtime === 'CLWR') {
174
+ this.info(messages.getMessage('success.frontdoor'));
175
+ }
176
+ return result; // --json returns the full CreateOutput (created[])
177
+ }
178
+ }
179
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/template/generate/lightning-out/index.ts"],"names":[],"mappings":"AA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AQ,CAAC,UAAU,CAAC,4BAA4B,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,CAAC;QAED,4DAA4D;QAC5D,+FAA+F;QAC/F,uGAAuG;QACvG,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC;QACxC,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC5G,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,CAAC;QAC3D,iFAAiF;QACjF,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,CAAC,CAAC,mDAAmD;IACpE,CAAC"}
@@ -4,13 +4,11 @@ export default class UIEmbedding extends SfCommand<CreateOutput> {
4
4
  static readonly summary: string;
5
5
  static readonly description: string;
6
6
  static readonly examples: string[];
7
- static readonly state = "beta";
8
- static readonly hidden = true;
9
7
  static readonly flags: {
10
8
  name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
9
  src: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
10
  sandbox: import("@oclif/core/interfaces").OptionFlag<("allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation")[], import("@oclif/core/interfaces").CustomOptions>;
13
- 'shell-title': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ title: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
12
  'output-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
13
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
14
  internal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -24,8 +24,6 @@ export default class UIEmbedding extends SfCommand {
24
24
  static summary = messages.getMessage('summary');
25
25
  static description = messages.getMessage('description');
26
26
  static examples = messages.getMessages('examples');
27
- static state = 'beta';
28
- static hidden = true;
29
27
  static flags = {
30
28
  name: Flags.string({
31
29
  char: 'n',
@@ -52,9 +50,9 @@ export default class UIEmbedding extends SfCommand {
52
50
  multiple: true,
53
51
  required: true,
54
52
  })(),
55
- 'shell-title': Flags.string({
56
- summary: messages.getMessage('flags.shell-title.summary'),
57
- description: messages.getMessage('flags.shell-title.description'),
53
+ title: Flags.string({
54
+ summary: messages.getMessage('flags.title.summary'),
55
+ description: messages.getMessage('flags.title.description'),
58
56
  required: true,
59
57
  }),
60
58
  'output-dir': outputDirFlagLightning,
@@ -68,7 +66,7 @@ export default class UIEmbedding extends SfCommand {
68
66
  componentname: flags.name,
69
67
  src: flags.src,
70
68
  sandbox: flags.sandbox.join(' '),
71
- shellTitle: flags['shell-title'],
69
+ title: flags.title,
72
70
  outputdir: flags['output-dir'],
73
71
  apiversion: flags['api-version'],
74
72
  internal: flags.internal,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/template/generate/ui-embedding/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,iCAAiC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAChH,OAAO,EAEL,0BAA0B,EAC1B,2BAA2B,EAE3B,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAElF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,8BAA8B,EAAE,aAAa,CAAC,CAAC;AAEtF,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAuB;IACvD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,KAAK,GAAG,MAAM,CAAC;IAC/B,MAAM,CAAU,MAAM,GAAG,IAAI,CAAC;IAE9B,MAAM,CAAU,KAAK,GAAG;QAC7B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QA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ACpC,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;SACf,CAAC,EAAE;QACJ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YAClB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;YACnD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,sBAAsB;QACpC,aAAa,EAAE,iCAAiC;QAChD,QAAQ,EAAE,YAAY;QACtB,QAAQ;KACT,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEhD,MAAM,cAAc,GAAuB;YACzC,aAAa,EAAE,KAAK,CAAC,IAAI;YACzB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;YAChC,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;YAC9B,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC;YAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC;QAEF,OAAO,YAAY,CAAC;YAClB,YAAY,EAAE,YAAY,CAAC,WAAW;YACtC,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YAC/C,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC;SACrD,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,105 @@
1
+ # examples
2
+
3
+ - Generate a Lightning Out 2.0 app using individual flags to specify the values:
4
+
5
+ <%= config.bin %> <%= command.id %> --app-name MyLoApp --runtime LWR_CORE --host-domains https://example.com --eca-name MyLoAppEca --eca-contact-email dev@example.com --eca-callback-url https://example.com/cb
6
+
7
+ - Generate an app using the values in a JSON definition file called lo-def.json:
8
+
9
+ <%= config.bin %> <%= command.id %> --definition-file lo-def.json
10
+
11
+ - Generate the app into a specific directory:
12
+
13
+ <%= config.bin %> <%= command.id %> --definition-file lo-def.json --output-dir force-app/main/default
14
+
15
+ - Generate the app using most of the values from a definition file, but the --host-domains value overrides its equivalent in the file:
16
+
17
+ <%= config.bin %> <%= command.id %> --definition-file lo-def.json --host-domains https://staging.example.com
18
+
19
+ # summary
20
+
21
+ Generate the required metadata to scaffold a Lightning Out 2.0 app.
22
+
23
+ # description
24
+
25
+ Lightning Out 2.0 lets you embed custom Lightning web components (LWCs) into your external, non-Salesforce apps.
26
+
27
+ This command gets you started by generating the seven metadata artifact types that a Lightning Out 2.0 app requires into your Salesforce DX project: LightningOutApp, MyDomain and Security settings, one CorsWhitelistOrigin per host domain, and the three External Client Application OAuth components (ExternalClientApplication, ExtlClntAppGlobalOauthSettings, ExtlClntAppOauthSettings). The command is generate-only; it doesn't deploy any metadata to an org.
28
+
29
+ Inputs may come from a --definition-file JSON, individual flags, or both. Flag values take precedence over the file on a per-key basis. The command validates the types of definition-file fields; the underlying generator performs the remaining structural validation, such as required fields and formats.
30
+
31
+ # flags.app-name.summary
32
+
33
+ Developer name of the new Lightning Out 2.0 app.
34
+
35
+ # flags.eca-name.summary
36
+
37
+ Developer name of the External Client Application associated with the app.
38
+
39
+ # flags.runtime.summary
40
+
41
+ Runtime the app targets. LWR_CORE serves from your Salesforce org for authenticated users; CLWR serves from an Experience Cloud site (guest access, extra site-deployment step).
42
+
43
+ # flags.host-domains.summary
44
+
45
+ HTTP or HTTPS origin of an external host page that embeds the app. Repeat the flag to specify more than one. Replaces, rather than merges with, any hostDomains in the --definition-file.
46
+
47
+ # flags.components.summary
48
+
49
+ Name of a Lightning web component exposed by the app. Repeat the flag to specify more than one. Replaces, rather than merges with, any components in the --definition-file.
50
+
51
+ # flags.eca-contact-email.summary
52
+
53
+ Contact email for the External Client Application.
54
+
55
+ # flags.eca-callback-url.summary
56
+
57
+ OAuth callback URL for the External Client Application.
58
+
59
+ # flags.definition-file.summary
60
+
61
+ Path to a JSON file describing the Lightning Out 2.0 app. Individual flags, when supplied, override the corresponding value in this file.
62
+
63
+ # error.definition-file-json
64
+
65
+ Definition file %s is not valid JSON: %s
66
+
67
+ # error.definition-file-not-object
68
+
69
+ Definition file %s must contain a single JSON object, not an array or scalar.
70
+
71
+ # error.definition-file-field-type
72
+
73
+ Definition file field "%s" must be %s.
74
+
75
+ # warning.unknown-definition-key
76
+
77
+ Ignoring unrecognized key "%s" in --definition-file.
78
+
79
+ # warning.source-api-version
80
+
81
+ Your local project's sourceApiVersion (%s) is below 68.0, the minimum API version this scaffold supports for deployment. Set sourceApiVersion to 68.0 or later in sfdx-project.json, or pass --api-version 68.0 or later when you deploy.
82
+
83
+ # success.next-step
84
+
85
+ Scaffold generated in %s. Deploy it with: sf project deploy start --source-dir %s%s
86
+
87
+ # success.app-id
88
+
89
+ After deploying, note the LightningOutApp's App ID from Setup — your host page needs it to embed the app.
90
+
91
+ # success.dont-delete
92
+
93
+ Don't delete the generated ExternalClientApplication after deploying — Lightning Out uses it for OAuth at runtime.
94
+
95
+ # success.eca-overwrite
96
+
97
+ Re-running this command overwrites the generated files for the "%s" External Client Application; back up local edits first.
98
+
99
+ # success.components-exist
100
+
101
+ Verify that every component you referenced already exists and is exposed for Lightning Out before deploying.
102
+
103
+ # success.frontdoor
104
+
105
+ For CLWR, host pages must complete a frontdoor.jsp handoff before the embedded app can authenticate.