@contello/extension 8.21.2 → 8.21.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,357 +1,352 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- ContelloCustomProperty: () => ContelloCustomProperty,
24
- ContelloDialog: () => ContelloDialog,
25
- ContelloDialogRef: () => ContelloDialogRef,
26
- ContelloExtension: () => ContelloExtension,
27
- ExtensionChannel: () => ExtensionChannel
28
- });
29
- module.exports = __toCommonJS(index_exports);
30
-
31
- // src/channel.ts
32
- var channelIdIterator = 0;
33
- var requestIdIterator = 0;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/channel.ts
3
+ let channelIdIterator = 0;
4
+ let requestIdIterator = 0;
34
5
  var ExtensionChannel = class {
35
- constructor(params) {
36
- this.params = params;
37
- }
38
- handlers = /* @__PURE__ */ new Map();
39
- listeners = /* @__PURE__ */ new Map();
40
- targetWindow;
41
- channelId;
42
- targetOrigin;
43
- isParent;
44
- populateChannelId() {
45
- if (!this.channelId) {
46
- this.channelId = this.createChannelId();
47
- }
48
- return this.channelId;
49
- }
50
- connectParent(targetOrigin, channelId) {
51
- this.channelId = channelId;
52
- this.targetOrigin = targetOrigin;
53
- this.targetWindow = window.parent;
54
- this.isParent = false;
55
- this.connect();
56
- }
57
- connectChild(targetWindow) {
58
- this.populateChannelId();
59
- this.targetWindow = targetWindow;
60
- this.targetOrigin = "*";
61
- this.isParent = true;
62
- this.connect();
63
- }
64
- getChannelId() {
65
- return this.channelId;
66
- }
67
- getIsDebug() {
68
- return this.params.debug;
69
- }
70
- getTargetOrigin() {
71
- return this.targetOrigin;
72
- }
73
- getTargetWindow() {
74
- return this.targetWindow;
75
- }
76
- connect() {
77
- window.addEventListener("message", this.handler);
78
- }
79
- disconnect() {
80
- window.removeEventListener("message", this.handler);
81
- }
82
- handler = (event) => {
83
- if (event.data.channelId !== this.channelId) {
84
- return;
85
- }
86
- if (this.targetOrigin === "*" || event.origin === this.targetOrigin) {
87
- const { channelId: requestChannelId, requestId, method } = event.data;
88
- if (requestChannelId === this.channelId) {
89
- if (this.params.debug) {
90
- console.log(this.isParent ? "Parent received" : "Child received", event.data);
91
- }
92
- if (this.handlers.has(requestId)) {
93
- this.handlers.get(requestId)(event.data);
94
- } else if (this.listeners.has(method)) {
95
- Promise.resolve(this.listeners.get(method)?.(event.data.payload)).then((responsePayload) => this.respond(event.data, responsePayload)).catch((err) => this.respondError(event.data, err));
96
- }
97
- }
98
- }
99
- };
100
- respond(request, payload) {
101
- this.send({ channelId: request.channelId, requestId: request.requestId, method: request.method, payload });
102
- }
103
- respondError(request, error) {
104
- this.send({ channelId: request.channelId, requestId: request.requestId, method: request.method, error });
105
- }
106
- on(method, handler) {
107
- this.listeners.set(method, handler);
108
- }
109
- call(method, message) {
110
- return new Promise((resolve, reject) => {
111
- const requestId = this.createRequestId();
112
- this.send({ channelId: this.channelId, requestId, method, payload: message });
113
- this.handlers.set(requestId, (data) => {
114
- this.handlers.delete(requestId);
115
- if (data.error) {
116
- return reject(data.error);
117
- }
118
- resolve(data.payload);
119
- });
120
- });
121
- }
122
- send(data) {
123
- this.targetWindow?.postMessage(data, this.targetOrigin);
124
- }
125
- createChannelId() {
126
- return `contello-channel-${++channelIdIterator}-${Math.random().toString(36).substring(2)}`;
127
- }
128
- createRequestId() {
129
- return `${this.isParent ? "parent" : "child"}-request-${++requestIdIterator}-${Math.random().toString(36).substring(2)}`;
130
- }
6
+ params;
7
+ targetWindow;
8
+ channelId;
9
+ targetOrigin;
10
+ isParent;
11
+ handler = (event) => {
12
+ if (event.data.channelId !== this.channelId) return;
13
+ if (this.targetOrigin === "*" || event.origin === this.targetOrigin) {
14
+ const { channelId: requestChannelId, requestId, method } = event.data;
15
+ if (requestChannelId === this.channelId) {
16
+ if (this.params.debug) console.log(this.isParent ? "Parent received" : "Child received", event.data);
17
+ if (this.handlers.has(requestId)) this.handlers.get(requestId)(event.data);
18
+ else if (this.listeners.has(method)) (async () => {
19
+ try {
20
+ const responsePayload = await this.listeners.get(method)?.(event.data.payload);
21
+ this.respond(event.data, responsePayload);
22
+ } catch (error) {
23
+ this.respondError(event.data, error);
24
+ }
25
+ })();
26
+ }
27
+ }
28
+ };
29
+ handlers = /* @__PURE__ */ new Map();
30
+ listeners = /* @__PURE__ */ new Map();
31
+ constructor(params) {
32
+ this.params = params;
33
+ }
34
+ connect() {
35
+ window.addEventListener("message", this.handler);
36
+ }
37
+ createChannelId() {
38
+ return `contello-channel-${++channelIdIterator}-${Math.random().toString(36).slice(2)}`;
39
+ }
40
+ createRequestId() {
41
+ return `${this.isParent ? "parent" : "child"}-request-${++requestIdIterator}-${Math.random().toString(36).slice(2)}`;
42
+ }
43
+ populateChannelId() {
44
+ if (!this.channelId) this.channelId = this.createChannelId();
45
+ return this.channelId;
46
+ }
47
+ connectParent(targetOrigin, channelId) {
48
+ this.channelId = channelId;
49
+ this.targetOrigin = targetOrigin;
50
+ this.targetWindow = window.parent;
51
+ this.isParent = false;
52
+ this.connect();
53
+ }
54
+ connectChild(targetWindow) {
55
+ this.populateChannelId();
56
+ this.targetWindow = targetWindow;
57
+ this.targetOrigin = "*";
58
+ this.isParent = true;
59
+ this.connect();
60
+ }
61
+ getChannelId() {
62
+ return this.channelId;
63
+ }
64
+ getIsDebug() {
65
+ return this.params.debug;
66
+ }
67
+ getTargetOrigin() {
68
+ return this.targetOrigin;
69
+ }
70
+ getTargetWindow() {
71
+ return this.targetWindow;
72
+ }
73
+ disconnect() {
74
+ window.removeEventListener("message", this.handler);
75
+ }
76
+ respond(request, payload) {
77
+ this.send({
78
+ channelId: request.channelId,
79
+ requestId: request.requestId,
80
+ method: request.method,
81
+ payload
82
+ });
83
+ }
84
+ respondError(request, error) {
85
+ this.send({
86
+ channelId: request.channelId,
87
+ requestId: request.requestId,
88
+ method: request.method,
89
+ error
90
+ });
91
+ }
92
+ on(method, handler) {
93
+ this.listeners.set(method, handler);
94
+ }
95
+ call(method, message) {
96
+ return new Promise((resolve, reject) => {
97
+ const requestId = this.createRequestId();
98
+ this.send({
99
+ channelId: this.channelId,
100
+ requestId,
101
+ method,
102
+ payload: message
103
+ });
104
+ this.handlers.set(requestId, (data) => {
105
+ this.handlers.delete(requestId);
106
+ if (data.error) return reject(data.error);
107
+ resolve(data.payload);
108
+ });
109
+ });
110
+ }
111
+ send(data) {
112
+ this.targetWindow?.postMessage(data, this.targetOrigin);
113
+ }
131
114
  };
132
-
133
- // src/dialog-ref.ts
115
+ //#endregion
116
+ //#region src/dialog-ref.ts
134
117
  var ContelloDialogRef = class {
135
- _id;
136
- open;
137
- connected;
138
- ready;
139
- complete;
140
- close;
141
- constructor({ channel, options, controller }) {
142
- this.open = channel.call("openDialog", options).then(({ id }) => this._id = id);
143
- this.connected = controller.connected.promise;
144
- this.ready = controller.ready.promise;
145
- this.complete = controller.complete.promise;
146
- this.close = controller.close;
147
- }
148
- get id() {
149
- return this._id;
150
- }
118
+ _id;
119
+ open;
120
+ connected;
121
+ ready;
122
+ complete;
123
+ close;
124
+ constructor({ channel, options, controller }) {
125
+ this.open = (async () => {
126
+ const { id } = await channel.call("openDialog", options);
127
+ this._id = id;
128
+ })();
129
+ this.connected = controller.connected.promise;
130
+ this.ready = controller.ready.promise;
131
+ this.complete = controller.complete.promise;
132
+ this.close = controller.close;
133
+ }
134
+ get id() {
135
+ return this._id;
136
+ }
151
137
  };
152
-
153
- // src/utils.ts
138
+ //#endregion
139
+ //#region src/utils.ts
154
140
  var Deferred = class {
155
- resolve;
156
- reject;
157
- promise = new Promise((resolve, reject) => {
158
- this.resolve = resolve;
159
- this.reject = reject;
160
- });
141
+ resolve;
142
+ reject;
143
+ promise = new Promise((resolve, reject) => {
144
+ this.resolve = resolve;
145
+ this.reject = reject;
146
+ });
161
147
  };
162
-
163
- // src/client.ts
148
+ //#endregion
149
+ //#region src/client.ts
164
150
  var ContelloClient = class {
165
- channel;
166
- projectId;
167
- resizeObserver;
168
- targetOrigin;
169
- data;
170
- dialogs = /* @__PURE__ */ new Map();
171
- constructor(targetOrigin, channelId, projectId, debug) {
172
- this.channel = new ExtensionChannel({ debug });
173
- this.channel.connectParent(targetOrigin, channelId);
174
- this.projectId = projectId;
175
- this.targetOrigin = targetOrigin;
176
- }
177
- connect() {
178
- return this.channel.call("connect").then(({ data }) => {
179
- this.channel.on("dialogConnect", ({ id }) => this.getDialogController(id)?.connected.resolve());
180
- this.channel.on("dialogReady", ({ id }) => this.getDialogController(id)?.ready.resolve());
181
- this.channel.on("dialogComplete", ({ id, value }) => this.getDialogController(id)?.complete.resolve(value));
182
- this.data = data;
183
- });
184
- }
185
- ready() {
186
- this.listenForResize();
187
- return this.channel.call("ready", { height: this.getWindowHeight() });
188
- }
189
- getAuthToken() {
190
- return this.channel.call("getAuthToken").then(({ token }) => token);
191
- }
192
- createProjectUrl() {
193
- return `${this.targetOrigin}/ui/projects/${this.projectId}`;
194
- }
195
- createEntityEntryUrl(referenceName) {
196
- return `${this.createProjectUrl()}/entities/${referenceName}`;
197
- }
198
- createSingletonEntityUrl(referenceName) {
199
- return this.createEntityEntryUrl(referenceName);
200
- }
201
- createEntityDetailUrl(referenceName, params) {
202
- const base = this.createEntityEntryUrl(referenceName);
203
- if (params.mode === "create") {
204
- return `${base}/create`;
205
- }
206
- return `${base}/${params.mode}/${params.id}`;
207
- }
208
- /**
209
- * @deprecated Use createEntityDetailUrl instead
210
- */
211
- createEntityUrl(referenceName, entityId) {
212
- return this.createEntityDetailUrl(referenceName, { mode: "edit", id: entityId });
213
- }
214
- createExtensionUrl(referenceName, params) {
215
- const path = params?.path?.join("/") || "";
216
- const query = new URLSearchParams(params?.query || {}).toString();
217
- return `${this.createProjectUrl()}/extensions/${referenceName}${path ? `/${path}` : ""}${query ? `?${query}` : ""}`;
218
- }
219
- navigate(url) {
220
- return this.channel.call("navigate", { url });
221
- }
222
- displayNotification(type, message) {
223
- return this.channel.call("displayNotification", { type, message });
224
- }
225
- openDialog(options) {
226
- const controller = {
227
- connected: new Deferred(),
228
- ready: new Deferred(),
229
- complete: new Deferred(),
230
- close: () => {
231
- if (!this.channel) {
232
- throw new Error("The channel is not yet initialized");
233
- }
234
- this.channel.call("closeDialog", { id: dialog.id });
235
- this.dialogs.delete(dialog);
236
- }
237
- };
238
- const dialog = new ContelloDialogRef({ channel: this.channel, options, controller });
239
- this.dialogs.set(dialog, controller);
240
- dialog.complete.then(() => this.dialogs.delete(dialog));
241
- return dialog;
242
- }
243
- listenForResize() {
244
- this.resizeObserver = new ResizeObserver(() => {
245
- this.channel.call("resize", { height: this.getWindowHeight() });
246
- });
247
- this.resizeObserver.observe(document.documentElement);
248
- }
249
- getWindowHeight() {
250
- return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.body.clientHeight);
251
- }
252
- getDialogController(id) {
253
- const key = Array.from(this.dialogs.keys()).find((dialog) => dialog.id === id);
254
- if (!key) {
255
- return;
256
- }
257
- return this.dialogs.get(key);
258
- }
151
+ resizeObserver;
152
+ targetOrigin;
153
+ dialogs = /* @__PURE__ */ new Map();
154
+ channel;
155
+ projectId;
156
+ data;
157
+ constructor(targetOrigin, channelId, projectId, debug) {
158
+ this.channel = new ExtensionChannel({ debug });
159
+ this.channel.connectParent(targetOrigin, channelId);
160
+ this.projectId = projectId;
161
+ this.targetOrigin = targetOrigin;
162
+ }
163
+ createEntityEntryUrl(referenceName) {
164
+ return `${this.createProjectUrl()}/entities/${referenceName}`;
165
+ }
166
+ listenForResize() {
167
+ this.resizeObserver = new ResizeObserver(() => {
168
+ this.channel.call("resize", { height: this.getWindowHeight() });
169
+ });
170
+ this.resizeObserver.observe(document.documentElement);
171
+ }
172
+ getWindowHeight() {
173
+ return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.body.clientHeight);
174
+ }
175
+ getDialogController(id) {
176
+ const key = this.dialogs.keys().find((dialog) => dialog.id === id);
177
+ if (!key) return;
178
+ return this.dialogs.get(key);
179
+ }
180
+ async connect() {
181
+ const { data } = await this.channel.call("connect");
182
+ this.channel.on("dialogConnect", ({ id }) => this.getDialogController(id)?.connected.resolve());
183
+ this.channel.on("dialogReady", ({ id }) => this.getDialogController(id)?.ready.resolve());
184
+ this.channel.on("dialogComplete", ({ id, value }) => this.getDialogController(id)?.complete.resolve(value));
185
+ this.data = data;
186
+ }
187
+ ready() {
188
+ this.listenForResize();
189
+ return this.channel.call("ready", { height: this.getWindowHeight() });
190
+ }
191
+ async getAuthToken() {
192
+ const { token } = await this.channel.call("getAuthToken");
193
+ return token;
194
+ }
195
+ createProjectUrl() {
196
+ return `${this.targetOrigin}/ui/projects/${this.projectId}`;
197
+ }
198
+ createSingletonEntityUrl(referenceName) {
199
+ return this.createEntityEntryUrl(referenceName);
200
+ }
201
+ createEntityDetailUrl(referenceName, params) {
202
+ const base = this.createEntityEntryUrl(referenceName);
203
+ if (params.mode === "create") return `${base}/create`;
204
+ return `${base}/${params.mode}/${params.id}`;
205
+ }
206
+ /**
207
+ * @deprecated Use createEntityDetailUrl instead
208
+ */
209
+ createEntityUrl(referenceName, entityId) {
210
+ return this.createEntityDetailUrl(referenceName, {
211
+ mode: "edit",
212
+ id: entityId
213
+ });
214
+ }
215
+ createExtensionUrl(referenceName, params) {
216
+ const path = params?.path?.join("/") || "";
217
+ const query = new URLSearchParams(params?.query || {}).toString();
218
+ return `${this.createProjectUrl()}/extensions/${referenceName}${path ? `/${path}` : ""}${query ? `?${query}` : ""}`;
219
+ }
220
+ navigate(url) {
221
+ return this.channel.call("navigate", { url });
222
+ }
223
+ displayNotification(type, message) {
224
+ return this.channel.call("displayNotification", {
225
+ type,
226
+ message
227
+ });
228
+ }
229
+ openDialog(options) {
230
+ const controller = {
231
+ connected: new Deferred(),
232
+ ready: new Deferred(),
233
+ complete: new Deferred(),
234
+ close: () => {
235
+ if (!this.channel) throw new Error("The channel is not yet initialized");
236
+ this.channel.call("closeDialog", { id: dialog.id });
237
+ this.dialogs.delete(dialog);
238
+ }
239
+ };
240
+ const dialog = new ContelloDialogRef({
241
+ channel: this.channel,
242
+ options,
243
+ controller
244
+ });
245
+ this.dialogs.set(dialog, controller);
246
+ (async () => {
247
+ await dialog.complete;
248
+ this.dialogs.delete(dialog);
249
+ })();
250
+ return dialog;
251
+ }
259
252
  };
260
-
261
- // src/url-parser.ts
253
+ //#endregion
254
+ //#region src/url-parser.ts
262
255
  function parseUrl(trustedOrigins) {
263
- const url = new URL(location.href);
264
- const channelId = url.searchParams.get("channelId");
265
- const targetOrigin = url.searchParams.get("origin");
266
- const applicationId = url.searchParams.get("applicationId");
267
- const debug = url.searchParams.get("debug") === "true";
268
- if (!channelId || !targetOrigin || !applicationId) {
269
- throw new Error("Missing required URL parameters");
270
- }
271
- if (!trustedOrigins?.length) {
272
- throw new Error("No trusted origins provided");
273
- }
274
- if (!trustedOrigins.includes(targetOrigin)) {
275
- throw new Error(`Origin ${targetOrigin} is not trusted`);
276
- }
277
- return { channelId, targetOrigin, applicationId, debug };
256
+ const url = new URL(globalThis.location.href);
257
+ const channelId = url.searchParams.get("channelId");
258
+ const targetOrigin = url.searchParams.get("origin");
259
+ const applicationId = url.searchParams.get("applicationId");
260
+ if (!channelId || !targetOrigin || !applicationId) throw new Error("Missing required URL parameters");
261
+ if (!trustedOrigins?.length) throw new Error("No trusted origins provided");
262
+ if (!trustedOrigins.includes(targetOrigin)) throw new Error(`Origin ${targetOrigin} is not trusted`);
263
+ return {
264
+ channelId,
265
+ targetOrigin,
266
+ applicationId,
267
+ debug: url.searchParams.get("debug") === "true"
268
+ };
278
269
  }
279
-
280
- // src/custom-property.ts
281
- var ContelloCustomProperty = class _ContelloCustomProperty extends ContelloClient {
282
- static connect(options) {
283
- const { targetOrigin, channelId, applicationId, debug } = parseUrl(options.trustedOrigins);
284
- const customProperty = new _ContelloCustomProperty(targetOrigin, channelId, applicationId, debug);
285
- customProperty.validate = options.validator || (() => true);
286
- customProperty.newValue = options.newValue || (() => null);
287
- return customProperty.connect().then(() => customProperty);
288
- }
289
- validate = () => true;
290
- newValue = () => null;
291
- constructor(targetOrigin, channelId, applicationId, debug) {
292
- super(targetOrigin, channelId, applicationId, debug);
293
- this.channel.on("validate", async () => {
294
- const valid = await Promise.resolve(this.validate());
295
- return { valid };
296
- });
297
- this.channel.on("newValue", async (msg) => {
298
- await Promise.resolve(this.newValue(msg.value));
299
- });
300
- }
301
- async getValue() {
302
- const r = await this.channel.call("getValue");
303
- return r.value;
304
- }
305
- async setValue(value) {
306
- const valid = await Promise.resolve(this.validate());
307
- return await this.channel.call("setValue", { value, valid });
308
- }
309
- async getValueByPath(path) {
310
- const r = await this.channel.call("getValueByPath", { path });
311
- return r.value;
312
- }
313
- async setValueByPath(path, value) {
314
- return this.channel.call("setValueByPath", { value, path });
315
- }
270
+ //#endregion
271
+ //#region src/custom-property.ts
272
+ var ContelloCustomProperty = class ContelloCustomProperty extends ContelloClient {
273
+ static async connect(options) {
274
+ const { targetOrigin, channelId, applicationId, debug } = parseUrl(options.trustedOrigins);
275
+ const customProperty = new ContelloCustomProperty(targetOrigin, channelId, applicationId, debug);
276
+ customProperty.validate = options.validator || (() => true);
277
+ customProperty.newValue = options.newValue || (() => null);
278
+ await customProperty.connect();
279
+ return customProperty;
280
+ }
281
+ validate = () => true;
282
+ newValue = () => null;
283
+ constructor(targetOrigin, channelId, applicationId, debug) {
284
+ super(targetOrigin, channelId, applicationId, debug);
285
+ this.channel.on("validate", async () => {
286
+ return { valid: await Promise.resolve(this.validate()) };
287
+ });
288
+ this.channel.on("newValue", async (msg) => {
289
+ await Promise.resolve(this.newValue(msg.value));
290
+ });
291
+ }
292
+ async getValue() {
293
+ return (await this.channel.call("getValue")).value;
294
+ }
295
+ async setValue(value) {
296
+ const valid = await Promise.resolve(this.validate());
297
+ return await this.channel.call("setValue", {
298
+ value,
299
+ valid
300
+ });
301
+ }
302
+ async getValueByPath(path) {
303
+ return (await this.channel.call("getValueByPath", { path })).value;
304
+ }
305
+ async setValueByPath(path, value) {
306
+ return this.channel.call("setValueByPath", {
307
+ value,
308
+ path
309
+ });
310
+ }
316
311
  };
317
-
318
- // src/dialog.ts
319
- var ContelloDialog = class _ContelloDialog extends ContelloClient {
320
- static connect({ trustedOrigins }) {
321
- const { targetOrigin, channelId, applicationId, debug } = parseUrl(trustedOrigins);
322
- const dialog = new _ContelloDialog(targetOrigin, channelId, applicationId, debug);
323
- return dialog.connect().then(() => dialog);
324
- }
325
- constructor(targetOrigin, channelId, applicationId, debug) {
326
- super(targetOrigin, channelId, applicationId, debug);
327
- }
328
- close(value) {
329
- return this.channel.call("complete", { value });
330
- }
312
+ //#endregion
313
+ //#region src/dialog.ts
314
+ var ContelloDialog = class ContelloDialog extends ContelloClient {
315
+ static async connect({ trustedOrigins }) {
316
+ const { targetOrigin, channelId, applicationId, debug } = parseUrl(trustedOrigins);
317
+ const dialog = new ContelloDialog(targetOrigin, channelId, applicationId, debug);
318
+ await dialog.connect();
319
+ return dialog;
320
+ }
321
+ constructor(targetOrigin, channelId, applicationId, debug) {
322
+ super(targetOrigin, channelId, applicationId, debug);
323
+ }
324
+ close(value) {
325
+ return this.channel.call("complete", { value });
326
+ }
331
327
  };
332
-
333
- // src/extension.ts
334
- var ContelloExtension = class _ContelloExtension extends ContelloClient {
335
- static connect({ trustedOrigins }) {
336
- const { targetOrigin, channelId, applicationId, debug } = parseUrl(trustedOrigins);
337
- const extension = new _ContelloExtension(targetOrigin, channelId, applicationId, debug);
338
- return extension.connect().then(() => extension);
339
- }
340
- constructor(targetOrigin, channelId, applicationId, debug) {
341
- super(targetOrigin, channelId, applicationId, debug);
342
- }
343
- getUrlData() {
344
- return this.channel.call("getUrlData");
345
- }
346
- setBreadcrumbs(breadcrumbs) {
347
- return this.channel.call("setBreadcrumbs", { breadcrumbs });
348
- }
328
+ //#endregion
329
+ //#region src/extension.ts
330
+ var ContelloExtension = class ContelloExtension extends ContelloClient {
331
+ static async connect({ trustedOrigins }) {
332
+ const { targetOrigin, channelId, applicationId, debug } = parseUrl(trustedOrigins);
333
+ const extension = new ContelloExtension(targetOrigin, channelId, applicationId, debug);
334
+ await extension.connect();
335
+ return extension;
336
+ }
337
+ constructor(targetOrigin, channelId, applicationId, debug) {
338
+ super(targetOrigin, channelId, applicationId, debug);
339
+ }
340
+ getUrlData() {
341
+ return this.channel.call("getUrlData");
342
+ }
343
+ setBreadcrumbs(breadcrumbs) {
344
+ return this.channel.call("setBreadcrumbs", { breadcrumbs });
345
+ }
349
346
  };
350
- // Annotate the CommonJS export names for ESM import in node:
351
- 0 && (module.exports = {
352
- ContelloCustomProperty,
353
- ContelloDialog,
354
- ContelloDialogRef,
355
- ContelloExtension,
356
- ExtensionChannel
357
- });
347
+ //#endregion
348
+ exports.ContelloCustomProperty = ContelloCustomProperty;
349
+ exports.ContelloDialog = ContelloDialog;
350
+ exports.ContelloDialogRef = ContelloDialogRef;
351
+ exports.ContelloExtension = ContelloExtension;
352
+ exports.ExtensionChannel = ExtensionChannel;