@contello/extension 8.21.3 → 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/LICENSE +21 -0
- package/dist/index.cjs +339 -344
- package/dist/index.d.cts +222 -204
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +222 -204
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +336 -313
- package/dist/index.js.map +1 -0
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,357 +1,352 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/dialog-ref.ts
|
|
134
117
|
var ContelloDialogRef = class {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/utils.ts
|
|
154
140
|
var Deferred = class {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
141
|
+
resolve;
|
|
142
|
+
reject;
|
|
143
|
+
promise = new Promise((resolve, reject) => {
|
|
144
|
+
this.resolve = resolve;
|
|
145
|
+
this.reject = reject;
|
|
146
|
+
});
|
|
161
147
|
};
|
|
162
|
-
|
|
163
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/client.ts
|
|
164
150
|
var ContelloClient = class {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
-
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/url-parser.ts
|
|
262
255
|
function parseUrl(trustedOrigins) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
-
|
|
281
|
-
var ContelloCustomProperty = class
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
|
|
319
|
-
var ContelloDialog = class
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
-
|
|
334
|
-
var ContelloExtension = class
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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;
|