@corti/embedded-web 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -12
- package/dist/CortiEmbedded.d.ts +36 -4
- package/dist/CortiEmbedded.js +115 -4
- package/dist/CortiEmbedded.js.map +1 -1
- package/dist/bundle.js +115 -5
- package/dist/corti-embedded.d.ts +1 -1
- package/dist/corti-embedded.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/public-types.d.ts +192 -0
- package/dist/public-types.js +2 -0
- package/dist/public-types.js.map +1 -0
- package/dist/react/CortiEmbeddedReact.d.ts +5 -2
- package/dist/react/CortiEmbeddedReact.js +4 -1
- package/dist/react/CortiEmbeddedReact.js.map +1 -1
- package/dist/types/api.d.ts +40 -8
- package/dist/types/api.js.map +1 -1
- package/dist/types/config.d.ts +20 -2
- package/dist/types/config.js.map +1 -1
- package/dist/types/generated/interview-details.d.ts +41 -0
- package/dist/types/generated/interview-details.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/payloads.d.ts +101 -0
- package/dist/types/payloads.js.map +1 -1
- package/dist/types/protocol.d.ts +12 -3
- package/dist/types/protocol.js.map +1 -1
- package/dist/types/responses.d.ts +23 -3
- package/dist/types/responses.js.map +1 -1
- package/dist/web-bundle.js +112 -5
- package/dist/web-index.d.ts +1 -1
- package/dist/web-index.js +2 -2
- package/dist/web-index.js.map +1 -1
- package/package.json +3 -1
package/dist/web-bundle.js
CHANGED
|
@@ -1026,12 +1026,40 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
1026
1026
|
return c4 > 3 && r5 && Object.defineProperty(target, key, r5), r5;
|
|
1027
1027
|
};
|
|
1028
1028
|
var IFRAME_SANDBOX_POLICY = "allow-forms allow-modals allow-scripts allow-same-origin";
|
|
1029
|
-
var
|
|
1029
|
+
var DEPRECATION_TIMELINE_URL = "https://docs.corti.ai/assistant/deprecation-timeline";
|
|
1030
|
+
var CONFIGURATION_MIGRATION_URL = "https://docs.corti.ai/assistant/configuration-migration";
|
|
1031
|
+
var DEPRECATED_EVENT_SUBSCRIPTIONS = /* @__PURE__ */ new Set([
|
|
1032
|
+
"ready",
|
|
1033
|
+
"loaded",
|
|
1034
|
+
"recordingStarted",
|
|
1035
|
+
"recordingStopped",
|
|
1036
|
+
"documentGenerated",
|
|
1037
|
+
"documentUpdated",
|
|
1038
|
+
"documentSynced",
|
|
1039
|
+
"authChanged",
|
|
1040
|
+
"interactionCreated",
|
|
1041
|
+
"navigationChanged",
|
|
1042
|
+
"usage",
|
|
1043
|
+
"embedded-event"
|
|
1044
|
+
]);
|
|
1045
|
+
var CortiEmbedded = class _CortiEmbedded extends i4 {
|
|
1030
1046
|
constructor() {
|
|
1031
1047
|
super(...arguments);
|
|
1032
1048
|
this.visibility = "hidden";
|
|
1033
1049
|
this.postMessageHandler = null;
|
|
1034
1050
|
this.normalizedBaseURL = null;
|
|
1051
|
+
this.warnedDeprecatedEventSubscriptions = /* @__PURE__ */ new Set();
|
|
1052
|
+
}
|
|
1053
|
+
addEventListener(type, callback, options) {
|
|
1054
|
+
this.warnDeprecatedEventSubscription(type);
|
|
1055
|
+
super.addEventListener(type, callback, options);
|
|
1056
|
+
}
|
|
1057
|
+
warnDeprecatedEventSubscription(eventName) {
|
|
1058
|
+
if (!DEPRECATED_EVENT_SUBSCRIPTIONS.has(eventName) || this.warnedDeprecatedEventSubscriptions.has(eventName)) {
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
this.warnedDeprecatedEventSubscriptions.add(eventName);
|
|
1062
|
+
console.warn(`[Corti Embedded] The '${eventName}' event subscription is deprecated and will be removed in a future release. Subscribe to the canonical 'event' stream instead. See ${DEPRECATION_TIMELINE_URL}.`);
|
|
1035
1063
|
}
|
|
1036
1064
|
// eslint-disable-next-line class-methods-use-this
|
|
1037
1065
|
getIframeAllowPolicy(normalizedBaseURL) {
|
|
@@ -1107,6 +1135,9 @@ var CortiEmbedded = class extends i4 {
|
|
|
1107
1135
|
dispatchErrorEvent(error) {
|
|
1108
1136
|
this.dispatchPublicEvent("error", error);
|
|
1109
1137
|
}
|
|
1138
|
+
static warnDeprecatedAPI(methodName, replacement) {
|
|
1139
|
+
console.warn(`[Corti Embedded] ${methodName} is deprecated and will be removed in a future release. Use ${replacement} instead. See ${CONFIGURATION_MIGRATION_URL} and ${DEPRECATION_TIMELINE_URL}.`);
|
|
1140
|
+
}
|
|
1110
1141
|
isRealIframeLoad(iframe) {
|
|
1111
1142
|
const src = iframe.getAttribute("src") || "";
|
|
1112
1143
|
if (!this.normalizedBaseURL)
|
|
@@ -1240,6 +1271,7 @@ var CortiEmbedded = class extends i4 {
|
|
|
1240
1271
|
throw new Error("Component not ready");
|
|
1241
1272
|
}
|
|
1242
1273
|
try {
|
|
1274
|
+
_CortiEmbedded.warnDeprecatedAPI("configureSession()", "setInteractionOptions()");
|
|
1243
1275
|
const payload = {
|
|
1244
1276
|
defaultLanguage: config.defaultLanguage,
|
|
1245
1277
|
defaultOutputLanguage: config.defaultOutputLanguage,
|
|
@@ -1281,20 +1313,20 @@ var CortiEmbedded = class extends i4 {
|
|
|
1281
1313
|
}
|
|
1282
1314
|
/**
|
|
1283
1315
|
* Navigate to a specific path within the embedded UI
|
|
1284
|
-
* @param
|
|
1316
|
+
* @param payload Navigation request payload or legacy path string
|
|
1285
1317
|
* @returns Promise that resolves when navigation is complete
|
|
1286
1318
|
*/
|
|
1287
|
-
async navigate(
|
|
1319
|
+
async navigate(payload) {
|
|
1288
1320
|
if (!this.postMessageHandler) {
|
|
1289
1321
|
throw new Error("Component not ready");
|
|
1290
1322
|
}
|
|
1291
1323
|
try {
|
|
1292
|
-
const
|
|
1324
|
+
const normalizedPayload = typeof payload === "string" ? { path: payload } : payload;
|
|
1293
1325
|
await this.postMessageHandler.postMessage({
|
|
1294
1326
|
type: "CORTI_EMBEDDED",
|
|
1295
1327
|
version: "v1",
|
|
1296
1328
|
action: "navigate",
|
|
1297
|
-
payload
|
|
1329
|
+
payload: normalizedPayload
|
|
1298
1330
|
});
|
|
1299
1331
|
} catch (error) {
|
|
1300
1332
|
const formattedError = formatError(error, "Failed to navigate");
|
|
@@ -1372,6 +1404,31 @@ var CortiEmbedded = class extends i4 {
|
|
|
1372
1404
|
throw new Error(JSON.stringify(formattedError));
|
|
1373
1405
|
}
|
|
1374
1406
|
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Configure the component
|
|
1409
|
+
* @param config Component configuration
|
|
1410
|
+
* @returns Promise that resolves when configuration is applied
|
|
1411
|
+
*/
|
|
1412
|
+
async configureApp(config) {
|
|
1413
|
+
if (!this.postMessageHandler) {
|
|
1414
|
+
throw new Error("Component not ready");
|
|
1415
|
+
}
|
|
1416
|
+
try {
|
|
1417
|
+
const response = await this.postMessageHandler.postMessage({
|
|
1418
|
+
type: "CORTI_EMBEDDED",
|
|
1419
|
+
version: "v1",
|
|
1420
|
+
action: "configureApp",
|
|
1421
|
+
payload: config
|
|
1422
|
+
});
|
|
1423
|
+
if (response.success && response.payload) {
|
|
1424
|
+
return response.payload;
|
|
1425
|
+
}
|
|
1426
|
+
throw new Error(response.error);
|
|
1427
|
+
} catch (error) {
|
|
1428
|
+
const formattedError = formatError(error, "Failed to configure app");
|
|
1429
|
+
throw new Error(JSON.stringify(formattedError));
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1375
1432
|
/**
|
|
1376
1433
|
* Configure the component
|
|
1377
1434
|
* @param config Component configuration
|
|
@@ -1382,6 +1439,7 @@ var CortiEmbedded = class extends i4 {
|
|
|
1382
1439
|
throw new Error("Component not ready");
|
|
1383
1440
|
}
|
|
1384
1441
|
try {
|
|
1442
|
+
_CortiEmbedded.warnDeprecatedAPI("configure()", "configureApp()");
|
|
1385
1443
|
const response = await this.postMessageHandler.postMessage({
|
|
1386
1444
|
type: "CORTI_EMBEDDED",
|
|
1387
1445
|
version: "v1",
|
|
@@ -1397,6 +1455,30 @@ var CortiEmbedded = class extends i4 {
|
|
|
1397
1455
|
throw new Error(JSON.stringify(formattedError));
|
|
1398
1456
|
}
|
|
1399
1457
|
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Set one-shot interaction options for the embedded instance.
|
|
1460
|
+
* @param config Interaction/session-level options
|
|
1461
|
+
* @returns Promise that resolves when options are applied
|
|
1462
|
+
*/
|
|
1463
|
+
async setInteractionOptions(config) {
|
|
1464
|
+
if (!this.postMessageHandler) {
|
|
1465
|
+
throw new Error("Component not ready");
|
|
1466
|
+
}
|
|
1467
|
+
try {
|
|
1468
|
+
const response = await this.postMessageHandler.postMessage({
|
|
1469
|
+
type: "CORTI_EMBEDDED",
|
|
1470
|
+
version: "v1",
|
|
1471
|
+
action: "setInteractionOptions",
|
|
1472
|
+
payload: config
|
|
1473
|
+
});
|
|
1474
|
+
if (response.success === false || response.error) {
|
|
1475
|
+
throw new Error(response.error);
|
|
1476
|
+
}
|
|
1477
|
+
} catch (error) {
|
|
1478
|
+
const formattedError = formatError(error, "Failed to set interaction options");
|
|
1479
|
+
throw new Error(JSON.stringify(formattedError));
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1400
1482
|
/**
|
|
1401
1483
|
* Set authentication credentials without triggering auth flow
|
|
1402
1484
|
* @param credentials Authentication credentials to store
|
|
@@ -1455,6 +1537,31 @@ var CortiEmbedded = class extends i4 {
|
|
|
1455
1537
|
throw new Error(JSON.stringify(formattedError));
|
|
1456
1538
|
}
|
|
1457
1539
|
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Show the device-link QR code in the embedded UI
|
|
1542
|
+
* @param payload Device-link token response to render as a QR code
|
|
1543
|
+
* @returns Promise resolving to the rendered QR code state
|
|
1544
|
+
*/
|
|
1545
|
+
async showDeviceLinkQR(payload) {
|
|
1546
|
+
if (!this.postMessageHandler) {
|
|
1547
|
+
throw new Error("Component not ready");
|
|
1548
|
+
}
|
|
1549
|
+
try {
|
|
1550
|
+
const response = await this.postMessageHandler.postMessage({
|
|
1551
|
+
type: "CORTI_EMBEDDED",
|
|
1552
|
+
version: "v1",
|
|
1553
|
+
action: "showDeviceLinkQR",
|
|
1554
|
+
payload
|
|
1555
|
+
});
|
|
1556
|
+
if (response.success && response.payload) {
|
|
1557
|
+
return response.payload;
|
|
1558
|
+
}
|
|
1559
|
+
throw new Error(response.error);
|
|
1560
|
+
} catch (error) {
|
|
1561
|
+
const formattedError = formatError(error, "Failed to show device link QR");
|
|
1562
|
+
throw new Error(JSON.stringify(formattedError));
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1458
1565
|
/**
|
|
1459
1566
|
* Check the current status of the iframe and PostMessageHandler
|
|
1460
1567
|
* Useful for debugging
|
package/dist/web-index.d.ts
CHANGED
package/dist/web-index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./corti-embedded.js";
|
|
2
2
|
export { CortiEmbedded } from "./CortiEmbedded.js";
|
|
3
|
-
// Export
|
|
4
|
-
export * from "./types
|
|
3
|
+
// Export hand-owned public types only. The src/types folder is generated.
|
|
4
|
+
export * from "./public-types.js";
|
|
5
5
|
//# sourceMappingURL=web-index.js.map
|
package/dist/web-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-index.js","sourceRoot":"","sources":["../src/web-index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,
|
|
1
|
+
{"version":3,"file":"web-index.js","sourceRoot":"","sources":["../src/web-index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,0EAA0E;AAC1E,cAAc,mBAAmB,CAAC","sourcesContent":["import \"./corti-embedded.js\";\n\nexport { CortiEmbedded } from \"./CortiEmbedded.js\";\n\n// Export hand-owned public types only. The src/types folder is generated.\nexport * from \"./public-types.js\";\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@corti/embedded-web",
|
|
3
3
|
"description": "Web component for Corti Embedded",
|
|
4
4
|
"author": "Corti ApS",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "1.0.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
8
8
|
"url": "https://help.corti.app",
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": [
|
|
38
|
+
"src/corti-embedded.ts",
|
|
39
|
+
"src/corti-embedded.js",
|
|
38
40
|
"dist/corti-embedded.js",
|
|
39
41
|
"dist/web-bundle.js",
|
|
40
42
|
"dist/bundle.js"
|