@dajiaoai/algeo-sdk 2.9.1 → 2.9.2
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 +7 -7
- package/dist/algeo-sdk.cjs.js +7 -12
- package/dist/algeo-sdk.esm.js +7 -12
- package/dist/algeo-sdk.umd.js +7 -12
- package/dist/shared.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ import { createPresentation } from '@dajiaoai/algeo-sdk';
|
|
|
34
34
|
|
|
35
35
|
const container = document.getElementById('algeo-container');
|
|
36
36
|
const presentation = await createPresentation(container, {
|
|
37
|
-
appId: 'YTVJDQZR',
|
|
37
|
+
auth: { appId: 'YTVJDQZR' },
|
|
38
38
|
shareId: '33TA3484',
|
|
39
39
|
ui: {
|
|
40
40
|
logo: false,
|
|
@@ -65,7 +65,7 @@ presentation.mode
|
|
|
65
65
|
```html
|
|
66
66
|
<iframe
|
|
67
67
|
id="algeo-embed"
|
|
68
|
-
src="https://dajiaoai.com/
|
|
68
|
+
src="https://dajiaoai.com/embed/present/YOUR_APP_ID/33TA3484"
|
|
69
69
|
allow="fullscreen"
|
|
70
70
|
referrerpolicy="origin"
|
|
71
71
|
></iframe>
|
|
@@ -234,7 +234,7 @@ create(container, {
|
|
|
234
234
|
|
|
235
235
|
演示模式快捷入口。该函数负责真正创建并初始化 `EmbeddedPresentation`。
|
|
236
236
|
|
|
237
|
-
创建成功后,SDK 会额外调用 `https://open.dajiaoai.com/console/api/whitelist/check`,使用 `options.appId` 与当前页面 `hostname` 做白名单校验。若未命中白名单,iframe 仍会完成初始化并呈现页面,`createPresentation` 仍会成功返回实例,但后续 `loadShareById`、`loadFile`、`switchSlide`、`getSlideCount`、`repl` 等演示模式 API 会被拒绝,并在控制台输出包含方法名的错误,便于接入方感知并处理。
|
|
237
|
+
创建成功后,SDK 会额外调用 `https://open.dajiaoai.com/console/api/whitelist/check`,使用 `options.auth.appId` 与当前页面 `hostname` 做白名单校验。若未命中白名单,iframe 仍会完成初始化并呈现页面,`createPresentation` 仍会成功返回实例,但后续 `loadShareById`、`loadFile`、`switchSlide`、`getSlideCount`、`repl` 等演示模式 API 会被拒绝,并在控制台输出包含方法名的错误,便于接入方感知并处理。
|
|
238
238
|
|
|
239
239
|
```javascript
|
|
240
240
|
create(container, {
|
|
@@ -294,13 +294,13 @@ type AlgeoCreateOptions =
|
|
|
294
294
|
|
|
295
295
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
296
296
|
| --------- | ------------------------------------ | ------ | -------------------------------------------------------- |
|
|
297
|
-
| `
|
|
298
|
-
| `shareId` | `string` | `''` | 演示模式初始分享 ID,会映射到 `/
|
|
297
|
+
| `auth` | `{ appId: string }` | - | 演示模式鉴权参数,`appId` 用于路由及白名单校验 |
|
|
298
|
+
| `shareId` | `string` | `''` | 演示模式初始分享 ID,会映射到 `/embed/present/:appId/:id` |
|
|
299
299
|
| `ui` | `Partial<AlgeoPresentationUiConfig>` | - | 演示模式 UI 配置 |
|
|
300
300
|
|
|
301
301
|
默认路径规则:
|
|
302
302
|
|
|
303
|
-
- `mode: 'presentation'` -> `/
|
|
303
|
+
- `mode: 'presentation'` -> `/embed/present/:appId`,若传 `presentation.shareId` 则生成 `/embed/present/:appId/:id`
|
|
304
304
|
- `mode: 'editor'` -> `/embed/edit/:appId`,其中 `:appId` 来自 `editor.auth.appId`;若传 `editor.shareId` 则生成 `/embed/edit/:appId/:id`
|
|
305
305
|
|
|
306
306
|
**示例:**
|
|
@@ -309,7 +309,7 @@ type AlgeoCreateOptions =
|
|
|
309
309
|
const presentation = await create(container, {
|
|
310
310
|
mode: 'presentation',
|
|
311
311
|
presentation: {
|
|
312
|
-
appId: 'xxxx',
|
|
312
|
+
auth: { appId: 'xxxx' },
|
|
313
313
|
shareId: '33TA3484',
|
|
314
314
|
},
|
|
315
315
|
});
|
package/dist/algeo-sdk.cjs.js
CHANGED
|
@@ -4011,9 +4011,9 @@ function convertToLatest(content) {
|
|
|
4011
4011
|
}
|
|
4012
4012
|
|
|
4013
4013
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
4014
|
-
const VERSION = '2.9.
|
|
4014
|
+
const VERSION = '2.9.2';
|
|
4015
4015
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
4016
|
-
const DEFAULT_PRESENTATION_PATH = '/
|
|
4016
|
+
const DEFAULT_PRESENTATION_PATH = '/embed/present';
|
|
4017
4017
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
4018
4018
|
const EMBED_TIMEOUT_MS = 30000;
|
|
4019
4019
|
let requestIdCounter = 0;
|
|
@@ -4090,18 +4090,12 @@ function buildEmbedSrc(options) {
|
|
|
4090
4090
|
const baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_EMBED_BASE);
|
|
4091
4091
|
const mode = normalizeMode(options.mode);
|
|
4092
4092
|
const path = getEmbedPath(mode);
|
|
4093
|
-
const
|
|
4093
|
+
const appId = options.auth?.appId?.trim() ?? '';
|
|
4094
4094
|
const initialId = options.initialId?.trim();
|
|
4095
|
-
if (mode === 'editor') {
|
|
4096
|
-
if (!initialId) {
|
|
4097
|
-
return `${baseUrl}${path}/${encodeURIComponent(authAppId)}`;
|
|
4098
|
-
}
|
|
4099
|
-
return `${baseUrl}${path}/${encodeURIComponent(authAppId)}/${encodeURIComponent(initialId)}`;
|
|
4100
|
-
}
|
|
4101
4095
|
if (!initialId) {
|
|
4102
|
-
return `${baseUrl}${path}`;
|
|
4096
|
+
return `${baseUrl}${path}/${encodeURIComponent(appId)}`;
|
|
4103
4097
|
}
|
|
4104
|
-
return `${baseUrl}${path}/${encodeURIComponent(initialId)}`;
|
|
4098
|
+
return `${baseUrl}${path}/${encodeURIComponent(appId)}/${encodeURIComponent(initialId)}`;
|
|
4105
4099
|
}
|
|
4106
4100
|
|
|
4107
4101
|
class EmbeddedTarget {
|
|
@@ -4382,6 +4376,7 @@ class EmbeddedPresentation extends EmbeddedTarget {
|
|
|
4382
4376
|
this.uiConfig = options.ui ? { ...options.ui } : {};
|
|
4383
4377
|
await this.init({
|
|
4384
4378
|
baseUrl,
|
|
4379
|
+
auth: options.auth,
|
|
4385
4380
|
initialId: options.shareId,
|
|
4386
4381
|
});
|
|
4387
4382
|
if (Object.keys(this.uiConfig).length > 0) {
|
|
@@ -4885,7 +4880,7 @@ class EmbeddedEditor extends EmbeddedTarget {
|
|
|
4885
4880
|
const WHITELIST_CHECK_BASE_URL = 'https://open.dajiaoai.com/console';
|
|
4886
4881
|
const WHITELIST_CHECK_PATH = '/api/whitelist/check';
|
|
4887
4882
|
async function checkPresentationWhitelist(options) {
|
|
4888
|
-
const appId = options.appId?.trim() ?? '';
|
|
4883
|
+
const appId = options.auth?.appId?.trim() ?? '';
|
|
4889
4884
|
const host = window.location.host.trim();
|
|
4890
4885
|
const url = new URL(`${normalizeBaseUrl(WHITELIST_CHECK_BASE_URL)}${WHITELIST_CHECK_PATH}`);
|
|
4891
4886
|
url.searchParams.set('appId', appId);
|
package/dist/algeo-sdk.esm.js
CHANGED
|
@@ -4009,9 +4009,9 @@ function convertToLatest(content) {
|
|
|
4009
4009
|
}
|
|
4010
4010
|
|
|
4011
4011
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
4012
|
-
const VERSION = '2.9.
|
|
4012
|
+
const VERSION = '2.9.2';
|
|
4013
4013
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
4014
|
-
const DEFAULT_PRESENTATION_PATH = '/
|
|
4014
|
+
const DEFAULT_PRESENTATION_PATH = '/embed/present';
|
|
4015
4015
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
4016
4016
|
const EMBED_TIMEOUT_MS = 30000;
|
|
4017
4017
|
let requestIdCounter = 0;
|
|
@@ -4088,18 +4088,12 @@ function buildEmbedSrc(options) {
|
|
|
4088
4088
|
const baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_EMBED_BASE);
|
|
4089
4089
|
const mode = normalizeMode(options.mode);
|
|
4090
4090
|
const path = getEmbedPath(mode);
|
|
4091
|
-
const
|
|
4091
|
+
const appId = options.auth?.appId?.trim() ?? '';
|
|
4092
4092
|
const initialId = options.initialId?.trim();
|
|
4093
|
-
if (mode === 'editor') {
|
|
4094
|
-
if (!initialId) {
|
|
4095
|
-
return `${baseUrl}${path}/${encodeURIComponent(authAppId)}`;
|
|
4096
|
-
}
|
|
4097
|
-
return `${baseUrl}${path}/${encodeURIComponent(authAppId)}/${encodeURIComponent(initialId)}`;
|
|
4098
|
-
}
|
|
4099
4093
|
if (!initialId) {
|
|
4100
|
-
return `${baseUrl}${path}`;
|
|
4094
|
+
return `${baseUrl}${path}/${encodeURIComponent(appId)}`;
|
|
4101
4095
|
}
|
|
4102
|
-
return `${baseUrl}${path}/${encodeURIComponent(initialId)}`;
|
|
4096
|
+
return `${baseUrl}${path}/${encodeURIComponent(appId)}/${encodeURIComponent(initialId)}`;
|
|
4103
4097
|
}
|
|
4104
4098
|
|
|
4105
4099
|
class EmbeddedTarget {
|
|
@@ -4380,6 +4374,7 @@ class EmbeddedPresentation extends EmbeddedTarget {
|
|
|
4380
4374
|
this.uiConfig = options.ui ? { ...options.ui } : {};
|
|
4381
4375
|
await this.init({
|
|
4382
4376
|
baseUrl,
|
|
4377
|
+
auth: options.auth,
|
|
4383
4378
|
initialId: options.shareId,
|
|
4384
4379
|
});
|
|
4385
4380
|
if (Object.keys(this.uiConfig).length > 0) {
|
|
@@ -4883,7 +4878,7 @@ class EmbeddedEditor extends EmbeddedTarget {
|
|
|
4883
4878
|
const WHITELIST_CHECK_BASE_URL = 'https://open.dajiaoai.com/console';
|
|
4884
4879
|
const WHITELIST_CHECK_PATH = '/api/whitelist/check';
|
|
4885
4880
|
async function checkPresentationWhitelist(options) {
|
|
4886
|
-
const appId = options.appId?.trim() ?? '';
|
|
4881
|
+
const appId = options.auth?.appId?.trim() ?? '';
|
|
4887
4882
|
const host = window.location.host.trim();
|
|
4888
4883
|
const url = new URL(`${normalizeBaseUrl(WHITELIST_CHECK_BASE_URL)}${WHITELIST_CHECK_PATH}`);
|
|
4889
4884
|
url.searchParams.set('appId', appId);
|
package/dist/algeo-sdk.umd.js
CHANGED
|
@@ -4015,9 +4015,9 @@
|
|
|
4015
4015
|
}
|
|
4016
4016
|
|
|
4017
4017
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
4018
|
-
const VERSION = '2.9.
|
|
4018
|
+
const VERSION = '2.9.2';
|
|
4019
4019
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
4020
|
-
const DEFAULT_PRESENTATION_PATH = '/
|
|
4020
|
+
const DEFAULT_PRESENTATION_PATH = '/embed/present';
|
|
4021
4021
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
4022
4022
|
const EMBED_TIMEOUT_MS = 30000;
|
|
4023
4023
|
let requestIdCounter = 0;
|
|
@@ -4094,18 +4094,12 @@
|
|
|
4094
4094
|
const baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_EMBED_BASE);
|
|
4095
4095
|
const mode = normalizeMode(options.mode);
|
|
4096
4096
|
const path = getEmbedPath(mode);
|
|
4097
|
-
const
|
|
4097
|
+
const appId = options.auth?.appId?.trim() ?? '';
|
|
4098
4098
|
const initialId = options.initialId?.trim();
|
|
4099
|
-
if (mode === 'editor') {
|
|
4100
|
-
if (!initialId) {
|
|
4101
|
-
return `${baseUrl}${path}/${encodeURIComponent(authAppId)}`;
|
|
4102
|
-
}
|
|
4103
|
-
return `${baseUrl}${path}/${encodeURIComponent(authAppId)}/${encodeURIComponent(initialId)}`;
|
|
4104
|
-
}
|
|
4105
4099
|
if (!initialId) {
|
|
4106
|
-
return `${baseUrl}${path}`;
|
|
4100
|
+
return `${baseUrl}${path}/${encodeURIComponent(appId)}`;
|
|
4107
4101
|
}
|
|
4108
|
-
return `${baseUrl}${path}/${encodeURIComponent(initialId)}`;
|
|
4102
|
+
return `${baseUrl}${path}/${encodeURIComponent(appId)}/${encodeURIComponent(initialId)}`;
|
|
4109
4103
|
}
|
|
4110
4104
|
|
|
4111
4105
|
class EmbeddedTarget {
|
|
@@ -4386,6 +4380,7 @@
|
|
|
4386
4380
|
this.uiConfig = options.ui ? { ...options.ui } : {};
|
|
4387
4381
|
await this.init({
|
|
4388
4382
|
baseUrl,
|
|
4383
|
+
auth: options.auth,
|
|
4389
4384
|
initialId: options.shareId,
|
|
4390
4385
|
});
|
|
4391
4386
|
if (Object.keys(this.uiConfig).length > 0) {
|
|
@@ -4889,7 +4884,7 @@
|
|
|
4889
4884
|
const WHITELIST_CHECK_BASE_URL = 'https://open.dajiaoai.com/console';
|
|
4890
4885
|
const WHITELIST_CHECK_PATH = '/api/whitelist/check';
|
|
4891
4886
|
async function checkPresentationWhitelist(options) {
|
|
4892
|
-
const appId = options.appId?.trim() ?? '';
|
|
4887
|
+
const appId = options.auth?.appId?.trim() ?? '';
|
|
4893
4888
|
const host = window.location.host.trim();
|
|
4894
4889
|
const url = new URL(`${normalizeBaseUrl(WHITELIST_CHECK_BASE_URL)}${WHITELIST_CHECK_PATH}`);
|
|
4895
4890
|
url.searchParams.set('appId', appId);
|
package/dist/shared.d.ts
CHANGED