@thoughtspot/visual-embed-sdk 1.41.0-pre-render-1 → 1.41.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/cjs/package.json +3 -3
- package/cjs/src/embed/app.d.ts +6 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +19 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +60 -3
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts +0 -1
- package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +3 -7
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +0 -1
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +2 -7
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +0 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +4 -27
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +25 -31
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +0 -1
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +6 -10
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +0 -1
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +7 -11
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +0 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +8 -7
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +4 -6
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +20 -21
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +122 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.d.ts +10 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +11 -1
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +3 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +2 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/types.d.ts +135 -17
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +40 -21
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/custom-actions.d.ts +12 -0
- package/cjs/src/utils/custom-actions.d.ts.map +1 -0
- package/cjs/src/utils/custom-actions.js +180 -0
- package/cjs/src/utils/custom-actions.js.map +1 -0
- package/cjs/src/utils/custom-actions.spec.d.ts +2 -0
- package/cjs/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/cjs/src/utils/custom-actions.spec.js +399 -0
- package/cjs/src/utils/custom-actions.spec.js.map +1 -0
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +10 -0
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +11 -0
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils.d.ts +7 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +11 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +28 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-CmEQfuE3.js → index-B_mxAan8.js} +1 -1
- package/dist/src/embed/app.d.ts +6 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/bodyless-conversation.d.ts +0 -1
- package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +0 -1
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +0 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +0 -1
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +0 -1
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +0 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +4 -6
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/errors.d.ts +10 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +135 -17
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/custom-actions.d.ts +12 -0
- package/dist/src/utils/custom-actions.d.ts.map +1 -0
- package/dist/src/utils/custom-actions.spec.d.ts +2 -0
- package/dist/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +1704 -250
- package/dist/tsembed-react.js +1703 -249
- package/dist/tsembed.es.js +1704 -250
- package/dist/tsembed.js +1703 -249
- package/dist/visual-embed-sdk-react-full.d.ts +146 -31
- package/dist/visual-embed-sdk-react.d.ts +146 -31
- package/dist/visual-embed-sdk.d.ts +146 -31
- package/lib/package.json +3 -3
- package/lib/src/embed/app.d.ts +6 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +19 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +60 -3
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts +0 -1
- package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +3 -7
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +0 -1
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +2 -7
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +0 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +4 -27
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +25 -31
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +0 -1
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +6 -10
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +0 -1
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +7 -11
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +0 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +8 -7
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +4 -6
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +20 -21
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +123 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +10 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +10 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +135 -17
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +39 -20
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/custom-actions.d.ts +12 -0
- package/lib/src/utils/custom-actions.d.ts.map +1 -0
- package/lib/src/utils/custom-actions.js +175 -0
- package/lib/src/utils/custom-actions.js.map +1 -0
- package/lib/src/utils/custom-actions.spec.d.ts +2 -0
- package/lib/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/lib/src/utils/custom-actions.spec.js +397 -0
- package/lib/src/utils/custom-actions.spec.js.map +1 -0
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +10 -0
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +11 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils.d.ts +7 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +9 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +29 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +147 -32
- package/package.json +3 -3
- package/src/embed/app.spec.ts +85 -3
- package/src/embed/app.ts +21 -0
- package/src/embed/bodyless-conversation.ts +3 -8
- package/src/embed/conversation.ts +2 -17
- package/src/embed/liveboard.spec.ts +35 -35
- package/src/embed/liveboard.ts +4 -32
- package/src/embed/sage.ts +7 -12
- package/src/embed/search-bar.tsx +7 -14
- package/src/embed/search.ts +7 -18
- package/src/embed/ts-embed.spec.ts +136 -2
- package/src/embed/ts-embed.ts +25 -28
- package/src/errors.ts +11 -0
- package/src/index.ts +4 -0
- package/src/react/index.tsx +1 -0
- package/src/types.ts +198 -76
- package/src/utils/custom-actions.spec.ts +431 -0
- package/src/utils/custom-actions.ts +217 -0
- package/src/utils/processData.spec.ts +12 -0
- package/src/utils/processData.ts +10 -0
- package/src/utils.spec.ts +34 -0
- package/src/utils.ts +10 -0
- package/dist/index-BDlM0f0T.js +0 -7371
- package/dist/index-D1pyb7RG.js +0 -7371
- package/dist/index-DeFzsyFF.js +0 -7371
- package/dist/index-Dpf0rd6w.js +0 -7371
- package/dist/index-UuEbsISo.js +0 -7447
- package/dist/index-e3Uw3YFO.js +0 -7371
- package/dist/index-k7pkZMhx.js +0 -7371
package/dist/tsembed.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.41.0
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.41.0 */
|
|
2
2
|
'use client';
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -373,6 +373,15 @@ function storeValueInWindow(key, value, options = {}) {
|
|
|
373
373
|
* @returns The stored value or `undefined` if the key is not found.
|
|
374
374
|
*/
|
|
375
375
|
const getValueFromWindow = (key) => { var _a; return (_a = window === null || window === void 0 ? void 0 : window[sdkWindowKey]) === null || _a === void 0 ? void 0 : _a[key]; };
|
|
376
|
+
/**
|
|
377
|
+
* Check if an array includes a string value
|
|
378
|
+
* @param arr - The array to check
|
|
379
|
+
* @param key - The string to search for
|
|
380
|
+
* @returns boolean indicating if the string is found in the array
|
|
381
|
+
*/
|
|
382
|
+
const arrayIncludesString = (arr, key) => {
|
|
383
|
+
return arr.some(item => typeof item === 'string' && item === key);
|
|
384
|
+
};
|
|
376
385
|
/**
|
|
377
386
|
* Check if the document is currently in fullscreen mode
|
|
378
387
|
*/
|
|
@@ -468,7 +477,6 @@ const calculateVisibleElementData = (element) => {
|
|
|
468
477
|
* the embedded app
|
|
469
478
|
* @group Authentication / Init
|
|
470
479
|
*/
|
|
471
|
-
// eslint-disable-next-line no-shadow
|
|
472
480
|
var AuthType;
|
|
473
481
|
(function (AuthType) {
|
|
474
482
|
/**
|
|
@@ -682,7 +690,6 @@ var HomeLeftNavItem;
|
|
|
682
690
|
/**
|
|
683
691
|
* A map of the supported runtime filter operations
|
|
684
692
|
*/
|
|
685
|
-
// eslint-disable-next-line no-shadow
|
|
686
693
|
var RuntimeFilterOp;
|
|
687
694
|
(function (RuntimeFilterOp) {
|
|
688
695
|
/**
|
|
@@ -753,7 +760,6 @@ var RuntimeFilterOp;
|
|
|
753
760
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
754
761
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
|
|
755
762
|
*/
|
|
756
|
-
// eslint-disable-next-line no-shadow
|
|
757
763
|
var HomepageModule;
|
|
758
764
|
(function (HomepageModule) {
|
|
759
765
|
/**
|
|
@@ -786,7 +792,6 @@ var HomepageModule;
|
|
|
786
792
|
* **Note**: This option is applicable to full app embedding only.
|
|
787
793
|
* @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
|
|
788
794
|
*/
|
|
789
|
-
// eslint-disable-next-line no-shadow
|
|
790
795
|
var ListPageColumns;
|
|
791
796
|
(function (ListPageColumns) {
|
|
792
797
|
/**
|
|
@@ -849,7 +854,6 @@ var ListPageColumns;
|
|
|
849
854
|
* ```
|
|
850
855
|
* @group Events
|
|
851
856
|
*/
|
|
852
|
-
// eslint-disable-next-line no-shadow
|
|
853
857
|
var EmbedEvent;
|
|
854
858
|
(function (EmbedEvent) {
|
|
855
859
|
/**
|
|
@@ -1491,6 +1495,11 @@ var EmbedEvent;
|
|
|
1491
1495
|
* @hidden
|
|
1492
1496
|
*/
|
|
1493
1497
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
1498
|
+
/**
|
|
1499
|
+
* Internal event to clear the cached info
|
|
1500
|
+
* @hidden
|
|
1501
|
+
*/
|
|
1502
|
+
EmbedEvent["CLEAR_INFO_CACHE"] = "clearInfoCache";
|
|
1494
1503
|
/**
|
|
1495
1504
|
* Emitted when a user clicks **Show Liveboard details** on a Liveboard
|
|
1496
1505
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
@@ -1959,6 +1968,17 @@ var EmbedEvent;
|
|
|
1959
1968
|
* ```
|
|
1960
1969
|
*/
|
|
1961
1970
|
EmbedEvent["EmbedListenerReady"] = "EmbedListenerReady";
|
|
1971
|
+
/**
|
|
1972
|
+
* Emitted when the organization is switched.
|
|
1973
|
+
* @example
|
|
1974
|
+
* ```js
|
|
1975
|
+
* appEmbed.on(EmbedEvent.OrgSwitched, (payload) => {
|
|
1976
|
+
* console.log('payload', payload);
|
|
1977
|
+
* })
|
|
1978
|
+
* ```
|
|
1979
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
1980
|
+
*/
|
|
1981
|
+
EmbedEvent["OrgSwitched"] = "orgSwitched";
|
|
1962
1982
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
1963
1983
|
/**
|
|
1964
1984
|
* Event types that can be triggered by the host application
|
|
@@ -2013,7 +2033,6 @@ var EmbedEvent;
|
|
|
2013
2033
|
* ```
|
|
2014
2034
|
* @group Events
|
|
2015
2035
|
*/
|
|
2016
|
-
// eslint-disable-next-line no-shadow
|
|
2017
2036
|
var HostEvent;
|
|
2018
2037
|
(function (HostEvent) {
|
|
2019
2038
|
/**
|
|
@@ -3223,22 +3242,11 @@ var HostEvent;
|
|
|
3223
3242
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
3224
3243
|
*/
|
|
3225
3244
|
HostEvent["AskSpotter"] = "AskSpotter";
|
|
3226
|
-
/**
|
|
3227
|
-
* @hidden
|
|
3228
|
-
* Triggers the update of the embed params.
|
|
3229
|
-
*
|
|
3230
|
-
* @example
|
|
3231
|
-
* ```js
|
|
3232
|
-
* liveboardEmbed.trigger(HostEvent.UpdateEmbedParams, viewConfig);
|
|
3233
|
-
* ```
|
|
3234
|
-
*/
|
|
3235
|
-
HostEvent["UpdateEmbedParams"] = "updateEmbedParams";
|
|
3236
3245
|
})(HostEvent || (HostEvent = {}));
|
|
3237
3246
|
/**
|
|
3238
3247
|
* The different visual modes that the data sources panel within
|
|
3239
3248
|
* search could appear in, such as hidden, collapsed, or expanded.
|
|
3240
3249
|
*/
|
|
3241
|
-
// eslint-disable-next-line no-shadow
|
|
3242
3250
|
var DataSourceVisualMode;
|
|
3243
3251
|
(function (DataSourceVisualMode) {
|
|
3244
3252
|
/**
|
|
@@ -3258,7 +3266,6 @@ var DataSourceVisualMode;
|
|
|
3258
3266
|
* The query params passed down to the embedded ThoughtSpot app
|
|
3259
3267
|
* containing configuration and/or visual information.
|
|
3260
3268
|
*/
|
|
3261
|
-
// eslint-disable-next-line no-shadow
|
|
3262
3269
|
var Param;
|
|
3263
3270
|
(function (Param) {
|
|
3264
3271
|
Param["EmbedApp"] = "embedApp";
|
|
@@ -3338,6 +3345,7 @@ var Param;
|
|
|
3338
3345
|
Param["Query"] = "query";
|
|
3339
3346
|
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
3340
3347
|
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
3348
|
+
Param["HomepageVersion"] = "homepageVersion";
|
|
3341
3349
|
Param["ListPageVersion"] = "listpageVersion";
|
|
3342
3350
|
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
3343
3351
|
Param["LiveboardHeaderSticky"] = "isLiveboardHeaderSticky";
|
|
@@ -3379,6 +3387,7 @@ var Param;
|
|
|
3379
3387
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
3380
3388
|
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
3381
3389
|
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
3390
|
+
Param["LiveboardXLSXCSVDownload"] = "isLiveboardXLSXCSVDownloadEnabled";
|
|
3382
3391
|
})(Param || (Param = {}));
|
|
3383
3392
|
/**
|
|
3384
3393
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -3407,7 +3416,6 @@ var Param;
|
|
|
3407
3416
|
* ```
|
|
3408
3417
|
* See also link:https://developers.thoughtspot.com/docs/actions[Action IDs in the SDK]
|
|
3409
3418
|
*/
|
|
3410
|
-
// eslint-disable-next-line no-shadow
|
|
3411
3419
|
var Action;
|
|
3412
3420
|
(function (Action) {
|
|
3413
3421
|
/**
|
|
@@ -3952,7 +3960,7 @@ var Action;
|
|
|
3952
3960
|
* The Favorites icon (*) for Answers,
|
|
3953
3961
|
* Liveboard, and data objects like Worksheet, Model,
|
|
3954
3962
|
* Tables and Views.
|
|
3955
|
-
* Allows adding an object to the user
|
|
3963
|
+
* Allows adding an object to the user's favorites list.
|
|
3956
3964
|
* @example
|
|
3957
3965
|
* ```js
|
|
3958
3966
|
* disabledActions: [Action.AddToFavorites]
|
|
@@ -4679,6 +4687,26 @@ var ContextMenuTriggerOptions;
|
|
|
4679
4687
|
ContextMenuTriggerOptions["RIGHT_CLICK"] = "right-click";
|
|
4680
4688
|
ContextMenuTriggerOptions["BOTH_CLICKS"] = "both-clicks";
|
|
4681
4689
|
})(ContextMenuTriggerOptions || (ContextMenuTriggerOptions = {}));
|
|
4690
|
+
/**
|
|
4691
|
+
* Enum options to show custom actions at different
|
|
4692
|
+
* positions in the application.
|
|
4693
|
+
*/
|
|
4694
|
+
var CustomActionsPosition;
|
|
4695
|
+
(function (CustomActionsPosition) {
|
|
4696
|
+
CustomActionsPosition["PRIMARY"] = "PRIMARY";
|
|
4697
|
+
CustomActionsPosition["MENU"] = "MENU";
|
|
4698
|
+
CustomActionsPosition["CONTEXTMENU"] = "CONTEXTMENU";
|
|
4699
|
+
})(CustomActionsPosition || (CustomActionsPosition = {}));
|
|
4700
|
+
/**
|
|
4701
|
+
* Enum options to mention the target of the custom action.
|
|
4702
|
+
*/
|
|
4703
|
+
var CustomActionTarget;
|
|
4704
|
+
(function (CustomActionTarget) {
|
|
4705
|
+
CustomActionTarget["LIVEBOARD"] = "LIVEBOARD";
|
|
4706
|
+
CustomActionTarget["VIZ"] = "VIZ";
|
|
4707
|
+
CustomActionTarget["ANSWER"] = "ANSWER";
|
|
4708
|
+
CustomActionTarget["SPOTTER"] = "SPOTTER";
|
|
4709
|
+
})(CustomActionTarget || (CustomActionTarget = {}));
|
|
4682
4710
|
/**
|
|
4683
4711
|
* Enum options to show or suppress Visual Embed SDK and
|
|
4684
4712
|
* ThoughtSpot application logs in the console output.
|
|
@@ -5835,8 +5863,8 @@ function cacheHas(cache, key) {
|
|
|
5835
5863
|
var _cacheHas = cacheHas;
|
|
5836
5864
|
|
|
5837
5865
|
/** Used to compose bitmasks for value comparisons. */
|
|
5838
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5839
|
-
COMPARE_UNORDERED_FLAG$
|
|
5866
|
+
var COMPARE_PARTIAL_FLAG$5 = 1,
|
|
5867
|
+
COMPARE_UNORDERED_FLAG$3 = 2;
|
|
5840
5868
|
|
|
5841
5869
|
/**
|
|
5842
5870
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
@@ -5852,7 +5880,7 @@ var COMPARE_PARTIAL_FLAG$3 = 1,
|
|
|
5852
5880
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
5853
5881
|
*/
|
|
5854
5882
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
5855
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
5883
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
|
|
5856
5884
|
arrLength = array.length,
|
|
5857
5885
|
othLength = other.length;
|
|
5858
5886
|
|
|
@@ -5867,7 +5895,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5867
5895
|
}
|
|
5868
5896
|
var index = -1,
|
|
5869
5897
|
result = true,
|
|
5870
|
-
seen = (bitmask & COMPARE_UNORDERED_FLAG$
|
|
5898
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new _SetCache : undefined;
|
|
5871
5899
|
|
|
5872
5900
|
stack.set(array, other);
|
|
5873
5901
|
stack.set(other, array);
|
|
@@ -5959,8 +5987,8 @@ function setToArray(set) {
|
|
|
5959
5987
|
var _setToArray = setToArray;
|
|
5960
5988
|
|
|
5961
5989
|
/** Used to compose bitmasks for value comparisons. */
|
|
5962
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5963
|
-
COMPARE_UNORDERED_FLAG = 2;
|
|
5990
|
+
var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
5991
|
+
COMPARE_UNORDERED_FLAG$2 = 2;
|
|
5964
5992
|
|
|
5965
5993
|
/** `Object#toString` result references. */
|
|
5966
5994
|
var boolTag$1 = '[object Boolean]',
|
|
@@ -5971,14 +5999,14 @@ var boolTag$1 = '[object Boolean]',
|
|
|
5971
5999
|
regexpTag$1 = '[object RegExp]',
|
|
5972
6000
|
setTag$3 = '[object Set]',
|
|
5973
6001
|
stringTag$1 = '[object String]',
|
|
5974
|
-
symbolTag = '[object Symbol]';
|
|
6002
|
+
symbolTag$1 = '[object Symbol]';
|
|
5975
6003
|
|
|
5976
6004
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
5977
6005
|
dataViewTag$2 = '[object DataView]';
|
|
5978
6006
|
|
|
5979
6007
|
/** Used to convert symbols to primitives and strings. */
|
|
5980
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
5981
|
-
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
6008
|
+
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
|
6009
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
5982
6010
|
|
|
5983
6011
|
/**
|
|
5984
6012
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
@@ -6035,7 +6063,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6035
6063
|
var convert = _mapToArray;
|
|
6036
6064
|
|
|
6037
6065
|
case setTag$3:
|
|
6038
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6066
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
6039
6067
|
convert || (convert = _setToArray);
|
|
6040
6068
|
|
|
6041
6069
|
if (object.size != other.size && !isPartial) {
|
|
@@ -6046,7 +6074,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6046
6074
|
if (stacked) {
|
|
6047
6075
|
return stacked == other;
|
|
6048
6076
|
}
|
|
6049
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
6077
|
+
bitmask |= COMPARE_UNORDERED_FLAG$2;
|
|
6050
6078
|
|
|
6051
6079
|
// Recursively compare objects (susceptible to call stack limits).
|
|
6052
6080
|
stack.set(object, other);
|
|
@@ -6054,7 +6082,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6054
6082
|
stack['delete'](object);
|
|
6055
6083
|
return result;
|
|
6056
6084
|
|
|
6057
|
-
case symbolTag:
|
|
6085
|
+
case symbolTag$1:
|
|
6058
6086
|
if (symbolValueOf) {
|
|
6059
6087
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
6060
6088
|
}
|
|
@@ -6745,7 +6773,7 @@ function getAllKeys(object) {
|
|
|
6745
6773
|
var _getAllKeys = getAllKeys;
|
|
6746
6774
|
|
|
6747
6775
|
/** Used to compose bitmasks for value comparisons. */
|
|
6748
|
-
var COMPARE_PARTIAL_FLAG$
|
|
6776
|
+
var COMPARE_PARTIAL_FLAG$3 = 1;
|
|
6749
6777
|
|
|
6750
6778
|
/** Used for built-in method references. */
|
|
6751
6779
|
var objectProto$2 = Object.prototype;
|
|
@@ -6767,7 +6795,7 @@ var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
|
|
|
6767
6795
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
6768
6796
|
*/
|
|
6769
6797
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
6770
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6798
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
6771
6799
|
objProps = _getAllKeys(object),
|
|
6772
6800
|
objLength = objProps.length,
|
|
6773
6801
|
othProps = _getAllKeys(other),
|
|
@@ -6905,7 +6933,7 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
6905
6933
|
var _getTag = getTag;
|
|
6906
6934
|
|
|
6907
6935
|
/** Used to compose bitmasks for value comparisons. */
|
|
6908
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
6936
|
+
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
6909
6937
|
|
|
6910
6938
|
/** `Object#toString` result references. */
|
|
6911
6939
|
var argsTag = '[object Arguments]',
|
|
@@ -6958,7 +6986,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
6958
6986
|
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
6959
6987
|
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
6960
6988
|
}
|
|
6961
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
6989
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
|
|
6962
6990
|
var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),
|
|
6963
6991
|
othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');
|
|
6964
6992
|
|
|
@@ -7128,6 +7156,16 @@ const ERROR_MESSAGE = {
|
|
|
7128
7156
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
7129
7157
|
RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
|
|
7130
7158
|
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
7159
|
+
};
|
|
7160
|
+
const CUSTOM_ACTIONS_ERROR_MESSAGE = {
|
|
7161
|
+
INVALID_ACTION_OBJECT: 'Custom Action Validation Error: Invalid action object provided',
|
|
7162
|
+
MISSING_REQUIRED_FIELDS: (id, missingFields) => `Custom Action Validation Error for '${id}': Missing required fields: ${missingFields.join(', ')}`,
|
|
7163
|
+
UNSUPPORTED_TARGET: (id, targetType) => `Custom Action Validation Error for '${id}': Target type '${targetType}' is not supported`,
|
|
7164
|
+
INVALID_POSITION: (position, targetType, supportedPositions) => `Position '${position}' is not supported for ${targetType.toLowerCase()}-level custom actions. Supported positions: ${supportedPositions}`,
|
|
7165
|
+
INVALID_METADATA_IDS: (targetType, invalidIds, supportedIds) => `Invalid metadata IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported metadata IDs: ${supportedIds}`,
|
|
7166
|
+
INVALID_DATA_MODEL_IDS: (targetType, invalidIds, supportedIds) => `Invalid data model IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported data model IDs: ${supportedIds}`,
|
|
7167
|
+
INVALID_FIELDS: (targetType, invalidFields, supportedFields) => `Invalid fields for ${targetType.toLowerCase()}-level custom actions: ${invalidFields.join(', ')}. Supported fields: ${supportedFields}`,
|
|
7168
|
+
DUPLICATE_IDS: (id, duplicateNames, keptName) => `Duplicate custom action ID '${id}' found. Actions with names '${duplicateNames.join("', '")}' will be ignored. Keeping '${keptName}'.`,
|
|
7131
7169
|
};
|
|
7132
7170
|
|
|
7133
7171
|
const EndPoints = {
|
|
@@ -7980,141 +8018,1571 @@ class AnswerService {
|
|
|
7980
8018
|
if (columnsToRemove.length) {
|
|
7981
8019
|
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
7982
8020
|
}
|
|
7983
|
-
return unaggAnswerSession;
|
|
7984
|
-
}
|
|
7985
|
-
/**
|
|
7986
|
-
* Execute a custom graphql query in the context of the answer.
|
|
7987
|
-
* @param query graphql query
|
|
7988
|
-
* @param variables graphql variables
|
|
7989
|
-
* @returns
|
|
7990
|
-
*/
|
|
7991
|
-
async executeQuery(query, variables) {
|
|
7992
|
-
const data = await graphqlQuery({
|
|
7993
|
-
query,
|
|
7994
|
-
variables: {
|
|
7995
|
-
session: this.session,
|
|
7996
|
-
...variables,
|
|
7997
|
-
},
|
|
7998
|
-
thoughtSpotHost: this.thoughtSpotHost,
|
|
7999
|
-
isCompositeQuery: false,
|
|
8000
|
-
});
|
|
8001
|
-
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8002
|
-
return data;
|
|
8003
|
-
}
|
|
8004
|
-
/**
|
|
8005
|
-
* Get the internal session details for the answer.
|
|
8006
|
-
* @returns
|
|
8007
|
-
*/
|
|
8008
|
-
getSession() {
|
|
8009
|
-
return this.session;
|
|
8021
|
+
return unaggAnswerSession;
|
|
8022
|
+
}
|
|
8023
|
+
/**
|
|
8024
|
+
* Execute a custom graphql query in the context of the answer.
|
|
8025
|
+
* @param query graphql query
|
|
8026
|
+
* @param variables graphql variables
|
|
8027
|
+
* @returns
|
|
8028
|
+
*/
|
|
8029
|
+
async executeQuery(query, variables) {
|
|
8030
|
+
const data = await graphqlQuery({
|
|
8031
|
+
query,
|
|
8032
|
+
variables: {
|
|
8033
|
+
session: this.session,
|
|
8034
|
+
...variables,
|
|
8035
|
+
},
|
|
8036
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
8037
|
+
isCompositeQuery: false,
|
|
8038
|
+
});
|
|
8039
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8040
|
+
return data;
|
|
8041
|
+
}
|
|
8042
|
+
/**
|
|
8043
|
+
* Get the internal session details for the answer.
|
|
8044
|
+
* @returns
|
|
8045
|
+
*/
|
|
8046
|
+
getSession() {
|
|
8047
|
+
return this.session;
|
|
8048
|
+
}
|
|
8049
|
+
async getAnswer() {
|
|
8050
|
+
if (this.answer) {
|
|
8051
|
+
return this.answer;
|
|
8052
|
+
}
|
|
8053
|
+
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8054
|
+
return this.answer;
|
|
8055
|
+
}
|
|
8056
|
+
async getTML() {
|
|
8057
|
+
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8058
|
+
const edoc = object[0].edoc;
|
|
8059
|
+
const YAML = await import('./index-B_mxAan8.js');
|
|
8060
|
+
const parsedDoc = YAML.parse(edoc);
|
|
8061
|
+
return {
|
|
8062
|
+
answer: {
|
|
8063
|
+
...parsedDoc.answer,
|
|
8064
|
+
...this.tmlOverride,
|
|
8065
|
+
},
|
|
8066
|
+
};
|
|
8067
|
+
}
|
|
8068
|
+
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8069
|
+
const { displayMode, visualizations } = await this.getAnswer();
|
|
8070
|
+
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8071
|
+
return this.executeQuery(addVizToLiveboard, {
|
|
8072
|
+
liveboardId,
|
|
8073
|
+
vizId: viz.id,
|
|
8074
|
+
});
|
|
8075
|
+
}
|
|
8076
|
+
setTMLOverride(override) {
|
|
8077
|
+
this.tmlOverride = override;
|
|
8078
|
+
}
|
|
8079
|
+
}
|
|
8080
|
+
/**
|
|
8081
|
+
*
|
|
8082
|
+
* @param sourceDetail
|
|
8083
|
+
* @param colNames
|
|
8084
|
+
*/
|
|
8085
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
8086
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
8087
|
+
colSet[col.name.toLowerCase()] = col;
|
|
8088
|
+
return colSet;
|
|
8089
|
+
}, {});
|
|
8090
|
+
return new Set(colNames.map((colName) => {
|
|
8091
|
+
const col = cols[colName.toLowerCase()];
|
|
8092
|
+
return col.id;
|
|
8093
|
+
}));
|
|
8094
|
+
}
|
|
8095
|
+
/**
|
|
8096
|
+
*
|
|
8097
|
+
* @param selectedPoints
|
|
8098
|
+
*/
|
|
8099
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
8100
|
+
const underlyingDataPoint = [];
|
|
8101
|
+
/**
|
|
8102
|
+
*
|
|
8103
|
+
* @param colVal
|
|
8104
|
+
*/
|
|
8105
|
+
function addPointFromColVal(colVal) {
|
|
8106
|
+
var _a;
|
|
8107
|
+
const dataType = colVal.column.dataType;
|
|
8108
|
+
colVal.column.id;
|
|
8109
|
+
let dataValue;
|
|
8110
|
+
if (dataType === 'DATE') {
|
|
8111
|
+
if (Number.isFinite(colVal.value)) {
|
|
8112
|
+
dataValue = [{
|
|
8113
|
+
epochRange: {
|
|
8114
|
+
startEpoch: colVal.value,
|
|
8115
|
+
},
|
|
8116
|
+
}];
|
|
8117
|
+
// Case for custom calendar.
|
|
8118
|
+
}
|
|
8119
|
+
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8120
|
+
dataValue = [{
|
|
8121
|
+
epochRange: {
|
|
8122
|
+
startEpoch: colVal.value.v.s,
|
|
8123
|
+
endEpoch: colVal.value.v.e,
|
|
8124
|
+
},
|
|
8125
|
+
}];
|
|
8126
|
+
}
|
|
8127
|
+
}
|
|
8128
|
+
else {
|
|
8129
|
+
dataValue = [{ value: colVal.value }];
|
|
8130
|
+
}
|
|
8131
|
+
underlyingDataPoint.push({
|
|
8132
|
+
columnId: colVal.column.id,
|
|
8133
|
+
dataValue,
|
|
8134
|
+
});
|
|
8135
|
+
}
|
|
8136
|
+
selectedPoints.forEach((p) => {
|
|
8137
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8138
|
+
});
|
|
8139
|
+
return underlyingDataPoint;
|
|
8140
|
+
}
|
|
8141
|
+
/**
|
|
8142
|
+
*
|
|
8143
|
+
* @param visualizations
|
|
8144
|
+
* @param displayMode
|
|
8145
|
+
*/
|
|
8146
|
+
function getDisplayedViz(visualizations, displayMode) {
|
|
8147
|
+
if (displayMode === 'CHART_MODE') {
|
|
8148
|
+
return visualizations.find(
|
|
8149
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8150
|
+
(viz) => viz.__typename === 'ChartViz');
|
|
8151
|
+
}
|
|
8152
|
+
return visualizations.find(
|
|
8153
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8154
|
+
(viz) => viz.__typename === 'TableViz');
|
|
8155
|
+
}
|
|
8156
|
+
|
|
8157
|
+
/** Built-in value references. */
|
|
8158
|
+
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
|
8159
|
+
|
|
8160
|
+
/**
|
|
8161
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
8162
|
+
*
|
|
8163
|
+
* @private
|
|
8164
|
+
* @param {*} value The value to check.
|
|
8165
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
8166
|
+
*/
|
|
8167
|
+
function isFlattenable(value) {
|
|
8168
|
+
return isArray_1(value) || isArguments_1(value) ||
|
|
8169
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
8170
|
+
}
|
|
8171
|
+
|
|
8172
|
+
var _isFlattenable = isFlattenable;
|
|
8173
|
+
|
|
8174
|
+
/**
|
|
8175
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
8176
|
+
*
|
|
8177
|
+
* @private
|
|
8178
|
+
* @param {Array} array The array to flatten.
|
|
8179
|
+
* @param {number} depth The maximum recursion depth.
|
|
8180
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
8181
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
8182
|
+
* @param {Array} [result=[]] The initial result value.
|
|
8183
|
+
* @returns {Array} Returns the new flattened array.
|
|
8184
|
+
*/
|
|
8185
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
8186
|
+
var index = -1,
|
|
8187
|
+
length = array.length;
|
|
8188
|
+
|
|
8189
|
+
predicate || (predicate = _isFlattenable);
|
|
8190
|
+
result || (result = []);
|
|
8191
|
+
|
|
8192
|
+
while (++index < length) {
|
|
8193
|
+
var value = array[index];
|
|
8194
|
+
if (depth > 0 && predicate(value)) {
|
|
8195
|
+
if (depth > 1) {
|
|
8196
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
8197
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
8198
|
+
} else {
|
|
8199
|
+
_arrayPush(result, value);
|
|
8200
|
+
}
|
|
8201
|
+
} else if (!isStrict) {
|
|
8202
|
+
result[result.length] = value;
|
|
8203
|
+
}
|
|
8204
|
+
}
|
|
8205
|
+
return result;
|
|
8206
|
+
}
|
|
8207
|
+
|
|
8208
|
+
var _baseFlatten = baseFlatten;
|
|
8209
|
+
|
|
8210
|
+
/**
|
|
8211
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
8212
|
+
* shorthands.
|
|
8213
|
+
*
|
|
8214
|
+
* @private
|
|
8215
|
+
* @param {Array} [array] The array to iterate over.
|
|
8216
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8217
|
+
* @returns {Array} Returns the new mapped array.
|
|
8218
|
+
*/
|
|
8219
|
+
function arrayMap(array, iteratee) {
|
|
8220
|
+
var index = -1,
|
|
8221
|
+
length = array == null ? 0 : array.length,
|
|
8222
|
+
result = Array(length);
|
|
8223
|
+
|
|
8224
|
+
while (++index < length) {
|
|
8225
|
+
result[index] = iteratee(array[index], index, array);
|
|
8226
|
+
}
|
|
8227
|
+
return result;
|
|
8228
|
+
}
|
|
8229
|
+
|
|
8230
|
+
var _arrayMap = arrayMap;
|
|
8231
|
+
|
|
8232
|
+
/** `Object#toString` result references. */
|
|
8233
|
+
var symbolTag = '[object Symbol]';
|
|
8234
|
+
|
|
8235
|
+
/**
|
|
8236
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
8237
|
+
*
|
|
8238
|
+
* @static
|
|
8239
|
+
* @memberOf _
|
|
8240
|
+
* @since 4.0.0
|
|
8241
|
+
* @category Lang
|
|
8242
|
+
* @param {*} value The value to check.
|
|
8243
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
8244
|
+
* @example
|
|
8245
|
+
*
|
|
8246
|
+
* _.isSymbol(Symbol.iterator);
|
|
8247
|
+
* // => true
|
|
8248
|
+
*
|
|
8249
|
+
* _.isSymbol('abc');
|
|
8250
|
+
* // => false
|
|
8251
|
+
*/
|
|
8252
|
+
function isSymbol(value) {
|
|
8253
|
+
return typeof value == 'symbol' ||
|
|
8254
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
8255
|
+
}
|
|
8256
|
+
|
|
8257
|
+
var isSymbol_1 = isSymbol;
|
|
8258
|
+
|
|
8259
|
+
/** Used to match property names within property paths. */
|
|
8260
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
8261
|
+
reIsPlainProp = /^\w*$/;
|
|
8262
|
+
|
|
8263
|
+
/**
|
|
8264
|
+
* Checks if `value` is a property name and not a property path.
|
|
8265
|
+
*
|
|
8266
|
+
* @private
|
|
8267
|
+
* @param {*} value The value to check.
|
|
8268
|
+
* @param {Object} [object] The object to query keys on.
|
|
8269
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
8270
|
+
*/
|
|
8271
|
+
function isKey(value, object) {
|
|
8272
|
+
if (isArray_1(value)) {
|
|
8273
|
+
return false;
|
|
8274
|
+
}
|
|
8275
|
+
var type = typeof value;
|
|
8276
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
8277
|
+
value == null || isSymbol_1(value)) {
|
|
8278
|
+
return true;
|
|
8279
|
+
}
|
|
8280
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
8281
|
+
(object != null && value in Object(object));
|
|
8282
|
+
}
|
|
8283
|
+
|
|
8284
|
+
var _isKey = isKey;
|
|
8285
|
+
|
|
8286
|
+
/** Error message constants. */
|
|
8287
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
8288
|
+
|
|
8289
|
+
/**
|
|
8290
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
8291
|
+
* provided, it determines the cache key for storing the result based on the
|
|
8292
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
8293
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
8294
|
+
* is invoked with the `this` binding of the memoized function.
|
|
8295
|
+
*
|
|
8296
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
8297
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
8298
|
+
* constructor with one whose instances implement the
|
|
8299
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
8300
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
8301
|
+
*
|
|
8302
|
+
* @static
|
|
8303
|
+
* @memberOf _
|
|
8304
|
+
* @since 0.1.0
|
|
8305
|
+
* @category Function
|
|
8306
|
+
* @param {Function} func The function to have its output memoized.
|
|
8307
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
8308
|
+
* @returns {Function} Returns the new memoized function.
|
|
8309
|
+
* @example
|
|
8310
|
+
*
|
|
8311
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
8312
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
8313
|
+
*
|
|
8314
|
+
* var values = _.memoize(_.values);
|
|
8315
|
+
* values(object);
|
|
8316
|
+
* // => [1, 2]
|
|
8317
|
+
*
|
|
8318
|
+
* values(other);
|
|
8319
|
+
* // => [3, 4]
|
|
8320
|
+
*
|
|
8321
|
+
* object.a = 2;
|
|
8322
|
+
* values(object);
|
|
8323
|
+
* // => [1, 2]
|
|
8324
|
+
*
|
|
8325
|
+
* // Modify the result cache.
|
|
8326
|
+
* values.cache.set(object, ['a', 'b']);
|
|
8327
|
+
* values(object);
|
|
8328
|
+
* // => ['a', 'b']
|
|
8329
|
+
*
|
|
8330
|
+
* // Replace `_.memoize.Cache`.
|
|
8331
|
+
* _.memoize.Cache = WeakMap;
|
|
8332
|
+
*/
|
|
8333
|
+
function memoize(func, resolver) {
|
|
8334
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
8335
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
8336
|
+
}
|
|
8337
|
+
var memoized = function() {
|
|
8338
|
+
var args = arguments,
|
|
8339
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
8340
|
+
cache = memoized.cache;
|
|
8341
|
+
|
|
8342
|
+
if (cache.has(key)) {
|
|
8343
|
+
return cache.get(key);
|
|
8344
|
+
}
|
|
8345
|
+
var result = func.apply(this, args);
|
|
8346
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
8347
|
+
return result;
|
|
8348
|
+
};
|
|
8349
|
+
memoized.cache = new (memoize.Cache || _MapCache);
|
|
8350
|
+
return memoized;
|
|
8351
|
+
}
|
|
8352
|
+
|
|
8353
|
+
// Expose `MapCache`.
|
|
8354
|
+
memoize.Cache = _MapCache;
|
|
8355
|
+
|
|
8356
|
+
var memoize_1 = memoize;
|
|
8357
|
+
|
|
8358
|
+
/** Used as the maximum memoize cache size. */
|
|
8359
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
8360
|
+
|
|
8361
|
+
/**
|
|
8362
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
8363
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
8364
|
+
*
|
|
8365
|
+
* @private
|
|
8366
|
+
* @param {Function} func The function to have its output memoized.
|
|
8367
|
+
* @returns {Function} Returns the new memoized function.
|
|
8368
|
+
*/
|
|
8369
|
+
function memoizeCapped(func) {
|
|
8370
|
+
var result = memoize_1(func, function(key) {
|
|
8371
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
8372
|
+
cache.clear();
|
|
8373
|
+
}
|
|
8374
|
+
return key;
|
|
8375
|
+
});
|
|
8376
|
+
|
|
8377
|
+
var cache = result.cache;
|
|
8378
|
+
return result;
|
|
8379
|
+
}
|
|
8380
|
+
|
|
8381
|
+
var _memoizeCapped = memoizeCapped;
|
|
8382
|
+
|
|
8383
|
+
/** Used to match property names within property paths. */
|
|
8384
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
8385
|
+
|
|
8386
|
+
/** Used to match backslashes in property paths. */
|
|
8387
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
8388
|
+
|
|
8389
|
+
/**
|
|
8390
|
+
* Converts `string` to a property path array.
|
|
8391
|
+
*
|
|
8392
|
+
* @private
|
|
8393
|
+
* @param {string} string The string to convert.
|
|
8394
|
+
* @returns {Array} Returns the property path array.
|
|
8395
|
+
*/
|
|
8396
|
+
var stringToPath = _memoizeCapped(function(string) {
|
|
8397
|
+
var result = [];
|
|
8398
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
8399
|
+
result.push('');
|
|
8400
|
+
}
|
|
8401
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
8402
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
8403
|
+
});
|
|
8404
|
+
return result;
|
|
8405
|
+
});
|
|
8406
|
+
|
|
8407
|
+
var _stringToPath = stringToPath;
|
|
8408
|
+
|
|
8409
|
+
/** Used as references for various `Number` constants. */
|
|
8410
|
+
var INFINITY$1 = 1 / 0;
|
|
8411
|
+
|
|
8412
|
+
/** Used to convert symbols to primitives and strings. */
|
|
8413
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
8414
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
8415
|
+
|
|
8416
|
+
/**
|
|
8417
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
8418
|
+
* values to empty strings.
|
|
8419
|
+
*
|
|
8420
|
+
* @private
|
|
8421
|
+
* @param {*} value The value to process.
|
|
8422
|
+
* @returns {string} Returns the string.
|
|
8423
|
+
*/
|
|
8424
|
+
function baseToString(value) {
|
|
8425
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
8426
|
+
if (typeof value == 'string') {
|
|
8427
|
+
return value;
|
|
8428
|
+
}
|
|
8429
|
+
if (isArray_1(value)) {
|
|
8430
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
8431
|
+
return _arrayMap(value, baseToString) + '';
|
|
8432
|
+
}
|
|
8433
|
+
if (isSymbol_1(value)) {
|
|
8434
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
8435
|
+
}
|
|
8436
|
+
var result = (value + '');
|
|
8437
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
8438
|
+
}
|
|
8439
|
+
|
|
8440
|
+
var _baseToString = baseToString;
|
|
8441
|
+
|
|
8442
|
+
/**
|
|
8443
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
8444
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
8445
|
+
*
|
|
8446
|
+
* @static
|
|
8447
|
+
* @memberOf _
|
|
8448
|
+
* @since 4.0.0
|
|
8449
|
+
* @category Lang
|
|
8450
|
+
* @param {*} value The value to convert.
|
|
8451
|
+
* @returns {string} Returns the converted string.
|
|
8452
|
+
* @example
|
|
8453
|
+
*
|
|
8454
|
+
* _.toString(null);
|
|
8455
|
+
* // => ''
|
|
8456
|
+
*
|
|
8457
|
+
* _.toString(-0);
|
|
8458
|
+
* // => '-0'
|
|
8459
|
+
*
|
|
8460
|
+
* _.toString([1, 2, 3]);
|
|
8461
|
+
* // => '1,2,3'
|
|
8462
|
+
*/
|
|
8463
|
+
function toString$1(value) {
|
|
8464
|
+
return value == null ? '' : _baseToString(value);
|
|
8465
|
+
}
|
|
8466
|
+
|
|
8467
|
+
var toString_1 = toString$1;
|
|
8468
|
+
|
|
8469
|
+
/**
|
|
8470
|
+
* Casts `value` to a path array if it's not one.
|
|
8471
|
+
*
|
|
8472
|
+
* @private
|
|
8473
|
+
* @param {*} value The value to inspect.
|
|
8474
|
+
* @param {Object} [object] The object to query keys on.
|
|
8475
|
+
* @returns {Array} Returns the cast property path array.
|
|
8476
|
+
*/
|
|
8477
|
+
function castPath(value, object) {
|
|
8478
|
+
if (isArray_1(value)) {
|
|
8479
|
+
return value;
|
|
8480
|
+
}
|
|
8481
|
+
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
8482
|
+
}
|
|
8483
|
+
|
|
8484
|
+
var _castPath = castPath;
|
|
8485
|
+
|
|
8486
|
+
/** Used as references for various `Number` constants. */
|
|
8487
|
+
var INFINITY = 1 / 0;
|
|
8488
|
+
|
|
8489
|
+
/**
|
|
8490
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
8491
|
+
*
|
|
8492
|
+
* @private
|
|
8493
|
+
* @param {*} value The value to inspect.
|
|
8494
|
+
* @returns {string|symbol} Returns the key.
|
|
8495
|
+
*/
|
|
8496
|
+
function toKey(value) {
|
|
8497
|
+
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
8498
|
+
return value;
|
|
8499
|
+
}
|
|
8500
|
+
var result = (value + '');
|
|
8501
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
8502
|
+
}
|
|
8503
|
+
|
|
8504
|
+
var _toKey = toKey;
|
|
8505
|
+
|
|
8506
|
+
/**
|
|
8507
|
+
* The base implementation of `_.get` without support for default values.
|
|
8508
|
+
*
|
|
8509
|
+
* @private
|
|
8510
|
+
* @param {Object} object The object to query.
|
|
8511
|
+
* @param {Array|string} path The path of the property to get.
|
|
8512
|
+
* @returns {*} Returns the resolved value.
|
|
8513
|
+
*/
|
|
8514
|
+
function baseGet(object, path) {
|
|
8515
|
+
path = _castPath(path, object);
|
|
8516
|
+
|
|
8517
|
+
var index = 0,
|
|
8518
|
+
length = path.length;
|
|
8519
|
+
|
|
8520
|
+
while (object != null && index < length) {
|
|
8521
|
+
object = object[_toKey(path[index++])];
|
|
8522
|
+
}
|
|
8523
|
+
return (index && index == length) ? object : undefined;
|
|
8524
|
+
}
|
|
8525
|
+
|
|
8526
|
+
var _baseGet = baseGet;
|
|
8527
|
+
|
|
8528
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8529
|
+
var COMPARE_PARTIAL_FLAG$1 = 1,
|
|
8530
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
8531
|
+
|
|
8532
|
+
/**
|
|
8533
|
+
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
8534
|
+
*
|
|
8535
|
+
* @private
|
|
8536
|
+
* @param {Object} object The object to inspect.
|
|
8537
|
+
* @param {Object} source The object of property values to match.
|
|
8538
|
+
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
8539
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
8540
|
+
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
8541
|
+
*/
|
|
8542
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
8543
|
+
var index = matchData.length,
|
|
8544
|
+
length = index,
|
|
8545
|
+
noCustomizer = !customizer;
|
|
8546
|
+
|
|
8547
|
+
if (object == null) {
|
|
8548
|
+
return !length;
|
|
8549
|
+
}
|
|
8550
|
+
object = Object(object);
|
|
8551
|
+
while (index--) {
|
|
8552
|
+
var data = matchData[index];
|
|
8553
|
+
if ((noCustomizer && data[2])
|
|
8554
|
+
? data[1] !== object[data[0]]
|
|
8555
|
+
: !(data[0] in object)
|
|
8556
|
+
) {
|
|
8557
|
+
return false;
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
while (++index < length) {
|
|
8561
|
+
data = matchData[index];
|
|
8562
|
+
var key = data[0],
|
|
8563
|
+
objValue = object[key],
|
|
8564
|
+
srcValue = data[1];
|
|
8565
|
+
|
|
8566
|
+
if (noCustomizer && data[2]) {
|
|
8567
|
+
if (objValue === undefined && !(key in object)) {
|
|
8568
|
+
return false;
|
|
8569
|
+
}
|
|
8570
|
+
} else {
|
|
8571
|
+
var stack = new _Stack;
|
|
8572
|
+
if (customizer) {
|
|
8573
|
+
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
8574
|
+
}
|
|
8575
|
+
if (!(result === undefined
|
|
8576
|
+
? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
|
|
8577
|
+
: result
|
|
8578
|
+
)) {
|
|
8579
|
+
return false;
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8582
|
+
}
|
|
8583
|
+
return true;
|
|
8584
|
+
}
|
|
8585
|
+
|
|
8586
|
+
var _baseIsMatch = baseIsMatch;
|
|
8587
|
+
|
|
8588
|
+
/**
|
|
8589
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
8590
|
+
*
|
|
8591
|
+
* @private
|
|
8592
|
+
* @param {*} value The value to check.
|
|
8593
|
+
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
8594
|
+
* equality comparisons, else `false`.
|
|
8595
|
+
*/
|
|
8596
|
+
function isStrictComparable(value) {
|
|
8597
|
+
return value === value && !isObject_1(value);
|
|
8598
|
+
}
|
|
8599
|
+
|
|
8600
|
+
var _isStrictComparable = isStrictComparable;
|
|
8601
|
+
|
|
8602
|
+
/**
|
|
8603
|
+
* Gets the property names, values, and compare flags of `object`.
|
|
8604
|
+
*
|
|
8605
|
+
* @private
|
|
8606
|
+
* @param {Object} object The object to query.
|
|
8607
|
+
* @returns {Array} Returns the match data of `object`.
|
|
8608
|
+
*/
|
|
8609
|
+
function getMatchData(object) {
|
|
8610
|
+
var result = keys_1(object),
|
|
8611
|
+
length = result.length;
|
|
8612
|
+
|
|
8613
|
+
while (length--) {
|
|
8614
|
+
var key = result[length],
|
|
8615
|
+
value = object[key];
|
|
8616
|
+
|
|
8617
|
+
result[length] = [key, value, _isStrictComparable(value)];
|
|
8618
|
+
}
|
|
8619
|
+
return result;
|
|
8620
|
+
}
|
|
8621
|
+
|
|
8622
|
+
var _getMatchData = getMatchData;
|
|
8623
|
+
|
|
8624
|
+
/**
|
|
8625
|
+
* A specialized version of `matchesProperty` for source values suitable
|
|
8626
|
+
* for strict equality comparisons, i.e. `===`.
|
|
8627
|
+
*
|
|
8628
|
+
* @private
|
|
8629
|
+
* @param {string} key The key of the property to get.
|
|
8630
|
+
* @param {*} srcValue The value to match.
|
|
8631
|
+
* @returns {Function} Returns the new spec function.
|
|
8632
|
+
*/
|
|
8633
|
+
function matchesStrictComparable(key, srcValue) {
|
|
8634
|
+
return function(object) {
|
|
8635
|
+
if (object == null) {
|
|
8636
|
+
return false;
|
|
8637
|
+
}
|
|
8638
|
+
return object[key] === srcValue &&
|
|
8639
|
+
(srcValue !== undefined || (key in Object(object)));
|
|
8640
|
+
};
|
|
8641
|
+
}
|
|
8642
|
+
|
|
8643
|
+
var _matchesStrictComparable = matchesStrictComparable;
|
|
8644
|
+
|
|
8645
|
+
/**
|
|
8646
|
+
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
8647
|
+
*
|
|
8648
|
+
* @private
|
|
8649
|
+
* @param {Object} source The object of property values to match.
|
|
8650
|
+
* @returns {Function} Returns the new spec function.
|
|
8651
|
+
*/
|
|
8652
|
+
function baseMatches(source) {
|
|
8653
|
+
var matchData = _getMatchData(source);
|
|
8654
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
8655
|
+
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
8656
|
+
}
|
|
8657
|
+
return function(object) {
|
|
8658
|
+
return object === source || _baseIsMatch(object, source, matchData);
|
|
8659
|
+
};
|
|
8660
|
+
}
|
|
8661
|
+
|
|
8662
|
+
var _baseMatches = baseMatches;
|
|
8663
|
+
|
|
8664
|
+
/**
|
|
8665
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
8666
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
8667
|
+
*
|
|
8668
|
+
* @static
|
|
8669
|
+
* @memberOf _
|
|
8670
|
+
* @since 3.7.0
|
|
8671
|
+
* @category Object
|
|
8672
|
+
* @param {Object} object The object to query.
|
|
8673
|
+
* @param {Array|string} path The path of the property to get.
|
|
8674
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
8675
|
+
* @returns {*} Returns the resolved value.
|
|
8676
|
+
* @example
|
|
8677
|
+
*
|
|
8678
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
8679
|
+
*
|
|
8680
|
+
* _.get(object, 'a[0].b.c');
|
|
8681
|
+
* // => 3
|
|
8682
|
+
*
|
|
8683
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
8684
|
+
* // => 3
|
|
8685
|
+
*
|
|
8686
|
+
* _.get(object, 'a.b.c', 'default');
|
|
8687
|
+
* // => 'default'
|
|
8688
|
+
*/
|
|
8689
|
+
function get(object, path, defaultValue) {
|
|
8690
|
+
var result = object == null ? undefined : _baseGet(object, path);
|
|
8691
|
+
return result === undefined ? defaultValue : result;
|
|
8692
|
+
}
|
|
8693
|
+
|
|
8694
|
+
var get_1 = get;
|
|
8695
|
+
|
|
8696
|
+
/**
|
|
8697
|
+
* The base implementation of `_.hasIn` without support for deep paths.
|
|
8698
|
+
*
|
|
8699
|
+
* @private
|
|
8700
|
+
* @param {Object} [object] The object to query.
|
|
8701
|
+
* @param {Array|string} key The key to check.
|
|
8702
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
8703
|
+
*/
|
|
8704
|
+
function baseHasIn(object, key) {
|
|
8705
|
+
return object != null && key in Object(object);
|
|
8706
|
+
}
|
|
8707
|
+
|
|
8708
|
+
var _baseHasIn = baseHasIn;
|
|
8709
|
+
|
|
8710
|
+
/**
|
|
8711
|
+
* Checks if `path` exists on `object`.
|
|
8712
|
+
*
|
|
8713
|
+
* @private
|
|
8714
|
+
* @param {Object} object The object to query.
|
|
8715
|
+
* @param {Array|string} path The path to check.
|
|
8716
|
+
* @param {Function} hasFunc The function to check properties.
|
|
8717
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8718
|
+
*/
|
|
8719
|
+
function hasPath(object, path, hasFunc) {
|
|
8720
|
+
path = _castPath(path, object);
|
|
8721
|
+
|
|
8722
|
+
var index = -1,
|
|
8723
|
+
length = path.length,
|
|
8724
|
+
result = false;
|
|
8725
|
+
|
|
8726
|
+
while (++index < length) {
|
|
8727
|
+
var key = _toKey(path[index]);
|
|
8728
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
8729
|
+
break;
|
|
8730
|
+
}
|
|
8731
|
+
object = object[key];
|
|
8732
|
+
}
|
|
8733
|
+
if (result || ++index != length) {
|
|
8734
|
+
return result;
|
|
8735
|
+
}
|
|
8736
|
+
length = object == null ? 0 : object.length;
|
|
8737
|
+
return !!length && isLength_1(length) && _isIndex(key, length) &&
|
|
8738
|
+
(isArray_1(object) || isArguments_1(object));
|
|
8739
|
+
}
|
|
8740
|
+
|
|
8741
|
+
var _hasPath = hasPath;
|
|
8742
|
+
|
|
8743
|
+
/**
|
|
8744
|
+
* Checks if `path` is a direct or inherited property of `object`.
|
|
8745
|
+
*
|
|
8746
|
+
* @static
|
|
8747
|
+
* @memberOf _
|
|
8748
|
+
* @since 4.0.0
|
|
8749
|
+
* @category Object
|
|
8750
|
+
* @param {Object} object The object to query.
|
|
8751
|
+
* @param {Array|string} path The path to check.
|
|
8752
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8753
|
+
* @example
|
|
8754
|
+
*
|
|
8755
|
+
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
8756
|
+
*
|
|
8757
|
+
* _.hasIn(object, 'a');
|
|
8758
|
+
* // => true
|
|
8759
|
+
*
|
|
8760
|
+
* _.hasIn(object, 'a.b');
|
|
8761
|
+
* // => true
|
|
8762
|
+
*
|
|
8763
|
+
* _.hasIn(object, ['a', 'b']);
|
|
8764
|
+
* // => true
|
|
8765
|
+
*
|
|
8766
|
+
* _.hasIn(object, 'b');
|
|
8767
|
+
* // => false
|
|
8768
|
+
*/
|
|
8769
|
+
function hasIn(object, path) {
|
|
8770
|
+
return object != null && _hasPath(object, path, _baseHasIn);
|
|
8771
|
+
}
|
|
8772
|
+
|
|
8773
|
+
var hasIn_1 = hasIn;
|
|
8774
|
+
|
|
8775
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8776
|
+
var COMPARE_PARTIAL_FLAG = 1,
|
|
8777
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
8778
|
+
|
|
8779
|
+
/**
|
|
8780
|
+
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
8781
|
+
*
|
|
8782
|
+
* @private
|
|
8783
|
+
* @param {string} path The path of the property to get.
|
|
8784
|
+
* @param {*} srcValue The value to match.
|
|
8785
|
+
* @returns {Function} Returns the new spec function.
|
|
8786
|
+
*/
|
|
8787
|
+
function baseMatchesProperty(path, srcValue) {
|
|
8788
|
+
if (_isKey(path) && _isStrictComparable(srcValue)) {
|
|
8789
|
+
return _matchesStrictComparable(_toKey(path), srcValue);
|
|
8790
|
+
}
|
|
8791
|
+
return function(object) {
|
|
8792
|
+
var objValue = get_1(object, path);
|
|
8793
|
+
return (objValue === undefined && objValue === srcValue)
|
|
8794
|
+
? hasIn_1(object, path)
|
|
8795
|
+
: _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
8796
|
+
};
|
|
8797
|
+
}
|
|
8798
|
+
|
|
8799
|
+
var _baseMatchesProperty = baseMatchesProperty;
|
|
8800
|
+
|
|
8801
|
+
/**
|
|
8802
|
+
* This method returns the first argument it receives.
|
|
8803
|
+
*
|
|
8804
|
+
* @static
|
|
8805
|
+
* @since 0.1.0
|
|
8806
|
+
* @memberOf _
|
|
8807
|
+
* @category Util
|
|
8808
|
+
* @param {*} value Any value.
|
|
8809
|
+
* @returns {*} Returns `value`.
|
|
8810
|
+
* @example
|
|
8811
|
+
*
|
|
8812
|
+
* var object = { 'a': 1 };
|
|
8813
|
+
*
|
|
8814
|
+
* console.log(_.identity(object) === object);
|
|
8815
|
+
* // => true
|
|
8816
|
+
*/
|
|
8817
|
+
function identity(value) {
|
|
8818
|
+
return value;
|
|
8819
|
+
}
|
|
8820
|
+
|
|
8821
|
+
var identity_1 = identity;
|
|
8822
|
+
|
|
8823
|
+
/**
|
|
8824
|
+
* The base implementation of `_.property` without support for deep paths.
|
|
8825
|
+
*
|
|
8826
|
+
* @private
|
|
8827
|
+
* @param {string} key The key of the property to get.
|
|
8828
|
+
* @returns {Function} Returns the new accessor function.
|
|
8829
|
+
*/
|
|
8830
|
+
function baseProperty(key) {
|
|
8831
|
+
return function(object) {
|
|
8832
|
+
return object == null ? undefined : object[key];
|
|
8833
|
+
};
|
|
8834
|
+
}
|
|
8835
|
+
|
|
8836
|
+
var _baseProperty = baseProperty;
|
|
8837
|
+
|
|
8838
|
+
/**
|
|
8839
|
+
* A specialized version of `baseProperty` which supports deep paths.
|
|
8840
|
+
*
|
|
8841
|
+
* @private
|
|
8842
|
+
* @param {Array|string} path The path of the property to get.
|
|
8843
|
+
* @returns {Function} Returns the new accessor function.
|
|
8844
|
+
*/
|
|
8845
|
+
function basePropertyDeep(path) {
|
|
8846
|
+
return function(object) {
|
|
8847
|
+
return _baseGet(object, path);
|
|
8848
|
+
};
|
|
8849
|
+
}
|
|
8850
|
+
|
|
8851
|
+
var _basePropertyDeep = basePropertyDeep;
|
|
8852
|
+
|
|
8853
|
+
/**
|
|
8854
|
+
* Creates a function that returns the value at `path` of a given object.
|
|
8855
|
+
*
|
|
8856
|
+
* @static
|
|
8857
|
+
* @memberOf _
|
|
8858
|
+
* @since 2.4.0
|
|
8859
|
+
* @category Util
|
|
8860
|
+
* @param {Array|string} path The path of the property to get.
|
|
8861
|
+
* @returns {Function} Returns the new accessor function.
|
|
8862
|
+
* @example
|
|
8863
|
+
*
|
|
8864
|
+
* var objects = [
|
|
8865
|
+
* { 'a': { 'b': 2 } },
|
|
8866
|
+
* { 'a': { 'b': 1 } }
|
|
8867
|
+
* ];
|
|
8868
|
+
*
|
|
8869
|
+
* _.map(objects, _.property('a.b'));
|
|
8870
|
+
* // => [2, 1]
|
|
8871
|
+
*
|
|
8872
|
+
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
8873
|
+
* // => [1, 2]
|
|
8874
|
+
*/
|
|
8875
|
+
function property(path) {
|
|
8876
|
+
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
|
|
8877
|
+
}
|
|
8878
|
+
|
|
8879
|
+
var property_1 = property;
|
|
8880
|
+
|
|
8881
|
+
/**
|
|
8882
|
+
* The base implementation of `_.iteratee`.
|
|
8883
|
+
*
|
|
8884
|
+
* @private
|
|
8885
|
+
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
8886
|
+
* @returns {Function} Returns the iteratee.
|
|
8887
|
+
*/
|
|
8888
|
+
function baseIteratee(value) {
|
|
8889
|
+
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
8890
|
+
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
8891
|
+
if (typeof value == 'function') {
|
|
8892
|
+
return value;
|
|
8893
|
+
}
|
|
8894
|
+
if (value == null) {
|
|
8895
|
+
return identity_1;
|
|
8896
|
+
}
|
|
8897
|
+
if (typeof value == 'object') {
|
|
8898
|
+
return isArray_1(value)
|
|
8899
|
+
? _baseMatchesProperty(value[0], value[1])
|
|
8900
|
+
: _baseMatches(value);
|
|
8901
|
+
}
|
|
8902
|
+
return property_1(value);
|
|
8903
|
+
}
|
|
8904
|
+
|
|
8905
|
+
var _baseIteratee = baseIteratee;
|
|
8906
|
+
|
|
8907
|
+
/**
|
|
8908
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
8909
|
+
*
|
|
8910
|
+
* @private
|
|
8911
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8912
|
+
* @returns {Function} Returns the new base function.
|
|
8913
|
+
*/
|
|
8914
|
+
function createBaseFor(fromRight) {
|
|
8915
|
+
return function(object, iteratee, keysFunc) {
|
|
8916
|
+
var index = -1,
|
|
8917
|
+
iterable = Object(object),
|
|
8918
|
+
props = keysFunc(object),
|
|
8919
|
+
length = props.length;
|
|
8920
|
+
|
|
8921
|
+
while (length--) {
|
|
8922
|
+
var key = props[fromRight ? length : ++index];
|
|
8923
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
8924
|
+
break;
|
|
8925
|
+
}
|
|
8926
|
+
}
|
|
8927
|
+
return object;
|
|
8928
|
+
};
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8931
|
+
var _createBaseFor = createBaseFor;
|
|
8932
|
+
|
|
8933
|
+
/**
|
|
8934
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
8935
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
8936
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
8937
|
+
*
|
|
8938
|
+
* @private
|
|
8939
|
+
* @param {Object} object The object to iterate over.
|
|
8940
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8941
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
8942
|
+
* @returns {Object} Returns `object`.
|
|
8943
|
+
*/
|
|
8944
|
+
var baseFor = _createBaseFor();
|
|
8945
|
+
|
|
8946
|
+
var _baseFor = baseFor;
|
|
8947
|
+
|
|
8948
|
+
/**
|
|
8949
|
+
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
8950
|
+
*
|
|
8951
|
+
* @private
|
|
8952
|
+
* @param {Object} object The object to iterate over.
|
|
8953
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8954
|
+
* @returns {Object} Returns `object`.
|
|
8955
|
+
*/
|
|
8956
|
+
function baseForOwn(object, iteratee) {
|
|
8957
|
+
return object && _baseFor(object, iteratee, keys_1);
|
|
8958
|
+
}
|
|
8959
|
+
|
|
8960
|
+
var _baseForOwn = baseForOwn;
|
|
8961
|
+
|
|
8962
|
+
/**
|
|
8963
|
+
* Creates a `baseEach` or `baseEachRight` function.
|
|
8964
|
+
*
|
|
8965
|
+
* @private
|
|
8966
|
+
* @param {Function} eachFunc The function to iterate over a collection.
|
|
8967
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8968
|
+
* @returns {Function} Returns the new base function.
|
|
8969
|
+
*/
|
|
8970
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
8971
|
+
return function(collection, iteratee) {
|
|
8972
|
+
if (collection == null) {
|
|
8973
|
+
return collection;
|
|
8974
|
+
}
|
|
8975
|
+
if (!isArrayLike_1(collection)) {
|
|
8976
|
+
return eachFunc(collection, iteratee);
|
|
8977
|
+
}
|
|
8978
|
+
var length = collection.length,
|
|
8979
|
+
index = fromRight ? length : -1,
|
|
8980
|
+
iterable = Object(collection);
|
|
8981
|
+
|
|
8982
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
8983
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
8984
|
+
break;
|
|
8985
|
+
}
|
|
8986
|
+
}
|
|
8987
|
+
return collection;
|
|
8988
|
+
};
|
|
8989
|
+
}
|
|
8990
|
+
|
|
8991
|
+
var _createBaseEach = createBaseEach;
|
|
8992
|
+
|
|
8993
|
+
/**
|
|
8994
|
+
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
8995
|
+
*
|
|
8996
|
+
* @private
|
|
8997
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
8998
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8999
|
+
* @returns {Array|Object} Returns `collection`.
|
|
9000
|
+
*/
|
|
9001
|
+
var baseEach = _createBaseEach(_baseForOwn);
|
|
9002
|
+
|
|
9003
|
+
var _baseEach = baseEach;
|
|
9004
|
+
|
|
9005
|
+
/**
|
|
9006
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
9007
|
+
*
|
|
9008
|
+
* @private
|
|
9009
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9010
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9011
|
+
* @returns {Array} Returns the new mapped array.
|
|
9012
|
+
*/
|
|
9013
|
+
function baseMap(collection, iteratee) {
|
|
9014
|
+
var index = -1,
|
|
9015
|
+
result = isArrayLike_1(collection) ? Array(collection.length) : [];
|
|
9016
|
+
|
|
9017
|
+
_baseEach(collection, function(value, key, collection) {
|
|
9018
|
+
result[++index] = iteratee(value, key, collection);
|
|
9019
|
+
});
|
|
9020
|
+
return result;
|
|
9021
|
+
}
|
|
9022
|
+
|
|
9023
|
+
var _baseMap = baseMap;
|
|
9024
|
+
|
|
9025
|
+
/**
|
|
9026
|
+
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
9027
|
+
* sort order of `array` and replaces criteria objects with their corresponding
|
|
9028
|
+
* values.
|
|
9029
|
+
*
|
|
9030
|
+
* @private
|
|
9031
|
+
* @param {Array} array The array to sort.
|
|
9032
|
+
* @param {Function} comparer The function to define sort order.
|
|
9033
|
+
* @returns {Array} Returns `array`.
|
|
9034
|
+
*/
|
|
9035
|
+
function baseSortBy(array, comparer) {
|
|
9036
|
+
var length = array.length;
|
|
9037
|
+
|
|
9038
|
+
array.sort(comparer);
|
|
9039
|
+
while (length--) {
|
|
9040
|
+
array[length] = array[length].value;
|
|
9041
|
+
}
|
|
9042
|
+
return array;
|
|
9043
|
+
}
|
|
9044
|
+
|
|
9045
|
+
var _baseSortBy = baseSortBy;
|
|
9046
|
+
|
|
9047
|
+
/**
|
|
9048
|
+
* Compares values to sort them in ascending order.
|
|
9049
|
+
*
|
|
9050
|
+
* @private
|
|
9051
|
+
* @param {*} value The value to compare.
|
|
9052
|
+
* @param {*} other The other value to compare.
|
|
9053
|
+
* @returns {number} Returns the sort order indicator for `value`.
|
|
9054
|
+
*/
|
|
9055
|
+
function compareAscending(value, other) {
|
|
9056
|
+
if (value !== other) {
|
|
9057
|
+
var valIsDefined = value !== undefined,
|
|
9058
|
+
valIsNull = value === null,
|
|
9059
|
+
valIsReflexive = value === value,
|
|
9060
|
+
valIsSymbol = isSymbol_1(value);
|
|
9061
|
+
|
|
9062
|
+
var othIsDefined = other !== undefined,
|
|
9063
|
+
othIsNull = other === null,
|
|
9064
|
+
othIsReflexive = other === other,
|
|
9065
|
+
othIsSymbol = isSymbol_1(other);
|
|
9066
|
+
|
|
9067
|
+
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
9068
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
9069
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
9070
|
+
(!valIsDefined && othIsReflexive) ||
|
|
9071
|
+
!valIsReflexive) {
|
|
9072
|
+
return 1;
|
|
9073
|
+
}
|
|
9074
|
+
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
9075
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
9076
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
9077
|
+
(!othIsDefined && valIsReflexive) ||
|
|
9078
|
+
!othIsReflexive) {
|
|
9079
|
+
return -1;
|
|
9080
|
+
}
|
|
9081
|
+
}
|
|
9082
|
+
return 0;
|
|
9083
|
+
}
|
|
9084
|
+
|
|
9085
|
+
var _compareAscending = compareAscending;
|
|
9086
|
+
|
|
9087
|
+
/**
|
|
9088
|
+
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
9089
|
+
* and stable sort them.
|
|
9090
|
+
*
|
|
9091
|
+
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
9092
|
+
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
9093
|
+
* of corresponding values.
|
|
9094
|
+
*
|
|
9095
|
+
* @private
|
|
9096
|
+
* @param {Object} object The object to compare.
|
|
9097
|
+
* @param {Object} other The other object to compare.
|
|
9098
|
+
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
9099
|
+
* @returns {number} Returns the sort order indicator for `object`.
|
|
9100
|
+
*/
|
|
9101
|
+
function compareMultiple(object, other, orders) {
|
|
9102
|
+
var index = -1,
|
|
9103
|
+
objCriteria = object.criteria,
|
|
9104
|
+
othCriteria = other.criteria,
|
|
9105
|
+
length = objCriteria.length,
|
|
9106
|
+
ordersLength = orders.length;
|
|
9107
|
+
|
|
9108
|
+
while (++index < length) {
|
|
9109
|
+
var result = _compareAscending(objCriteria[index], othCriteria[index]);
|
|
9110
|
+
if (result) {
|
|
9111
|
+
if (index >= ordersLength) {
|
|
9112
|
+
return result;
|
|
9113
|
+
}
|
|
9114
|
+
var order = orders[index];
|
|
9115
|
+
return result * (order == 'desc' ? -1 : 1);
|
|
9116
|
+
}
|
|
9117
|
+
}
|
|
9118
|
+
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
9119
|
+
// that causes it, under certain circumstances, to provide the same value for
|
|
9120
|
+
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
9121
|
+
// for more details.
|
|
9122
|
+
//
|
|
9123
|
+
// This also ensures a stable sort in V8 and other engines.
|
|
9124
|
+
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
9125
|
+
return object.index - other.index;
|
|
9126
|
+
}
|
|
9127
|
+
|
|
9128
|
+
var _compareMultiple = compareMultiple;
|
|
9129
|
+
|
|
9130
|
+
/**
|
|
9131
|
+
* The base implementation of `_.orderBy` without param guards.
|
|
9132
|
+
*
|
|
9133
|
+
* @private
|
|
9134
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9135
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
9136
|
+
* @param {string[]} orders The sort orders of `iteratees`.
|
|
9137
|
+
* @returns {Array} Returns the new sorted array.
|
|
9138
|
+
*/
|
|
9139
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
9140
|
+
if (iteratees.length) {
|
|
9141
|
+
iteratees = _arrayMap(iteratees, function(iteratee) {
|
|
9142
|
+
if (isArray_1(iteratee)) {
|
|
9143
|
+
return function(value) {
|
|
9144
|
+
return _baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
9145
|
+
}
|
|
9146
|
+
}
|
|
9147
|
+
return iteratee;
|
|
9148
|
+
});
|
|
9149
|
+
} else {
|
|
9150
|
+
iteratees = [identity_1];
|
|
9151
|
+
}
|
|
9152
|
+
|
|
9153
|
+
var index = -1;
|
|
9154
|
+
iteratees = _arrayMap(iteratees, _baseUnary(_baseIteratee));
|
|
9155
|
+
|
|
9156
|
+
var result = _baseMap(collection, function(value, key, collection) {
|
|
9157
|
+
var criteria = _arrayMap(iteratees, function(iteratee) {
|
|
9158
|
+
return iteratee(value);
|
|
9159
|
+
});
|
|
9160
|
+
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
9161
|
+
});
|
|
9162
|
+
|
|
9163
|
+
return _baseSortBy(result, function(object, other) {
|
|
9164
|
+
return _compareMultiple(object, other, orders);
|
|
9165
|
+
});
|
|
9166
|
+
}
|
|
9167
|
+
|
|
9168
|
+
var _baseOrderBy = baseOrderBy;
|
|
9169
|
+
|
|
9170
|
+
/**
|
|
9171
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
9172
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
9173
|
+
*
|
|
9174
|
+
* @private
|
|
9175
|
+
* @param {Function} func The function to invoke.
|
|
9176
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
9177
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
9178
|
+
* @returns {*} Returns the result of `func`.
|
|
9179
|
+
*/
|
|
9180
|
+
function apply(func, thisArg, args) {
|
|
9181
|
+
switch (args.length) {
|
|
9182
|
+
case 0: return func.call(thisArg);
|
|
9183
|
+
case 1: return func.call(thisArg, args[0]);
|
|
9184
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
9185
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
9186
|
+
}
|
|
9187
|
+
return func.apply(thisArg, args);
|
|
9188
|
+
}
|
|
9189
|
+
|
|
9190
|
+
var _apply = apply;
|
|
9191
|
+
|
|
9192
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9193
|
+
var nativeMax = Math.max;
|
|
9194
|
+
|
|
9195
|
+
/**
|
|
9196
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
9197
|
+
*
|
|
9198
|
+
* @private
|
|
9199
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9200
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9201
|
+
* @param {Function} transform The rest array transform.
|
|
9202
|
+
* @returns {Function} Returns the new function.
|
|
9203
|
+
*/
|
|
9204
|
+
function overRest(func, start, transform) {
|
|
9205
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
9206
|
+
return function() {
|
|
9207
|
+
var args = arguments,
|
|
9208
|
+
index = -1,
|
|
9209
|
+
length = nativeMax(args.length - start, 0),
|
|
9210
|
+
array = Array(length);
|
|
9211
|
+
|
|
9212
|
+
while (++index < length) {
|
|
9213
|
+
array[index] = args[start + index];
|
|
9214
|
+
}
|
|
9215
|
+
index = -1;
|
|
9216
|
+
var otherArgs = Array(start + 1);
|
|
9217
|
+
while (++index < start) {
|
|
9218
|
+
otherArgs[index] = args[index];
|
|
9219
|
+
}
|
|
9220
|
+
otherArgs[start] = transform(array);
|
|
9221
|
+
return _apply(func, this, otherArgs);
|
|
9222
|
+
};
|
|
9223
|
+
}
|
|
9224
|
+
|
|
9225
|
+
var _overRest = overRest;
|
|
9226
|
+
|
|
9227
|
+
/**
|
|
9228
|
+
* Creates a function that returns `value`.
|
|
9229
|
+
*
|
|
9230
|
+
* @static
|
|
9231
|
+
* @memberOf _
|
|
9232
|
+
* @since 2.4.0
|
|
9233
|
+
* @category Util
|
|
9234
|
+
* @param {*} value The value to return from the new function.
|
|
9235
|
+
* @returns {Function} Returns the new constant function.
|
|
9236
|
+
* @example
|
|
9237
|
+
*
|
|
9238
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
9239
|
+
*
|
|
9240
|
+
* console.log(objects);
|
|
9241
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
9242
|
+
*
|
|
9243
|
+
* console.log(objects[0] === objects[1]);
|
|
9244
|
+
* // => true
|
|
9245
|
+
*/
|
|
9246
|
+
function constant(value) {
|
|
9247
|
+
return function() {
|
|
9248
|
+
return value;
|
|
9249
|
+
};
|
|
9250
|
+
}
|
|
9251
|
+
|
|
9252
|
+
var constant_1 = constant;
|
|
9253
|
+
|
|
9254
|
+
var defineProperty = (function() {
|
|
9255
|
+
try {
|
|
9256
|
+
var func = _getNative(Object, 'defineProperty');
|
|
9257
|
+
func({}, '', {});
|
|
9258
|
+
return func;
|
|
9259
|
+
} catch (e) {}
|
|
9260
|
+
}());
|
|
9261
|
+
|
|
9262
|
+
var _defineProperty = defineProperty;
|
|
9263
|
+
|
|
9264
|
+
/**
|
|
9265
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
9266
|
+
*
|
|
9267
|
+
* @private
|
|
9268
|
+
* @param {Function} func The function to modify.
|
|
9269
|
+
* @param {Function} string The `toString` result.
|
|
9270
|
+
* @returns {Function} Returns `func`.
|
|
9271
|
+
*/
|
|
9272
|
+
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
|
9273
|
+
return _defineProperty(func, 'toString', {
|
|
9274
|
+
'configurable': true,
|
|
9275
|
+
'enumerable': false,
|
|
9276
|
+
'value': constant_1(string),
|
|
9277
|
+
'writable': true
|
|
9278
|
+
});
|
|
9279
|
+
};
|
|
9280
|
+
|
|
9281
|
+
var _baseSetToString = baseSetToString;
|
|
9282
|
+
|
|
9283
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
9284
|
+
var HOT_COUNT = 800,
|
|
9285
|
+
HOT_SPAN = 16;
|
|
9286
|
+
|
|
9287
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9288
|
+
var nativeNow = Date.now;
|
|
9289
|
+
|
|
9290
|
+
/**
|
|
9291
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
9292
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
9293
|
+
* milliseconds.
|
|
9294
|
+
*
|
|
9295
|
+
* @private
|
|
9296
|
+
* @param {Function} func The function to restrict.
|
|
9297
|
+
* @returns {Function} Returns the new shortable function.
|
|
9298
|
+
*/
|
|
9299
|
+
function shortOut(func) {
|
|
9300
|
+
var count = 0,
|
|
9301
|
+
lastCalled = 0;
|
|
9302
|
+
|
|
9303
|
+
return function() {
|
|
9304
|
+
var stamp = nativeNow(),
|
|
9305
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
9306
|
+
|
|
9307
|
+
lastCalled = stamp;
|
|
9308
|
+
if (remaining > 0) {
|
|
9309
|
+
if (++count >= HOT_COUNT) {
|
|
9310
|
+
return arguments[0];
|
|
9311
|
+
}
|
|
9312
|
+
} else {
|
|
9313
|
+
count = 0;
|
|
9314
|
+
}
|
|
9315
|
+
return func.apply(undefined, arguments);
|
|
9316
|
+
};
|
|
9317
|
+
}
|
|
9318
|
+
|
|
9319
|
+
var _shortOut = shortOut;
|
|
9320
|
+
|
|
9321
|
+
/**
|
|
9322
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
9323
|
+
*
|
|
9324
|
+
* @private
|
|
9325
|
+
* @param {Function} func The function to modify.
|
|
9326
|
+
* @param {Function} string The `toString` result.
|
|
9327
|
+
* @returns {Function} Returns `func`.
|
|
9328
|
+
*/
|
|
9329
|
+
var setToString = _shortOut(_baseSetToString);
|
|
9330
|
+
|
|
9331
|
+
var _setToString = setToString;
|
|
9332
|
+
|
|
9333
|
+
/**
|
|
9334
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
9335
|
+
*
|
|
9336
|
+
* @private
|
|
9337
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9338
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9339
|
+
* @returns {Function} Returns the new function.
|
|
9340
|
+
*/
|
|
9341
|
+
function baseRest(func, start) {
|
|
9342
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
9343
|
+
}
|
|
9344
|
+
|
|
9345
|
+
var _baseRest = baseRest;
|
|
9346
|
+
|
|
9347
|
+
/**
|
|
9348
|
+
* Checks if the given arguments are from an iteratee call.
|
|
9349
|
+
*
|
|
9350
|
+
* @private
|
|
9351
|
+
* @param {*} value The potential iteratee value argument.
|
|
9352
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
9353
|
+
* @param {*} object The potential iteratee object argument.
|
|
9354
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
9355
|
+
* else `false`.
|
|
9356
|
+
*/
|
|
9357
|
+
function isIterateeCall(value, index, object) {
|
|
9358
|
+
if (!isObject_1(object)) {
|
|
9359
|
+
return false;
|
|
9360
|
+
}
|
|
9361
|
+
var type = typeof index;
|
|
9362
|
+
if (type == 'number'
|
|
9363
|
+
? (isArrayLike_1(object) && _isIndex(index, object.length))
|
|
9364
|
+
: (type == 'string' && index in object)
|
|
9365
|
+
) {
|
|
9366
|
+
return eq_1(object[index], value);
|
|
9367
|
+
}
|
|
9368
|
+
return false;
|
|
9369
|
+
}
|
|
9370
|
+
|
|
9371
|
+
var _isIterateeCall = isIterateeCall;
|
|
9372
|
+
|
|
9373
|
+
/**
|
|
9374
|
+
* Creates an array of elements, sorted in ascending order by the results of
|
|
9375
|
+
* running each element in a collection thru each iteratee. This method
|
|
9376
|
+
* performs a stable sort, that is, it preserves the original sort order of
|
|
9377
|
+
* equal elements. The iteratees are invoked with one argument: (value).
|
|
9378
|
+
*
|
|
9379
|
+
* @static
|
|
9380
|
+
* @memberOf _
|
|
9381
|
+
* @since 0.1.0
|
|
9382
|
+
* @category Collection
|
|
9383
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9384
|
+
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
9385
|
+
* The iteratees to sort by.
|
|
9386
|
+
* @returns {Array} Returns the new sorted array.
|
|
9387
|
+
* @example
|
|
9388
|
+
*
|
|
9389
|
+
* var users = [
|
|
9390
|
+
* { 'user': 'fred', 'age': 48 },
|
|
9391
|
+
* { 'user': 'barney', 'age': 36 },
|
|
9392
|
+
* { 'user': 'fred', 'age': 30 },
|
|
9393
|
+
* { 'user': 'barney', 'age': 34 }
|
|
9394
|
+
* ];
|
|
9395
|
+
*
|
|
9396
|
+
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
9397
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
9398
|
+
*
|
|
9399
|
+
* _.sortBy(users, ['user', 'age']);
|
|
9400
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
9401
|
+
*/
|
|
9402
|
+
var sortBy = _baseRest(function(collection, iteratees) {
|
|
9403
|
+
if (collection == null) {
|
|
9404
|
+
return [];
|
|
9405
|
+
}
|
|
9406
|
+
var length = iteratees.length;
|
|
9407
|
+
if (length > 1 && _isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
9408
|
+
iteratees = [];
|
|
9409
|
+
} else if (length > 2 && _isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
9410
|
+
iteratees = [iteratees[0]];
|
|
9411
|
+
}
|
|
9412
|
+
return _baseOrderBy(collection, _baseFlatten(iteratees, 1), []);
|
|
9413
|
+
});
|
|
9414
|
+
|
|
9415
|
+
var sortBy_1 = sortBy;
|
|
9416
|
+
|
|
9417
|
+
/**
|
|
9418
|
+
* Configuration for custom action validation rules.
|
|
9419
|
+
* Defines allowed positions, metadata IDs, data model IDs, and fields for each target
|
|
9420
|
+
* type.
|
|
9421
|
+
*
|
|
9422
|
+
*/
|
|
9423
|
+
const customActionValidationConfig = {
|
|
9424
|
+
[CustomActionTarget.LIVEBOARD]: {
|
|
9425
|
+
positions: [CustomActionsPosition.PRIMARY, CustomActionsPosition.MENU],
|
|
9426
|
+
allowedMetadataIds: ['liveboardIds'],
|
|
9427
|
+
allowedDataModelIds: [],
|
|
9428
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds'],
|
|
9429
|
+
},
|
|
9430
|
+
[CustomActionTarget.VIZ]: {
|
|
9431
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.PRIMARY, CustomActionsPosition.CONTEXTMENU],
|
|
9432
|
+
allowedMetadataIds: ['liveboardIds', 'vizIds', 'answerIds'],
|
|
9433
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9434
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9435
|
+
},
|
|
9436
|
+
[CustomActionTarget.ANSWER]: {
|
|
9437
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.PRIMARY, CustomActionsPosition.CONTEXTMENU],
|
|
9438
|
+
allowedMetadataIds: ['answerIds'],
|
|
9439
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9440
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9441
|
+
},
|
|
9442
|
+
[CustomActionTarget.SPOTTER]: {
|
|
9443
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.CONTEXTMENU],
|
|
9444
|
+
allowedMetadataIds: [],
|
|
9445
|
+
allowedDataModelIds: ['modelIds'],
|
|
9446
|
+
allowedFields: ['name', 'id', 'position', 'target', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9447
|
+
},
|
|
9448
|
+
};
|
|
9449
|
+
/**
|
|
9450
|
+
* Validates a single custom action based on its target type
|
|
9451
|
+
* @param action - The custom action to validate
|
|
9452
|
+
* @param primaryActionsPerTarget - Map to track primary actions per target
|
|
9453
|
+
* @returns CustomActionValidation with isValid flag and reason string
|
|
9454
|
+
*
|
|
9455
|
+
* @hidden
|
|
9456
|
+
*/
|
|
9457
|
+
const validateCustomAction = (action, primaryActionsPerTarget) => {
|
|
9458
|
+
const { id: actionId, target: targetType, position, metadataIds, dataModelIds } = action;
|
|
9459
|
+
// Check if target type is supported
|
|
9460
|
+
if (!customActionValidationConfig[targetType]) {
|
|
9461
|
+
const errorMessage = CUSTOM_ACTIONS_ERROR_MESSAGE.UNSUPPORTED_TARGET(actionId, targetType);
|
|
9462
|
+
return { isValid: false, errors: [errorMessage] };
|
|
9463
|
+
}
|
|
9464
|
+
const config = customActionValidationConfig[targetType];
|
|
9465
|
+
const errors = [];
|
|
9466
|
+
// Validate position
|
|
9467
|
+
if (!arrayIncludesString(config.positions, position)) {
|
|
9468
|
+
const supportedPositions = config.positions.join(', ');
|
|
9469
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_POSITION(position, targetType, supportedPositions));
|
|
9470
|
+
}
|
|
9471
|
+
// Validate metadata IDs
|
|
9472
|
+
if (metadataIds) {
|
|
9473
|
+
const invalidMetadataIds = Object.keys(metadataIds).filter((key) => !arrayIncludesString(config.allowedMetadataIds, key));
|
|
9474
|
+
if (invalidMetadataIds.length > 0) {
|
|
9475
|
+
const supportedMetadataIds = config.allowedMetadataIds.length > 0 ? config.allowedMetadataIds.join(', ') : 'none';
|
|
9476
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_METADATA_IDS(targetType, invalidMetadataIds, supportedMetadataIds));
|
|
9477
|
+
}
|
|
8010
9478
|
}
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
9479
|
+
// Validate data model IDs
|
|
9480
|
+
if (dataModelIds) {
|
|
9481
|
+
const invalidDataModelIds = Object.keys(dataModelIds).filter((key) => !arrayIncludesString(config.allowedDataModelIds, key));
|
|
9482
|
+
if (invalidDataModelIds.length > 0) {
|
|
9483
|
+
const supportedDataModelIds = config.allowedDataModelIds.length > 0 ? config.allowedDataModelIds.join(', ') : 'none';
|
|
9484
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_DATA_MODEL_IDS(targetType, invalidDataModelIds, supportedDataModelIds));
|
|
8014
9485
|
}
|
|
8015
|
-
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8016
|
-
return this.answer;
|
|
8017
|
-
}
|
|
8018
|
-
async getTML() {
|
|
8019
|
-
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8020
|
-
const edoc = object[0].edoc;
|
|
8021
|
-
const YAML = await import('./index-BDlM0f0T.js');
|
|
8022
|
-
const parsedDoc = YAML.parse(edoc);
|
|
8023
|
-
return {
|
|
8024
|
-
answer: {
|
|
8025
|
-
...parsedDoc.answer,
|
|
8026
|
-
...this.tmlOverride,
|
|
8027
|
-
},
|
|
8028
|
-
};
|
|
8029
|
-
}
|
|
8030
|
-
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8031
|
-
const { displayMode, visualizations } = await this.getAnswer();
|
|
8032
|
-
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8033
|
-
return this.executeQuery(addVizToLiveboard, {
|
|
8034
|
-
liveboardId,
|
|
8035
|
-
vizId: viz.id,
|
|
8036
|
-
});
|
|
8037
9486
|
}
|
|
8038
|
-
|
|
8039
|
-
|
|
9487
|
+
// Validate allowed fields
|
|
9488
|
+
const actionKeys = Object.keys(action);
|
|
9489
|
+
const invalidFields = actionKeys.filter((key) => !arrayIncludesString(config.allowedFields, key));
|
|
9490
|
+
if (invalidFields.length > 0) {
|
|
9491
|
+
const supportedFields = config.allowedFields.join(', ');
|
|
9492
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_FIELDS(targetType, invalidFields, supportedFields));
|
|
8040
9493
|
}
|
|
8041
|
-
|
|
9494
|
+
return {
|
|
9495
|
+
isValid: errors.length === 0,
|
|
9496
|
+
errors,
|
|
9497
|
+
};
|
|
9498
|
+
};
|
|
8042
9499
|
/**
|
|
9500
|
+
* Validates basic action structure and required fields
|
|
9501
|
+
* @param action - The action to validate
|
|
9502
|
+
* @returns Object containing validation result and missing fields
|
|
8043
9503
|
*
|
|
8044
|
-
* @
|
|
8045
|
-
* @param colNames
|
|
9504
|
+
* @hidden
|
|
8046
9505
|
*/
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
}));
|
|
8056
|
-
}
|
|
9506
|
+
const validateActionStructure = (action) => {
|
|
9507
|
+
if (!action || typeof action !== 'object') {
|
|
9508
|
+
return { isValid: false, missingFields: [] };
|
|
9509
|
+
}
|
|
9510
|
+
// Check for all missing required fields
|
|
9511
|
+
const missingFields = ['id', 'name', 'target', 'position'].filter(field => !action[field]);
|
|
9512
|
+
return { isValid: missingFields.length === 0, missingFields };
|
|
9513
|
+
};
|
|
8057
9514
|
/**
|
|
9515
|
+
* Checks for duplicate IDs among actions
|
|
9516
|
+
* @param actions - Array of actions to check
|
|
9517
|
+
* @returns Object containing filtered actions and duplicate errors
|
|
8058
9518
|
*
|
|
8059
|
-
* @
|
|
9519
|
+
* @hidden
|
|
8060
9520
|
*/
|
|
8061
|
-
|
|
8062
|
-
const
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
let dataValue;
|
|
8072
|
-
if (dataType === 'DATE') {
|
|
8073
|
-
if (Number.isFinite(colVal.value)) {
|
|
8074
|
-
dataValue = [{
|
|
8075
|
-
epochRange: {
|
|
8076
|
-
startEpoch: colVal.value,
|
|
8077
|
-
},
|
|
8078
|
-
}];
|
|
8079
|
-
// Case for custom calendar.
|
|
8080
|
-
}
|
|
8081
|
-
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8082
|
-
dataValue = [{
|
|
8083
|
-
epochRange: {
|
|
8084
|
-
startEpoch: colVal.value.v.s,
|
|
8085
|
-
endEpoch: colVal.value.v.e,
|
|
8086
|
-
},
|
|
8087
|
-
}];
|
|
8088
|
-
}
|
|
9521
|
+
const filterDuplicateIds = (actions) => {
|
|
9522
|
+
const idMap = actions.reduce((map, action) => {
|
|
9523
|
+
const list = map.get(action.id) || [];
|
|
9524
|
+
list.push(action);
|
|
9525
|
+
map.set(action.id, list);
|
|
9526
|
+
return map;
|
|
9527
|
+
}, new Map());
|
|
9528
|
+
const { actions: actionsWithUniqueIds, errors } = Array.from(idMap.entries()).reduce((acc, [id, actionsWithSameId]) => {
|
|
9529
|
+
if (actionsWithSameId.length === 1) {
|
|
9530
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
8089
9531
|
}
|
|
8090
9532
|
else {
|
|
8091
|
-
|
|
9533
|
+
// Keep the first action and add error for duplicates
|
|
9534
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
9535
|
+
const duplicateNames = actionsWithSameId.slice(1).map(action => action.name);
|
|
9536
|
+
acc.errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.DUPLICATE_IDS(id, duplicateNames, actionsWithSameId[0].name));
|
|
8092
9537
|
}
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
}
|
|
8098
|
-
selectedPoints.forEach((p) => {
|
|
8099
|
-
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8100
|
-
});
|
|
8101
|
-
return underlyingDataPoint;
|
|
8102
|
-
}
|
|
9538
|
+
return acc;
|
|
9539
|
+
}, { actions: [], errors: [] });
|
|
9540
|
+
return { actions: actionsWithUniqueIds, errors };
|
|
9541
|
+
};
|
|
8103
9542
|
/**
|
|
8104
|
-
*
|
|
8105
|
-
* @param
|
|
8106
|
-
* @
|
|
9543
|
+
* Validates and processes custom actions
|
|
9544
|
+
* @param customActions - Array of custom actions to validate
|
|
9545
|
+
* @returns Object containing valid actions and any validation errors
|
|
8107
9546
|
*/
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
9547
|
+
const getCustomActions = (customActions) => {
|
|
9548
|
+
const errors = [];
|
|
9549
|
+
if (!customActions || !Array.isArray(customActions)) {
|
|
9550
|
+
return { actions: [], errors: [] };
|
|
9551
|
+
}
|
|
9552
|
+
// Step 1: Handle invalid actions first (null, undefined, missing required
|
|
9553
|
+
// fields)
|
|
9554
|
+
const validActions = customActions.filter(action => {
|
|
9555
|
+
const validation = validateActionStructure(action);
|
|
9556
|
+
if (!validation.isValid) {
|
|
9557
|
+
if (!action || typeof action !== 'object') {
|
|
9558
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_ACTION_OBJECT);
|
|
9559
|
+
}
|
|
9560
|
+
else {
|
|
9561
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.MISSING_REQUIRED_FIELDS(action.id, validation.missingFields));
|
|
9562
|
+
}
|
|
9563
|
+
return false;
|
|
9564
|
+
}
|
|
9565
|
+
return true;
|
|
9566
|
+
});
|
|
9567
|
+
// Step 2: Check for duplicate IDs among valid actions
|
|
9568
|
+
const { actions: actionsWithUniqueIds, errors: duplicateErrors } = filterDuplicateIds(validActions);
|
|
9569
|
+
// Add duplicate errors to the errors array
|
|
9570
|
+
duplicateErrors.forEach(error => errors.push(error));
|
|
9571
|
+
// Step 3: Validate actions with unique IDs
|
|
9572
|
+
const finalValidActions = [];
|
|
9573
|
+
actionsWithUniqueIds.forEach((action) => {
|
|
9574
|
+
const { isValid, errors: validationErrors } = validateCustomAction(action);
|
|
9575
|
+
validationErrors.forEach(error => errors.push(error));
|
|
9576
|
+
if (isValid) {
|
|
9577
|
+
finalValidActions.push(action);
|
|
9578
|
+
}
|
|
9579
|
+
});
|
|
9580
|
+
const sortedActions = sortBy_1(finalValidActions, (a) => a.name.toLocaleLowerCase());
|
|
9581
|
+
return {
|
|
9582
|
+
actions: sortedActions,
|
|
9583
|
+
errors: errors,
|
|
9584
|
+
};
|
|
9585
|
+
};
|
|
8118
9586
|
|
|
8119
9587
|
/**
|
|
8120
9588
|
* Copyright (c) 2023
|
|
@@ -15808,6 +17276,13 @@ function processExitPresentMode(e) {
|
|
|
15808
17276
|
handleExitPresentMode();
|
|
15809
17277
|
}
|
|
15810
17278
|
}
|
|
17279
|
+
/**
|
|
17280
|
+
* Clears the cached preauth and session info.
|
|
17281
|
+
*/
|
|
17282
|
+
function processClearInfoCache() {
|
|
17283
|
+
resetCachedPreauthInfo();
|
|
17284
|
+
resetCachedSessionInfo();
|
|
17285
|
+
}
|
|
15811
17286
|
/**
|
|
15812
17287
|
*
|
|
15813
17288
|
* @param e
|
|
@@ -15914,11 +17389,13 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
15914
17389
|
return processAuthLogout(e, containerEl);
|
|
15915
17390
|
case EmbedEvent.ExitPresentMode:
|
|
15916
17391
|
return processExitPresentMode();
|
|
17392
|
+
case EmbedEvent.CLEAR_INFO_CACHE:
|
|
17393
|
+
return processClearInfoCache();
|
|
15917
17394
|
}
|
|
15918
17395
|
return e;
|
|
15919
17396
|
}
|
|
15920
17397
|
|
|
15921
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.41.0
|
|
17398
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.41.0";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/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};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","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@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/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",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:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};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","embedded","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$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],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};
|
|
15922
17399
|
|
|
15923
17400
|
/**
|
|
15924
17401
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -16229,10 +17706,10 @@ class TsEmbed {
|
|
|
16229
17706
|
};
|
|
16230
17707
|
this.showPreRenderByDefault = false;
|
|
16231
17708
|
/**
|
|
16232
|
-
|
|
16233
|
-
|
|
16234
|
-
|
|
16235
|
-
|
|
17709
|
+
* @hidden
|
|
17710
|
+
* Internal state to track if the embed container is loaded.
|
|
17711
|
+
* This is used to trigger events after the embed container is loaded.
|
|
17712
|
+
*/
|
|
16236
17713
|
this.isEmbedContainerLoaded = false;
|
|
16237
17714
|
/**
|
|
16238
17715
|
* @hidden
|
|
@@ -16291,10 +17768,10 @@ class TsEmbed {
|
|
|
16291
17768
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
16292
17769
|
...viewConfig,
|
|
16293
17770
|
});
|
|
16294
|
-
const embedConfig = getEmbedConfig();
|
|
16295
|
-
this.embedConfig = embedConfig;
|
|
16296
17771
|
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
16297
17772
|
this.isReadyForRenderPromise = getInitPromise().then(async () => {
|
|
17773
|
+
const embedConfig = getEmbedConfig();
|
|
17774
|
+
this.embedConfig = embedConfig;
|
|
16298
17775
|
if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
|
|
16299
17776
|
this.embedConfig.authTriggerContainer = domSelector;
|
|
16300
17777
|
}
|
|
@@ -16443,6 +17920,16 @@ class TsEmbed {
|
|
|
16443
17920
|
async getDefaultAppInitData() {
|
|
16444
17921
|
var _a, _b;
|
|
16445
17922
|
const authToken = await this.getAuthTokenForCookielessInit();
|
|
17923
|
+
const customActionsResult = getCustomActions([
|
|
17924
|
+
...(this.viewConfig.customActions || []),
|
|
17925
|
+
...(this.embedConfig.customActions || [])
|
|
17926
|
+
]);
|
|
17927
|
+
if (customActionsResult.errors.length > 0) {
|
|
17928
|
+
this.handleError({
|
|
17929
|
+
type: 'CUSTOM_ACTION_VALIDATION',
|
|
17930
|
+
message: customActionsResult.errors,
|
|
17931
|
+
});
|
|
17932
|
+
}
|
|
16446
17933
|
return {
|
|
16447
17934
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
16448
17935
|
authToken,
|
|
@@ -16460,6 +17947,7 @@ class TsEmbed {
|
|
|
16460
17947
|
: [],
|
|
16461
17948
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
16462
17949
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
17950
|
+
customActions: customActionsResult.actions,
|
|
16463
17951
|
};
|
|
16464
17952
|
}
|
|
16465
17953
|
async getAppInitData() {
|
|
@@ -16479,11 +17967,6 @@ class TsEmbed {
|
|
|
16479
17967
|
.join('/');
|
|
16480
17968
|
return `${basePath}#`;
|
|
16481
17969
|
}
|
|
16482
|
-
getUpdateEmbedParamsObject() {
|
|
16483
|
-
let queryParams = this.getEmbedParamsObject();
|
|
16484
|
-
queryParams = { ...this.viewConfig, ...queryParams };
|
|
16485
|
-
return queryParams;
|
|
16486
|
-
}
|
|
16487
17970
|
/**
|
|
16488
17971
|
* Common query params set for all the embed modes.
|
|
16489
17972
|
* @param queryParams
|
|
@@ -16633,13 +18116,9 @@ class TsEmbed {
|
|
|
16633
18116
|
return path;
|
|
16634
18117
|
}
|
|
16635
18118
|
getEmbedParams() {
|
|
16636
|
-
const queryParams = this.
|
|
18119
|
+
const queryParams = this.getBaseQueryParams();
|
|
16637
18120
|
return getQueryParamString(queryParams);
|
|
16638
18121
|
}
|
|
16639
|
-
getEmbedParamsObject() {
|
|
16640
|
-
const params = this.getBaseQueryParams();
|
|
16641
|
-
return params;
|
|
16642
|
-
}
|
|
16643
18122
|
getRootIframeSrc() {
|
|
16644
18123
|
const query = this.getEmbedParams();
|
|
16645
18124
|
return this.getEmbedBasePath(query);
|
|
@@ -17200,12 +18679,7 @@ class TsEmbed {
|
|
|
17200
18679
|
return this.preRender(true);
|
|
17201
18680
|
}
|
|
17202
18681
|
this.validatePreRenderViewConfig(this.viewConfig);
|
|
17203
|
-
logger$3.debug('triggering UpdateEmbedParams', this.viewConfig);
|
|
17204
|
-
this.executeAfterEmbedContainerLoaded(() => {
|
|
17205
|
-
this.trigger(HostEvent.UpdateEmbedParams, this.getUpdateEmbedParamsObject());
|
|
17206
|
-
});
|
|
17207
18682
|
}
|
|
17208
|
-
this.beforePrerenderVisible();
|
|
17209
18683
|
if (this.el) {
|
|
17210
18684
|
this.syncPreRenderStyle();
|
|
17211
18685
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
@@ -17222,6 +18696,7 @@ class TsEmbed {
|
|
|
17222
18696
|
this.resizeObserver.observe(this.el);
|
|
17223
18697
|
}
|
|
17224
18698
|
}
|
|
18699
|
+
this.beforePrerenderVisible();
|
|
17225
18700
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
17226
18701
|
this.subscribeToEvents();
|
|
17227
18702
|
// Setup fullscreen change handler for prerendered components
|
|
@@ -17495,6 +18970,11 @@ var HomePage;
|
|
|
17495
18970
|
* It serves as the foundational version of the home page.
|
|
17496
18971
|
*/
|
|
17497
18972
|
HomePage["Modular"] = "v2";
|
|
18973
|
+
/**
|
|
18974
|
+
* ModularWithStylingChanges (v3) introduces Modular Home Experience
|
|
18975
|
+
* with styling changes.
|
|
18976
|
+
*/
|
|
18977
|
+
HomePage["ModularWithStylingChanges"] = "v3";
|
|
17498
18978
|
})(HomePage || (HomePage = {}));
|
|
17499
18979
|
/**
|
|
17500
18980
|
* Define the version of the list page
|
|
@@ -17582,7 +19062,7 @@ class AppEmbed extends V1Embed {
|
|
|
17582
19062
|
* embedded Liveboard or visualization.
|
|
17583
19063
|
*/
|
|
17584
19064
|
getEmbedParams() {
|
|
17585
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
19065
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17586
19066
|
let params = {};
|
|
17587
19067
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17588
19068
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17599,6 +19079,7 @@ class AppEmbed extends V1Embed {
|
|
|
17599
19079
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17600
19080
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
17601
19081
|
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
19082
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
17602
19083
|
params = this.getBaseQueryParams(params);
|
|
17603
19084
|
if (hideObjectSearch) {
|
|
17604
19085
|
params[Param.HideObjectSearch] = !!hideObjectSearch;
|
|
@@ -17666,6 +19147,12 @@ class AppEmbed extends V1Embed {
|
|
|
17666
19147
|
// To use v3 navigation, we must manually set the discoveryExperience
|
|
17667
19148
|
// settings.
|
|
17668
19149
|
params[Param.NavigationVersion] = 'v2';
|
|
19150
|
+
// Set homePageVersion to v2 by default to reset the LD flag value
|
|
19151
|
+
// for the homepageVersion.
|
|
19152
|
+
params[Param.HomepageVersion] = 'v2';
|
|
19153
|
+
// Set listpageVersion to v2 by default to reset the LD flag value
|
|
19154
|
+
// for the listpageVersion.
|
|
19155
|
+
params[Param.ListPageVersion] = ListPage.List;
|
|
17669
19156
|
if (discoveryExperience) {
|
|
17670
19157
|
// primaryNavbarVersion v3 will enabled the new left navigation
|
|
17671
19158
|
if (discoveryExperience.primaryNavbarVersion === PrimaryNavbarVersion.Sliding) {
|
|
@@ -17678,6 +19165,12 @@ class AppEmbed extends V1Embed {
|
|
|
17678
19165
|
if (discoveryExperience.homePage === HomePage.Modular) {
|
|
17679
19166
|
params[Param.ModularHomeExperienceEnabled] = true;
|
|
17680
19167
|
}
|
|
19168
|
+
// ModularWithStylingChanges (v3) introduces the styling changes
|
|
19169
|
+
// to the Modular Homepage.
|
|
19170
|
+
// v3 will be the base version of homePageVersion.
|
|
19171
|
+
if (discoveryExperience.homePage === HomePage.ModularWithStylingChanges) {
|
|
19172
|
+
params[Param.HomepageVersion] = HomePage.ModularWithStylingChanges;
|
|
19173
|
+
}
|
|
17681
19174
|
// listPageVersion v3 will enable the new list page
|
|
17682
19175
|
if (discoveryExperience.listPageVersion === ListPage.ListWithUXChanges) {
|
|
17683
19176
|
params[Param.ListPageVersion] = discoveryExperience.listPageVersion;
|
|
@@ -17981,14 +19474,9 @@ class LiveboardEmbed extends V1Embed {
|
|
|
17981
19474
|
* embedded Liveboard or visualization.
|
|
17982
19475
|
*/
|
|
17983
19476
|
getEmbedParams() {
|
|
17984
|
-
const params = this.getEmbedParamsObject();
|
|
17985
|
-
const queryParams = getQueryParamString(params, true);
|
|
17986
|
-
return queryParams;
|
|
17987
|
-
}
|
|
17988
|
-
getEmbedParamsObject() {
|
|
17989
19477
|
let params = {};
|
|
17990
19478
|
params = this.getBaseQueryParams(params);
|
|
17991
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = false, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
19479
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = false, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17992
19480
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
17993
19481
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
17994
19482
|
if (fullHeight === true) {
|
|
@@ -18055,27 +19543,9 @@ class LiveboardEmbed extends V1Embed {
|
|
|
18055
19543
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18056
19544
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18057
19545
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
if (isForceRedirect) {
|
|
18062
|
-
params[Param.IsForceRedirect] = isForceRedirect;
|
|
18063
|
-
}
|
|
18064
|
-
if (dataSourceId !== undefined) {
|
|
18065
|
-
params[Param.DataSourceId] = dataSourceId;
|
|
18066
|
-
}
|
|
18067
|
-
if (isLiveboardStylingAndGroupingEnabled !== undefined) {
|
|
18068
|
-
params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
|
|
18069
|
-
}
|
|
18070
|
-
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
18071
|
-
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
18072
|
-
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
18073
|
-
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
18074
|
-
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
18075
|
-
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18076
|
-
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18077
|
-
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
18078
|
-
return params;
|
|
19546
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
19547
|
+
const queryParams = getQueryParamString(params, true);
|
|
19548
|
+
return queryParams;
|
|
18079
19549
|
}
|
|
18080
19550
|
getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
|
|
18081
19551
|
let suffix = `/embed/viz/${liveboardId}`;
|
|
@@ -18317,9 +19787,11 @@ class SearchEmbed extends TsEmbed {
|
|
|
18317
19787
|
const defaultAppInitData = await super.getAppInitData();
|
|
18318
19788
|
return { ...defaultAppInitData, ...this.getSearchInitData() };
|
|
18319
19789
|
}
|
|
18320
|
-
|
|
19790
|
+
getEmbedParams() {
|
|
18321
19791
|
var _a;
|
|
18322
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
19792
|
+
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
19793
|
+
/* eslint-disable-next-line max-len */
|
|
19794
|
+
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, focusSearchBarOnRender = true, excludeRuntimeParametersfromURL, excludeSearchTokenStringFromURL, collapseSearchBar = true, } = this.viewConfig;
|
|
18323
19795
|
const queryParams = this.getBaseQueryParams();
|
|
18324
19796
|
queryParams[Param.HideActions] = [
|
|
18325
19797
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -18352,6 +19824,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
18352
19824
|
queryParams[Param.HideSearchBar] = true;
|
|
18353
19825
|
}
|
|
18354
19826
|
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19827
|
+
/* eslint-disable-next-line max-len */
|
|
18355
19828
|
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
18356
19829
|
}
|
|
18357
19830
|
if (!focusSearchBarOnRender) {
|
|
@@ -18364,22 +19837,20 @@ class SearchEmbed extends TsEmbed {
|
|
|
18364
19837
|
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
18365
19838
|
}
|
|
18366
19839
|
queryParams[Param.searchEmbed] = true;
|
|
19840
|
+
/* eslint-disable-next-line max-len */
|
|
18367
19841
|
queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
|
|
18368
19842
|
queryParams[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18369
19843
|
if (dataPanelCustomGroupsAccordionInitialState
|
|
18370
19844
|
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
18371
19845
|
|| dataPanelCustomGroupsAccordionInitialState
|
|
18372
19846
|
=== DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST) {
|
|
19847
|
+
/* eslint-disable-next-line max-len */
|
|
18373
19848
|
queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
|
|
18374
19849
|
}
|
|
18375
19850
|
else {
|
|
19851
|
+
/* eslint-disable-next-line max-len */
|
|
18376
19852
|
queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
|
|
18377
19853
|
}
|
|
18378
|
-
return queryParams;
|
|
18379
|
-
}
|
|
18380
|
-
getEmbedParams() {
|
|
18381
|
-
const { runtimeParameters, runtimeFilters, excludeRuntimeParametersfromURL, excludeRuntimeFiltersfromURL, } = this.viewConfig;
|
|
18382
|
-
const queryParams = this.getEmbedParamsObject();
|
|
18383
19854
|
let query = '';
|
|
18384
19855
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18385
19856
|
if (queryParamsString) {
|
|
@@ -18435,9 +19906,15 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
18435
19906
|
this.embedComponentType = 'SearchBarEmbed';
|
|
18436
19907
|
this.viewConfig = viewConfig;
|
|
18437
19908
|
}
|
|
18438
|
-
|
|
19909
|
+
/**
|
|
19910
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
19911
|
+
* loaded in the iframe
|
|
19912
|
+
* @param dataSources A list of data source GUIDs
|
|
19913
|
+
*/
|
|
19914
|
+
getIFrameSrc() {
|
|
18439
19915
|
var _a;
|
|
18440
19916
|
const { searchOptions, dataSource, dataSources, useLastSelectedSources = false, excludeSearchTokenStringFromURL, } = this.viewConfig;
|
|
19917
|
+
const path = 'search-bar-embed';
|
|
18441
19918
|
const queryParams = this.getBaseQueryParams();
|
|
18442
19919
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
18443
19920
|
if (dataSources && dataSources.length) {
|
|
@@ -18459,16 +19936,6 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
18459
19936
|
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
18460
19937
|
}
|
|
18461
19938
|
queryParams[Param.searchEmbed] = true;
|
|
18462
|
-
return queryParams;
|
|
18463
|
-
}
|
|
18464
|
-
/**
|
|
18465
|
-
* Construct the URL of the embedded ThoughtSpot search to be
|
|
18466
|
-
* loaded in the iframe
|
|
18467
|
-
* @param dataSources A list of data source GUIDs
|
|
18468
|
-
*/
|
|
18469
|
-
getIFrameSrc() {
|
|
18470
|
-
const queryParams = this.getEmbedParamsObject();
|
|
18471
|
-
const path = 'search-bar-embed';
|
|
18472
19939
|
let query = '';
|
|
18473
19940
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18474
19941
|
if (queryParamsString) {
|
|
@@ -18891,17 +20358,13 @@ class ConversationMessage extends TsEmbed {
|
|
|
18891
20358
|
super(container, viewConfig);
|
|
18892
20359
|
this.viewConfig = viewConfig;
|
|
18893
20360
|
}
|
|
18894
|
-
|
|
20361
|
+
getIframeSrc() {
|
|
18895
20362
|
var _a;
|
|
20363
|
+
const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
|
|
20364
|
+
const path = 'conv-assist-answer';
|
|
18896
20365
|
const queryParams = this.getBaseQueryParams();
|
|
18897
20366
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
18898
20367
|
queryParams[Param.isSpotterAgentEmbed] = true;
|
|
18899
|
-
return queryParams;
|
|
18900
|
-
}
|
|
18901
|
-
getIframeSrc() {
|
|
18902
|
-
const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
|
|
18903
|
-
const path = 'conv-assist-answer';
|
|
18904
|
-
const queryParams = this.getEmbedParamsObject();
|
|
18905
20368
|
let query = '';
|
|
18906
20369
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18907
20370
|
if (queryParamsString) {
|
|
@@ -19062,8 +20525,9 @@ class SpotterEmbed extends TsEmbed {
|
|
|
19062
20525
|
super(container, viewConfig);
|
|
19063
20526
|
this.viewConfig = viewConfig;
|
|
19064
20527
|
}
|
|
19065
|
-
|
|
20528
|
+
getIframeSrc() {
|
|
19066
20529
|
const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
20530
|
+
const path = 'insights/conv-assist';
|
|
19067
20531
|
if (!worksheetId) {
|
|
19068
20532
|
this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
|
|
19069
20533
|
}
|
|
@@ -19084,12 +20548,6 @@ class SpotterEmbed extends TsEmbed {
|
|
|
19084
20548
|
if (!isUndefined_1(hideSampleQuestions)) {
|
|
19085
20549
|
queryParams[Param.HideSampleQuestions] = !!hideSampleQuestions;
|
|
19086
20550
|
}
|
|
19087
|
-
return queryParams;
|
|
19088
|
-
}
|
|
19089
|
-
getIframeSrc() {
|
|
19090
|
-
const { worksheetId, searchOptions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
19091
|
-
const path = 'insights/conv-assist';
|
|
19092
|
-
const queryParams = this.getEmbedParamsObject();
|
|
19093
20551
|
let query = '';
|
|
19094
20552
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
19095
20553
|
if (queryParamsString) {
|
|
@@ -19161,7 +20619,12 @@ class SageEmbed extends V1Embed {
|
|
|
19161
20619
|
viewConfig.embedComponentType = 'SageEmbed';
|
|
19162
20620
|
super(domSelector, viewConfig);
|
|
19163
20621
|
}
|
|
19164
|
-
|
|
20622
|
+
/**
|
|
20623
|
+
* Constructs a map of parameters to be passed on to the
|
|
20624
|
+
* embedded Eureka or Sage search page.
|
|
20625
|
+
* @returns {string} query string
|
|
20626
|
+
*/
|
|
20627
|
+
getEmbedParams() {
|
|
19165
20628
|
const { disableWorksheetChange, hideWorksheetSelector, showObjectSuggestions, dataPanelV2, hideSampleQuestions, isProductTour, hideSageAnswerHeader, hideAutocompleteSuggestions, } = this.viewConfig;
|
|
19166
20629
|
const params = this.getBaseQueryParams();
|
|
19167
20630
|
params[Param.DataPanelV2Enabled] = !!dataPanelV2;
|
|
@@ -19176,15 +20639,6 @@ class SageEmbed extends V1Embed {
|
|
|
19176
20639
|
params[Param.HideSampleQuestions] = !!hideSampleQuestions;
|
|
19177
20640
|
params[Param.IsProductTour] = !!isProductTour;
|
|
19178
20641
|
params[Param.HideSageAnswerHeader] = !!hideSageAnswerHeader;
|
|
19179
|
-
return params;
|
|
19180
|
-
}
|
|
19181
|
-
/**
|
|
19182
|
-
* Constructs a map of parameters to be passed on to the
|
|
19183
|
-
* embedded Eureka or Sage search page.
|
|
19184
|
-
* @returns {string} query string
|
|
19185
|
-
*/
|
|
19186
|
-
getEmbedParams() {
|
|
19187
|
-
const params = this.getEmbedParamsObject();
|
|
19188
20642
|
return getQueryParamString(params, true);
|
|
19189
20643
|
}
|
|
19190
20644
|
/**
|
|
@@ -19745,4 +21199,4 @@ const createLiveboardWithAnswers = async (answers, name) => {
|
|
|
19745
21199
|
return result;
|
|
19746
21200
|
};
|
|
19747
21201
|
|
|
19748
|
-
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|
|
21202
|
+
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|