@salesforce/lightning-out 2.2.2 → 2.2.3-rc.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/dist/index.esm.js +147 -65
- package/dist/index.iife.debug.js +147 -65
- package/dist/index.iife.prod.js +3 -3
- package/package.json +5 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,103 @@
|
|
|
1
|
-
/*! @salesforce/lightning-out v2.2.
|
|
1
|
+
/*! @salesforce/lightning-out v2.2.3-rc.0 (2026-06-22) */
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Uses ResizeObserver to monitor element size changes and notify the host
|
|
3
|
+
* Numeric ranks for {@link LogLevel}; lower values are more severe.
|
|
5
4
|
*/
|
|
5
|
+
const logLevels = {
|
|
6
|
+
error: 0,
|
|
7
|
+
warn: 1,
|
|
8
|
+
info: 2,
|
|
9
|
+
debug: 3,
|
|
10
|
+
trace: 4,
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Branded console logger with a global severity threshold.
|
|
14
|
+
*
|
|
15
|
+
* Each instance prepends a `prefix:branding:` tag to every message so output can be filtered in the browser console.
|
|
16
|
+
* The prefix and threshold are class-level (shared by all instances), while the branding is per-instance.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* Logger.level = "debug";
|
|
21
|
+
* const log = new Logger("MyComponent");
|
|
22
|
+
* log.info("ready"); // logs: "LO2:MyComponent: ready"
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
class Logger {
|
|
26
|
+
static #prefix = "LO2";
|
|
27
|
+
static #level = "error";
|
|
28
|
+
#branding;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the global severity threshold. Messages at or below this level are emitted; the rest are suppressed.
|
|
31
|
+
*/
|
|
32
|
+
static set level(level) {
|
|
33
|
+
this.#level = level;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sets the global prefix that appears at the start of every logged message. Defaults to `"LO2"`.
|
|
37
|
+
*/
|
|
38
|
+
static set prefix(prefix) {
|
|
39
|
+
this.#prefix = prefix;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The full tag prepended to every message from this instance, in the form `prefix:branding:`. Appears first in the
|
|
43
|
+
* console and can be used as a filter expression.
|
|
44
|
+
*/
|
|
45
|
+
get brand() {
|
|
46
|
+
return `${Logger.#prefix}:${this.#branding}:`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @param branding A string label, or any object whose constructor name should be used as the label (typically
|
|
50
|
+
* `this`, so a class can do `new Logger(this)`).
|
|
51
|
+
*/
|
|
52
|
+
constructor(branding) {
|
|
53
|
+
if (typeof branding === "string") {
|
|
54
|
+
this.#branding = branding;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.#branding = branding.constructor?.name;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Logs at `error` severity via `console.error`. Always emitted unless the level is silenced externally.
|
|
62
|
+
*/
|
|
63
|
+
error(...args) {
|
|
64
|
+
if (logLevels.error <= logLevels[Logger.#level]) {
|
|
65
|
+
console.error(this.brand, ...args);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Logs at `warn` severity via `console.warn`. Suppressed when the level is `error`.
|
|
70
|
+
*/
|
|
71
|
+
warn(...args) {
|
|
72
|
+
if (logLevels.warn <= logLevels[Logger.#level]) {
|
|
73
|
+
console.warn(this.brand, ...args);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Logs at `info` severity via `console.info`. Suppressed when the level is `error` or `warn`.
|
|
78
|
+
*/
|
|
79
|
+
info(...args) {
|
|
80
|
+
if (logLevels.info <= logLevels[Logger.#level]) {
|
|
81
|
+
console.info(this.brand, ...args);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Logs at `debug` severity via `console.debug`. Emitted only when the level is `debug` or `trace`.
|
|
86
|
+
*/
|
|
87
|
+
debug(...args) {
|
|
88
|
+
if (logLevels.debug <= logLevels[Logger.#level]) {
|
|
89
|
+
console.debug(this.brand, ...args);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Logs at `trace` severity via `console.trace`, including a stack trace. Emitted only when the level is `trace`.
|
|
94
|
+
*/
|
|
95
|
+
trace(...args) {
|
|
96
|
+
if (logLevels.trace <= logLevels[Logger.#level]) {
|
|
97
|
+
console.trace(this.brand, ...args);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
6
101
|
/**
|
|
7
102
|
* Generates a pseudo-random alphanumeric identifier string for unique
|
|
8
103
|
* element IDs or temporary identifiers (not cryptographically secure).
|
|
@@ -17,11 +112,15 @@ function getUUID() {
|
|
|
17
112
|
}
|
|
18
113
|
|
|
19
114
|
/**
|
|
20
|
-
*
|
|
115
|
+
* Event names fired via `dispatchEvent` on Lightning Out hosts and components. Grouped by source: `application` and
|
|
116
|
+
* `component` events are part of the public API consumers can listen for; `iframe` events are internal plumbing between
|
|
117
|
+
* the host and the embedded frame.
|
|
21
118
|
*/
|
|
22
119
|
const events = {
|
|
23
120
|
lo: {
|
|
24
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Public events dispatched on the application host element.
|
|
123
|
+
*/
|
|
25
124
|
application: {
|
|
26
125
|
ready: "lo.application.ready",
|
|
27
126
|
error: "lo.application.error",
|
|
@@ -30,12 +129,16 @@ const events = {
|
|
|
30
129
|
redirect: "lo.application.auth.redirect",
|
|
31
130
|
},
|
|
32
131
|
},
|
|
33
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Public events dispatched on individual component elements.
|
|
134
|
+
*/
|
|
34
135
|
component: {
|
|
35
136
|
ready: "lo.component.ready",
|
|
36
137
|
error: "lo.component.error",
|
|
37
138
|
},
|
|
38
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Internal events relayed from the embedded iframe; not part of the public API.
|
|
141
|
+
*/
|
|
39
142
|
iframe: {
|
|
40
143
|
load: "lo.iframe.load",
|
|
41
144
|
error: "lo.iframe.error",
|
|
@@ -47,7 +150,8 @@ const events = {
|
|
|
47
150
|
},
|
|
48
151
|
};
|
|
49
152
|
/**
|
|
50
|
-
*
|
|
153
|
+
* Message types exchanged via `postMessage` between the host page and the embedded iframe. All messages are internal
|
|
154
|
+
* implementation details — consumers should listen for {@link events} instead of these wire-level messages.
|
|
51
155
|
*/
|
|
52
156
|
const messages = {
|
|
53
157
|
lo: {
|
|
@@ -65,69 +169,31 @@ const messages = {
|
|
|
65
169
|
},
|
|
66
170
|
};
|
|
67
171
|
|
|
68
|
-
const logLevels = {
|
|
69
|
-
error: 0,
|
|
70
|
-
warn: 1,
|
|
71
|
-
info: 2,
|
|
72
|
-
debug: 3,
|
|
73
|
-
trace: 4,
|
|
74
|
-
};
|
|
75
|
-
class Logger {
|
|
76
|
-
static #prefix = "LO2";
|
|
77
|
-
static #level = "error";
|
|
78
|
-
#branding;
|
|
79
|
-
static set level(level) {
|
|
80
|
-
this.#level = level;
|
|
81
|
-
}
|
|
82
|
-
static set prefix(prefix) {
|
|
83
|
-
this.#prefix = prefix;
|
|
84
|
-
}
|
|
85
|
-
// This string appears first in the console, it can be used for filtering messages
|
|
86
|
-
get brand() {
|
|
87
|
-
return `${Logger.#prefix}:${this.#branding}:`;
|
|
88
|
-
}
|
|
89
|
-
constructor(branding) {
|
|
90
|
-
if (typeof branding === "string") {
|
|
91
|
-
this.#branding = branding;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this.#branding = branding.constructor?.name;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
error(...args) {
|
|
98
|
-
if (logLevels.error <= logLevels[Logger.#level]) {
|
|
99
|
-
console.error(this.brand, ...args);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
warn(...args) {
|
|
103
|
-
if (logLevels.warn <= logLevels[Logger.#level]) {
|
|
104
|
-
console.warn(this.brand, ...args);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
info(...args) {
|
|
108
|
-
if (logLevels.info <= logLevels[Logger.#level]) {
|
|
109
|
-
console.info(this.brand, ...args);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
debug(...args) {
|
|
113
|
-
if (logLevels.debug <= logLevels[Logger.#level]) {
|
|
114
|
-
console.debug(this.brand, ...args);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
trace(...args) {
|
|
118
|
-
if (logLevels.trace <= logLevels[Logger.#level]) {
|
|
119
|
-
console.trace(this.brand, ...args);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
172
|
/**
|
|
125
173
|
* Error class for Lightning Out
|
|
126
174
|
*/
|
|
127
175
|
const logger$4 = new Logger("LightningOutError");
|
|
176
|
+
/**
|
|
177
|
+
* Branded error helper for Lightning Out. Wraps messages with the owning component's name and, when the owner is an
|
|
178
|
+
* `EventTarget`, dispatches them as `CustomEvent`s so consumers can react via `addEventListener`.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* class MyComponent extends EventTarget {
|
|
183
|
+
* #errors = new LightningOutError(this);
|
|
184
|
+
* fail() {
|
|
185
|
+
* this.#errors.dispatch("loaderror", "boom");
|
|
186
|
+
* }
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
128
190
|
class LightningOutError {
|
|
129
191
|
#eventTarget;
|
|
130
192
|
#branding;
|
|
193
|
+
/**
|
|
194
|
+
* @param branding A string label, or an `EventTarget` whose constructor name is used as the label and on which
|
|
195
|
+
* `dispatch()` will fire events. Pass `this` from a class that extends `EventTarget` to get both behaviors.
|
|
196
|
+
*/
|
|
131
197
|
constructor(branding) {
|
|
132
198
|
if (typeof branding === "string") {
|
|
133
199
|
this.#branding = branding;
|
|
@@ -142,10 +208,26 @@ class LightningOutError {
|
|
|
142
208
|
#branded(message) {
|
|
143
209
|
return `${this.#branding}: ${message}`;
|
|
144
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Builds a new `Error` whose message is prefixed with the branding (`"<branding>: <message>"`). Accepts either a
|
|
213
|
+
* raw string or an existing `Error` whose `message` is reused.
|
|
214
|
+
*
|
|
215
|
+
* @param error A message string, or an `Error` whose `message` is unwrapped.
|
|
216
|
+
* @returns A new `Error` with the branded message.
|
|
217
|
+
*/
|
|
145
218
|
create(error) {
|
|
146
219
|
const message = typeof error === "string" ? error : error.message;
|
|
147
220
|
return new Error(this.#branded(message));
|
|
148
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Fires a `CustomEvent` of the given `type` on the owner `EventTarget`, carrying the branded error in `detail`.
|
|
224
|
+
* If a `CustomEvent` is passed in, its existing `detail` is preserved; otherwise a fresh
|
|
225
|
+
* `{ message, originalError }` detail is constructed. Logs the outcome via {@link Logger}; when the owner is not an
|
|
226
|
+
* `EventTarget`, the dispatch is skipped and only the log line is emitted.
|
|
227
|
+
*
|
|
228
|
+
* @param type The event type to dispatch (the first argument to `addEventListener`).
|
|
229
|
+
* @param error A message string, an `Error`, or a pre-built `CustomEvent` whose `detail` should be reused.
|
|
230
|
+
*/
|
|
149
231
|
dispatch(type, error) {
|
|
150
232
|
const message = typeof error === "string" ? error : error.message || error.detail?.message;
|
|
151
233
|
if (this.#eventTarget) {
|
|
@@ -1380,7 +1462,7 @@ class LightningOutRouter {
|
|
|
1380
1462
|
url.searchParams.set("parentElementId", parentElementId);
|
|
1381
1463
|
url.searchParams.set("loAppOrigin", this.config.loAppOrigin);
|
|
1382
1464
|
// This helps in general but also for cache busting
|
|
1383
|
-
url.searchParams.set("loVersion", "2.2.
|
|
1465
|
+
url.searchParams.set("loVersion", "2.2.3-rc.0");
|
|
1384
1466
|
if (this.config.appId) {
|
|
1385
1467
|
url.searchParams.set("appId", this.config.appId);
|
|
1386
1468
|
}
|
package/dist/index.iife.debug.js
CHANGED
|
@@ -1,11 +1,106 @@
|
|
|
1
|
-
/*! @salesforce/lightning-out v2.2.
|
|
1
|
+
/*! @salesforce/lightning-out v2.2.3-rc.0 (2026-06-22) */
|
|
2
2
|
var LO2 = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* Uses ResizeObserver to monitor element size changes and notify the host
|
|
6
|
+
* Numeric ranks for {@link LogLevel}; lower values are more severe.
|
|
8
7
|
*/
|
|
8
|
+
const logLevels = {
|
|
9
|
+
error: 0,
|
|
10
|
+
warn: 1,
|
|
11
|
+
info: 2,
|
|
12
|
+
debug: 3,
|
|
13
|
+
trace: 4,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Branded console logger with a global severity threshold.
|
|
17
|
+
*
|
|
18
|
+
* Each instance prepends a `prefix:branding:` tag to every message so output can be filtered in the browser console.
|
|
19
|
+
* The prefix and threshold are class-level (shared by all instances), while the branding is per-instance.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* Logger.level = "debug";
|
|
24
|
+
* const log = new Logger("MyComponent");
|
|
25
|
+
* log.info("ready"); // logs: "LO2:MyComponent: ready"
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
class Logger {
|
|
29
|
+
static #prefix = "LO2";
|
|
30
|
+
static #level = "error";
|
|
31
|
+
#branding;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the global severity threshold. Messages at or below this level are emitted; the rest are suppressed.
|
|
34
|
+
*/
|
|
35
|
+
static set level(level) {
|
|
36
|
+
this.#level = level;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Sets the global prefix that appears at the start of every logged message. Defaults to `"LO2"`.
|
|
40
|
+
*/
|
|
41
|
+
static set prefix(prefix) {
|
|
42
|
+
this.#prefix = prefix;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The full tag prepended to every message from this instance, in the form `prefix:branding:`. Appears first in the
|
|
46
|
+
* console and can be used as a filter expression.
|
|
47
|
+
*/
|
|
48
|
+
get brand() {
|
|
49
|
+
return `${Logger.#prefix}:${this.#branding}:`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @param branding A string label, or any object whose constructor name should be used as the label (typically
|
|
53
|
+
* `this`, so a class can do `new Logger(this)`).
|
|
54
|
+
*/
|
|
55
|
+
constructor(branding) {
|
|
56
|
+
if (typeof branding === "string") {
|
|
57
|
+
this.#branding = branding;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.#branding = branding.constructor?.name;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Logs at `error` severity via `console.error`. Always emitted unless the level is silenced externally.
|
|
65
|
+
*/
|
|
66
|
+
error(...args) {
|
|
67
|
+
if (logLevels.error <= logLevels[Logger.#level]) {
|
|
68
|
+
console.error(this.brand, ...args);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Logs at `warn` severity via `console.warn`. Suppressed when the level is `error`.
|
|
73
|
+
*/
|
|
74
|
+
warn(...args) {
|
|
75
|
+
if (logLevels.warn <= logLevels[Logger.#level]) {
|
|
76
|
+
console.warn(this.brand, ...args);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Logs at `info` severity via `console.info`. Suppressed when the level is `error` or `warn`.
|
|
81
|
+
*/
|
|
82
|
+
info(...args) {
|
|
83
|
+
if (logLevels.info <= logLevels[Logger.#level]) {
|
|
84
|
+
console.info(this.brand, ...args);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Logs at `debug` severity via `console.debug`. Emitted only when the level is `debug` or `trace`.
|
|
89
|
+
*/
|
|
90
|
+
debug(...args) {
|
|
91
|
+
if (logLevels.debug <= logLevels[Logger.#level]) {
|
|
92
|
+
console.debug(this.brand, ...args);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Logs at `trace` severity via `console.trace`, including a stack trace. Emitted only when the level is `trace`.
|
|
97
|
+
*/
|
|
98
|
+
trace(...args) {
|
|
99
|
+
if (logLevels.trace <= logLevels[Logger.#level]) {
|
|
100
|
+
console.trace(this.brand, ...args);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
9
104
|
/**
|
|
10
105
|
* Generates a pseudo-random alphanumeric identifier string for unique
|
|
11
106
|
* element IDs or temporary identifiers (not cryptographically secure).
|
|
@@ -20,11 +115,15 @@ var LO2 = (function (exports) {
|
|
|
20
115
|
}
|
|
21
116
|
|
|
22
117
|
/**
|
|
23
|
-
*
|
|
118
|
+
* Event names fired via `dispatchEvent` on Lightning Out hosts and components. Grouped by source: `application` and
|
|
119
|
+
* `component` events are part of the public API consumers can listen for; `iframe` events are internal plumbing between
|
|
120
|
+
* the host and the embedded frame.
|
|
24
121
|
*/
|
|
25
122
|
const events = {
|
|
26
123
|
lo: {
|
|
27
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Public events dispatched on the application host element.
|
|
126
|
+
*/
|
|
28
127
|
application: {
|
|
29
128
|
ready: "lo.application.ready",
|
|
30
129
|
error: "lo.application.error",
|
|
@@ -33,12 +132,16 @@ var LO2 = (function (exports) {
|
|
|
33
132
|
redirect: "lo.application.auth.redirect",
|
|
34
133
|
},
|
|
35
134
|
},
|
|
36
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Public events dispatched on individual component elements.
|
|
137
|
+
*/
|
|
37
138
|
component: {
|
|
38
139
|
ready: "lo.component.ready",
|
|
39
140
|
error: "lo.component.error",
|
|
40
141
|
},
|
|
41
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Internal events relayed from the embedded iframe; not part of the public API.
|
|
144
|
+
*/
|
|
42
145
|
iframe: {
|
|
43
146
|
load: "lo.iframe.load",
|
|
44
147
|
error: "lo.iframe.error",
|
|
@@ -50,7 +153,8 @@ var LO2 = (function (exports) {
|
|
|
50
153
|
},
|
|
51
154
|
};
|
|
52
155
|
/**
|
|
53
|
-
*
|
|
156
|
+
* Message types exchanged via `postMessage` between the host page and the embedded iframe. All messages are internal
|
|
157
|
+
* implementation details — consumers should listen for {@link events} instead of these wire-level messages.
|
|
54
158
|
*/
|
|
55
159
|
const messages = {
|
|
56
160
|
lo: {
|
|
@@ -68,69 +172,31 @@ var LO2 = (function (exports) {
|
|
|
68
172
|
},
|
|
69
173
|
};
|
|
70
174
|
|
|
71
|
-
const logLevels = {
|
|
72
|
-
error: 0,
|
|
73
|
-
warn: 1,
|
|
74
|
-
info: 2,
|
|
75
|
-
debug: 3,
|
|
76
|
-
trace: 4,
|
|
77
|
-
};
|
|
78
|
-
class Logger {
|
|
79
|
-
static #prefix = "LO2";
|
|
80
|
-
static #level = "error";
|
|
81
|
-
#branding;
|
|
82
|
-
static set level(level) {
|
|
83
|
-
this.#level = level;
|
|
84
|
-
}
|
|
85
|
-
static set prefix(prefix) {
|
|
86
|
-
this.#prefix = prefix;
|
|
87
|
-
}
|
|
88
|
-
// This string appears first in the console, it can be used for filtering messages
|
|
89
|
-
get brand() {
|
|
90
|
-
return `${Logger.#prefix}:${this.#branding}:`;
|
|
91
|
-
}
|
|
92
|
-
constructor(branding) {
|
|
93
|
-
if (typeof branding === "string") {
|
|
94
|
-
this.#branding = branding;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
this.#branding = branding.constructor?.name;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
error(...args) {
|
|
101
|
-
if (logLevels.error <= logLevels[Logger.#level]) {
|
|
102
|
-
console.error(this.brand, ...args);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
warn(...args) {
|
|
106
|
-
if (logLevels.warn <= logLevels[Logger.#level]) {
|
|
107
|
-
console.warn(this.brand, ...args);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
info(...args) {
|
|
111
|
-
if (logLevels.info <= logLevels[Logger.#level]) {
|
|
112
|
-
console.info(this.brand, ...args);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
debug(...args) {
|
|
116
|
-
if (logLevels.debug <= logLevels[Logger.#level]) {
|
|
117
|
-
console.debug(this.brand, ...args);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
trace(...args) {
|
|
121
|
-
if (logLevels.trace <= logLevels[Logger.#level]) {
|
|
122
|
-
console.trace(this.brand, ...args);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
175
|
/**
|
|
128
176
|
* Error class for Lightning Out
|
|
129
177
|
*/
|
|
130
178
|
const logger$4 = new Logger("LightningOutError");
|
|
179
|
+
/**
|
|
180
|
+
* Branded error helper for Lightning Out. Wraps messages with the owning component's name and, when the owner is an
|
|
181
|
+
* `EventTarget`, dispatches them as `CustomEvent`s so consumers can react via `addEventListener`.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* class MyComponent extends EventTarget {
|
|
186
|
+
* #errors = new LightningOutError(this);
|
|
187
|
+
* fail() {
|
|
188
|
+
* this.#errors.dispatch("loaderror", "boom");
|
|
189
|
+
* }
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
131
193
|
class LightningOutError {
|
|
132
194
|
#eventTarget;
|
|
133
195
|
#branding;
|
|
196
|
+
/**
|
|
197
|
+
* @param branding A string label, or an `EventTarget` whose constructor name is used as the label and on which
|
|
198
|
+
* `dispatch()` will fire events. Pass `this` from a class that extends `EventTarget` to get both behaviors.
|
|
199
|
+
*/
|
|
134
200
|
constructor(branding) {
|
|
135
201
|
if (typeof branding === "string") {
|
|
136
202
|
this.#branding = branding;
|
|
@@ -145,10 +211,26 @@ var LO2 = (function (exports) {
|
|
|
145
211
|
#branded(message) {
|
|
146
212
|
return `${this.#branding}: ${message}`;
|
|
147
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Builds a new `Error` whose message is prefixed with the branding (`"<branding>: <message>"`). Accepts either a
|
|
216
|
+
* raw string or an existing `Error` whose `message` is reused.
|
|
217
|
+
*
|
|
218
|
+
* @param error A message string, or an `Error` whose `message` is unwrapped.
|
|
219
|
+
* @returns A new `Error` with the branded message.
|
|
220
|
+
*/
|
|
148
221
|
create(error) {
|
|
149
222
|
const message = typeof error === "string" ? error : error.message;
|
|
150
223
|
return new Error(this.#branded(message));
|
|
151
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Fires a `CustomEvent` of the given `type` on the owner `EventTarget`, carrying the branded error in `detail`.
|
|
227
|
+
* If a `CustomEvent` is passed in, its existing `detail` is preserved; otherwise a fresh
|
|
228
|
+
* `{ message, originalError }` detail is constructed. Logs the outcome via {@link Logger}; when the owner is not an
|
|
229
|
+
* `EventTarget`, the dispatch is skipped and only the log line is emitted.
|
|
230
|
+
*
|
|
231
|
+
* @param type The event type to dispatch (the first argument to `addEventListener`).
|
|
232
|
+
* @param error A message string, an `Error`, or a pre-built `CustomEvent` whose `detail` should be reused.
|
|
233
|
+
*/
|
|
152
234
|
dispatch(type, error) {
|
|
153
235
|
const message = typeof error === "string" ? error : error.message || error.detail?.message;
|
|
154
236
|
if (this.#eventTarget) {
|
|
@@ -1383,7 +1465,7 @@ var LO2 = (function (exports) {
|
|
|
1383
1465
|
url.searchParams.set("parentElementId", parentElementId);
|
|
1384
1466
|
url.searchParams.set("loAppOrigin", this.config.loAppOrigin);
|
|
1385
1467
|
// This helps in general but also for cache busting
|
|
1386
|
-
url.searchParams.set("loVersion", "2.2.
|
|
1468
|
+
url.searchParams.set("loVersion", "2.2.3-rc.0");
|
|
1387
1469
|
if (this.config.appId) {
|
|
1388
1470
|
url.searchParams.set("appId", this.config.appId);
|
|
1389
1471
|
}
|
package/dist/index.iife.prod.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @salesforce/lightning-out v2.2.
|
|
2
|
-
var LO2=function(e){"use strict";
|
|
1
|
+
/*! @salesforce/lightning-out v2.2.3-rc.0 (2026-06-22) */
|
|
2
|
+
var LO2=function(e){"use strict";const t={error:0,warn:1,info:2,debug:3,trace:4};class r{static#e="LO2";static#t="error";#r;static set level(e){this.#t=e}static set prefix(e){this.#e=e}get brand(){return`${r.#e}:${this.#r}:`}constructor(e){this.#r="string"==typeof e?e:e.constructor?.name}error(...e){t.error<=t[r.#t]&&console.error(this.brand,...e)}warn(...e){t.warn<=t[r.#t]&&console.warn(this.brand,...e)}info(...e){t.info<=t[r.#t]&&console.info(this.brand,...e)}debug(...e){t.debug<=t[r.#t]&&console.debug(this.brand,...e)}trace(...e){t.trace<=t[r.#t]&&console.trace(this.brand,...e)}}function i(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(36)}const s={application:{ready:"lo.application.ready",error:"lo.application.error",logout:"lo.application.logout",auth:{redirect:"lo.application.auth.redirect"}},component:{ready:"lo.component.ready",error:"lo.component.error"},iframe:{load:"lo.iframe.load",error:"lo.iframe.error",logout:"lo.iframe.logout",auth:{redirect:"lo.iframe.auth.redirect"}}},o={addEventListener:"lo.addEventListener",dispatchEvent:"lo.dispatchEvent",error:"lo.error",getComponentData:"lo.getComponentData",loaded:"lo.loaded",logout:"lo.logout",ready:"lo.ready",redirect:"lo.redirect",removeEventListener:"lo.removeEventListener",setComponentData:"lo.setComponentData",setComponentProps:"lo.setComponentProps"},n=new r("LightningOutError");class a{#i;#r;constructor(e){this.#r="string"==typeof e?e:e.constructor?.name,"function"==typeof e.dispatchEvent&&(this.#i=e)}#s(e){return`${this.#r}: ${e}`}create(e){const t="string"==typeof e?e:e.message;return new Error(this.#s(t))}dispatch(e,t){const r="string"==typeof t?t:t.message||t.detail?.message;if(this.#i){const i=t.detail||{message:this.#s(r),originalError:t},s=new CustomEvent(e,{detail:i});this.#i.dispatchEvent(s),n.error(`${this.#s("dispatched error")} -> ${e}: ${r}`)}else n.error(`${this.#s("unable to dispatch error on a non-EventTarget object")} -> ${e}: ${r}`)}}const l=new a("LightningOutUtils");function h(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function c(e,t=!1){if(/[A-Z]/.test(e))throw l.create(`elementNameToStandardName: "${e}" is not a valid custom element name - must be all lowercase.`);const r=e.indexOf("-");if(-1===r)throw l.create(`elementNameToStandardName: "${e}" is not a valid custom element name - missing hyphen character.`);return`${function(e){if(/[A-Z]/.test(e))throw l.create(`snakeToCamel: "${e}" is not valid snake_case - must be all lowercase.`);return e.replace(/_([a-z_])/g,(e,t)=>t.toUpperCase())}(e.slice(0,r))}${t?":":"/"}${function(e){if(/[A-Z]/.test(e))throw l.create(`kebabToCamel: "${e}" is not valid kebab-case - must be all lowercase.`);return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}(e.slice(r+1))}`}function d(e,t){const r=Object.entries(t).map(t=>{let[r,i]=t;const s=r.split("dataMirror");2===s.length&&""===s[0]&&(r=s[1].charAt(0).toLowerCase()+s[1].slice(1));const o=`_propertyChanged_${r}`;if("function"==typeof e[o]){i=(0,e[o])(i)}return[r,i]});return Object.fromEntries(r)}const p=new r("LightningOutIFrame");class m{#o;#n;#a;#l="display:none";#h="border:0px; width:100%; height:100%; overflow:auto;";#c;#d;#p;#m;#u;#g;constructor(e){this.#o=e.parentElement,this.#n=e.isVisible,this.#a=new a(e.parentElement)}get iframeReady(){return!!this.#p&&!!this.#m}get iframeElement(){return this.#d}#f(e,t){this.#p=e,this.#m=t}#v=e=>{if(e.data.id===this.#o._uuid)switch(p.debug("#messageListener:",`parentElement._uuid: ${this.#o._uuid}`,`parentElement.localName: ${this.#o.localName}`,JSON.stringify(e.data)),e.data.type){case o.loaded:{this.#g=clearTimeout(this.#g),this.#f(e.source,e.origin);const t=e.data.lightningDomain;this.#o.dispatchEvent(new CustomEvent(s.iframe.load,{detail:{origin:e.origin,lightningDomain:t}}));break}case o.logout:this.#g=clearTimeout(this.#g),this.#o.dispatchEvent(new CustomEvent(s.iframe.logout));break;case o.redirect:this.#g=clearTimeout(this.#g),this.#o.dispatchEvent(new CustomEvent(s.iframe.auth.redirect,{detail:{redirectUrl:e.data.redirectUrl,redirectOrigin:e.origin}}))}};#b(e){this.#d&&this.#n&&(this.#d.style.height=`${e}px`,p.debug(`#handleResize: applied height ${e}px to iframe`))}#w(){if(!this.#d){const e=window.document.createElement("iframe");e.name="lightning_af",e.setAttribute("sandbox",["allow-downloads","allow-forms","allow-popups","allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation"].join(" ")),e.style.cssText=this.#n?this.#h:this.#l,this.#d=e,this.#c=this.#o.attachShadow({mode:"closed"}),this.#c.appendChild(this.#d),e.addEventListener("load",this.#y),window.addEventListener("message",this.#v)}return this.#d}load(e){const t=this.#w();this.#u=new URL(e),p.debug("#loadIframe: endpoint =",function(e){const t={},r=e=>{const t={};for(const[r,i]of e.entries())t[r]=i;return t};if(t.url=e.origin+e.pathname,t.urlParams=r(e.searchParams),"/secur/frontdoor.jsp"===e.pathname){const e=t.urlParams.otp?"startURL":"retURL",i=new URL(t.urlParams[e],"http://dummy.com");t.urlParams[e]={url:i.pathname,urlParams:r(i.searchParams)}}return t}(this.#u)),this.#f(void 0,void 0),this.#n?t.src=e:localStorage.getItem("LightningOutIFrame:load:window.open")?window.open(e,`LO2 Hidden ${this.#o._uuid}`,"left=200,top=200,width=800,height=800"):t.src=e}#y=()=>{this.#g&&clearTimeout(this.#g),this.#g=setTimeout(()=>{if(!this.iframeReady){const e="Error: Unknown error, unable to load the iframe.";this.#a.dispatch(s.iframe.error,e),this.#E(e)}},6e4)};destroy(){this.#c&&(this.#c.innerHTML=""),this.#d&&this.#d.remove(),this.#c=void 0,this.#d=void 0,this.#f(void 0,void 0)}#E(e){if(this.#n&&this.#u){const t=new URL("/lightning/lightning.out.message.html",this.#u.origin);t.search=new URLSearchParams({loAppOrigin:window.location.origin,parentElementId:this.#o._uuid,message:e}).toString(),this.load(t.href)}}postMessage(e){if(!this.#p||!this.#m)throw this.#a.create("Error attempting to postMessage on an iframe that is not ready.");p.debug("postMessage:",`parentElement: ${this.#o._uuid}`,JSON.stringify(e));try{this.#p.postMessage(e,this.#m)}catch(e){const t=`postMessage error: ${e}`;throw this.#a.dispatch(s.iframe.error,t),this.#a.create(t)}}}
|
|
3
3
|
/**
|
|
4
4
|
* @file property-observer.ts
|
|
5
5
|
* @author Caridy Patiño (2025)
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @description Provides the PropertyObserver class, a utility to observe property and attribute
|
|
8
8
|
* changes on any DOM element, with automatic getter/setter interception and batched notifications.
|
|
9
|
-
*/const u=new o("PropertyObserver");class g{_el;_cb;_cache;_shouldObserve;_interceptedProps;_originalDescriptors;_observer;_changesPending;_pendingChanges;_attributeExceptions=new Map([["for","htmlFor"],["class","className"],["formnovalidate","formNoValidate"],["readonly","readOnly"],["maxlength","maxLength"],["minlength","minLength"],["contenteditable","contentEditable"],["spellcheck","spellcheck"],["novalidate","noValidate"],["autofocus","autofocus"],["autocomplete","autocomplete"],["crossorigin","crossOrigin"]]);constructor(e,t,r){if(!(e instanceof Element))throw new TypeError("Target must be a DOM Element");if("function"!=typeof t)throw new TypeError("Callback must be a function");if(r&&"function"!=typeof r)throw new TypeError("shouldObserve callback must be a function");this._el=e,this._cb=t,this._cache=new Map,this._shouldObserve=r||((e,t)=>!1===t),this._interceptedProps=new Set,this._originalDescriptors=new Map,this._changesPending=!1,this._pendingChanges={},this._initialScan(),this._setupMutationObserver()}disconnect(){this._observer&&this._observer.disconnect();for(const[e,t]of this._originalDescriptors)Object.defineProperty(this._el,e,t);this._cache.clear(),this._interceptedProps.clear(),this._originalDescriptors.clear(),this._pendingChanges={},this._changesPending=!1}_initialScan(){const e={};for(const t of Array.from(this._el.attributes)){const r=t.name,i=this._isStandardAttribute(r);if(!this._shouldObserve(r,i))continue;const s=this._attributeNameToPropName(r),o=t.value;e[s]=o,this._cache.set(s,o),this._installPropertyInterceptor(s)}for(const t of Object.getOwnPropertyNames(this._el)){const r=this._isStandardProperty(t);if(this._cache.has(t)||!this._shouldObserve(t,r))continue;const i=this._el[t];e[t]=i,this._cache.set(t,i),this._installPropertyInterceptor(t)}if(Object.keys(e).length>0)try{this._cb(e)}catch(e){u.error("Error in initial PropertyObserver callback:",e)}}_setupMutationObserver(){this._observer=new MutationObserver(e=>{const t={};for(const r of e)if("attributes"===r.type&&r.attributeName){const e=r.attributeName,i=this._isStandardAttribute(e);if(!this._shouldObserve(e,i))continue;const s=this._attributeNameToPropName(e),o=this._el.getAttribute(e);o!==this._cache.get(s)&&(t[s]=o,this._cache.set(s,o),this._interceptedProps.has(s)||this._installPropertyInterceptor(s))}Object.keys(t).length>0&&this._batchChanges(t)}),this._observer.observe(this._el,{attributes:!0,attributeOldValue:!1})}_installPropertyInterceptor(e){if(this._interceptedProps.has(e))return;const t=Object.getOwnPropertyDescriptor(this._el,e)||{value:this._el[e],writable:!0,enumerable:!0,configurable:!0};this._originalDescriptors.set(e,t);const r={enumerable:t.enumerable,configurable:t.configurable,get:t.get||(()=>t.value),set:r=>{r!==this._cache.get(e)&&(t.set?t.set.call(this._el,r):t.value=r,this._cache.set(e,r),this._batchChanges({[e]:r}))}};Object.defineProperty(this._el,e,r),this._interceptedProps.add(e)}_batchChanges(e){Object.assign(this._pendingChanges,e),this._changesPending||(this._changesPending=!0,queueMicrotask(()=>{this._changesPending=!1;const e={...this._pendingChanges};this._pendingChanges={};try{this._cb(e)}catch(e){u.error("Error in PropertyObserver callback:",e)}}))}_attributeNameToPropName(e){return this._attributeExceptions.has(e)?this._attributeExceptions.get(e):e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}_isStandardAttribute(e){if(e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("on"))return!0;const t=this._attributeNameToPropName(e);return this._isStandardProperty(t)}_isStandardProperty(e){return e in HTMLElement.prototype}}const f=new class{#_=new a("LightningOutRegistry");appToComps=new WeakMap;compToApp=new WeakMap;compNameToApp=new Map;registerApplication(e){this.appToComps.has(e)||this.appToComps.set(e,new Set)}registerComponentName(e,t){if(this.compNameToApp.has(e))throw this.#_.create(`"${e}" is already registered to another App.`);this.compNameToApp.set(e,t)}registerComponent(e,t){if(this.compToApp.has(e))throw this.#_.create("This Comp is already registered to another App.");let r=t;if(!r){const t=e.localName;if(r=this.compNameToApp.get(t),!r)throw this.#_.create(`Could not find a parent App for component "${e.localName}"`)}return this.appToComps.get(r).add(e),this.compToApp.set(e,r),r}unregisterComponent(e){const t=this.compToApp.get(e);if(!t)return!1;const r=this.appToComps.get(t);return r?.delete(e),this.compToApp.delete(e),!0}getComps(e){const t=this.appToComps.get(e);if(!t)throw this.#_.create("Unable to find set of LightningOutComponents");return t}},v=new o("LightningOutComponent"),b=new Set(["autocapitalize","autocorrect","dir","enterkeyhint","inputmode","lang","spellcheck","style","title","translate"]),w=new Set(["aria-disabled","aria-hidden","aria-label","aria-live","aria-modal","aria-pressed","aria-valuemax","aria-valuemin","aria-valuenow"]),y=new Set(["accesskey","autofocus","draggable","exportparts","hidden","inert","nonce","part","slot","tabindex"]),E=new Set(["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"]);class _ extends HTMLElement{_uuid=t();componentReady=!1;_standardName=c(this.localName);#C;#_=new a(this);#L=new m({parentElement:this,isVisible:!0});#A;#P=!0;#O=[];#R=new WeakMap;#$=0;constructor(){super(),v.trace("constructor: called",`_uuid: ${this._uuid}`)}_getComponentURL(){const e=this.#C;if(!e)throw this.#_.create("Undefined parent App!");return e._getComponentURL(this._standardName,this._uuid)}_init(){this.componentReady||this.#L.load(this._getComponentURL().href)}#v=e=>{if(e.data.id===this._uuid)switch(v.debug("#messageListener:",`this._uuid: ${this._uuid}`,`this._standardName: ${this._standardName}`,`event.data: ${JSON.stringify(e.data)}`),e.data.type){case i.ready:for(this.componentReady=!0;this.#O.length;){const e=this.#O.shift();e&&("add"===e.type?this.addEventListener(...e.args):"remove"===e.type?this.removeEventListener(...e.args):"dispatch"===e.type&&this.dispatchEvent(e.event))}super.dispatchEvent(new CustomEvent(r.component.ready));break;case i.getComponentData:this.#A=new g(this,this.#U,this.#S);break;case i.dispatchEvent:{const t=new CustomEvent(e.data.name,{detail:e.data.detail});super.dispatchEvent(t);break}case i.error:this.#_.dispatch(r.component.error,e.data.error);break;default:v.info("#messageListener:","Unknown message received:",{"event.data":e.data})}};_propertyChanged_style=e=>{const t=this.style,r=[];for(let e=0;e<t.length;e+=1){const i=t.item(e);i.startsWith("--")&&r.push(`${i}:${t.getPropertyValue(i)}`)}return r.join(";")};#U=e=>{const t=d(this,e);v.debug("#propObserverCallback:",{changes:e,propsToSend:t}),this.#P?(this.#P=!1,this.#L.postMessage({type:i.setComponentData,componentData:{id:this._uuid,name:this._standardName,props:t}})):this.#L.postMessage({type:i.setComponentProps,componentProps:t})};#S=(e,t)=>{const r=h(e);return v.debug("#shouldObserveCallback:",{attrOrPropName:e,attrName:r,isStandard:t}),t?!(!b.has(r)&&!w.has(r))||(y.has(r)||E.has(r)||r.startsWith("on")?(v.warn(`"${r}" will not be mirrored.`),!1):!!r.startsWith("data-mirror-")||(v.warn(`"${r}" will not be mirrored.`),!1)):!r.startsWith("_")};addEventListener(e,t,s){if(e===r.component.ready&&this.componentReady){const e=new CustomEvent(r.component.ready);queueMicrotask(()=>{"function"==typeof t?t.call(this,e):t.handleEvent(e)})}if(e.startsWith("lo."))return void super.addEventListener(e,t,s);let o=this.#R.get(t);o||(o=`${e}_${this.#$++}`,this.#R.set(t,o)),this.componentReady?(super.addEventListener(...arguments),this.#L.postMessage({name:e,options:s,listenerKey:o,type:i.addEventListener})):(this.#O.push({type:"add",args:[e,t,s]}),v.debug("addEventListener:","#eventQueue pushed add args:",[e,t,s]))}dispatchEvent(e){if(e.type.startsWith("lo."))return v.debug(`dispatchEvent: dispatching event "${e.type}" to this Element only`),super.dispatchEvent(e);if(this.componentReady){v.debug(`dispatchEvent: dispatching event "${e.type}" to this Element and embedded Element inside the iframe`);const t=super.dispatchEvent(e);return this.#L.postMessage({name:e.type,detail:e.detail||{},type:i.dispatchEvent}),t}return v.debug(`dispatchEvent: component not ready, queueing event "${e.type}"`),this.#O.push({type:"dispatch",event:e}),!0}removeEventListener(e,t,r){if(e.startsWith("lo."))return void super.removeEventListener(...arguments);const s=this.#R.get(t);this.componentReady?(super.removeEventListener(...arguments),this.#L.postMessage({name:e,options:r,listenerKey:s,type:i.removeEventListener})):(this.#O.push({type:"remove",args:[e,t,r]}),v.debug("removeEventListener:","#eventQueue pushed remove args:",[e,t,r])),s&&this.#R.delete(t)}adoptedCallback(){throw this.remove(),this.#_.create("This component cannot be rerendered for security reasons.")}connectedCallback(){if(v.trace("connectedCallback: called",`_uuid: ${this._uuid}`),window.addEventListener("message",this.#v),this.hasChildNodes())throw this.#_.create("Should not have child nodes");this.style.display||="block",this.style.width||="100%",this.style.height||="100%",this.#C=f.registerComponent(this),this._standardName=this.#C._getComponentStandardName(this),this.#C.applicationReady&&this._init()}disconnectedCallback(){v.trace("disconnectedCallback: called",`_uuid: ${this._uuid}`),this.#L.destroy(),window.removeEventListener("message",this.#v),f.unregisterComponent(this),this.#A?.disconnect()}connectedMoveCallback(){}}class C{config;errorHandler;constructor(e,t){if(this.config=e,this.errorHandler=t,!this.config.origin)throw this.errorHandler('Missing "frontdoor-url" or "org-url" attribute')}getComponentURL(e,t){let r;if(void 0===this.config.sitePrefix){let t=e.includes("/")?this.config.lwrAppComp:e.includes(":")?this.config.lwrAppAura:void 0;if(void 0===t)throw this.errorHandler(`Invalid componentName: ${e}`);t=t.replace("/","%2F");const i=this.config.lang?`l/${this.config.lang}/`:"";r=new URL(`lwr/application/amd/0/${i}ai/${t}`,this.config.origin)}else r=new URL(`${this.config.sitePrefix}/lightning-out`,this.config.origin);return r.searchParams.set("componentName",e),this.#N(r,t)}getAuthURL(e){let t;if(void 0===this.config.sitePrefix){const e=this.config.lwrAppAuth.replace("/","%2F");t=new URL(`lwr/application/amd/0/ai/${e}`,this.config.origin)}else t=new URL(this.config.lwrPageAuth,this.config.origin);return this.#N(t,e)}getPageURL(e,t){const r=new URL(e,this.config.origin);return this.#N(r,t)}#N(e,t){return e.searchParams.set("parentElementId",t),e.searchParams.set("loAppOrigin",this.config.loAppOrigin),e.searchParams.set("loVersion","2.2.2"),this.config.appId&&e.searchParams.set("appId",this.config.appId),this.config.testMode&&e.searchParams.set("testMode","true"),this.config.designSystem&&e.searchParams.set("designSystem",this.config.designSystem),this.config.globalStyle&&e.searchParams.set("globalStyle",this.config.globalStyle),e}}const L=new o("LightningOutApplication"),A=new Set(["slds1","slds2","none"]),P=new Set(["frontdoorUrl","orgUrl"]);class O extends HTMLElement{_uuid=t();applicationReady=!1;#_=new a(this);#L=new m({parentElement:this,isVisible:!1});#k;#A;#T="";#I="lightningout/auth";#M="lightningout/container";#x="lightningout/auraContainer";#D="lightning/lightning.out.auth.html";#F="lightning/lightning.out.logout.html";#j="lightning/lightning.out.auth.error.html";#W="/secur/logout.jsp";lwrApplication;orgUrl;#V;frontdoorUrl;#H;appId;#K;components;#Q=new Map;sitePrefix;#z;designSystem;#Z;globalStyle;#q;#J=document.documentElement.lang??"";constructor(){super(),L.trace("constructor: called",`_uuid: ${this._uuid}`),f.registerApplication(this)}addEventListener(e,t,i){if(e===r.application.ready&&this.applicationReady){const e=new CustomEvent(r.application.ready);queueMicrotask(()=>{"function"==typeof t?t.call(this,e):t.handleEvent(e)})}super.addEventListener(e,t,i)}#G(e){try{this.#V=new URL(e)}catch{throw this.#_.create(`Invalid org-url: ${e}`)}this.dispatchEvent(new CustomEvent(r.iframe.load,{detail:this.#V.origin}))}#X(e){try{this.#H=new URL(e),this.#T=this.#H.origin;const t=this.#B(),r=this.#H.searchParams.has("otp")?"startURL":"retURL";this.#H.searchParams.set(r,t.pathname+t.search);const i=this.#Y(this.#j);this.#H.searchParams.set("error-redirect-uri",i.pathname+i.search)}catch{throw this.#_.create(`Invalid frontdoor-url: ${e}`)}this.#L.load(this.#H.href)}#ee(){const e=new URL(this.#W,this.#T),t=this.#Y(this.#F);e.searchParams.set("redirect-uri",t.pathname+t.search),this.#L.load(e.href)}getRouter(){if(void 0===this.#k){const e={origin:this.#T,lwrPageAuth:this.#D,lwrAppAuth:this.#I,lwrAppComp:this.#M,lwrAppAura:this.#x,sitePrefix:this.#z,lang:this.#J,appId:this.#K,testMode:this.__testMode||!1,loAppOrigin:window.location.origin,designSystem:this.#Z,globalStyle:this.#q};this.#k=new C(e,e=>this.#_.create(e))}return this.#k}_getComponentURL(e,t){return this.getRouter().getComponentURL(e,t)}#B(){return this.getRouter().getAuthURL(this._uuid)}#Y(e){return this.getRouter().getPageURL(e,this._uuid)}#te=e=>{this.applicationReady=!0;const t=e.detail;this.#T="string"==typeof t?t:t.lightningDomain||t.origin,this.#k=void 0,this.#re(),this.dispatchEvent(new CustomEvent(r.application.ready))};#ie=e=>{this.#_.dispatch(r.application.error,e)};#se=e=>{this.dispatchEvent(new CustomEvent(r.application.logout))};#oe=e=>{this.dispatchEvent(new CustomEvent(r.application.auth.redirect,{detail:e.detail}))};#re(){f.getComps(this).forEach(e=>{e._init()})}#U=e=>{const t={},r={};Object.keys(e).forEach(i=>{P.has(i)?r[i]=e[i]:t[i]=e[i]}),d(this,t),d(this,r)};#S=(e,t)=>t?"lang"===e:!e.startsWith("_");_propertyChanged_lwrApplication=e=>{if(void 0!==e){const t=e.split("/");if(2!==t.length||!t[0]||!t[1])throw this.#_.create(`"${e}" is not a valid lwr-application name, must be of the form 'namespace/name'`);this.#M=e}};_propertyChanged_lang=e=>{this.#J=e??""};_propertyChanged_orgUrl=e=>{if(void 0!==e){if(void 0!==this.#H)throw this.#_.create('Can\'t set "org-url" because "frontdoor-url" is already set');""===e?this.#ee():this.#G(e)}};_propertyChanged_frontdoorUrl=e=>{if(void 0!==e){if(void 0!==this.#V)throw this.#_.create('Can\'t set "frontdoor-url" because "org-url" is already set');""===e?this.#ee():this.#X(e)}};_propertyChanged_sitePrefix=e=>{void 0!==e&&(this.#z=e)};_propertyChanged_appId=e=>{void 0!==e&&(this.#K=e)};_propertyChanged_globalStyle=e=>{if(void 0!==e){const t=e.split(";").map(e=>e.trim()).filter(e=>e.length>0),r=[];for(const e of t){const[t,...i]=e.split(":"),s=t.trim();if(!s.startsWith("--"))throw this.#_.create(`Invalid global-style: "${s}" is not a CSS custom property. Only CSS custom properties (starting with --) are allowed.`);const o=i.join(":").trim();o&&r.push(`${s}:${o}`)}this.#q=r.join(";")+";"}};_propertyChanged_components=e=>{void 0!==e&&e.split(",").forEach(e=>{const[t,r]=e.split(" as ").map(e=>e.trim()),i=function(e){return e.includes("/")||e.includes(":")}(t);if(i&&t.includes(":"))throw this.#_.create(`"${t}" is not supported in components. Use kebab "namespace-name" in components and the "aura" attribute on the component element instead.`);const s=i?t:c(t),o=r||(i?function(e){const t=e.includes("/")?"/":":",r=e.indexOf(t);if(-1===r)throw l.create(`standardNameToElementName: "${e}" is not a valid component name - missing namespace separator.`);if(/-/.test(e))throw l.create(`standardNameToElementName: "${e}" is not a valid component name - must not contain hyphens.`);if(/^[A-Z]/.test(e))throw l.create(`standardNameToElementName: "${e}" is not a valid component name - first character must not be uppercase.`);const i=e.slice(0,r),s=e.slice(r+1);return`${i.replace(/([A-Z_])/g,"_$1").toLowerCase()}-${h(s)}`}(s):t);if(o&&!this.#Q.has(o)){this.#Q.set(o,s);try{f.registerComponentName(o,this),customElements.define(o,class extends _{})}catch(e){throw this.#_.create(`"${o}" is already registered. ${e}`)}}})};_propertyChanged_designSystem=e=>{if(void 0!==e&&!A.has(e))throw this.#_.create(`Invalid design-system: ${e}`);this.#Z=e};_getComponentStandardName(e){const t=e.localName,r=e.hasAttribute("aura"),i=this.#Q.get(t);if(!i)throw this.#_.create(`"${t}" is not registered.`);return r&&i.includes("/")?i.replace("/",":"):i}get _compNames(){}connectedCallback(){if(L.trace("connectedCallback: called",`_uuid: ${this._uuid}`),this.hasChildNodes())throw this.#_.create("Should not have child nodes");this.style.display||="none",this.addEventListener(r.iframe.load,this.#te),this.addEventListener(r.iframe.error,this.#ie),this.addEventListener(r.iframe.logout,this.#se),this.addEventListener(r.iframe.auth.redirect,this.#oe),this.#A=new g(this,this.#U,this.#S)}disconnectedCallback(){L.trace("disconnectedCallback: called",`_uuid: ${this._uuid}`),this.#ee(),this.#L.destroy(),this.removeEventListener(r.iframe.load,this.#te),this.removeEventListener(r.iframe.error,this.#ie),this.removeEventListener(r.iframe.logout,this.#se),this.removeEventListener(r.iframe.auth.redirect,this.#oe),this.#A?.disconnect()}connectedMoveCallback(){}}return o.level="debug",window.customElements.define("lightning-out-application",O),e.LightningOutApplication=O,e}({});
|
|
9
|
+
*/const u=new r("PropertyObserver");class g{_el;_cb;_cache;_shouldObserve;_interceptedProps;_originalDescriptors;_observer;_changesPending;_pendingChanges;_attributeExceptions=new Map([["for","htmlFor"],["class","className"],["formnovalidate","formNoValidate"],["readonly","readOnly"],["maxlength","maxLength"],["minlength","minLength"],["contenteditable","contentEditable"],["spellcheck","spellcheck"],["novalidate","noValidate"],["autofocus","autofocus"],["autocomplete","autocomplete"],["crossorigin","crossOrigin"]]);constructor(e,t,r){if(!(e instanceof Element))throw new TypeError("Target must be a DOM Element");if("function"!=typeof t)throw new TypeError("Callback must be a function");if(r&&"function"!=typeof r)throw new TypeError("shouldObserve callback must be a function");this._el=e,this._cb=t,this._cache=new Map,this._shouldObserve=r||((e,t)=>!1===t),this._interceptedProps=new Set,this._originalDescriptors=new Map,this._changesPending=!1,this._pendingChanges={},this._initialScan(),this._setupMutationObserver()}disconnect(){this._observer&&this._observer.disconnect();for(const[e,t]of this._originalDescriptors)Object.defineProperty(this._el,e,t);this._cache.clear(),this._interceptedProps.clear(),this._originalDescriptors.clear(),this._pendingChanges={},this._changesPending=!1}_initialScan(){const e={};for(const t of Array.from(this._el.attributes)){const r=t.name,i=this._isStandardAttribute(r);if(!this._shouldObserve(r,i))continue;const s=this._attributeNameToPropName(r),o=t.value;e[s]=o,this._cache.set(s,o),this._installPropertyInterceptor(s)}for(const t of Object.getOwnPropertyNames(this._el)){const r=this._isStandardProperty(t);if(this._cache.has(t)||!this._shouldObserve(t,r))continue;const i=this._el[t];e[t]=i,this._cache.set(t,i),this._installPropertyInterceptor(t)}if(Object.keys(e).length>0)try{this._cb(e)}catch(e){u.error("Error in initial PropertyObserver callback:",e)}}_setupMutationObserver(){this._observer=new MutationObserver(e=>{const t={};for(const r of e)if("attributes"===r.type&&r.attributeName){const e=r.attributeName,i=this._isStandardAttribute(e);if(!this._shouldObserve(e,i))continue;const s=this._attributeNameToPropName(e),o=this._el.getAttribute(e);o!==this._cache.get(s)&&(t[s]=o,this._cache.set(s,o),this._interceptedProps.has(s)||this._installPropertyInterceptor(s))}Object.keys(t).length>0&&this._batchChanges(t)}),this._observer.observe(this._el,{attributes:!0,attributeOldValue:!1})}_installPropertyInterceptor(e){if(this._interceptedProps.has(e))return;const t=Object.getOwnPropertyDescriptor(this._el,e)||{value:this._el[e],writable:!0,enumerable:!0,configurable:!0};this._originalDescriptors.set(e,t);const r={enumerable:t.enumerable,configurable:t.configurable,get:t.get||(()=>t.value),set:r=>{r!==this._cache.get(e)&&(t.set?t.set.call(this._el,r):t.value=r,this._cache.set(e,r),this._batchChanges({[e]:r}))}};Object.defineProperty(this._el,e,r),this._interceptedProps.add(e)}_batchChanges(e){Object.assign(this._pendingChanges,e),this._changesPending||(this._changesPending=!0,queueMicrotask(()=>{this._changesPending=!1;const e={...this._pendingChanges};this._pendingChanges={};try{this._cb(e)}catch(e){u.error("Error in PropertyObserver callback:",e)}}))}_attributeNameToPropName(e){return this._attributeExceptions.has(e)?this._attributeExceptions.get(e):e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}_isStandardAttribute(e){if(e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("on"))return!0;const t=this._attributeNameToPropName(e);return this._isStandardProperty(t)}_isStandardProperty(e){return e in HTMLElement.prototype}}const f=new class{#_=new a("LightningOutRegistry");appToComps=new WeakMap;compToApp=new WeakMap;compNameToApp=new Map;registerApplication(e){this.appToComps.has(e)||this.appToComps.set(e,new Set)}registerComponentName(e,t){if(this.compNameToApp.has(e))throw this.#_.create(`"${e}" is already registered to another App.`);this.compNameToApp.set(e,t)}registerComponent(e,t){if(this.compToApp.has(e))throw this.#_.create("This Comp is already registered to another App.");let r=t;if(!r){const t=e.localName;if(r=this.compNameToApp.get(t),!r)throw this.#_.create(`Could not find a parent App for component "${e.localName}"`)}return this.appToComps.get(r).add(e),this.compToApp.set(e,r),r}unregisterComponent(e){const t=this.compToApp.get(e);if(!t)return!1;const r=this.appToComps.get(t);return r?.delete(e),this.compToApp.delete(e),!0}getComps(e){const t=this.appToComps.get(e);if(!t)throw this.#_.create("Unable to find set of LightningOutComponents");return t}},v=new r("LightningOutComponent"),b=new Set(["autocapitalize","autocorrect","dir","enterkeyhint","inputmode","lang","spellcheck","style","title","translate"]),w=new Set(["aria-disabled","aria-hidden","aria-label","aria-live","aria-modal","aria-pressed","aria-valuemax","aria-valuemin","aria-valuenow"]),y=new Set(["accesskey","autofocus","draggable","exportparts","hidden","inert","nonce","part","slot","tabindex"]),E=new Set(["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"]);class _ extends HTMLElement{_uuid=i();componentReady=!1;_standardName=c(this.localName);#C;#_=new a(this);#L=new m({parentElement:this,isVisible:!0});#A;#P=!0;#O=[];#R=new WeakMap;#$=0;constructor(){super(),v.trace("constructor: called",`_uuid: ${this._uuid}`)}_getComponentURL(){const e=this.#C;if(!e)throw this.#_.create("Undefined parent App!");return e._getComponentURL(this._standardName,this._uuid)}_init(){this.componentReady||this.#L.load(this._getComponentURL().href)}#v=e=>{if(e.data.id===this._uuid)switch(v.debug("#messageListener:",`this._uuid: ${this._uuid}`,`this._standardName: ${this._standardName}`,`event.data: ${JSON.stringify(e.data)}`),e.data.type){case o.ready:for(this.componentReady=!0;this.#O.length;){const e=this.#O.shift();e&&("add"===e.type?this.addEventListener(...e.args):"remove"===e.type?this.removeEventListener(...e.args):"dispatch"===e.type&&this.dispatchEvent(e.event))}super.dispatchEvent(new CustomEvent(s.component.ready));break;case o.getComponentData:this.#A=new g(this,this.#U,this.#S);break;case o.dispatchEvent:{const t=new CustomEvent(e.data.name,{detail:e.data.detail});super.dispatchEvent(t);break}case o.error:this.#_.dispatch(s.component.error,e.data.error);break;default:v.info("#messageListener:","Unknown message received:",{"event.data":e.data})}};_propertyChanged_style=e=>{const t=this.style,r=[];for(let e=0;e<t.length;e+=1){const i=t.item(e);i.startsWith("--")&&r.push(`${i}:${t.getPropertyValue(i)}`)}return r.join(";")};#U=e=>{const t=d(this,e);v.debug("#propObserverCallback:",{changes:e,propsToSend:t}),this.#P?(this.#P=!1,this.#L.postMessage({type:o.setComponentData,componentData:{id:this._uuid,name:this._standardName,props:t}})):this.#L.postMessage({type:o.setComponentProps,componentProps:t})};#S=(e,t)=>{const r=h(e);return v.debug("#shouldObserveCallback:",{attrOrPropName:e,attrName:r,isStandard:t}),t?!(!b.has(r)&&!w.has(r))||(y.has(r)||E.has(r)||r.startsWith("on")?(v.warn(`"${r}" will not be mirrored.`),!1):!!r.startsWith("data-mirror-")||(v.warn(`"${r}" will not be mirrored.`),!1)):!r.startsWith("_")};addEventListener(e,t,r){if(e===s.component.ready&&this.componentReady){const e=new CustomEvent(s.component.ready);queueMicrotask(()=>{"function"==typeof t?t.call(this,e):t.handleEvent(e)})}if(e.startsWith("lo."))return void super.addEventListener(e,t,r);let i=this.#R.get(t);i||(i=`${e}_${this.#$++}`,this.#R.set(t,i)),this.componentReady?(super.addEventListener(...arguments),this.#L.postMessage({name:e,options:r,listenerKey:i,type:o.addEventListener})):(this.#O.push({type:"add",args:[e,t,r]}),v.debug("addEventListener:","#eventQueue pushed add args:",[e,t,r]))}dispatchEvent(e){if(e.type.startsWith("lo."))return v.debug(`dispatchEvent: dispatching event "${e.type}" to this Element only`),super.dispatchEvent(e);if(this.componentReady){v.debug(`dispatchEvent: dispatching event "${e.type}" to this Element and embedded Element inside the iframe`);const t=super.dispatchEvent(e);return this.#L.postMessage({name:e.type,detail:e.detail||{},type:o.dispatchEvent}),t}return v.debug(`dispatchEvent: component not ready, queueing event "${e.type}"`),this.#O.push({type:"dispatch",event:e}),!0}removeEventListener(e,t,r){if(e.startsWith("lo."))return void super.removeEventListener(...arguments);const i=this.#R.get(t);this.componentReady?(super.removeEventListener(...arguments),this.#L.postMessage({name:e,options:r,listenerKey:i,type:o.removeEventListener})):(this.#O.push({type:"remove",args:[e,t,r]}),v.debug("removeEventListener:","#eventQueue pushed remove args:",[e,t,r])),i&&this.#R.delete(t)}adoptedCallback(){throw this.remove(),this.#_.create("This component cannot be rerendered for security reasons.")}connectedCallback(){if(v.trace("connectedCallback: called",`_uuid: ${this._uuid}`),window.addEventListener("message",this.#v),this.hasChildNodes())throw this.#_.create("Should not have child nodes");this.style.display||="block",this.style.width||="100%",this.style.height||="100%",this.#C=f.registerComponent(this),this._standardName=this.#C._getComponentStandardName(this),this.#C.applicationReady&&this._init()}disconnectedCallback(){v.trace("disconnectedCallback: called",`_uuid: ${this._uuid}`),this.#L.destroy(),window.removeEventListener("message",this.#v),f.unregisterComponent(this),this.#A?.disconnect()}connectedMoveCallback(){}}class C{config;errorHandler;constructor(e,t){if(this.config=e,this.errorHandler=t,!this.config.origin)throw this.errorHandler('Missing "frontdoor-url" or "org-url" attribute')}getComponentURL(e,t){let r;if(void 0===this.config.sitePrefix){let t=e.includes("/")?this.config.lwrAppComp:e.includes(":")?this.config.lwrAppAura:void 0;if(void 0===t)throw this.errorHandler(`Invalid componentName: ${e}`);t=t.replace("/","%2F");const i=this.config.lang?`l/${this.config.lang}/`:"";r=new URL(`lwr/application/amd/0/${i}ai/${t}`,this.config.origin)}else r=new URL(`${this.config.sitePrefix}/lightning-out`,this.config.origin);return r.searchParams.set("componentName",e),this.#N(r,t)}getAuthURL(e){let t;if(void 0===this.config.sitePrefix){const e=this.config.lwrAppAuth.replace("/","%2F");t=new URL(`lwr/application/amd/0/ai/${e}`,this.config.origin)}else t=new URL(this.config.lwrPageAuth,this.config.origin);return this.#N(t,e)}getPageURL(e,t){const r=new URL(e,this.config.origin);return this.#N(r,t)}#N(e,t){return e.searchParams.set("parentElementId",t),e.searchParams.set("loAppOrigin",this.config.loAppOrigin),e.searchParams.set("loVersion","2.2.3-rc.0"),this.config.appId&&e.searchParams.set("appId",this.config.appId),this.config.testMode&&e.searchParams.set("testMode","true"),this.config.designSystem&&e.searchParams.set("designSystem",this.config.designSystem),this.config.globalStyle&&e.searchParams.set("globalStyle",this.config.globalStyle),e}}const L=new r("LightningOutApplication"),A=new Set(["slds1","slds2","none"]),P=new Set(["frontdoorUrl","orgUrl"]);class O extends HTMLElement{_uuid=i();applicationReady=!1;#_=new a(this);#L=new m({parentElement:this,isVisible:!1});#k;#A;#T="";#I="lightningout/auth";#M="lightningout/container";#x="lightningout/auraContainer";#D="lightning/lightning.out.auth.html";#F="lightning/lightning.out.logout.html";#j="lightning/lightning.out.auth.error.html";#W="/secur/logout.jsp";lwrApplication;orgUrl;#V;frontdoorUrl;#H;appId;#K;components;#Q=new Map;sitePrefix;#z;designSystem;#Z;globalStyle;#q;#J=document.documentElement.lang??"";constructor(){super(),L.trace("constructor: called",`_uuid: ${this._uuid}`),f.registerApplication(this)}addEventListener(e,t,r){if(e===s.application.ready&&this.applicationReady){const e=new CustomEvent(s.application.ready);queueMicrotask(()=>{"function"==typeof t?t.call(this,e):t.handleEvent(e)})}super.addEventListener(e,t,r)}#G(e){try{this.#V=new URL(e)}catch{throw this.#_.create(`Invalid org-url: ${e}`)}this.dispatchEvent(new CustomEvent(s.iframe.load,{detail:this.#V.origin}))}#X(e){try{this.#H=new URL(e),this.#T=this.#H.origin;const t=this.#B(),r=this.#H.searchParams.has("otp")?"startURL":"retURL";this.#H.searchParams.set(r,t.pathname+t.search);const i=this.#Y(this.#j);this.#H.searchParams.set("error-redirect-uri",i.pathname+i.search)}catch{throw this.#_.create(`Invalid frontdoor-url: ${e}`)}this.#L.load(this.#H.href)}#ee(){const e=new URL(this.#W,this.#T),t=this.#Y(this.#F);e.searchParams.set("redirect-uri",t.pathname+t.search),this.#L.load(e.href)}getRouter(){if(void 0===this.#k){const e={origin:this.#T,lwrPageAuth:this.#D,lwrAppAuth:this.#I,lwrAppComp:this.#M,lwrAppAura:this.#x,sitePrefix:this.#z,lang:this.#J,appId:this.#K,testMode:this.__testMode||!1,loAppOrigin:window.location.origin,designSystem:this.#Z,globalStyle:this.#q};this.#k=new C(e,e=>this.#_.create(e))}return this.#k}_getComponentURL(e,t){return this.getRouter().getComponentURL(e,t)}#B(){return this.getRouter().getAuthURL(this._uuid)}#Y(e){return this.getRouter().getPageURL(e,this._uuid)}#te=e=>{this.applicationReady=!0;const t=e.detail;this.#T="string"==typeof t?t:t.lightningDomain||t.origin,this.#k=void 0,this.#re(),this.dispatchEvent(new CustomEvent(s.application.ready))};#ie=e=>{this.#_.dispatch(s.application.error,e)};#se=e=>{this.dispatchEvent(new CustomEvent(s.application.logout))};#oe=e=>{this.dispatchEvent(new CustomEvent(s.application.auth.redirect,{detail:e.detail}))};#re(){f.getComps(this).forEach(e=>{e._init()})}#U=e=>{const t={},r={};Object.keys(e).forEach(i=>{P.has(i)?r[i]=e[i]:t[i]=e[i]}),d(this,t),d(this,r)};#S=(e,t)=>t?"lang"===e:!e.startsWith("_");_propertyChanged_lwrApplication=e=>{if(void 0!==e){const t=e.split("/");if(2!==t.length||!t[0]||!t[1])throw this.#_.create(`"${e}" is not a valid lwr-application name, must be of the form 'namespace/name'`);this.#M=e}};_propertyChanged_lang=e=>{this.#J=e??""};_propertyChanged_orgUrl=e=>{if(void 0!==e){if(void 0!==this.#H)throw this.#_.create('Can\'t set "org-url" because "frontdoor-url" is already set');""===e?this.#ee():this.#G(e)}};_propertyChanged_frontdoorUrl=e=>{if(void 0!==e){if(void 0!==this.#V)throw this.#_.create('Can\'t set "frontdoor-url" because "org-url" is already set');""===e?this.#ee():this.#X(e)}};_propertyChanged_sitePrefix=e=>{void 0!==e&&(this.#z=e)};_propertyChanged_appId=e=>{void 0!==e&&(this.#K=e)};_propertyChanged_globalStyle=e=>{if(void 0!==e){const t=e.split(";").map(e=>e.trim()).filter(e=>e.length>0),r=[];for(const e of t){const[t,...i]=e.split(":"),s=t.trim();if(!s.startsWith("--"))throw this.#_.create(`Invalid global-style: "${s}" is not a CSS custom property. Only CSS custom properties (starting with --) are allowed.`);const o=i.join(":").trim();o&&r.push(`${s}:${o}`)}this.#q=r.join(";")+";"}};_propertyChanged_components=e=>{void 0!==e&&e.split(",").forEach(e=>{const[t,r]=e.split(" as ").map(e=>e.trim()),i=function(e){return e.includes("/")||e.includes(":")}(t);if(i&&t.includes(":"))throw this.#_.create(`"${t}" is not supported in components. Use kebab "namespace-name" in components and the "aura" attribute on the component element instead.`);const s=i?t:c(t),o=r||(i?function(e){const t=e.includes("/")?"/":":",r=e.indexOf(t);if(-1===r)throw l.create(`standardNameToElementName: "${e}" is not a valid component name - missing namespace separator.`);if(/-/.test(e))throw l.create(`standardNameToElementName: "${e}" is not a valid component name - must not contain hyphens.`);if(/^[A-Z]/.test(e))throw l.create(`standardNameToElementName: "${e}" is not a valid component name - first character must not be uppercase.`);const i=e.slice(0,r),s=e.slice(r+1);return`${i.replace(/([A-Z_])/g,"_$1").toLowerCase()}-${h(s)}`}(s):t);if(o&&!this.#Q.has(o)){this.#Q.set(o,s);try{f.registerComponentName(o,this),customElements.define(o,class extends _{})}catch(e){throw this.#_.create(`"${o}" is already registered. ${e}`)}}})};_propertyChanged_designSystem=e=>{if(void 0!==e&&!A.has(e))throw this.#_.create(`Invalid design-system: ${e}`);this.#Z=e};_getComponentStandardName(e){const t=e.localName,r=e.hasAttribute("aura"),i=this.#Q.get(t);if(!i)throw this.#_.create(`"${t}" is not registered.`);return r&&i.includes("/")?i.replace("/",":"):i}get _compNames(){}connectedCallback(){if(L.trace("connectedCallback: called",`_uuid: ${this._uuid}`),this.hasChildNodes())throw this.#_.create("Should not have child nodes");this.style.display||="none",this.addEventListener(s.iframe.load,this.#te),this.addEventListener(s.iframe.error,this.#ie),this.addEventListener(s.iframe.logout,this.#se),this.addEventListener(s.iframe.auth.redirect,this.#oe),this.#A=new g(this,this.#U,this.#S)}disconnectedCallback(){L.trace("disconnectedCallback: called",`_uuid: ${this._uuid}`),this.#ee(),this.#L.destroy(),this.removeEventListener(s.iframe.load,this.#te),this.removeEventListener(s.iframe.error,this.#ie),this.removeEventListener(s.iframe.logout,this.#se),this.removeEventListener(s.iframe.auth.redirect,this.#oe),this.#A?.disconnect()}connectedMoveCallback(){}}return r.level="debug",window.customElements.define("lightning-out-application",O),e.LightningOutApplication=O,e}({});
|
|
10
10
|
//# sourceMappingURL=index.iife.prod.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lightning-out",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3-rc.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Lightning Out 2.0 for Salesforce",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -22,11 +22,13 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"core": "2.2.
|
|
26
|
-
"utils": "2.2.
|
|
25
|
+
"core": "2.2.3-rc.0",
|
|
26
|
+
"utils": "2.2.3-rc.0"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"dist/",
|
|
30
|
+
"!dist/__tests__/",
|
|
31
|
+
"!dist/__mocks__/",
|
|
30
32
|
"!dist/*.test.js",
|
|
31
33
|
"!dist/*.map",
|
|
32
34
|
"README.md",
|