@thoughtspot/visual-embed-sdk 1.6.0-alpha.1 → 1.6.1
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 +8 -8
- package/dist/src/embed/app.d.ts +14 -3
- package/dist/src/embed/liveboard.d.ts +101 -0
- package/dist/src/embed/liveboard.spec.d.ts +1 -0
- package/dist/src/embed/pinboard.d.ts +6 -0
- package/dist/src/embed/search.d.ts +4 -0
- package/dist/src/embed/ts-embed.d.ts +2 -11
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/react/index.d.ts +4 -3
- package/dist/src/types.d.ts +24 -20
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +87 -72
- package/dist/tsembed.js +86 -70
- package/lib/package.json +5 -1
- package/lib/src/embed/app.d.ts +14 -3
- package/lib/src/embed/app.js +25 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +32 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +55 -2
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +101 -0
- package/lib/src/embed/liveboard.js +115 -0
- package/lib/src/embed/liveboard.js.map +1 -0
- package/lib/src/embed/liveboard.spec.d.ts +1 -0
- package/lib/src/embed/liveboard.spec.js +159 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -0
- package/lib/src/embed/pinboard.d.ts +6 -0
- package/lib/src/embed/pinboard.js +4 -1
- package/lib/src/embed/pinboard.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +1 -1
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +4 -0
- package/lib/src/embed/search.js +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +2 -11
- package/lib/src/embed/ts-embed.js +4 -23
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +63 -6
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +1 -1
- package/lib/src/errors.js +1 -1
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/index.d.ts +4 -3
- package/lib/src/react/index.js +3 -2
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +24 -20
- package/lib/src/types.js +21 -18
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +84 -58
- package/package.json +5 -1
- package/src/embed/app.spec.ts +41 -0
- package/src/embed/app.ts +28 -3
- package/src/embed/events.spec.ts +64 -5
- package/src/embed/liveboard.spec.ts +199 -0
- package/src/embed/{pinboard.ts → liveboard.ts} +60 -42
- package/src/embed/pinboard.spec.ts +11 -11
- package/src/embed/search.ts +5 -0
- package/src/embed/ts-embed.spec.ts +81 -8
- package/src/embed/ts-embed.ts +6 -25
- package/src/errors.ts +2 -2
- package/src/index.ts +7 -2
- package/src/react/index.tsx +14 -8
- package/src/types.ts +24 -20
package/dist/tsembed.js
CHANGED
|
@@ -220,12 +220,12 @@
|
|
|
220
220
|
*/
|
|
221
221
|
EmbedEvent["Load"] = "load";
|
|
222
222
|
/**
|
|
223
|
-
* Data pertaining to answer or
|
|
224
|
-
* @return data - The answer or
|
|
223
|
+
* Data pertaining to answer or Liveboard is received
|
|
224
|
+
* @return data - The answer or Liveboard data
|
|
225
225
|
*/
|
|
226
226
|
EmbedEvent["Data"] = "data";
|
|
227
227
|
/**
|
|
228
|
-
* Search/answer/
|
|
228
|
+
* Search/answer/Liveboard filters have been applied/updated
|
|
229
229
|
* @hidden
|
|
230
230
|
*/
|
|
231
231
|
EmbedEvent["FiltersChanged"] = "filtersChanged";
|
|
@@ -248,13 +248,13 @@
|
|
|
248
248
|
/**
|
|
249
249
|
* A custom action has been triggered
|
|
250
250
|
* @return actionId - The id of the custom action
|
|
251
|
-
* @return data - The answer or
|
|
251
|
+
* @return data - The answer or Liveboard data
|
|
252
252
|
*/
|
|
253
253
|
EmbedEvent["CustomAction"] = "customAction";
|
|
254
254
|
/**
|
|
255
255
|
* A double click has been triggered on table/chart
|
|
256
256
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
257
|
-
*
|
|
257
|
+
* @version 1.5.0 or later
|
|
258
258
|
*/
|
|
259
259
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
260
260
|
/**
|
|
@@ -272,8 +272,8 @@
|
|
|
272
272
|
*/
|
|
273
273
|
EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired";
|
|
274
274
|
/**
|
|
275
|
-
* The height of the embedded
|
|
276
|
-
* @return data - The height of the embedded
|
|
275
|
+
* The height of the embedded Liveboard or visualization has been computed.
|
|
276
|
+
* @return data - The height of the embedded Liveboard or visualization
|
|
277
277
|
* @hidden
|
|
278
278
|
*/
|
|
279
279
|
EmbedEvent["EmbedHeight"] = "EMBED_HEIGHT";
|
|
@@ -285,7 +285,6 @@
|
|
|
285
285
|
EmbedEvent["EmbedIframeCenter"] = "EmbedIframeCenter";
|
|
286
286
|
/**
|
|
287
287
|
* Detects the route change.
|
|
288
|
-
* @hidden
|
|
289
288
|
*/
|
|
290
289
|
EmbedEvent["RouteChange"] = "ROUTE_CHANGE";
|
|
291
290
|
/**
|
|
@@ -297,7 +296,7 @@
|
|
|
297
296
|
* Emitted when the embed does not have cookie access. This
|
|
298
297
|
* happens on Safari where third-party cookies are blocked by default.
|
|
299
298
|
*
|
|
300
|
-
* @version 1.1.0
|
|
299
|
+
* @version 1.1.0 or later
|
|
301
300
|
*/
|
|
302
301
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
303
302
|
/**
|
|
@@ -308,12 +307,12 @@
|
|
|
308
307
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
309
308
|
/**
|
|
310
309
|
* Emitted when any modal is opened in the app
|
|
311
|
-
*
|
|
310
|
+
* @version 1.6.0 or later
|
|
312
311
|
*/
|
|
313
312
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
314
313
|
/**
|
|
315
314
|
* Emitted when any modal is closed in the app
|
|
316
|
-
*
|
|
315
|
+
* @version 1.6.0 or later
|
|
317
316
|
*/
|
|
318
317
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
319
318
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
@@ -330,7 +329,7 @@
|
|
|
330
329
|
* eg. { selectedPoints: []}
|
|
331
330
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
332
331
|
* if not provided it will auto drill by the configured column. \
|
|
333
|
-
*
|
|
332
|
+
* @version 1.5.0 or later
|
|
334
333
|
*/
|
|
335
334
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
336
335
|
/**
|
|
@@ -344,10 +343,10 @@
|
|
|
344
343
|
*/
|
|
345
344
|
HostEvent["Reload"] = "reload";
|
|
346
345
|
/**
|
|
347
|
-
* Set the visible
|
|
348
|
-
* @param - an array of ids of
|
|
346
|
+
* Set the visible visualizations on a Liveboard.
|
|
347
|
+
* @param - an array of ids of visualizations to show, the ids not passed
|
|
349
348
|
* will be hidden.
|
|
350
|
-
*
|
|
349
|
+
* @version 1.6.0 or later
|
|
351
350
|
*/
|
|
352
351
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
353
352
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
@@ -374,10 +373,11 @@
|
|
|
374
373
|
(function (Param) {
|
|
375
374
|
Param["DataSources"] = "dataSources";
|
|
376
375
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
376
|
+
Param["ExpandAllDataSource"] = "expandAllDataSource";
|
|
377
377
|
Param["DisableActions"] = "disableAction";
|
|
378
378
|
Param["DisableActionReason"] = "disableHint";
|
|
379
379
|
Param["ForceTable"] = "forceTable";
|
|
380
|
-
Param["
|
|
380
|
+
Param["preventLiveboardFilterRemoval"] = "preventPinboardFilterRemoval";
|
|
381
381
|
Param["SearchQuery"] = "searchQuery";
|
|
382
382
|
Param["HideActions"] = "hideAction";
|
|
383
383
|
Param["HideObjects"] = "hideObjects";
|
|
@@ -405,7 +405,6 @@
|
|
|
405
405
|
Action["MakeACopy"] = "makeACopy";
|
|
406
406
|
Action["EditACopy"] = "editACopy";
|
|
407
407
|
Action["CopyLink"] = "embedDocument";
|
|
408
|
-
Action["PinboardSnapshot"] = "pinboardSnapshot";
|
|
409
408
|
Action["ResetLayout"] = "resetLayout";
|
|
410
409
|
Action["Schedule"] = "schedule";
|
|
411
410
|
Action["SchedulesList"] = "schedule-list";
|
|
@@ -438,7 +437,11 @@
|
|
|
438
437
|
Action["Describe"] = "describe";
|
|
439
438
|
Action["Relate"] = "relate";
|
|
440
439
|
Action["CustomizeHeadlines"] = "customizeHeadlines";
|
|
440
|
+
/**
|
|
441
|
+
* @hidden
|
|
442
|
+
*/
|
|
441
443
|
Action["PinboardInfo"] = "pinboardInfo";
|
|
444
|
+
Action["LiveboardInfo"] = "pinboardInfo";
|
|
442
445
|
Action["SendAnswerFeedback"] = "sendFeedback";
|
|
443
446
|
/**
|
|
444
447
|
* @deprecated Will be removed in next version
|
|
@@ -468,7 +471,7 @@
|
|
|
468
471
|
|
|
469
472
|
const ERROR_MESSAGE = {
|
|
470
473
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
471
|
-
|
|
474
|
+
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
472
475
|
};
|
|
473
476
|
|
|
474
477
|
/**
|
|
@@ -8809,7 +8812,7 @@
|
|
|
8809
8812
|
}
|
|
8810
8813
|
}
|
|
8811
8814
|
|
|
8812
|
-
var version="1.6.0-
|
|
8815
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.6.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0",classnames:"^2.3.1","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
8813
8816
|
|
|
8814
8817
|
/**
|
|
8815
8818
|
* Copyright (c) 2021
|
|
@@ -8819,6 +8822,7 @@
|
|
|
8819
8822
|
* @summary Base classes
|
|
8820
8823
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8821
8824
|
*/
|
|
8825
|
+
const { version: version$1 } = pkgInfo;
|
|
8822
8826
|
/**
|
|
8823
8827
|
* The event id map from v2 event names to v1 event id
|
|
8824
8828
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -8970,12 +8974,12 @@
|
|
|
8970
8974
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
8971
8975
|
queryParams[Param.ViewPortHeight] = window.innerHeight;
|
|
8972
8976
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
8973
|
-
queryParams[Param.Version] = version;
|
|
8977
|
+
queryParams[Param.Version] = version$1;
|
|
8974
8978
|
if (this.embedConfig.customCssUrl) {
|
|
8975
8979
|
queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
|
|
8976
8980
|
}
|
|
8977
8981
|
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, } = this.viewConfig;
|
|
8978
|
-
if ((visibleActions
|
|
8982
|
+
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
8979
8983
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
8980
8984
|
return queryParams;
|
|
8981
8985
|
}
|
|
@@ -8995,7 +8999,7 @@
|
|
|
8995
8999
|
}
|
|
8996
9000
|
/**
|
|
8997
9001
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
8998
|
-
* This is used for embedding
|
|
9002
|
+
* This is used for embedding Liveboards, visualizations, and full application.
|
|
8999
9003
|
* @param queryString The query string to append to the URL.
|
|
9000
9004
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
9001
9005
|
* the full application.
|
|
@@ -9173,26 +9177,6 @@
|
|
|
9173
9177
|
this.eventHandlerMap.set(messageType, callbacks);
|
|
9174
9178
|
return this;
|
|
9175
9179
|
}
|
|
9176
|
-
/**
|
|
9177
|
-
* Navigates users to the specified application page.
|
|
9178
|
-
* Use this method to navigate users from the embedded
|
|
9179
|
-
* ThoughtSpot context to a specific page in your app.
|
|
9180
|
-
* @param path The page path string.
|
|
9181
|
-
* For example, to navigate users to a pinboard page,
|
|
9182
|
-
* define the method as navigateToPage('pinboard/<pinboardId>').
|
|
9183
|
-
*/
|
|
9184
|
-
navigateToPage(path) {
|
|
9185
|
-
var _a;
|
|
9186
|
-
const iframeSrc = (_a = this.iFrame) === null || _a === void 0 ? void 0 : _a.src;
|
|
9187
|
-
if (iframeSrc) {
|
|
9188
|
-
const embedPath = '#/embed';
|
|
9189
|
-
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9190
|
-
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9191
|
-
}
|
|
9192
|
-
else {
|
|
9193
|
-
console.log('Please call render before invoking this method');
|
|
9194
|
-
}
|
|
9195
|
-
}
|
|
9196
9180
|
/**
|
|
9197
9181
|
* Triggers an event on specific Port registered against
|
|
9198
9182
|
* for the EmbedEvent
|
|
@@ -9285,7 +9269,11 @@
|
|
|
9285
9269
|
*/
|
|
9286
9270
|
Page["Answers"] = "answers";
|
|
9287
9271
|
/**
|
|
9288
|
-
*
|
|
9272
|
+
* Liveboards listing page
|
|
9273
|
+
*/
|
|
9274
|
+
Page["Liveboards"] = "liveboards";
|
|
9275
|
+
/**
|
|
9276
|
+
* @hidden
|
|
9289
9277
|
*/
|
|
9290
9278
|
Page["Pinboards"] = "pinboards";
|
|
9291
9279
|
/**
|
|
@@ -9304,7 +9292,7 @@
|
|
|
9304
9292
|
}
|
|
9305
9293
|
/**
|
|
9306
9294
|
* Constructs a map of parameters to be passed on to the
|
|
9307
|
-
* embedded
|
|
9295
|
+
* embedded Liveboard or visualization.
|
|
9308
9296
|
*/
|
|
9309
9297
|
getEmbedParams() {
|
|
9310
9298
|
const params = this.getBaseQueryParams();
|
|
@@ -9341,6 +9329,8 @@
|
|
|
9341
9329
|
return 'answer';
|
|
9342
9330
|
case exports.Page.Answers:
|
|
9343
9331
|
return 'answers';
|
|
9332
|
+
case exports.Page.Liveboards:
|
|
9333
|
+
return 'pinboards';
|
|
9344
9334
|
case exports.Page.Pinboards:
|
|
9345
9335
|
return 'pinboards';
|
|
9346
9336
|
case exports.Page.Data:
|
|
@@ -9365,6 +9355,23 @@
|
|
|
9365
9355
|
}
|
|
9366
9356
|
return path;
|
|
9367
9357
|
}
|
|
9358
|
+
/**
|
|
9359
|
+
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
9360
|
+
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
9361
|
+
* @param path The string, set to iframe src and navigate to new page
|
|
9362
|
+
* eg: appEmbed.navigateToPage('pinboards')
|
|
9363
|
+
*/
|
|
9364
|
+
navigateToPage(path) {
|
|
9365
|
+
if (this.iFrame) {
|
|
9366
|
+
const iframeSrc = this.iFrame.src;
|
|
9367
|
+
const embedPath = '#/embed';
|
|
9368
|
+
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
9369
|
+
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
9370
|
+
}
|
|
9371
|
+
else {
|
|
9372
|
+
console.log('Please call render before invoking this method');
|
|
9373
|
+
}
|
|
9374
|
+
}
|
|
9368
9375
|
/**
|
|
9369
9376
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
9370
9377
|
* @param renderOptions An object containing the page ID
|
|
@@ -9383,18 +9390,18 @@
|
|
|
9383
9390
|
/**
|
|
9384
9391
|
* Copyright (c) 2021
|
|
9385
9392
|
*
|
|
9386
|
-
* Embed a ThoughtSpot
|
|
9393
|
+
* Embed a ThoughtSpot Liveboard or visualization
|
|
9387
9394
|
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
9388
9395
|
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
9389
9396
|
*
|
|
9390
|
-
* @summary
|
|
9397
|
+
* @summary Liveboard & visualization embed
|
|
9391
9398
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
9392
9399
|
*/
|
|
9393
9400
|
/**
|
|
9394
|
-
* Embed a ThoughtSpot
|
|
9395
|
-
* @Category
|
|
9401
|
+
* Embed a ThoughtSpot Liveboard or visualization
|
|
9402
|
+
* @Category Liveboards and Charts
|
|
9396
9403
|
*/
|
|
9397
|
-
class
|
|
9404
|
+
class LiveboardEmbed extends V1Embed {
|
|
9398
9405
|
// eslint-disable-next-line no-useless-constructor
|
|
9399
9406
|
constructor(domSelector, viewConfig) {
|
|
9400
9407
|
super(domSelector, viewConfig);
|
|
@@ -9411,20 +9418,21 @@
|
|
|
9411
9418
|
const obj = this.getIframeCenter();
|
|
9412
9419
|
responder({ type: exports.EmbedEvent.EmbedIframeCenter, data: obj });
|
|
9413
9420
|
};
|
|
9414
|
-
this.
|
|
9415
|
-
if (data.data.
|
|
9416
|
-
data.data.canvasState !== 'pinboard') {
|
|
9421
|
+
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
9422
|
+
if (!data.data.currentPath.startsWith('/embed/viz/')) {
|
|
9417
9423
|
this.setIFrameHeight(this.defaultHeight);
|
|
9418
9424
|
}
|
|
9419
9425
|
};
|
|
9420
9426
|
}
|
|
9421
9427
|
/**
|
|
9422
9428
|
* Construct a map of params to be passed on to the
|
|
9423
|
-
* embedded
|
|
9429
|
+
* embedded Liveboard or visualization.
|
|
9424
9430
|
*/
|
|
9425
9431
|
getEmbedParams() {
|
|
9426
9432
|
const params = this.getBaseQueryParams();
|
|
9427
|
-
const { enableVizTransformations, fullHeight,
|
|
9433
|
+
const { enableVizTransformations, fullHeight, defaultHeight, } = this.viewConfig;
|
|
9434
|
+
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval ||
|
|
9435
|
+
this.viewConfig.preventPinboardFilterRemoval;
|
|
9428
9436
|
if (fullHeight === true) {
|
|
9429
9437
|
params[Param.fullHeight] = true;
|
|
9430
9438
|
}
|
|
@@ -9434,53 +9442,60 @@
|
|
|
9434
9442
|
if (enableVizTransformations !== undefined) {
|
|
9435
9443
|
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
9436
9444
|
}
|
|
9437
|
-
if (
|
|
9438
|
-
params[Param.
|
|
9445
|
+
if (preventLiveboardFilterRemoval) {
|
|
9446
|
+
params[Param.preventLiveboardFilterRemoval] = true;
|
|
9439
9447
|
}
|
|
9440
9448
|
params[Param.livedBoardEmbed] = true;
|
|
9441
9449
|
const queryParams = getQueryParamString(params, true);
|
|
9442
9450
|
return queryParams;
|
|
9443
9451
|
}
|
|
9444
9452
|
/**
|
|
9445
|
-
* Construct the URL of the embedded ThoughtSpot
|
|
9453
|
+
* Construct the URL of the embedded ThoughtSpot Liveboard or visualization
|
|
9446
9454
|
* to be loaded within the iframe.
|
|
9447
|
-
* @param
|
|
9448
|
-
* @param vizId The optional GUID of a visualization within the
|
|
9455
|
+
* @param liveboardId The GUID of the Liveboard.
|
|
9456
|
+
* @param vizId The optional GUID of a visualization within the Liveboard.
|
|
9449
9457
|
* @param runtimeFilters A list of runtime filters to be applied to
|
|
9450
|
-
* the
|
|
9458
|
+
* the Liveboard or visualization on load.
|
|
9451
9459
|
*/
|
|
9452
|
-
getIFrameSrc(
|
|
9460
|
+
getIFrameSrc(liveboardId, vizId, runtimeFilters) {
|
|
9453
9461
|
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
9454
9462
|
const queryParams = this.getEmbedParams();
|
|
9455
9463
|
const queryString = [filterQuery, queryParams]
|
|
9456
9464
|
.filter(Boolean)
|
|
9457
9465
|
.join('&');
|
|
9458
|
-
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${
|
|
9466
|
+
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${liveboardId}`;
|
|
9459
9467
|
if (vizId) {
|
|
9460
9468
|
url = `${url}/${vizId}`;
|
|
9461
9469
|
}
|
|
9462
9470
|
return url;
|
|
9463
9471
|
}
|
|
9464
9472
|
/**
|
|
9465
|
-
* Render an embedded ThoughtSpot
|
|
9466
|
-
* @param renderOptions An object specifying the
|
|
9473
|
+
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
9474
|
+
* @param renderOptions An object specifying the Liveboard ID,
|
|
9467
9475
|
* visualization ID and the runtime filters.
|
|
9468
9476
|
*/
|
|
9469
9477
|
render() {
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9478
|
+
var _a;
|
|
9479
|
+
const { vizId, runtimeFilters } = this.viewConfig;
|
|
9480
|
+
const liveboardId = (_a = this.viewConfig.liveboardId) !== null && _a !== void 0 ? _a : this.viewConfig.pinboardId;
|
|
9481
|
+
if (!liveboardId) {
|
|
9482
|
+
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION);
|
|
9473
9483
|
}
|
|
9474
9484
|
if (this.viewConfig.fullHeight === true) {
|
|
9475
|
-
this.on(exports.EmbedEvent.RouteChange, this.
|
|
9485
|
+
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
9476
9486
|
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
9477
9487
|
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
9478
9488
|
}
|
|
9479
9489
|
super.render();
|
|
9480
|
-
const src = this.getIFrameSrc(
|
|
9490
|
+
const src = this.getIFrameSrc(liveboardId, vizId, runtimeFilters);
|
|
9481
9491
|
this.renderV1Embed(src);
|
|
9482
9492
|
return this;
|
|
9483
9493
|
}
|
|
9494
|
+
}
|
|
9495
|
+
/**
|
|
9496
|
+
* @hidden
|
|
9497
|
+
*/
|
|
9498
|
+
class PinboardEmbed extends LiveboardEmbed {
|
|
9484
9499
|
}
|
|
9485
9500
|
|
|
9486
9501
|
/**
|
|
@@ -9522,7 +9537,7 @@
|
|
|
9522
9537
|
* @param dataSources A list of data source GUIDs
|
|
9523
9538
|
*/
|
|
9524
9539
|
getIFrameSrc(answerId, dataSources) {
|
|
9525
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9540
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9526
9541
|
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
9527
9542
|
const queryParams = this.getBaseQueryParams();
|
|
9528
9543
|
if (dataSources && dataSources.length) {
|
|
@@ -9565,6 +9580,7 @@
|
|
|
9565
9580
|
}
|
|
9566
9581
|
|
|
9567
9582
|
exports.AppEmbed = AppEmbed;
|
|
9583
|
+
exports.LiveboardEmbed = LiveboardEmbed;
|
|
9568
9584
|
exports.PinboardEmbed = PinboardEmbed;
|
|
9569
9585
|
exports.SearchEmbed = SearchEmbed;
|
|
9570
9586
|
exports.init = init;
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"asciidoctor": "^2.2.1",
|
|
66
66
|
"babel-jest": "^26.6.3",
|
|
67
67
|
"babel-preset-gatsby": "^1.10.0",
|
|
68
|
+
"classnames": "^2.3.1",
|
|
68
69
|
"command-line-args": "^5.1.1",
|
|
69
70
|
"coveralls": "^3.1.0",
|
|
70
71
|
"dts-bundle": "0.7.3",
|
|
@@ -126,6 +127,9 @@
|
|
|
126
127
|
"type": "git",
|
|
127
128
|
"url": "git+https://github.com/thoughtspot/visual-embed-sdk.git"
|
|
128
129
|
},
|
|
130
|
+
"publishConfig": {
|
|
131
|
+
"registry": "https://registry.npmjs.org"
|
|
132
|
+
},
|
|
129
133
|
"keywords": [
|
|
130
134
|
"thoughtspot",
|
|
131
135
|
"everywhere",
|
package/lib/src/embed/app.d.ts
CHANGED
|
@@ -27,7 +27,11 @@ export declare enum Page {
|
|
|
27
27
|
*/
|
|
28
28
|
Answers = "answers",
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Liveboards listing page
|
|
31
|
+
*/
|
|
32
|
+
Liveboards = "liveboards",
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
31
35
|
*/
|
|
32
36
|
Pinboards = "pinboards",
|
|
33
37
|
/**
|
|
@@ -63,7 +67,7 @@ export interface AppViewConfig extends ViewConfig {
|
|
|
63
67
|
pageId?: Page;
|
|
64
68
|
/**
|
|
65
69
|
* This puts a filter tag on the application. All metadata lists in the application, such as
|
|
66
|
-
*
|
|
70
|
+
* Liveboards and answers, would be filtered by this tag.
|
|
67
71
|
*/
|
|
68
72
|
tag?: string;
|
|
69
73
|
/**
|
|
@@ -80,7 +84,7 @@ export declare class AppEmbed extends V1Embed {
|
|
|
80
84
|
constructor(domSelector: DOMSelector, viewConfig: AppViewConfig);
|
|
81
85
|
/**
|
|
82
86
|
* Constructs a map of parameters to be passed on to the
|
|
83
|
-
* embedded
|
|
87
|
+
* embedded Liveboard or visualization.
|
|
84
88
|
*/
|
|
85
89
|
private getEmbedParams;
|
|
86
90
|
/**
|
|
@@ -99,6 +103,13 @@ export declare class AppEmbed extends V1Embed {
|
|
|
99
103
|
* @returns The URL path that the embedded app understands.
|
|
100
104
|
*/
|
|
101
105
|
private formatPath;
|
|
106
|
+
/**
|
|
107
|
+
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
108
|
+
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
109
|
+
* @param path The string, set to iframe src and navigate to new page
|
|
110
|
+
* eg: appEmbed.navigateToPage('pinboards')
|
|
111
|
+
*/
|
|
112
|
+
navigateToPage(path: string): void;
|
|
102
113
|
/**
|
|
103
114
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
104
115
|
* @param renderOptions An object containing the page ID
|
package/lib/src/embed/app.js
CHANGED
|
@@ -30,7 +30,11 @@ export var Page;
|
|
|
30
30
|
*/
|
|
31
31
|
Page["Answers"] = "answers";
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Liveboards listing page
|
|
34
|
+
*/
|
|
35
|
+
Page["Liveboards"] = "liveboards";
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
34
38
|
*/
|
|
35
39
|
Page["Pinboards"] = "pinboards";
|
|
36
40
|
/**
|
|
@@ -49,7 +53,7 @@ export class AppEmbed extends V1Embed {
|
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
51
55
|
* Constructs a map of parameters to be passed on to the
|
|
52
|
-
* embedded
|
|
56
|
+
* embedded Liveboard or visualization.
|
|
53
57
|
*/
|
|
54
58
|
getEmbedParams() {
|
|
55
59
|
const params = this.getBaseQueryParams();
|
|
@@ -86,6 +90,8 @@ export class AppEmbed extends V1Embed {
|
|
|
86
90
|
return 'answer';
|
|
87
91
|
case Page.Answers:
|
|
88
92
|
return 'answers';
|
|
93
|
+
case Page.Liveboards:
|
|
94
|
+
return 'pinboards';
|
|
89
95
|
case Page.Pinboards:
|
|
90
96
|
return 'pinboards';
|
|
91
97
|
case Page.Data:
|
|
@@ -110,6 +116,23 @@ export class AppEmbed extends V1Embed {
|
|
|
110
116
|
}
|
|
111
117
|
return path;
|
|
112
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
121
|
+
* This is used for embedding answers, pinboards, visualizations and full application only.
|
|
122
|
+
* @param path The string, set to iframe src and navigate to new page
|
|
123
|
+
* eg: appEmbed.navigateToPage('pinboards')
|
|
124
|
+
*/
|
|
125
|
+
navigateToPage(path) {
|
|
126
|
+
if (this.iFrame) {
|
|
127
|
+
const iframeSrc = this.iFrame.src;
|
|
128
|
+
const embedPath = '#/embed';
|
|
129
|
+
const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
|
|
130
|
+
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
console.log('Please call render before invoking this method');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
113
136
|
/**
|
|
114
137
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
115
138
|
* @param renderOptions An object containing the page ID
|
package/lib/src/embed/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/embed/app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,KAAK,EAA8B,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AAEjD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/embed/app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,KAAK,EAA8B,MAAM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,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;YACpE,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,GACd,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAClC,GAAG,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC;SACpD;aAAM;YACH,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;SACjE;IACL,CAAC;IAED;;;;OAIG;IACI,MAAM;QACT,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QACzD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACrE,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -3,6 +3,7 @@ import { init } from '../index';
|
|
|
3
3
|
import { Action, AuthType, RuntimeFilterOp } from '../types';
|
|
4
4
|
import { executeAfterWait, getDocumentBody, getIFrameSrc, getRootEl, } from '../test/test-utils';
|
|
5
5
|
import { version } from '../../package.json';
|
|
6
|
+
import * as config from '../config';
|
|
6
7
|
const defaultViewConfig = {
|
|
7
8
|
frameParams: {
|
|
8
9
|
width: 1280,
|
|
@@ -11,6 +12,7 @@ const defaultViewConfig = {
|
|
|
11
12
|
};
|
|
12
13
|
const thoughtSpotHost = 'tshost';
|
|
13
14
|
const defaultParams = `&hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}`;
|
|
15
|
+
const defaultParamsForPinboardEmbed = `hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}`;
|
|
14
16
|
beforeAll(() => {
|
|
15
17
|
init({
|
|
16
18
|
thoughtSpotHost,
|
|
@@ -57,6 +59,7 @@ describe('App embed tests', () => {
|
|
|
57
59
|
[Page.Search]: 'answer',
|
|
58
60
|
[Page.Answers]: 'answers',
|
|
59
61
|
[Page.Pinboards]: 'pinboards',
|
|
62
|
+
[Page.Liveboards]: 'pinboards',
|
|
60
63
|
[Page.Data]: 'data/tables',
|
|
61
64
|
[Page.Home]: 'home',
|
|
62
65
|
};
|
|
@@ -128,5 +131,34 @@ describe('App embed tests', () => {
|
|
|
128
131
|
expect(getIFrameSrc()).toBe(`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}&tag=Finance#/home`);
|
|
129
132
|
});
|
|
130
133
|
});
|
|
134
|
+
describe('Naviage to Page API', () => {
|
|
135
|
+
const path = 'pinboard/e0836cad-4fdf-42d4-bd97-567a6b2a6058';
|
|
136
|
+
beforeEach(() => {
|
|
137
|
+
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
|
|
138
|
+
});
|
|
139
|
+
test('when app is AppEmbed after navigateToPage function call, new path should be set to iframe', async () => {
|
|
140
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
141
|
+
frameParams: {
|
|
142
|
+
width: '100%',
|
|
143
|
+
height: '100%',
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
await appEmbed.render();
|
|
147
|
+
appEmbed.navigateToPage(path);
|
|
148
|
+
expect(getIFrameSrc()).toBe(`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}#/${path}`);
|
|
149
|
+
});
|
|
150
|
+
test('navigateToPage function use before render', async () => {
|
|
151
|
+
spyOn(console, 'log');
|
|
152
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
153
|
+
frameParams: {
|
|
154
|
+
width: '100%',
|
|
155
|
+
height: '100%',
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
appEmbed.navigateToPage(path);
|
|
159
|
+
await appEmbed.render();
|
|
160
|
+
expect(console.log).toHaveBeenCalledWith('Please call render before invoking this method');
|
|
161
|
+
});
|
|
162
|
+
});
|
|
131
163
|
});
|
|
132
164
|
//# sourceMappingURL=app.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.spec.js","sourceRoot":"","sources":["../../../src/embed/app.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,IAAI,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,SAAS,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"app.spec.js","sourceRoot":"","sources":["../../../src/embed/app.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,IAAI,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,SAAS,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAEpC,MAAM,iBAAiB,GAAG;IACtB,WAAW,EAAE;QACT,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,GAAG;KACd;CACJ,CAAC;AACF,MAAM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