@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-react.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
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useRef, useCallback } from 'react';
|
|
@@ -195,7 +195,6 @@ merge.withOptions = (options, ...objects) => {
|
|
|
195
195
|
* the embedded app
|
|
196
196
|
* @group Authentication / Init
|
|
197
197
|
*/
|
|
198
|
-
// eslint-disable-next-line no-shadow
|
|
199
198
|
var AuthType;
|
|
200
199
|
(function (AuthType) {
|
|
201
200
|
/**
|
|
@@ -409,7 +408,6 @@ var HomeLeftNavItem;
|
|
|
409
408
|
/**
|
|
410
409
|
* A map of the supported runtime filter operations
|
|
411
410
|
*/
|
|
412
|
-
// eslint-disable-next-line no-shadow
|
|
413
411
|
var RuntimeFilterOp;
|
|
414
412
|
(function (RuntimeFilterOp) {
|
|
415
413
|
/**
|
|
@@ -480,7 +478,6 @@ var RuntimeFilterOp;
|
|
|
480
478
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
481
479
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
|
|
482
480
|
*/
|
|
483
|
-
// eslint-disable-next-line no-shadow
|
|
484
481
|
var HomepageModule;
|
|
485
482
|
(function (HomepageModule) {
|
|
486
483
|
/**
|
|
@@ -513,7 +510,6 @@ var HomepageModule;
|
|
|
513
510
|
* **Note**: This option is applicable to full app embedding only.
|
|
514
511
|
* @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
|
|
515
512
|
*/
|
|
516
|
-
// eslint-disable-next-line no-shadow
|
|
517
513
|
var ListPageColumns;
|
|
518
514
|
(function (ListPageColumns) {
|
|
519
515
|
/**
|
|
@@ -576,7 +572,6 @@ var ListPageColumns;
|
|
|
576
572
|
* ```
|
|
577
573
|
* @group Events
|
|
578
574
|
*/
|
|
579
|
-
// eslint-disable-next-line no-shadow
|
|
580
575
|
var EmbedEvent;
|
|
581
576
|
(function (EmbedEvent) {
|
|
582
577
|
/**
|
|
@@ -1218,6 +1213,11 @@ var EmbedEvent;
|
|
|
1218
1213
|
* @hidden
|
|
1219
1214
|
*/
|
|
1220
1215
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
1216
|
+
/**
|
|
1217
|
+
* Internal event to clear the cached info
|
|
1218
|
+
* @hidden
|
|
1219
|
+
*/
|
|
1220
|
+
EmbedEvent["CLEAR_INFO_CACHE"] = "clearInfoCache";
|
|
1221
1221
|
/**
|
|
1222
1222
|
* Emitted when a user clicks **Show Liveboard details** on a Liveboard
|
|
1223
1223
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
@@ -1686,6 +1686,17 @@ var EmbedEvent;
|
|
|
1686
1686
|
* ```
|
|
1687
1687
|
*/
|
|
1688
1688
|
EmbedEvent["EmbedListenerReady"] = "EmbedListenerReady";
|
|
1689
|
+
/**
|
|
1690
|
+
* Emitted when the organization is switched.
|
|
1691
|
+
* @example
|
|
1692
|
+
* ```js
|
|
1693
|
+
* appEmbed.on(EmbedEvent.OrgSwitched, (payload) => {
|
|
1694
|
+
* console.log('payload', payload);
|
|
1695
|
+
* })
|
|
1696
|
+
* ```
|
|
1697
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
1698
|
+
*/
|
|
1699
|
+
EmbedEvent["OrgSwitched"] = "orgSwitched";
|
|
1689
1700
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
1690
1701
|
/**
|
|
1691
1702
|
* Event types that can be triggered by the host application
|
|
@@ -1740,7 +1751,6 @@ var EmbedEvent;
|
|
|
1740
1751
|
* ```
|
|
1741
1752
|
* @group Events
|
|
1742
1753
|
*/
|
|
1743
|
-
// eslint-disable-next-line no-shadow
|
|
1744
1754
|
var HostEvent;
|
|
1745
1755
|
(function (HostEvent) {
|
|
1746
1756
|
/**
|
|
@@ -2950,22 +2960,11 @@ var HostEvent;
|
|
|
2950
2960
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
2951
2961
|
*/
|
|
2952
2962
|
HostEvent["AskSpotter"] = "AskSpotter";
|
|
2953
|
-
/**
|
|
2954
|
-
* @hidden
|
|
2955
|
-
* Triggers the update of the embed params.
|
|
2956
|
-
*
|
|
2957
|
-
* @example
|
|
2958
|
-
* ```js
|
|
2959
|
-
* liveboardEmbed.trigger(HostEvent.UpdateEmbedParams, viewConfig);
|
|
2960
|
-
* ```
|
|
2961
|
-
*/
|
|
2962
|
-
HostEvent["UpdateEmbedParams"] = "updateEmbedParams";
|
|
2963
2963
|
})(HostEvent || (HostEvent = {}));
|
|
2964
2964
|
/**
|
|
2965
2965
|
* The different visual modes that the data sources panel within
|
|
2966
2966
|
* search could appear in, such as hidden, collapsed, or expanded.
|
|
2967
2967
|
*/
|
|
2968
|
-
// eslint-disable-next-line no-shadow
|
|
2969
2968
|
var DataSourceVisualMode;
|
|
2970
2969
|
(function (DataSourceVisualMode) {
|
|
2971
2970
|
/**
|
|
@@ -2985,7 +2984,6 @@ var DataSourceVisualMode;
|
|
|
2985
2984
|
* The query params passed down to the embedded ThoughtSpot app
|
|
2986
2985
|
* containing configuration and/or visual information.
|
|
2987
2986
|
*/
|
|
2988
|
-
// eslint-disable-next-line no-shadow
|
|
2989
2987
|
var Param;
|
|
2990
2988
|
(function (Param) {
|
|
2991
2989
|
Param["EmbedApp"] = "embedApp";
|
|
@@ -3065,6 +3063,7 @@ var Param;
|
|
|
3065
3063
|
Param["Query"] = "query";
|
|
3066
3064
|
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
3067
3065
|
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
3066
|
+
Param["HomepageVersion"] = "homepageVersion";
|
|
3068
3067
|
Param["ListPageVersion"] = "listpageVersion";
|
|
3069
3068
|
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
3070
3069
|
Param["LiveboardHeaderSticky"] = "isLiveboardHeaderSticky";
|
|
@@ -3106,6 +3105,7 @@ var Param;
|
|
|
3106
3105
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
3107
3106
|
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
3108
3107
|
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
3108
|
+
Param["LiveboardXLSXCSVDownload"] = "isLiveboardXLSXCSVDownloadEnabled";
|
|
3109
3109
|
})(Param || (Param = {}));
|
|
3110
3110
|
/**
|
|
3111
3111
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -3134,7 +3134,6 @@ var Param;
|
|
|
3134
3134
|
* ```
|
|
3135
3135
|
* See also link:https://developers.thoughtspot.com/docs/actions[Action IDs in the SDK]
|
|
3136
3136
|
*/
|
|
3137
|
-
// eslint-disable-next-line no-shadow
|
|
3138
3137
|
var Action;
|
|
3139
3138
|
(function (Action) {
|
|
3140
3139
|
/**
|
|
@@ -3679,7 +3678,7 @@ var Action;
|
|
|
3679
3678
|
* The Favorites icon (*) for Answers,
|
|
3680
3679
|
* Liveboard, and data objects like Worksheet, Model,
|
|
3681
3680
|
* Tables and Views.
|
|
3682
|
-
* Allows adding an object to the user
|
|
3681
|
+
* Allows adding an object to the user's favorites list.
|
|
3683
3682
|
* @example
|
|
3684
3683
|
* ```js
|
|
3685
3684
|
* disabledActions: [Action.AddToFavorites]
|
|
@@ -4406,6 +4405,26 @@ var ContextMenuTriggerOptions;
|
|
|
4406
4405
|
ContextMenuTriggerOptions["RIGHT_CLICK"] = "right-click";
|
|
4407
4406
|
ContextMenuTriggerOptions["BOTH_CLICKS"] = "both-clicks";
|
|
4408
4407
|
})(ContextMenuTriggerOptions || (ContextMenuTriggerOptions = {}));
|
|
4408
|
+
/**
|
|
4409
|
+
* Enum options to show custom actions at different
|
|
4410
|
+
* positions in the application.
|
|
4411
|
+
*/
|
|
4412
|
+
var CustomActionsPosition;
|
|
4413
|
+
(function (CustomActionsPosition) {
|
|
4414
|
+
CustomActionsPosition["PRIMARY"] = "PRIMARY";
|
|
4415
|
+
CustomActionsPosition["MENU"] = "MENU";
|
|
4416
|
+
CustomActionsPosition["CONTEXTMENU"] = "CONTEXTMENU";
|
|
4417
|
+
})(CustomActionsPosition || (CustomActionsPosition = {}));
|
|
4418
|
+
/**
|
|
4419
|
+
* Enum options to mention the target of the custom action.
|
|
4420
|
+
*/
|
|
4421
|
+
var CustomActionTarget;
|
|
4422
|
+
(function (CustomActionTarget) {
|
|
4423
|
+
CustomActionTarget["LIVEBOARD"] = "LIVEBOARD";
|
|
4424
|
+
CustomActionTarget["VIZ"] = "VIZ";
|
|
4425
|
+
CustomActionTarget["ANSWER"] = "ANSWER";
|
|
4426
|
+
CustomActionTarget["SPOTTER"] = "SPOTTER";
|
|
4427
|
+
})(CustomActionTarget || (CustomActionTarget = {}));
|
|
4409
4428
|
/**
|
|
4410
4429
|
* Enum options to show or suppress Visual Embed SDK and
|
|
4411
4430
|
* ThoughtSpot application logs in the console output.
|
|
@@ -4866,6 +4885,15 @@ function storeValueInWindow(key, value, options = {}) {
|
|
|
4866
4885
|
* @returns The stored value or `undefined` if the key is not found.
|
|
4867
4886
|
*/
|
|
4868
4887
|
const getValueFromWindow = (key) => { var _a; return (_a = window === null || window === void 0 ? void 0 : window[sdkWindowKey]) === null || _a === void 0 ? void 0 : _a[key]; };
|
|
4888
|
+
/**
|
|
4889
|
+
* Check if an array includes a string value
|
|
4890
|
+
* @param arr - The array to check
|
|
4891
|
+
* @param key - The string to search for
|
|
4892
|
+
* @returns boolean indicating if the string is found in the array
|
|
4893
|
+
*/
|
|
4894
|
+
const arrayIncludesString = (arr, key) => {
|
|
4895
|
+
return arr.some(item => typeof item === 'string' && item === key);
|
|
4896
|
+
};
|
|
4869
4897
|
/**
|
|
4870
4898
|
* Check if the document is currently in fullscreen mode
|
|
4871
4899
|
*/
|
|
@@ -5950,8 +5978,8 @@ function cacheHas(cache, key) {
|
|
|
5950
5978
|
var _cacheHas = cacheHas;
|
|
5951
5979
|
|
|
5952
5980
|
/** Used to compose bitmasks for value comparisons. */
|
|
5953
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5954
|
-
COMPARE_UNORDERED_FLAG$
|
|
5981
|
+
var COMPARE_PARTIAL_FLAG$5 = 1,
|
|
5982
|
+
COMPARE_UNORDERED_FLAG$3 = 2;
|
|
5955
5983
|
|
|
5956
5984
|
/**
|
|
5957
5985
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
@@ -5967,7 +5995,7 @@ var COMPARE_PARTIAL_FLAG$3 = 1,
|
|
|
5967
5995
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
5968
5996
|
*/
|
|
5969
5997
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
5970
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
5998
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
|
|
5971
5999
|
arrLength = array.length,
|
|
5972
6000
|
othLength = other.length;
|
|
5973
6001
|
|
|
@@ -5982,7 +6010,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5982
6010
|
}
|
|
5983
6011
|
var index = -1,
|
|
5984
6012
|
result = true,
|
|
5985
|
-
seen = (bitmask & COMPARE_UNORDERED_FLAG$
|
|
6013
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new _SetCache : undefined;
|
|
5986
6014
|
|
|
5987
6015
|
stack.set(array, other);
|
|
5988
6016
|
stack.set(other, array);
|
|
@@ -6074,8 +6102,8 @@ function setToArray(set) {
|
|
|
6074
6102
|
var _setToArray = setToArray;
|
|
6075
6103
|
|
|
6076
6104
|
/** Used to compose bitmasks for value comparisons. */
|
|
6077
|
-
var COMPARE_PARTIAL_FLAG$
|
|
6078
|
-
COMPARE_UNORDERED_FLAG = 2;
|
|
6105
|
+
var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
6106
|
+
COMPARE_UNORDERED_FLAG$2 = 2;
|
|
6079
6107
|
|
|
6080
6108
|
/** `Object#toString` result references. */
|
|
6081
6109
|
var boolTag$1 = '[object Boolean]',
|
|
@@ -6086,14 +6114,14 @@ var boolTag$1 = '[object Boolean]',
|
|
|
6086
6114
|
regexpTag$1 = '[object RegExp]',
|
|
6087
6115
|
setTag$3 = '[object Set]',
|
|
6088
6116
|
stringTag$1 = '[object String]',
|
|
6089
|
-
symbolTag = '[object Symbol]';
|
|
6117
|
+
symbolTag$1 = '[object Symbol]';
|
|
6090
6118
|
|
|
6091
6119
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
6092
6120
|
dataViewTag$2 = '[object DataView]';
|
|
6093
6121
|
|
|
6094
6122
|
/** Used to convert symbols to primitives and strings. */
|
|
6095
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
6096
|
-
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
6123
|
+
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
|
6124
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
6097
6125
|
|
|
6098
6126
|
/**
|
|
6099
6127
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
@@ -6150,7 +6178,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6150
6178
|
var convert = _mapToArray;
|
|
6151
6179
|
|
|
6152
6180
|
case setTag$3:
|
|
6153
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6181
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
6154
6182
|
convert || (convert = _setToArray);
|
|
6155
6183
|
|
|
6156
6184
|
if (object.size != other.size && !isPartial) {
|
|
@@ -6161,7 +6189,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6161
6189
|
if (stacked) {
|
|
6162
6190
|
return stacked == other;
|
|
6163
6191
|
}
|
|
6164
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
6192
|
+
bitmask |= COMPARE_UNORDERED_FLAG$2;
|
|
6165
6193
|
|
|
6166
6194
|
// Recursively compare objects (susceptible to call stack limits).
|
|
6167
6195
|
stack.set(object, other);
|
|
@@ -6169,7 +6197,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6169
6197
|
stack['delete'](object);
|
|
6170
6198
|
return result;
|
|
6171
6199
|
|
|
6172
|
-
case symbolTag:
|
|
6200
|
+
case symbolTag$1:
|
|
6173
6201
|
if (symbolValueOf) {
|
|
6174
6202
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
6175
6203
|
}
|
|
@@ -6860,7 +6888,7 @@ function getAllKeys(object) {
|
|
|
6860
6888
|
var _getAllKeys = getAllKeys;
|
|
6861
6889
|
|
|
6862
6890
|
/** Used to compose bitmasks for value comparisons. */
|
|
6863
|
-
var COMPARE_PARTIAL_FLAG$
|
|
6891
|
+
var COMPARE_PARTIAL_FLAG$3 = 1;
|
|
6864
6892
|
|
|
6865
6893
|
/** Used for built-in method references. */
|
|
6866
6894
|
var objectProto$2 = Object.prototype;
|
|
@@ -6882,7 +6910,7 @@ var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
|
|
|
6882
6910
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
6883
6911
|
*/
|
|
6884
6912
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
6885
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6913
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
6886
6914
|
objProps = _getAllKeys(object),
|
|
6887
6915
|
objLength = objProps.length,
|
|
6888
6916
|
othProps = _getAllKeys(other),
|
|
@@ -7020,7 +7048,7 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
7020
7048
|
var _getTag = getTag;
|
|
7021
7049
|
|
|
7022
7050
|
/** Used to compose bitmasks for value comparisons. */
|
|
7023
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
7051
|
+
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
7024
7052
|
|
|
7025
7053
|
/** `Object#toString` result references. */
|
|
7026
7054
|
var argsTag = '[object Arguments]',
|
|
@@ -7073,7 +7101,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
7073
7101
|
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
7074
7102
|
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
7075
7103
|
}
|
|
7076
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
7104
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
|
|
7077
7105
|
var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),
|
|
7078
7106
|
othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');
|
|
7079
7107
|
|
|
@@ -7243,6 +7271,16 @@ const ERROR_MESSAGE = {
|
|
|
7243
7271
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
7244
7272
|
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',
|
|
7245
7273
|
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
7274
|
+
};
|
|
7275
|
+
const CUSTOM_ACTIONS_ERROR_MESSAGE = {
|
|
7276
|
+
INVALID_ACTION_OBJECT: 'Custom Action Validation Error: Invalid action object provided',
|
|
7277
|
+
MISSING_REQUIRED_FIELDS: (id, missingFields) => `Custom Action Validation Error for '${id}': Missing required fields: ${missingFields.join(', ')}`,
|
|
7278
|
+
UNSUPPORTED_TARGET: (id, targetType) => `Custom Action Validation Error for '${id}': Target type '${targetType}' is not supported`,
|
|
7279
|
+
INVALID_POSITION: (position, targetType, supportedPositions) => `Position '${position}' is not supported for ${targetType.toLowerCase()}-level custom actions. Supported positions: ${supportedPositions}`,
|
|
7280
|
+
INVALID_METADATA_IDS: (targetType, invalidIds, supportedIds) => `Invalid metadata IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported metadata IDs: ${supportedIds}`,
|
|
7281
|
+
INVALID_DATA_MODEL_IDS: (targetType, invalidIds, supportedIds) => `Invalid data model IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported data model IDs: ${supportedIds}`,
|
|
7282
|
+
INVALID_FIELDS: (targetType, invalidFields, supportedFields) => `Invalid fields for ${targetType.toLowerCase()}-level custom actions: ${invalidFields.join(', ')}. Supported fields: ${supportedFields}`,
|
|
7283
|
+
DUPLICATE_IDS: (id, duplicateNames, keptName) => `Duplicate custom action ID '${id}' found. Actions with names '${duplicateNames.join("', '")}' will be ignored. Keeping '${keptName}'.`,
|
|
7246
7284
|
};
|
|
7247
7285
|
|
|
7248
7286
|
const EndPoints = {
|
|
@@ -8095,141 +8133,1571 @@ class AnswerService {
|
|
|
8095
8133
|
if (columnsToRemove.length) {
|
|
8096
8134
|
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
8097
8135
|
}
|
|
8098
|
-
return unaggAnswerSession;
|
|
8099
|
-
}
|
|
8100
|
-
/**
|
|
8101
|
-
* Execute a custom graphql query in the context of the answer.
|
|
8102
|
-
* @param query graphql query
|
|
8103
|
-
* @param variables graphql variables
|
|
8104
|
-
* @returns
|
|
8105
|
-
*/
|
|
8106
|
-
async executeQuery(query, variables) {
|
|
8107
|
-
const data = await graphqlQuery({
|
|
8108
|
-
query,
|
|
8109
|
-
variables: {
|
|
8110
|
-
session: this.session,
|
|
8111
|
-
...variables,
|
|
8112
|
-
},
|
|
8113
|
-
thoughtSpotHost: this.thoughtSpotHost,
|
|
8114
|
-
isCompositeQuery: false,
|
|
8115
|
-
});
|
|
8116
|
-
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8117
|
-
return data;
|
|
8118
|
-
}
|
|
8119
|
-
/**
|
|
8120
|
-
* Get the internal session details for the answer.
|
|
8121
|
-
* @returns
|
|
8122
|
-
*/
|
|
8123
|
-
getSession() {
|
|
8124
|
-
return this.session;
|
|
8136
|
+
return unaggAnswerSession;
|
|
8137
|
+
}
|
|
8138
|
+
/**
|
|
8139
|
+
* Execute a custom graphql query in the context of the answer.
|
|
8140
|
+
* @param query graphql query
|
|
8141
|
+
* @param variables graphql variables
|
|
8142
|
+
* @returns
|
|
8143
|
+
*/
|
|
8144
|
+
async executeQuery(query, variables) {
|
|
8145
|
+
const data = await graphqlQuery({
|
|
8146
|
+
query,
|
|
8147
|
+
variables: {
|
|
8148
|
+
session: this.session,
|
|
8149
|
+
...variables,
|
|
8150
|
+
},
|
|
8151
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
8152
|
+
isCompositeQuery: false,
|
|
8153
|
+
});
|
|
8154
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8155
|
+
return data;
|
|
8156
|
+
}
|
|
8157
|
+
/**
|
|
8158
|
+
* Get the internal session details for the answer.
|
|
8159
|
+
* @returns
|
|
8160
|
+
*/
|
|
8161
|
+
getSession() {
|
|
8162
|
+
return this.session;
|
|
8163
|
+
}
|
|
8164
|
+
async getAnswer() {
|
|
8165
|
+
if (this.answer) {
|
|
8166
|
+
return this.answer;
|
|
8167
|
+
}
|
|
8168
|
+
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8169
|
+
return this.answer;
|
|
8170
|
+
}
|
|
8171
|
+
async getTML() {
|
|
8172
|
+
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8173
|
+
const edoc = object[0].edoc;
|
|
8174
|
+
const YAML = await import('./index-B_mxAan8.js');
|
|
8175
|
+
const parsedDoc = YAML.parse(edoc);
|
|
8176
|
+
return {
|
|
8177
|
+
answer: {
|
|
8178
|
+
...parsedDoc.answer,
|
|
8179
|
+
...this.tmlOverride,
|
|
8180
|
+
},
|
|
8181
|
+
};
|
|
8182
|
+
}
|
|
8183
|
+
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8184
|
+
const { displayMode, visualizations } = await this.getAnswer();
|
|
8185
|
+
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8186
|
+
return this.executeQuery(addVizToLiveboard, {
|
|
8187
|
+
liveboardId,
|
|
8188
|
+
vizId: viz.id,
|
|
8189
|
+
});
|
|
8190
|
+
}
|
|
8191
|
+
setTMLOverride(override) {
|
|
8192
|
+
this.tmlOverride = override;
|
|
8193
|
+
}
|
|
8194
|
+
}
|
|
8195
|
+
/**
|
|
8196
|
+
*
|
|
8197
|
+
* @param sourceDetail
|
|
8198
|
+
* @param colNames
|
|
8199
|
+
*/
|
|
8200
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
8201
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
8202
|
+
colSet[col.name.toLowerCase()] = col;
|
|
8203
|
+
return colSet;
|
|
8204
|
+
}, {});
|
|
8205
|
+
return new Set(colNames.map((colName) => {
|
|
8206
|
+
const col = cols[colName.toLowerCase()];
|
|
8207
|
+
return col.id;
|
|
8208
|
+
}));
|
|
8209
|
+
}
|
|
8210
|
+
/**
|
|
8211
|
+
*
|
|
8212
|
+
* @param selectedPoints
|
|
8213
|
+
*/
|
|
8214
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
8215
|
+
const underlyingDataPoint = [];
|
|
8216
|
+
/**
|
|
8217
|
+
*
|
|
8218
|
+
* @param colVal
|
|
8219
|
+
*/
|
|
8220
|
+
function addPointFromColVal(colVal) {
|
|
8221
|
+
var _a;
|
|
8222
|
+
const dataType = colVal.column.dataType;
|
|
8223
|
+
colVal.column.id;
|
|
8224
|
+
let dataValue;
|
|
8225
|
+
if (dataType === 'DATE') {
|
|
8226
|
+
if (Number.isFinite(colVal.value)) {
|
|
8227
|
+
dataValue = [{
|
|
8228
|
+
epochRange: {
|
|
8229
|
+
startEpoch: colVal.value,
|
|
8230
|
+
},
|
|
8231
|
+
}];
|
|
8232
|
+
// Case for custom calendar.
|
|
8233
|
+
}
|
|
8234
|
+
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8235
|
+
dataValue = [{
|
|
8236
|
+
epochRange: {
|
|
8237
|
+
startEpoch: colVal.value.v.s,
|
|
8238
|
+
endEpoch: colVal.value.v.e,
|
|
8239
|
+
},
|
|
8240
|
+
}];
|
|
8241
|
+
}
|
|
8242
|
+
}
|
|
8243
|
+
else {
|
|
8244
|
+
dataValue = [{ value: colVal.value }];
|
|
8245
|
+
}
|
|
8246
|
+
underlyingDataPoint.push({
|
|
8247
|
+
columnId: colVal.column.id,
|
|
8248
|
+
dataValue,
|
|
8249
|
+
});
|
|
8250
|
+
}
|
|
8251
|
+
selectedPoints.forEach((p) => {
|
|
8252
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8253
|
+
});
|
|
8254
|
+
return underlyingDataPoint;
|
|
8255
|
+
}
|
|
8256
|
+
/**
|
|
8257
|
+
*
|
|
8258
|
+
* @param visualizations
|
|
8259
|
+
* @param displayMode
|
|
8260
|
+
*/
|
|
8261
|
+
function getDisplayedViz(visualizations, displayMode) {
|
|
8262
|
+
if (displayMode === 'CHART_MODE') {
|
|
8263
|
+
return visualizations.find(
|
|
8264
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8265
|
+
(viz) => viz.__typename === 'ChartViz');
|
|
8266
|
+
}
|
|
8267
|
+
return visualizations.find(
|
|
8268
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8269
|
+
(viz) => viz.__typename === 'TableViz');
|
|
8270
|
+
}
|
|
8271
|
+
|
|
8272
|
+
/** Built-in value references. */
|
|
8273
|
+
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
|
8274
|
+
|
|
8275
|
+
/**
|
|
8276
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
8277
|
+
*
|
|
8278
|
+
* @private
|
|
8279
|
+
* @param {*} value The value to check.
|
|
8280
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
8281
|
+
*/
|
|
8282
|
+
function isFlattenable(value) {
|
|
8283
|
+
return isArray_1(value) || isArguments_1(value) ||
|
|
8284
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
8285
|
+
}
|
|
8286
|
+
|
|
8287
|
+
var _isFlattenable = isFlattenable;
|
|
8288
|
+
|
|
8289
|
+
/**
|
|
8290
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
8291
|
+
*
|
|
8292
|
+
* @private
|
|
8293
|
+
* @param {Array} array The array to flatten.
|
|
8294
|
+
* @param {number} depth The maximum recursion depth.
|
|
8295
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
8296
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
8297
|
+
* @param {Array} [result=[]] The initial result value.
|
|
8298
|
+
* @returns {Array} Returns the new flattened array.
|
|
8299
|
+
*/
|
|
8300
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
8301
|
+
var index = -1,
|
|
8302
|
+
length = array.length;
|
|
8303
|
+
|
|
8304
|
+
predicate || (predicate = _isFlattenable);
|
|
8305
|
+
result || (result = []);
|
|
8306
|
+
|
|
8307
|
+
while (++index < length) {
|
|
8308
|
+
var value = array[index];
|
|
8309
|
+
if (depth > 0 && predicate(value)) {
|
|
8310
|
+
if (depth > 1) {
|
|
8311
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
8312
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
8313
|
+
} else {
|
|
8314
|
+
_arrayPush(result, value);
|
|
8315
|
+
}
|
|
8316
|
+
} else if (!isStrict) {
|
|
8317
|
+
result[result.length] = value;
|
|
8318
|
+
}
|
|
8319
|
+
}
|
|
8320
|
+
return result;
|
|
8321
|
+
}
|
|
8322
|
+
|
|
8323
|
+
var _baseFlatten = baseFlatten;
|
|
8324
|
+
|
|
8325
|
+
/**
|
|
8326
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
8327
|
+
* shorthands.
|
|
8328
|
+
*
|
|
8329
|
+
* @private
|
|
8330
|
+
* @param {Array} [array] The array to iterate over.
|
|
8331
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8332
|
+
* @returns {Array} Returns the new mapped array.
|
|
8333
|
+
*/
|
|
8334
|
+
function arrayMap(array, iteratee) {
|
|
8335
|
+
var index = -1,
|
|
8336
|
+
length = array == null ? 0 : array.length,
|
|
8337
|
+
result = Array(length);
|
|
8338
|
+
|
|
8339
|
+
while (++index < length) {
|
|
8340
|
+
result[index] = iteratee(array[index], index, array);
|
|
8341
|
+
}
|
|
8342
|
+
return result;
|
|
8343
|
+
}
|
|
8344
|
+
|
|
8345
|
+
var _arrayMap = arrayMap;
|
|
8346
|
+
|
|
8347
|
+
/** `Object#toString` result references. */
|
|
8348
|
+
var symbolTag = '[object Symbol]';
|
|
8349
|
+
|
|
8350
|
+
/**
|
|
8351
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
8352
|
+
*
|
|
8353
|
+
* @static
|
|
8354
|
+
* @memberOf _
|
|
8355
|
+
* @since 4.0.0
|
|
8356
|
+
* @category Lang
|
|
8357
|
+
* @param {*} value The value to check.
|
|
8358
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
8359
|
+
* @example
|
|
8360
|
+
*
|
|
8361
|
+
* _.isSymbol(Symbol.iterator);
|
|
8362
|
+
* // => true
|
|
8363
|
+
*
|
|
8364
|
+
* _.isSymbol('abc');
|
|
8365
|
+
* // => false
|
|
8366
|
+
*/
|
|
8367
|
+
function isSymbol(value) {
|
|
8368
|
+
return typeof value == 'symbol' ||
|
|
8369
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
8370
|
+
}
|
|
8371
|
+
|
|
8372
|
+
var isSymbol_1 = isSymbol;
|
|
8373
|
+
|
|
8374
|
+
/** Used to match property names within property paths. */
|
|
8375
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
8376
|
+
reIsPlainProp = /^\w*$/;
|
|
8377
|
+
|
|
8378
|
+
/**
|
|
8379
|
+
* Checks if `value` is a property name and not a property path.
|
|
8380
|
+
*
|
|
8381
|
+
* @private
|
|
8382
|
+
* @param {*} value The value to check.
|
|
8383
|
+
* @param {Object} [object] The object to query keys on.
|
|
8384
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
8385
|
+
*/
|
|
8386
|
+
function isKey(value, object) {
|
|
8387
|
+
if (isArray_1(value)) {
|
|
8388
|
+
return false;
|
|
8389
|
+
}
|
|
8390
|
+
var type = typeof value;
|
|
8391
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
8392
|
+
value == null || isSymbol_1(value)) {
|
|
8393
|
+
return true;
|
|
8394
|
+
}
|
|
8395
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
8396
|
+
(object != null && value in Object(object));
|
|
8397
|
+
}
|
|
8398
|
+
|
|
8399
|
+
var _isKey = isKey;
|
|
8400
|
+
|
|
8401
|
+
/** Error message constants. */
|
|
8402
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
8403
|
+
|
|
8404
|
+
/**
|
|
8405
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
8406
|
+
* provided, it determines the cache key for storing the result based on the
|
|
8407
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
8408
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
8409
|
+
* is invoked with the `this` binding of the memoized function.
|
|
8410
|
+
*
|
|
8411
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
8412
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
8413
|
+
* constructor with one whose instances implement the
|
|
8414
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
8415
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
8416
|
+
*
|
|
8417
|
+
* @static
|
|
8418
|
+
* @memberOf _
|
|
8419
|
+
* @since 0.1.0
|
|
8420
|
+
* @category Function
|
|
8421
|
+
* @param {Function} func The function to have its output memoized.
|
|
8422
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
8423
|
+
* @returns {Function} Returns the new memoized function.
|
|
8424
|
+
* @example
|
|
8425
|
+
*
|
|
8426
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
8427
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
8428
|
+
*
|
|
8429
|
+
* var values = _.memoize(_.values);
|
|
8430
|
+
* values(object);
|
|
8431
|
+
* // => [1, 2]
|
|
8432
|
+
*
|
|
8433
|
+
* values(other);
|
|
8434
|
+
* // => [3, 4]
|
|
8435
|
+
*
|
|
8436
|
+
* object.a = 2;
|
|
8437
|
+
* values(object);
|
|
8438
|
+
* // => [1, 2]
|
|
8439
|
+
*
|
|
8440
|
+
* // Modify the result cache.
|
|
8441
|
+
* values.cache.set(object, ['a', 'b']);
|
|
8442
|
+
* values(object);
|
|
8443
|
+
* // => ['a', 'b']
|
|
8444
|
+
*
|
|
8445
|
+
* // Replace `_.memoize.Cache`.
|
|
8446
|
+
* _.memoize.Cache = WeakMap;
|
|
8447
|
+
*/
|
|
8448
|
+
function memoize(func, resolver) {
|
|
8449
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
8450
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
8451
|
+
}
|
|
8452
|
+
var memoized = function() {
|
|
8453
|
+
var args = arguments,
|
|
8454
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
8455
|
+
cache = memoized.cache;
|
|
8456
|
+
|
|
8457
|
+
if (cache.has(key)) {
|
|
8458
|
+
return cache.get(key);
|
|
8459
|
+
}
|
|
8460
|
+
var result = func.apply(this, args);
|
|
8461
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
8462
|
+
return result;
|
|
8463
|
+
};
|
|
8464
|
+
memoized.cache = new (memoize.Cache || _MapCache);
|
|
8465
|
+
return memoized;
|
|
8466
|
+
}
|
|
8467
|
+
|
|
8468
|
+
// Expose `MapCache`.
|
|
8469
|
+
memoize.Cache = _MapCache;
|
|
8470
|
+
|
|
8471
|
+
var memoize_1 = memoize;
|
|
8472
|
+
|
|
8473
|
+
/** Used as the maximum memoize cache size. */
|
|
8474
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
8475
|
+
|
|
8476
|
+
/**
|
|
8477
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
8478
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
8479
|
+
*
|
|
8480
|
+
* @private
|
|
8481
|
+
* @param {Function} func The function to have its output memoized.
|
|
8482
|
+
* @returns {Function} Returns the new memoized function.
|
|
8483
|
+
*/
|
|
8484
|
+
function memoizeCapped(func) {
|
|
8485
|
+
var result = memoize_1(func, function(key) {
|
|
8486
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
8487
|
+
cache.clear();
|
|
8488
|
+
}
|
|
8489
|
+
return key;
|
|
8490
|
+
});
|
|
8491
|
+
|
|
8492
|
+
var cache = result.cache;
|
|
8493
|
+
return result;
|
|
8494
|
+
}
|
|
8495
|
+
|
|
8496
|
+
var _memoizeCapped = memoizeCapped;
|
|
8497
|
+
|
|
8498
|
+
/** Used to match property names within property paths. */
|
|
8499
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
8500
|
+
|
|
8501
|
+
/** Used to match backslashes in property paths. */
|
|
8502
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
8503
|
+
|
|
8504
|
+
/**
|
|
8505
|
+
* Converts `string` to a property path array.
|
|
8506
|
+
*
|
|
8507
|
+
* @private
|
|
8508
|
+
* @param {string} string The string to convert.
|
|
8509
|
+
* @returns {Array} Returns the property path array.
|
|
8510
|
+
*/
|
|
8511
|
+
var stringToPath = _memoizeCapped(function(string) {
|
|
8512
|
+
var result = [];
|
|
8513
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
8514
|
+
result.push('');
|
|
8515
|
+
}
|
|
8516
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
8517
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
8518
|
+
});
|
|
8519
|
+
return result;
|
|
8520
|
+
});
|
|
8521
|
+
|
|
8522
|
+
var _stringToPath = stringToPath;
|
|
8523
|
+
|
|
8524
|
+
/** Used as references for various `Number` constants. */
|
|
8525
|
+
var INFINITY$1 = 1 / 0;
|
|
8526
|
+
|
|
8527
|
+
/** Used to convert symbols to primitives and strings. */
|
|
8528
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
8529
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
8530
|
+
|
|
8531
|
+
/**
|
|
8532
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
8533
|
+
* values to empty strings.
|
|
8534
|
+
*
|
|
8535
|
+
* @private
|
|
8536
|
+
* @param {*} value The value to process.
|
|
8537
|
+
* @returns {string} Returns the string.
|
|
8538
|
+
*/
|
|
8539
|
+
function baseToString(value) {
|
|
8540
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
8541
|
+
if (typeof value == 'string') {
|
|
8542
|
+
return value;
|
|
8543
|
+
}
|
|
8544
|
+
if (isArray_1(value)) {
|
|
8545
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
8546
|
+
return _arrayMap(value, baseToString) + '';
|
|
8547
|
+
}
|
|
8548
|
+
if (isSymbol_1(value)) {
|
|
8549
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
8550
|
+
}
|
|
8551
|
+
var result = (value + '');
|
|
8552
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
8553
|
+
}
|
|
8554
|
+
|
|
8555
|
+
var _baseToString = baseToString;
|
|
8556
|
+
|
|
8557
|
+
/**
|
|
8558
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
8559
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
8560
|
+
*
|
|
8561
|
+
* @static
|
|
8562
|
+
* @memberOf _
|
|
8563
|
+
* @since 4.0.0
|
|
8564
|
+
* @category Lang
|
|
8565
|
+
* @param {*} value The value to convert.
|
|
8566
|
+
* @returns {string} Returns the converted string.
|
|
8567
|
+
* @example
|
|
8568
|
+
*
|
|
8569
|
+
* _.toString(null);
|
|
8570
|
+
* // => ''
|
|
8571
|
+
*
|
|
8572
|
+
* _.toString(-0);
|
|
8573
|
+
* // => '-0'
|
|
8574
|
+
*
|
|
8575
|
+
* _.toString([1, 2, 3]);
|
|
8576
|
+
* // => '1,2,3'
|
|
8577
|
+
*/
|
|
8578
|
+
function toString$1(value) {
|
|
8579
|
+
return value == null ? '' : _baseToString(value);
|
|
8580
|
+
}
|
|
8581
|
+
|
|
8582
|
+
var toString_1 = toString$1;
|
|
8583
|
+
|
|
8584
|
+
/**
|
|
8585
|
+
* Casts `value` to a path array if it's not one.
|
|
8586
|
+
*
|
|
8587
|
+
* @private
|
|
8588
|
+
* @param {*} value The value to inspect.
|
|
8589
|
+
* @param {Object} [object] The object to query keys on.
|
|
8590
|
+
* @returns {Array} Returns the cast property path array.
|
|
8591
|
+
*/
|
|
8592
|
+
function castPath(value, object) {
|
|
8593
|
+
if (isArray_1(value)) {
|
|
8594
|
+
return value;
|
|
8595
|
+
}
|
|
8596
|
+
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
8597
|
+
}
|
|
8598
|
+
|
|
8599
|
+
var _castPath = castPath;
|
|
8600
|
+
|
|
8601
|
+
/** Used as references for various `Number` constants. */
|
|
8602
|
+
var INFINITY = 1 / 0;
|
|
8603
|
+
|
|
8604
|
+
/**
|
|
8605
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
8606
|
+
*
|
|
8607
|
+
* @private
|
|
8608
|
+
* @param {*} value The value to inspect.
|
|
8609
|
+
* @returns {string|symbol} Returns the key.
|
|
8610
|
+
*/
|
|
8611
|
+
function toKey(value) {
|
|
8612
|
+
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
8613
|
+
return value;
|
|
8614
|
+
}
|
|
8615
|
+
var result = (value + '');
|
|
8616
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
8617
|
+
}
|
|
8618
|
+
|
|
8619
|
+
var _toKey = toKey;
|
|
8620
|
+
|
|
8621
|
+
/**
|
|
8622
|
+
* The base implementation of `_.get` without support for default values.
|
|
8623
|
+
*
|
|
8624
|
+
* @private
|
|
8625
|
+
* @param {Object} object The object to query.
|
|
8626
|
+
* @param {Array|string} path The path of the property to get.
|
|
8627
|
+
* @returns {*} Returns the resolved value.
|
|
8628
|
+
*/
|
|
8629
|
+
function baseGet(object, path) {
|
|
8630
|
+
path = _castPath(path, object);
|
|
8631
|
+
|
|
8632
|
+
var index = 0,
|
|
8633
|
+
length = path.length;
|
|
8634
|
+
|
|
8635
|
+
while (object != null && index < length) {
|
|
8636
|
+
object = object[_toKey(path[index++])];
|
|
8637
|
+
}
|
|
8638
|
+
return (index && index == length) ? object : undefined;
|
|
8639
|
+
}
|
|
8640
|
+
|
|
8641
|
+
var _baseGet = baseGet;
|
|
8642
|
+
|
|
8643
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8644
|
+
var COMPARE_PARTIAL_FLAG$1 = 1,
|
|
8645
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
8646
|
+
|
|
8647
|
+
/**
|
|
8648
|
+
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
8649
|
+
*
|
|
8650
|
+
* @private
|
|
8651
|
+
* @param {Object} object The object to inspect.
|
|
8652
|
+
* @param {Object} source The object of property values to match.
|
|
8653
|
+
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
8654
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
8655
|
+
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
8656
|
+
*/
|
|
8657
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
8658
|
+
var index = matchData.length,
|
|
8659
|
+
length = index,
|
|
8660
|
+
noCustomizer = !customizer;
|
|
8661
|
+
|
|
8662
|
+
if (object == null) {
|
|
8663
|
+
return !length;
|
|
8664
|
+
}
|
|
8665
|
+
object = Object(object);
|
|
8666
|
+
while (index--) {
|
|
8667
|
+
var data = matchData[index];
|
|
8668
|
+
if ((noCustomizer && data[2])
|
|
8669
|
+
? data[1] !== object[data[0]]
|
|
8670
|
+
: !(data[0] in object)
|
|
8671
|
+
) {
|
|
8672
|
+
return false;
|
|
8673
|
+
}
|
|
8674
|
+
}
|
|
8675
|
+
while (++index < length) {
|
|
8676
|
+
data = matchData[index];
|
|
8677
|
+
var key = data[0],
|
|
8678
|
+
objValue = object[key],
|
|
8679
|
+
srcValue = data[1];
|
|
8680
|
+
|
|
8681
|
+
if (noCustomizer && data[2]) {
|
|
8682
|
+
if (objValue === undefined && !(key in object)) {
|
|
8683
|
+
return false;
|
|
8684
|
+
}
|
|
8685
|
+
} else {
|
|
8686
|
+
var stack = new _Stack;
|
|
8687
|
+
if (customizer) {
|
|
8688
|
+
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
8689
|
+
}
|
|
8690
|
+
if (!(result === undefined
|
|
8691
|
+
? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
|
|
8692
|
+
: result
|
|
8693
|
+
)) {
|
|
8694
|
+
return false;
|
|
8695
|
+
}
|
|
8696
|
+
}
|
|
8697
|
+
}
|
|
8698
|
+
return true;
|
|
8699
|
+
}
|
|
8700
|
+
|
|
8701
|
+
var _baseIsMatch = baseIsMatch;
|
|
8702
|
+
|
|
8703
|
+
/**
|
|
8704
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
8705
|
+
*
|
|
8706
|
+
* @private
|
|
8707
|
+
* @param {*} value The value to check.
|
|
8708
|
+
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
8709
|
+
* equality comparisons, else `false`.
|
|
8710
|
+
*/
|
|
8711
|
+
function isStrictComparable(value) {
|
|
8712
|
+
return value === value && !isObject_1(value);
|
|
8713
|
+
}
|
|
8714
|
+
|
|
8715
|
+
var _isStrictComparable = isStrictComparable;
|
|
8716
|
+
|
|
8717
|
+
/**
|
|
8718
|
+
* Gets the property names, values, and compare flags of `object`.
|
|
8719
|
+
*
|
|
8720
|
+
* @private
|
|
8721
|
+
* @param {Object} object The object to query.
|
|
8722
|
+
* @returns {Array} Returns the match data of `object`.
|
|
8723
|
+
*/
|
|
8724
|
+
function getMatchData(object) {
|
|
8725
|
+
var result = keys_1(object),
|
|
8726
|
+
length = result.length;
|
|
8727
|
+
|
|
8728
|
+
while (length--) {
|
|
8729
|
+
var key = result[length],
|
|
8730
|
+
value = object[key];
|
|
8731
|
+
|
|
8732
|
+
result[length] = [key, value, _isStrictComparable(value)];
|
|
8733
|
+
}
|
|
8734
|
+
return result;
|
|
8735
|
+
}
|
|
8736
|
+
|
|
8737
|
+
var _getMatchData = getMatchData;
|
|
8738
|
+
|
|
8739
|
+
/**
|
|
8740
|
+
* A specialized version of `matchesProperty` for source values suitable
|
|
8741
|
+
* for strict equality comparisons, i.e. `===`.
|
|
8742
|
+
*
|
|
8743
|
+
* @private
|
|
8744
|
+
* @param {string} key The key of the property to get.
|
|
8745
|
+
* @param {*} srcValue The value to match.
|
|
8746
|
+
* @returns {Function} Returns the new spec function.
|
|
8747
|
+
*/
|
|
8748
|
+
function matchesStrictComparable(key, srcValue) {
|
|
8749
|
+
return function(object) {
|
|
8750
|
+
if (object == null) {
|
|
8751
|
+
return false;
|
|
8752
|
+
}
|
|
8753
|
+
return object[key] === srcValue &&
|
|
8754
|
+
(srcValue !== undefined || (key in Object(object)));
|
|
8755
|
+
};
|
|
8756
|
+
}
|
|
8757
|
+
|
|
8758
|
+
var _matchesStrictComparable = matchesStrictComparable;
|
|
8759
|
+
|
|
8760
|
+
/**
|
|
8761
|
+
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
8762
|
+
*
|
|
8763
|
+
* @private
|
|
8764
|
+
* @param {Object} source The object of property values to match.
|
|
8765
|
+
* @returns {Function} Returns the new spec function.
|
|
8766
|
+
*/
|
|
8767
|
+
function baseMatches(source) {
|
|
8768
|
+
var matchData = _getMatchData(source);
|
|
8769
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
8770
|
+
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
8771
|
+
}
|
|
8772
|
+
return function(object) {
|
|
8773
|
+
return object === source || _baseIsMatch(object, source, matchData);
|
|
8774
|
+
};
|
|
8775
|
+
}
|
|
8776
|
+
|
|
8777
|
+
var _baseMatches = baseMatches;
|
|
8778
|
+
|
|
8779
|
+
/**
|
|
8780
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
8781
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
8782
|
+
*
|
|
8783
|
+
* @static
|
|
8784
|
+
* @memberOf _
|
|
8785
|
+
* @since 3.7.0
|
|
8786
|
+
* @category Object
|
|
8787
|
+
* @param {Object} object The object to query.
|
|
8788
|
+
* @param {Array|string} path The path of the property to get.
|
|
8789
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
8790
|
+
* @returns {*} Returns the resolved value.
|
|
8791
|
+
* @example
|
|
8792
|
+
*
|
|
8793
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
8794
|
+
*
|
|
8795
|
+
* _.get(object, 'a[0].b.c');
|
|
8796
|
+
* // => 3
|
|
8797
|
+
*
|
|
8798
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
8799
|
+
* // => 3
|
|
8800
|
+
*
|
|
8801
|
+
* _.get(object, 'a.b.c', 'default');
|
|
8802
|
+
* // => 'default'
|
|
8803
|
+
*/
|
|
8804
|
+
function get(object, path, defaultValue) {
|
|
8805
|
+
var result = object == null ? undefined : _baseGet(object, path);
|
|
8806
|
+
return result === undefined ? defaultValue : result;
|
|
8807
|
+
}
|
|
8808
|
+
|
|
8809
|
+
var get_1 = get;
|
|
8810
|
+
|
|
8811
|
+
/**
|
|
8812
|
+
* The base implementation of `_.hasIn` without support for deep paths.
|
|
8813
|
+
*
|
|
8814
|
+
* @private
|
|
8815
|
+
* @param {Object} [object] The object to query.
|
|
8816
|
+
* @param {Array|string} key The key to check.
|
|
8817
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
8818
|
+
*/
|
|
8819
|
+
function baseHasIn(object, key) {
|
|
8820
|
+
return object != null && key in Object(object);
|
|
8821
|
+
}
|
|
8822
|
+
|
|
8823
|
+
var _baseHasIn = baseHasIn;
|
|
8824
|
+
|
|
8825
|
+
/**
|
|
8826
|
+
* Checks if `path` exists on `object`.
|
|
8827
|
+
*
|
|
8828
|
+
* @private
|
|
8829
|
+
* @param {Object} object The object to query.
|
|
8830
|
+
* @param {Array|string} path The path to check.
|
|
8831
|
+
* @param {Function} hasFunc The function to check properties.
|
|
8832
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8833
|
+
*/
|
|
8834
|
+
function hasPath(object, path, hasFunc) {
|
|
8835
|
+
path = _castPath(path, object);
|
|
8836
|
+
|
|
8837
|
+
var index = -1,
|
|
8838
|
+
length = path.length,
|
|
8839
|
+
result = false;
|
|
8840
|
+
|
|
8841
|
+
while (++index < length) {
|
|
8842
|
+
var key = _toKey(path[index]);
|
|
8843
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
8844
|
+
break;
|
|
8845
|
+
}
|
|
8846
|
+
object = object[key];
|
|
8847
|
+
}
|
|
8848
|
+
if (result || ++index != length) {
|
|
8849
|
+
return result;
|
|
8850
|
+
}
|
|
8851
|
+
length = object == null ? 0 : object.length;
|
|
8852
|
+
return !!length && isLength_1(length) && _isIndex(key, length) &&
|
|
8853
|
+
(isArray_1(object) || isArguments_1(object));
|
|
8854
|
+
}
|
|
8855
|
+
|
|
8856
|
+
var _hasPath = hasPath;
|
|
8857
|
+
|
|
8858
|
+
/**
|
|
8859
|
+
* Checks if `path` is a direct or inherited property of `object`.
|
|
8860
|
+
*
|
|
8861
|
+
* @static
|
|
8862
|
+
* @memberOf _
|
|
8863
|
+
* @since 4.0.0
|
|
8864
|
+
* @category Object
|
|
8865
|
+
* @param {Object} object The object to query.
|
|
8866
|
+
* @param {Array|string} path The path to check.
|
|
8867
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8868
|
+
* @example
|
|
8869
|
+
*
|
|
8870
|
+
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
8871
|
+
*
|
|
8872
|
+
* _.hasIn(object, 'a');
|
|
8873
|
+
* // => true
|
|
8874
|
+
*
|
|
8875
|
+
* _.hasIn(object, 'a.b');
|
|
8876
|
+
* // => true
|
|
8877
|
+
*
|
|
8878
|
+
* _.hasIn(object, ['a', 'b']);
|
|
8879
|
+
* // => true
|
|
8880
|
+
*
|
|
8881
|
+
* _.hasIn(object, 'b');
|
|
8882
|
+
* // => false
|
|
8883
|
+
*/
|
|
8884
|
+
function hasIn(object, path) {
|
|
8885
|
+
return object != null && _hasPath(object, path, _baseHasIn);
|
|
8886
|
+
}
|
|
8887
|
+
|
|
8888
|
+
var hasIn_1 = hasIn;
|
|
8889
|
+
|
|
8890
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8891
|
+
var COMPARE_PARTIAL_FLAG = 1,
|
|
8892
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
8893
|
+
|
|
8894
|
+
/**
|
|
8895
|
+
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
8896
|
+
*
|
|
8897
|
+
* @private
|
|
8898
|
+
* @param {string} path The path of the property to get.
|
|
8899
|
+
* @param {*} srcValue The value to match.
|
|
8900
|
+
* @returns {Function} Returns the new spec function.
|
|
8901
|
+
*/
|
|
8902
|
+
function baseMatchesProperty(path, srcValue) {
|
|
8903
|
+
if (_isKey(path) && _isStrictComparable(srcValue)) {
|
|
8904
|
+
return _matchesStrictComparable(_toKey(path), srcValue);
|
|
8905
|
+
}
|
|
8906
|
+
return function(object) {
|
|
8907
|
+
var objValue = get_1(object, path);
|
|
8908
|
+
return (objValue === undefined && objValue === srcValue)
|
|
8909
|
+
? hasIn_1(object, path)
|
|
8910
|
+
: _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
8911
|
+
};
|
|
8912
|
+
}
|
|
8913
|
+
|
|
8914
|
+
var _baseMatchesProperty = baseMatchesProperty;
|
|
8915
|
+
|
|
8916
|
+
/**
|
|
8917
|
+
* This method returns the first argument it receives.
|
|
8918
|
+
*
|
|
8919
|
+
* @static
|
|
8920
|
+
* @since 0.1.0
|
|
8921
|
+
* @memberOf _
|
|
8922
|
+
* @category Util
|
|
8923
|
+
* @param {*} value Any value.
|
|
8924
|
+
* @returns {*} Returns `value`.
|
|
8925
|
+
* @example
|
|
8926
|
+
*
|
|
8927
|
+
* var object = { 'a': 1 };
|
|
8928
|
+
*
|
|
8929
|
+
* console.log(_.identity(object) === object);
|
|
8930
|
+
* // => true
|
|
8931
|
+
*/
|
|
8932
|
+
function identity(value) {
|
|
8933
|
+
return value;
|
|
8934
|
+
}
|
|
8935
|
+
|
|
8936
|
+
var identity_1 = identity;
|
|
8937
|
+
|
|
8938
|
+
/**
|
|
8939
|
+
* The base implementation of `_.property` without support for deep paths.
|
|
8940
|
+
*
|
|
8941
|
+
* @private
|
|
8942
|
+
* @param {string} key The key of the property to get.
|
|
8943
|
+
* @returns {Function} Returns the new accessor function.
|
|
8944
|
+
*/
|
|
8945
|
+
function baseProperty(key) {
|
|
8946
|
+
return function(object) {
|
|
8947
|
+
return object == null ? undefined : object[key];
|
|
8948
|
+
};
|
|
8949
|
+
}
|
|
8950
|
+
|
|
8951
|
+
var _baseProperty = baseProperty;
|
|
8952
|
+
|
|
8953
|
+
/**
|
|
8954
|
+
* A specialized version of `baseProperty` which supports deep paths.
|
|
8955
|
+
*
|
|
8956
|
+
* @private
|
|
8957
|
+
* @param {Array|string} path The path of the property to get.
|
|
8958
|
+
* @returns {Function} Returns the new accessor function.
|
|
8959
|
+
*/
|
|
8960
|
+
function basePropertyDeep(path) {
|
|
8961
|
+
return function(object) {
|
|
8962
|
+
return _baseGet(object, path);
|
|
8963
|
+
};
|
|
8964
|
+
}
|
|
8965
|
+
|
|
8966
|
+
var _basePropertyDeep = basePropertyDeep;
|
|
8967
|
+
|
|
8968
|
+
/**
|
|
8969
|
+
* Creates a function that returns the value at `path` of a given object.
|
|
8970
|
+
*
|
|
8971
|
+
* @static
|
|
8972
|
+
* @memberOf _
|
|
8973
|
+
* @since 2.4.0
|
|
8974
|
+
* @category Util
|
|
8975
|
+
* @param {Array|string} path The path of the property to get.
|
|
8976
|
+
* @returns {Function} Returns the new accessor function.
|
|
8977
|
+
* @example
|
|
8978
|
+
*
|
|
8979
|
+
* var objects = [
|
|
8980
|
+
* { 'a': { 'b': 2 } },
|
|
8981
|
+
* { 'a': { 'b': 1 } }
|
|
8982
|
+
* ];
|
|
8983
|
+
*
|
|
8984
|
+
* _.map(objects, _.property('a.b'));
|
|
8985
|
+
* // => [2, 1]
|
|
8986
|
+
*
|
|
8987
|
+
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
8988
|
+
* // => [1, 2]
|
|
8989
|
+
*/
|
|
8990
|
+
function property(path) {
|
|
8991
|
+
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
|
|
8992
|
+
}
|
|
8993
|
+
|
|
8994
|
+
var property_1 = property;
|
|
8995
|
+
|
|
8996
|
+
/**
|
|
8997
|
+
* The base implementation of `_.iteratee`.
|
|
8998
|
+
*
|
|
8999
|
+
* @private
|
|
9000
|
+
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
9001
|
+
* @returns {Function} Returns the iteratee.
|
|
9002
|
+
*/
|
|
9003
|
+
function baseIteratee(value) {
|
|
9004
|
+
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
9005
|
+
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
9006
|
+
if (typeof value == 'function') {
|
|
9007
|
+
return value;
|
|
9008
|
+
}
|
|
9009
|
+
if (value == null) {
|
|
9010
|
+
return identity_1;
|
|
9011
|
+
}
|
|
9012
|
+
if (typeof value == 'object') {
|
|
9013
|
+
return isArray_1(value)
|
|
9014
|
+
? _baseMatchesProperty(value[0], value[1])
|
|
9015
|
+
: _baseMatches(value);
|
|
9016
|
+
}
|
|
9017
|
+
return property_1(value);
|
|
9018
|
+
}
|
|
9019
|
+
|
|
9020
|
+
var _baseIteratee = baseIteratee;
|
|
9021
|
+
|
|
9022
|
+
/**
|
|
9023
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
9024
|
+
*
|
|
9025
|
+
* @private
|
|
9026
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
9027
|
+
* @returns {Function} Returns the new base function.
|
|
9028
|
+
*/
|
|
9029
|
+
function createBaseFor(fromRight) {
|
|
9030
|
+
return function(object, iteratee, keysFunc) {
|
|
9031
|
+
var index = -1,
|
|
9032
|
+
iterable = Object(object),
|
|
9033
|
+
props = keysFunc(object),
|
|
9034
|
+
length = props.length;
|
|
9035
|
+
|
|
9036
|
+
while (length--) {
|
|
9037
|
+
var key = props[fromRight ? length : ++index];
|
|
9038
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
9039
|
+
break;
|
|
9040
|
+
}
|
|
9041
|
+
}
|
|
9042
|
+
return object;
|
|
9043
|
+
};
|
|
9044
|
+
}
|
|
9045
|
+
|
|
9046
|
+
var _createBaseFor = createBaseFor;
|
|
9047
|
+
|
|
9048
|
+
/**
|
|
9049
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
9050
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
9051
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
9052
|
+
*
|
|
9053
|
+
* @private
|
|
9054
|
+
* @param {Object} object The object to iterate over.
|
|
9055
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9056
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
9057
|
+
* @returns {Object} Returns `object`.
|
|
9058
|
+
*/
|
|
9059
|
+
var baseFor = _createBaseFor();
|
|
9060
|
+
|
|
9061
|
+
var _baseFor = baseFor;
|
|
9062
|
+
|
|
9063
|
+
/**
|
|
9064
|
+
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
9065
|
+
*
|
|
9066
|
+
* @private
|
|
9067
|
+
* @param {Object} object The object to iterate over.
|
|
9068
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9069
|
+
* @returns {Object} Returns `object`.
|
|
9070
|
+
*/
|
|
9071
|
+
function baseForOwn(object, iteratee) {
|
|
9072
|
+
return object && _baseFor(object, iteratee, keys_1);
|
|
9073
|
+
}
|
|
9074
|
+
|
|
9075
|
+
var _baseForOwn = baseForOwn;
|
|
9076
|
+
|
|
9077
|
+
/**
|
|
9078
|
+
* Creates a `baseEach` or `baseEachRight` function.
|
|
9079
|
+
*
|
|
9080
|
+
* @private
|
|
9081
|
+
* @param {Function} eachFunc The function to iterate over a collection.
|
|
9082
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
9083
|
+
* @returns {Function} Returns the new base function.
|
|
9084
|
+
*/
|
|
9085
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
9086
|
+
return function(collection, iteratee) {
|
|
9087
|
+
if (collection == null) {
|
|
9088
|
+
return collection;
|
|
9089
|
+
}
|
|
9090
|
+
if (!isArrayLike_1(collection)) {
|
|
9091
|
+
return eachFunc(collection, iteratee);
|
|
9092
|
+
}
|
|
9093
|
+
var length = collection.length,
|
|
9094
|
+
index = fromRight ? length : -1,
|
|
9095
|
+
iterable = Object(collection);
|
|
9096
|
+
|
|
9097
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
9098
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
9099
|
+
break;
|
|
9100
|
+
}
|
|
9101
|
+
}
|
|
9102
|
+
return collection;
|
|
9103
|
+
};
|
|
9104
|
+
}
|
|
9105
|
+
|
|
9106
|
+
var _createBaseEach = createBaseEach;
|
|
9107
|
+
|
|
9108
|
+
/**
|
|
9109
|
+
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
9110
|
+
*
|
|
9111
|
+
* @private
|
|
9112
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9113
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9114
|
+
* @returns {Array|Object} Returns `collection`.
|
|
9115
|
+
*/
|
|
9116
|
+
var baseEach = _createBaseEach(_baseForOwn);
|
|
9117
|
+
|
|
9118
|
+
var _baseEach = baseEach;
|
|
9119
|
+
|
|
9120
|
+
/**
|
|
9121
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
9122
|
+
*
|
|
9123
|
+
* @private
|
|
9124
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9125
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9126
|
+
* @returns {Array} Returns the new mapped array.
|
|
9127
|
+
*/
|
|
9128
|
+
function baseMap(collection, iteratee) {
|
|
9129
|
+
var index = -1,
|
|
9130
|
+
result = isArrayLike_1(collection) ? Array(collection.length) : [];
|
|
9131
|
+
|
|
9132
|
+
_baseEach(collection, function(value, key, collection) {
|
|
9133
|
+
result[++index] = iteratee(value, key, collection);
|
|
9134
|
+
});
|
|
9135
|
+
return result;
|
|
9136
|
+
}
|
|
9137
|
+
|
|
9138
|
+
var _baseMap = baseMap;
|
|
9139
|
+
|
|
9140
|
+
/**
|
|
9141
|
+
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
9142
|
+
* sort order of `array` and replaces criteria objects with their corresponding
|
|
9143
|
+
* values.
|
|
9144
|
+
*
|
|
9145
|
+
* @private
|
|
9146
|
+
* @param {Array} array The array to sort.
|
|
9147
|
+
* @param {Function} comparer The function to define sort order.
|
|
9148
|
+
* @returns {Array} Returns `array`.
|
|
9149
|
+
*/
|
|
9150
|
+
function baseSortBy(array, comparer) {
|
|
9151
|
+
var length = array.length;
|
|
9152
|
+
|
|
9153
|
+
array.sort(comparer);
|
|
9154
|
+
while (length--) {
|
|
9155
|
+
array[length] = array[length].value;
|
|
9156
|
+
}
|
|
9157
|
+
return array;
|
|
9158
|
+
}
|
|
9159
|
+
|
|
9160
|
+
var _baseSortBy = baseSortBy;
|
|
9161
|
+
|
|
9162
|
+
/**
|
|
9163
|
+
* Compares values to sort them in ascending order.
|
|
9164
|
+
*
|
|
9165
|
+
* @private
|
|
9166
|
+
* @param {*} value The value to compare.
|
|
9167
|
+
* @param {*} other The other value to compare.
|
|
9168
|
+
* @returns {number} Returns the sort order indicator for `value`.
|
|
9169
|
+
*/
|
|
9170
|
+
function compareAscending(value, other) {
|
|
9171
|
+
if (value !== other) {
|
|
9172
|
+
var valIsDefined = value !== undefined,
|
|
9173
|
+
valIsNull = value === null,
|
|
9174
|
+
valIsReflexive = value === value,
|
|
9175
|
+
valIsSymbol = isSymbol_1(value);
|
|
9176
|
+
|
|
9177
|
+
var othIsDefined = other !== undefined,
|
|
9178
|
+
othIsNull = other === null,
|
|
9179
|
+
othIsReflexive = other === other,
|
|
9180
|
+
othIsSymbol = isSymbol_1(other);
|
|
9181
|
+
|
|
9182
|
+
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
9183
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
9184
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
9185
|
+
(!valIsDefined && othIsReflexive) ||
|
|
9186
|
+
!valIsReflexive) {
|
|
9187
|
+
return 1;
|
|
9188
|
+
}
|
|
9189
|
+
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
9190
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
9191
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
9192
|
+
(!othIsDefined && valIsReflexive) ||
|
|
9193
|
+
!othIsReflexive) {
|
|
9194
|
+
return -1;
|
|
9195
|
+
}
|
|
9196
|
+
}
|
|
9197
|
+
return 0;
|
|
9198
|
+
}
|
|
9199
|
+
|
|
9200
|
+
var _compareAscending = compareAscending;
|
|
9201
|
+
|
|
9202
|
+
/**
|
|
9203
|
+
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
9204
|
+
* and stable sort them.
|
|
9205
|
+
*
|
|
9206
|
+
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
9207
|
+
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
9208
|
+
* of corresponding values.
|
|
9209
|
+
*
|
|
9210
|
+
* @private
|
|
9211
|
+
* @param {Object} object The object to compare.
|
|
9212
|
+
* @param {Object} other The other object to compare.
|
|
9213
|
+
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
9214
|
+
* @returns {number} Returns the sort order indicator for `object`.
|
|
9215
|
+
*/
|
|
9216
|
+
function compareMultiple(object, other, orders) {
|
|
9217
|
+
var index = -1,
|
|
9218
|
+
objCriteria = object.criteria,
|
|
9219
|
+
othCriteria = other.criteria,
|
|
9220
|
+
length = objCriteria.length,
|
|
9221
|
+
ordersLength = orders.length;
|
|
9222
|
+
|
|
9223
|
+
while (++index < length) {
|
|
9224
|
+
var result = _compareAscending(objCriteria[index], othCriteria[index]);
|
|
9225
|
+
if (result) {
|
|
9226
|
+
if (index >= ordersLength) {
|
|
9227
|
+
return result;
|
|
9228
|
+
}
|
|
9229
|
+
var order = orders[index];
|
|
9230
|
+
return result * (order == 'desc' ? -1 : 1);
|
|
9231
|
+
}
|
|
9232
|
+
}
|
|
9233
|
+
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
9234
|
+
// that causes it, under certain circumstances, to provide the same value for
|
|
9235
|
+
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
9236
|
+
// for more details.
|
|
9237
|
+
//
|
|
9238
|
+
// This also ensures a stable sort in V8 and other engines.
|
|
9239
|
+
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
9240
|
+
return object.index - other.index;
|
|
9241
|
+
}
|
|
9242
|
+
|
|
9243
|
+
var _compareMultiple = compareMultiple;
|
|
9244
|
+
|
|
9245
|
+
/**
|
|
9246
|
+
* The base implementation of `_.orderBy` without param guards.
|
|
9247
|
+
*
|
|
9248
|
+
* @private
|
|
9249
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9250
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
9251
|
+
* @param {string[]} orders The sort orders of `iteratees`.
|
|
9252
|
+
* @returns {Array} Returns the new sorted array.
|
|
9253
|
+
*/
|
|
9254
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
9255
|
+
if (iteratees.length) {
|
|
9256
|
+
iteratees = _arrayMap(iteratees, function(iteratee) {
|
|
9257
|
+
if (isArray_1(iteratee)) {
|
|
9258
|
+
return function(value) {
|
|
9259
|
+
return _baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
9260
|
+
}
|
|
9261
|
+
}
|
|
9262
|
+
return iteratee;
|
|
9263
|
+
});
|
|
9264
|
+
} else {
|
|
9265
|
+
iteratees = [identity_1];
|
|
9266
|
+
}
|
|
9267
|
+
|
|
9268
|
+
var index = -1;
|
|
9269
|
+
iteratees = _arrayMap(iteratees, _baseUnary(_baseIteratee));
|
|
9270
|
+
|
|
9271
|
+
var result = _baseMap(collection, function(value, key, collection) {
|
|
9272
|
+
var criteria = _arrayMap(iteratees, function(iteratee) {
|
|
9273
|
+
return iteratee(value);
|
|
9274
|
+
});
|
|
9275
|
+
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
9276
|
+
});
|
|
9277
|
+
|
|
9278
|
+
return _baseSortBy(result, function(object, other) {
|
|
9279
|
+
return _compareMultiple(object, other, orders);
|
|
9280
|
+
});
|
|
9281
|
+
}
|
|
9282
|
+
|
|
9283
|
+
var _baseOrderBy = baseOrderBy;
|
|
9284
|
+
|
|
9285
|
+
/**
|
|
9286
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
9287
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
9288
|
+
*
|
|
9289
|
+
* @private
|
|
9290
|
+
* @param {Function} func The function to invoke.
|
|
9291
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
9292
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
9293
|
+
* @returns {*} Returns the result of `func`.
|
|
9294
|
+
*/
|
|
9295
|
+
function apply(func, thisArg, args) {
|
|
9296
|
+
switch (args.length) {
|
|
9297
|
+
case 0: return func.call(thisArg);
|
|
9298
|
+
case 1: return func.call(thisArg, args[0]);
|
|
9299
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
9300
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
9301
|
+
}
|
|
9302
|
+
return func.apply(thisArg, args);
|
|
9303
|
+
}
|
|
9304
|
+
|
|
9305
|
+
var _apply = apply;
|
|
9306
|
+
|
|
9307
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9308
|
+
var nativeMax = Math.max;
|
|
9309
|
+
|
|
9310
|
+
/**
|
|
9311
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
9312
|
+
*
|
|
9313
|
+
* @private
|
|
9314
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9315
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9316
|
+
* @param {Function} transform The rest array transform.
|
|
9317
|
+
* @returns {Function} Returns the new function.
|
|
9318
|
+
*/
|
|
9319
|
+
function overRest(func, start, transform) {
|
|
9320
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
9321
|
+
return function() {
|
|
9322
|
+
var args = arguments,
|
|
9323
|
+
index = -1,
|
|
9324
|
+
length = nativeMax(args.length - start, 0),
|
|
9325
|
+
array = Array(length);
|
|
9326
|
+
|
|
9327
|
+
while (++index < length) {
|
|
9328
|
+
array[index] = args[start + index];
|
|
9329
|
+
}
|
|
9330
|
+
index = -1;
|
|
9331
|
+
var otherArgs = Array(start + 1);
|
|
9332
|
+
while (++index < start) {
|
|
9333
|
+
otherArgs[index] = args[index];
|
|
9334
|
+
}
|
|
9335
|
+
otherArgs[start] = transform(array);
|
|
9336
|
+
return _apply(func, this, otherArgs);
|
|
9337
|
+
};
|
|
9338
|
+
}
|
|
9339
|
+
|
|
9340
|
+
var _overRest = overRest;
|
|
9341
|
+
|
|
9342
|
+
/**
|
|
9343
|
+
* Creates a function that returns `value`.
|
|
9344
|
+
*
|
|
9345
|
+
* @static
|
|
9346
|
+
* @memberOf _
|
|
9347
|
+
* @since 2.4.0
|
|
9348
|
+
* @category Util
|
|
9349
|
+
* @param {*} value The value to return from the new function.
|
|
9350
|
+
* @returns {Function} Returns the new constant function.
|
|
9351
|
+
* @example
|
|
9352
|
+
*
|
|
9353
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
9354
|
+
*
|
|
9355
|
+
* console.log(objects);
|
|
9356
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
9357
|
+
*
|
|
9358
|
+
* console.log(objects[0] === objects[1]);
|
|
9359
|
+
* // => true
|
|
9360
|
+
*/
|
|
9361
|
+
function constant(value) {
|
|
9362
|
+
return function() {
|
|
9363
|
+
return value;
|
|
9364
|
+
};
|
|
9365
|
+
}
|
|
9366
|
+
|
|
9367
|
+
var constant_1 = constant;
|
|
9368
|
+
|
|
9369
|
+
var defineProperty = (function() {
|
|
9370
|
+
try {
|
|
9371
|
+
var func = _getNative(Object, 'defineProperty');
|
|
9372
|
+
func({}, '', {});
|
|
9373
|
+
return func;
|
|
9374
|
+
} catch (e) {}
|
|
9375
|
+
}());
|
|
9376
|
+
|
|
9377
|
+
var _defineProperty = defineProperty;
|
|
9378
|
+
|
|
9379
|
+
/**
|
|
9380
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
9381
|
+
*
|
|
9382
|
+
* @private
|
|
9383
|
+
* @param {Function} func The function to modify.
|
|
9384
|
+
* @param {Function} string The `toString` result.
|
|
9385
|
+
* @returns {Function} Returns `func`.
|
|
9386
|
+
*/
|
|
9387
|
+
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
|
9388
|
+
return _defineProperty(func, 'toString', {
|
|
9389
|
+
'configurable': true,
|
|
9390
|
+
'enumerable': false,
|
|
9391
|
+
'value': constant_1(string),
|
|
9392
|
+
'writable': true
|
|
9393
|
+
});
|
|
9394
|
+
};
|
|
9395
|
+
|
|
9396
|
+
var _baseSetToString = baseSetToString;
|
|
9397
|
+
|
|
9398
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
9399
|
+
var HOT_COUNT = 800,
|
|
9400
|
+
HOT_SPAN = 16;
|
|
9401
|
+
|
|
9402
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9403
|
+
var nativeNow = Date.now;
|
|
9404
|
+
|
|
9405
|
+
/**
|
|
9406
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
9407
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
9408
|
+
* milliseconds.
|
|
9409
|
+
*
|
|
9410
|
+
* @private
|
|
9411
|
+
* @param {Function} func The function to restrict.
|
|
9412
|
+
* @returns {Function} Returns the new shortable function.
|
|
9413
|
+
*/
|
|
9414
|
+
function shortOut(func) {
|
|
9415
|
+
var count = 0,
|
|
9416
|
+
lastCalled = 0;
|
|
9417
|
+
|
|
9418
|
+
return function() {
|
|
9419
|
+
var stamp = nativeNow(),
|
|
9420
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
9421
|
+
|
|
9422
|
+
lastCalled = stamp;
|
|
9423
|
+
if (remaining > 0) {
|
|
9424
|
+
if (++count >= HOT_COUNT) {
|
|
9425
|
+
return arguments[0];
|
|
9426
|
+
}
|
|
9427
|
+
} else {
|
|
9428
|
+
count = 0;
|
|
9429
|
+
}
|
|
9430
|
+
return func.apply(undefined, arguments);
|
|
9431
|
+
};
|
|
9432
|
+
}
|
|
9433
|
+
|
|
9434
|
+
var _shortOut = shortOut;
|
|
9435
|
+
|
|
9436
|
+
/**
|
|
9437
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
9438
|
+
*
|
|
9439
|
+
* @private
|
|
9440
|
+
* @param {Function} func The function to modify.
|
|
9441
|
+
* @param {Function} string The `toString` result.
|
|
9442
|
+
* @returns {Function} Returns `func`.
|
|
9443
|
+
*/
|
|
9444
|
+
var setToString = _shortOut(_baseSetToString);
|
|
9445
|
+
|
|
9446
|
+
var _setToString = setToString;
|
|
9447
|
+
|
|
9448
|
+
/**
|
|
9449
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
9450
|
+
*
|
|
9451
|
+
* @private
|
|
9452
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9453
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9454
|
+
* @returns {Function} Returns the new function.
|
|
9455
|
+
*/
|
|
9456
|
+
function baseRest(func, start) {
|
|
9457
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
9458
|
+
}
|
|
9459
|
+
|
|
9460
|
+
var _baseRest = baseRest;
|
|
9461
|
+
|
|
9462
|
+
/**
|
|
9463
|
+
* Checks if the given arguments are from an iteratee call.
|
|
9464
|
+
*
|
|
9465
|
+
* @private
|
|
9466
|
+
* @param {*} value The potential iteratee value argument.
|
|
9467
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
9468
|
+
* @param {*} object The potential iteratee object argument.
|
|
9469
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
9470
|
+
* else `false`.
|
|
9471
|
+
*/
|
|
9472
|
+
function isIterateeCall(value, index, object) {
|
|
9473
|
+
if (!isObject_1(object)) {
|
|
9474
|
+
return false;
|
|
9475
|
+
}
|
|
9476
|
+
var type = typeof index;
|
|
9477
|
+
if (type == 'number'
|
|
9478
|
+
? (isArrayLike_1(object) && _isIndex(index, object.length))
|
|
9479
|
+
: (type == 'string' && index in object)
|
|
9480
|
+
) {
|
|
9481
|
+
return eq_1(object[index], value);
|
|
9482
|
+
}
|
|
9483
|
+
return false;
|
|
9484
|
+
}
|
|
9485
|
+
|
|
9486
|
+
var _isIterateeCall = isIterateeCall;
|
|
9487
|
+
|
|
9488
|
+
/**
|
|
9489
|
+
* Creates an array of elements, sorted in ascending order by the results of
|
|
9490
|
+
* running each element in a collection thru each iteratee. This method
|
|
9491
|
+
* performs a stable sort, that is, it preserves the original sort order of
|
|
9492
|
+
* equal elements. The iteratees are invoked with one argument: (value).
|
|
9493
|
+
*
|
|
9494
|
+
* @static
|
|
9495
|
+
* @memberOf _
|
|
9496
|
+
* @since 0.1.0
|
|
9497
|
+
* @category Collection
|
|
9498
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9499
|
+
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
9500
|
+
* The iteratees to sort by.
|
|
9501
|
+
* @returns {Array} Returns the new sorted array.
|
|
9502
|
+
* @example
|
|
9503
|
+
*
|
|
9504
|
+
* var users = [
|
|
9505
|
+
* { 'user': 'fred', 'age': 48 },
|
|
9506
|
+
* { 'user': 'barney', 'age': 36 },
|
|
9507
|
+
* { 'user': 'fred', 'age': 30 },
|
|
9508
|
+
* { 'user': 'barney', 'age': 34 }
|
|
9509
|
+
* ];
|
|
9510
|
+
*
|
|
9511
|
+
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
9512
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
9513
|
+
*
|
|
9514
|
+
* _.sortBy(users, ['user', 'age']);
|
|
9515
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
9516
|
+
*/
|
|
9517
|
+
var sortBy = _baseRest(function(collection, iteratees) {
|
|
9518
|
+
if (collection == null) {
|
|
9519
|
+
return [];
|
|
9520
|
+
}
|
|
9521
|
+
var length = iteratees.length;
|
|
9522
|
+
if (length > 1 && _isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
9523
|
+
iteratees = [];
|
|
9524
|
+
} else if (length > 2 && _isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
9525
|
+
iteratees = [iteratees[0]];
|
|
9526
|
+
}
|
|
9527
|
+
return _baseOrderBy(collection, _baseFlatten(iteratees, 1), []);
|
|
9528
|
+
});
|
|
9529
|
+
|
|
9530
|
+
var sortBy_1 = sortBy;
|
|
9531
|
+
|
|
9532
|
+
/**
|
|
9533
|
+
* Configuration for custom action validation rules.
|
|
9534
|
+
* Defines allowed positions, metadata IDs, data model IDs, and fields for each target
|
|
9535
|
+
* type.
|
|
9536
|
+
*
|
|
9537
|
+
*/
|
|
9538
|
+
const customActionValidationConfig = {
|
|
9539
|
+
[CustomActionTarget.LIVEBOARD]: {
|
|
9540
|
+
positions: [CustomActionsPosition.PRIMARY, CustomActionsPosition.MENU],
|
|
9541
|
+
allowedMetadataIds: ['liveboardIds'],
|
|
9542
|
+
allowedDataModelIds: [],
|
|
9543
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds'],
|
|
9544
|
+
},
|
|
9545
|
+
[CustomActionTarget.VIZ]: {
|
|
9546
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.PRIMARY, CustomActionsPosition.CONTEXTMENU],
|
|
9547
|
+
allowedMetadataIds: ['liveboardIds', 'vizIds', 'answerIds'],
|
|
9548
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9549
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9550
|
+
},
|
|
9551
|
+
[CustomActionTarget.ANSWER]: {
|
|
9552
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.PRIMARY, CustomActionsPosition.CONTEXTMENU],
|
|
9553
|
+
allowedMetadataIds: ['answerIds'],
|
|
9554
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9555
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9556
|
+
},
|
|
9557
|
+
[CustomActionTarget.SPOTTER]: {
|
|
9558
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.CONTEXTMENU],
|
|
9559
|
+
allowedMetadataIds: [],
|
|
9560
|
+
allowedDataModelIds: ['modelIds'],
|
|
9561
|
+
allowedFields: ['name', 'id', 'position', 'target', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9562
|
+
},
|
|
9563
|
+
};
|
|
9564
|
+
/**
|
|
9565
|
+
* Validates a single custom action based on its target type
|
|
9566
|
+
* @param action - The custom action to validate
|
|
9567
|
+
* @param primaryActionsPerTarget - Map to track primary actions per target
|
|
9568
|
+
* @returns CustomActionValidation with isValid flag and reason string
|
|
9569
|
+
*
|
|
9570
|
+
* @hidden
|
|
9571
|
+
*/
|
|
9572
|
+
const validateCustomAction = (action, primaryActionsPerTarget) => {
|
|
9573
|
+
const { id: actionId, target: targetType, position, metadataIds, dataModelIds } = action;
|
|
9574
|
+
// Check if target type is supported
|
|
9575
|
+
if (!customActionValidationConfig[targetType]) {
|
|
9576
|
+
const errorMessage = CUSTOM_ACTIONS_ERROR_MESSAGE.UNSUPPORTED_TARGET(actionId, targetType);
|
|
9577
|
+
return { isValid: false, errors: [errorMessage] };
|
|
9578
|
+
}
|
|
9579
|
+
const config = customActionValidationConfig[targetType];
|
|
9580
|
+
const errors = [];
|
|
9581
|
+
// Validate position
|
|
9582
|
+
if (!arrayIncludesString(config.positions, position)) {
|
|
9583
|
+
const supportedPositions = config.positions.join(', ');
|
|
9584
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_POSITION(position, targetType, supportedPositions));
|
|
9585
|
+
}
|
|
9586
|
+
// Validate metadata IDs
|
|
9587
|
+
if (metadataIds) {
|
|
9588
|
+
const invalidMetadataIds = Object.keys(metadataIds).filter((key) => !arrayIncludesString(config.allowedMetadataIds, key));
|
|
9589
|
+
if (invalidMetadataIds.length > 0) {
|
|
9590
|
+
const supportedMetadataIds = config.allowedMetadataIds.length > 0 ? config.allowedMetadataIds.join(', ') : 'none';
|
|
9591
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_METADATA_IDS(targetType, invalidMetadataIds, supportedMetadataIds));
|
|
9592
|
+
}
|
|
8125
9593
|
}
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
9594
|
+
// Validate data model IDs
|
|
9595
|
+
if (dataModelIds) {
|
|
9596
|
+
const invalidDataModelIds = Object.keys(dataModelIds).filter((key) => !arrayIncludesString(config.allowedDataModelIds, key));
|
|
9597
|
+
if (invalidDataModelIds.length > 0) {
|
|
9598
|
+
const supportedDataModelIds = config.allowedDataModelIds.length > 0 ? config.allowedDataModelIds.join(', ') : 'none';
|
|
9599
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_DATA_MODEL_IDS(targetType, invalidDataModelIds, supportedDataModelIds));
|
|
8129
9600
|
}
|
|
8130
|
-
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8131
|
-
return this.answer;
|
|
8132
|
-
}
|
|
8133
|
-
async getTML() {
|
|
8134
|
-
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8135
|
-
const edoc = object[0].edoc;
|
|
8136
|
-
const YAML = await import('./index-BDlM0f0T.js');
|
|
8137
|
-
const parsedDoc = YAML.parse(edoc);
|
|
8138
|
-
return {
|
|
8139
|
-
answer: {
|
|
8140
|
-
...parsedDoc.answer,
|
|
8141
|
-
...this.tmlOverride,
|
|
8142
|
-
},
|
|
8143
|
-
};
|
|
8144
|
-
}
|
|
8145
|
-
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8146
|
-
const { displayMode, visualizations } = await this.getAnswer();
|
|
8147
|
-
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8148
|
-
return this.executeQuery(addVizToLiveboard, {
|
|
8149
|
-
liveboardId,
|
|
8150
|
-
vizId: viz.id,
|
|
8151
|
-
});
|
|
8152
9601
|
}
|
|
8153
|
-
|
|
8154
|
-
|
|
9602
|
+
// Validate allowed fields
|
|
9603
|
+
const actionKeys = Object.keys(action);
|
|
9604
|
+
const invalidFields = actionKeys.filter((key) => !arrayIncludesString(config.allowedFields, key));
|
|
9605
|
+
if (invalidFields.length > 0) {
|
|
9606
|
+
const supportedFields = config.allowedFields.join(', ');
|
|
9607
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_FIELDS(targetType, invalidFields, supportedFields));
|
|
8155
9608
|
}
|
|
8156
|
-
|
|
9609
|
+
return {
|
|
9610
|
+
isValid: errors.length === 0,
|
|
9611
|
+
errors,
|
|
9612
|
+
};
|
|
9613
|
+
};
|
|
8157
9614
|
/**
|
|
9615
|
+
* Validates basic action structure and required fields
|
|
9616
|
+
* @param action - The action to validate
|
|
9617
|
+
* @returns Object containing validation result and missing fields
|
|
8158
9618
|
*
|
|
8159
|
-
* @
|
|
8160
|
-
* @param colNames
|
|
9619
|
+
* @hidden
|
|
8161
9620
|
*/
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
}));
|
|
8171
|
-
}
|
|
9621
|
+
const validateActionStructure = (action) => {
|
|
9622
|
+
if (!action || typeof action !== 'object') {
|
|
9623
|
+
return { isValid: false, missingFields: [] };
|
|
9624
|
+
}
|
|
9625
|
+
// Check for all missing required fields
|
|
9626
|
+
const missingFields = ['id', 'name', 'target', 'position'].filter(field => !action[field]);
|
|
9627
|
+
return { isValid: missingFields.length === 0, missingFields };
|
|
9628
|
+
};
|
|
8172
9629
|
/**
|
|
9630
|
+
* Checks for duplicate IDs among actions
|
|
9631
|
+
* @param actions - Array of actions to check
|
|
9632
|
+
* @returns Object containing filtered actions and duplicate errors
|
|
8173
9633
|
*
|
|
8174
|
-
* @
|
|
9634
|
+
* @hidden
|
|
8175
9635
|
*/
|
|
8176
|
-
|
|
8177
|
-
const
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
let dataValue;
|
|
8187
|
-
if (dataType === 'DATE') {
|
|
8188
|
-
if (Number.isFinite(colVal.value)) {
|
|
8189
|
-
dataValue = [{
|
|
8190
|
-
epochRange: {
|
|
8191
|
-
startEpoch: colVal.value,
|
|
8192
|
-
},
|
|
8193
|
-
}];
|
|
8194
|
-
// Case for custom calendar.
|
|
8195
|
-
}
|
|
8196
|
-
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8197
|
-
dataValue = [{
|
|
8198
|
-
epochRange: {
|
|
8199
|
-
startEpoch: colVal.value.v.s,
|
|
8200
|
-
endEpoch: colVal.value.v.e,
|
|
8201
|
-
},
|
|
8202
|
-
}];
|
|
8203
|
-
}
|
|
9636
|
+
const filterDuplicateIds = (actions) => {
|
|
9637
|
+
const idMap = actions.reduce((map, action) => {
|
|
9638
|
+
const list = map.get(action.id) || [];
|
|
9639
|
+
list.push(action);
|
|
9640
|
+
map.set(action.id, list);
|
|
9641
|
+
return map;
|
|
9642
|
+
}, new Map());
|
|
9643
|
+
const { actions: actionsWithUniqueIds, errors } = Array.from(idMap.entries()).reduce((acc, [id, actionsWithSameId]) => {
|
|
9644
|
+
if (actionsWithSameId.length === 1) {
|
|
9645
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
8204
9646
|
}
|
|
8205
9647
|
else {
|
|
8206
|
-
|
|
9648
|
+
// Keep the first action and add error for duplicates
|
|
9649
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
9650
|
+
const duplicateNames = actionsWithSameId.slice(1).map(action => action.name);
|
|
9651
|
+
acc.errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.DUPLICATE_IDS(id, duplicateNames, actionsWithSameId[0].name));
|
|
8207
9652
|
}
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
}
|
|
8213
|
-
selectedPoints.forEach((p) => {
|
|
8214
|
-
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8215
|
-
});
|
|
8216
|
-
return underlyingDataPoint;
|
|
8217
|
-
}
|
|
9653
|
+
return acc;
|
|
9654
|
+
}, { actions: [], errors: [] });
|
|
9655
|
+
return { actions: actionsWithUniqueIds, errors };
|
|
9656
|
+
};
|
|
8218
9657
|
/**
|
|
8219
|
-
*
|
|
8220
|
-
* @param
|
|
8221
|
-
* @
|
|
9658
|
+
* Validates and processes custom actions
|
|
9659
|
+
* @param customActions - Array of custom actions to validate
|
|
9660
|
+
* @returns Object containing valid actions and any validation errors
|
|
8222
9661
|
*/
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
9662
|
+
const getCustomActions = (customActions) => {
|
|
9663
|
+
const errors = [];
|
|
9664
|
+
if (!customActions || !Array.isArray(customActions)) {
|
|
9665
|
+
return { actions: [], errors: [] };
|
|
9666
|
+
}
|
|
9667
|
+
// Step 1: Handle invalid actions first (null, undefined, missing required
|
|
9668
|
+
// fields)
|
|
9669
|
+
const validActions = customActions.filter(action => {
|
|
9670
|
+
const validation = validateActionStructure(action);
|
|
9671
|
+
if (!validation.isValid) {
|
|
9672
|
+
if (!action || typeof action !== 'object') {
|
|
9673
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_ACTION_OBJECT);
|
|
9674
|
+
}
|
|
9675
|
+
else {
|
|
9676
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.MISSING_REQUIRED_FIELDS(action.id, validation.missingFields));
|
|
9677
|
+
}
|
|
9678
|
+
return false;
|
|
9679
|
+
}
|
|
9680
|
+
return true;
|
|
9681
|
+
});
|
|
9682
|
+
// Step 2: Check for duplicate IDs among valid actions
|
|
9683
|
+
const { actions: actionsWithUniqueIds, errors: duplicateErrors } = filterDuplicateIds(validActions);
|
|
9684
|
+
// Add duplicate errors to the errors array
|
|
9685
|
+
duplicateErrors.forEach(error => errors.push(error));
|
|
9686
|
+
// Step 3: Validate actions with unique IDs
|
|
9687
|
+
const finalValidActions = [];
|
|
9688
|
+
actionsWithUniqueIds.forEach((action) => {
|
|
9689
|
+
const { isValid, errors: validationErrors } = validateCustomAction(action);
|
|
9690
|
+
validationErrors.forEach(error => errors.push(error));
|
|
9691
|
+
if (isValid) {
|
|
9692
|
+
finalValidActions.push(action);
|
|
9693
|
+
}
|
|
9694
|
+
});
|
|
9695
|
+
const sortedActions = sortBy_1(finalValidActions, (a) => a.name.toLocaleLowerCase());
|
|
9696
|
+
return {
|
|
9697
|
+
actions: sortedActions,
|
|
9698
|
+
errors: errors,
|
|
9699
|
+
};
|
|
9700
|
+
};
|
|
8233
9701
|
|
|
8234
9702
|
/**
|
|
8235
9703
|
* Copyright (c) 2023
|
|
@@ -15757,6 +17225,13 @@ function processExitPresentMode(e) {
|
|
|
15757
17225
|
handleExitPresentMode();
|
|
15758
17226
|
}
|
|
15759
17227
|
}
|
|
17228
|
+
/**
|
|
17229
|
+
* Clears the cached preauth and session info.
|
|
17230
|
+
*/
|
|
17231
|
+
function processClearInfoCache() {
|
|
17232
|
+
resetCachedPreauthInfo();
|
|
17233
|
+
resetCachedSessionInfo();
|
|
17234
|
+
}
|
|
15760
17235
|
/**
|
|
15761
17236
|
*
|
|
15762
17237
|
* @param e
|
|
@@ -15863,11 +17338,13 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
15863
17338
|
return processAuthLogout(e, containerEl);
|
|
15864
17339
|
case EmbedEvent.ExitPresentMode:
|
|
15865
17340
|
return processExitPresentMode();
|
|
17341
|
+
case EmbedEvent.CLEAR_INFO_CACHE:
|
|
17342
|
+
return processClearInfoCache();
|
|
15866
17343
|
}
|
|
15867
17344
|
return e;
|
|
15868
17345
|
}
|
|
15869
17346
|
|
|
15870
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.41.0
|
|
17347
|
+
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};
|
|
15871
17348
|
|
|
15872
17349
|
/**
|
|
15873
17350
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -16178,10 +17655,10 @@ class TsEmbed {
|
|
|
16178
17655
|
};
|
|
16179
17656
|
this.showPreRenderByDefault = false;
|
|
16180
17657
|
/**
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
17658
|
+
* @hidden
|
|
17659
|
+
* Internal state to track if the embed container is loaded.
|
|
17660
|
+
* This is used to trigger events after the embed container is loaded.
|
|
17661
|
+
*/
|
|
16185
17662
|
this.isEmbedContainerLoaded = false;
|
|
16186
17663
|
/**
|
|
16187
17664
|
* @hidden
|
|
@@ -16240,10 +17717,10 @@ class TsEmbed {
|
|
|
16240
17717
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
16241
17718
|
...viewConfig,
|
|
16242
17719
|
});
|
|
16243
|
-
const embedConfig = getEmbedConfig();
|
|
16244
|
-
this.embedConfig = embedConfig;
|
|
16245
17720
|
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
16246
17721
|
this.isReadyForRenderPromise = getInitPromise().then(async () => {
|
|
17722
|
+
const embedConfig = getEmbedConfig();
|
|
17723
|
+
this.embedConfig = embedConfig;
|
|
16247
17724
|
if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
|
|
16248
17725
|
this.embedConfig.authTriggerContainer = domSelector;
|
|
16249
17726
|
}
|
|
@@ -16392,6 +17869,16 @@ class TsEmbed {
|
|
|
16392
17869
|
async getDefaultAppInitData() {
|
|
16393
17870
|
var _a, _b;
|
|
16394
17871
|
const authToken = await this.getAuthTokenForCookielessInit();
|
|
17872
|
+
const customActionsResult = getCustomActions([
|
|
17873
|
+
...(this.viewConfig.customActions || []),
|
|
17874
|
+
...(this.embedConfig.customActions || [])
|
|
17875
|
+
]);
|
|
17876
|
+
if (customActionsResult.errors.length > 0) {
|
|
17877
|
+
this.handleError({
|
|
17878
|
+
type: 'CUSTOM_ACTION_VALIDATION',
|
|
17879
|
+
message: customActionsResult.errors,
|
|
17880
|
+
});
|
|
17881
|
+
}
|
|
16395
17882
|
return {
|
|
16396
17883
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
16397
17884
|
authToken,
|
|
@@ -16409,6 +17896,7 @@ class TsEmbed {
|
|
|
16409
17896
|
: [],
|
|
16410
17897
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
16411
17898
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
17899
|
+
customActions: customActionsResult.actions,
|
|
16412
17900
|
};
|
|
16413
17901
|
}
|
|
16414
17902
|
async getAppInitData() {
|
|
@@ -16428,11 +17916,6 @@ class TsEmbed {
|
|
|
16428
17916
|
.join('/');
|
|
16429
17917
|
return `${basePath}#`;
|
|
16430
17918
|
}
|
|
16431
|
-
getUpdateEmbedParamsObject() {
|
|
16432
|
-
let queryParams = this.getEmbedParamsObject();
|
|
16433
|
-
queryParams = { ...this.viewConfig, ...queryParams };
|
|
16434
|
-
return queryParams;
|
|
16435
|
-
}
|
|
16436
17919
|
/**
|
|
16437
17920
|
* Common query params set for all the embed modes.
|
|
16438
17921
|
* @param queryParams
|
|
@@ -16582,13 +18065,9 @@ class TsEmbed {
|
|
|
16582
18065
|
return path;
|
|
16583
18066
|
}
|
|
16584
18067
|
getEmbedParams() {
|
|
16585
|
-
const queryParams = this.
|
|
18068
|
+
const queryParams = this.getBaseQueryParams();
|
|
16586
18069
|
return getQueryParamString(queryParams);
|
|
16587
18070
|
}
|
|
16588
|
-
getEmbedParamsObject() {
|
|
16589
|
-
const params = this.getBaseQueryParams();
|
|
16590
|
-
return params;
|
|
16591
|
-
}
|
|
16592
18071
|
getRootIframeSrc() {
|
|
16593
18072
|
const query = this.getEmbedParams();
|
|
16594
18073
|
return this.getEmbedBasePath(query);
|
|
@@ -17149,12 +18628,7 @@ class TsEmbed {
|
|
|
17149
18628
|
return this.preRender(true);
|
|
17150
18629
|
}
|
|
17151
18630
|
this.validatePreRenderViewConfig(this.viewConfig);
|
|
17152
|
-
logger$3.debug('triggering UpdateEmbedParams', this.viewConfig);
|
|
17153
|
-
this.executeAfterEmbedContainerLoaded(() => {
|
|
17154
|
-
this.trigger(HostEvent.UpdateEmbedParams, this.getUpdateEmbedParamsObject());
|
|
17155
|
-
});
|
|
17156
18631
|
}
|
|
17157
|
-
this.beforePrerenderVisible();
|
|
17158
18632
|
if (this.el) {
|
|
17159
18633
|
this.syncPreRenderStyle();
|
|
17160
18634
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
@@ -17171,6 +18645,7 @@ class TsEmbed {
|
|
|
17171
18645
|
this.resizeObserver.observe(this.el);
|
|
17172
18646
|
}
|
|
17173
18647
|
}
|
|
18648
|
+
this.beforePrerenderVisible();
|
|
17174
18649
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
17175
18650
|
this.subscribeToEvents();
|
|
17176
18651
|
// Setup fullscreen change handler for prerendered components
|
|
@@ -17359,9 +18834,15 @@ let SearchBarEmbed$1 = class SearchBarEmbed extends TsEmbed {
|
|
|
17359
18834
|
this.embedComponentType = 'SearchBarEmbed';
|
|
17360
18835
|
this.viewConfig = viewConfig;
|
|
17361
18836
|
}
|
|
17362
|
-
|
|
18837
|
+
/**
|
|
18838
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
18839
|
+
* loaded in the iframe
|
|
18840
|
+
* @param dataSources A list of data source GUIDs
|
|
18841
|
+
*/
|
|
18842
|
+
getIFrameSrc() {
|
|
17363
18843
|
var _a;
|
|
17364
18844
|
const { searchOptions, dataSource, dataSources, useLastSelectedSources = false, excludeSearchTokenStringFromURL, } = this.viewConfig;
|
|
18845
|
+
const path = 'search-bar-embed';
|
|
17365
18846
|
const queryParams = this.getBaseQueryParams();
|
|
17366
18847
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
17367
18848
|
if (dataSources && dataSources.length) {
|
|
@@ -17383,16 +18864,6 @@ let SearchBarEmbed$1 = class SearchBarEmbed extends TsEmbed {
|
|
|
17383
18864
|
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
17384
18865
|
}
|
|
17385
18866
|
queryParams[Param.searchEmbed] = true;
|
|
17386
|
-
return queryParams;
|
|
17387
|
-
}
|
|
17388
|
-
/**
|
|
17389
|
-
* Construct the URL of the embedded ThoughtSpot search to be
|
|
17390
|
-
* loaded in the iframe
|
|
17391
|
-
* @param dataSources A list of data source GUIDs
|
|
17392
|
-
*/
|
|
17393
|
-
getIFrameSrc() {
|
|
17394
|
-
const queryParams = this.getEmbedParamsObject();
|
|
17395
|
-
const path = 'search-bar-embed';
|
|
17396
18867
|
let query = '';
|
|
17397
18868
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
17398
18869
|
if (queryParamsString) {
|
|
@@ -17443,7 +18914,12 @@ let SageEmbed$1 = class SageEmbed extends V1Embed {
|
|
|
17443
18914
|
viewConfig.embedComponentType = 'SageEmbed';
|
|
17444
18915
|
super(domSelector, viewConfig);
|
|
17445
18916
|
}
|
|
17446
|
-
|
|
18917
|
+
/**
|
|
18918
|
+
* Constructs a map of parameters to be passed on to the
|
|
18919
|
+
* embedded Eureka or Sage search page.
|
|
18920
|
+
* @returns {string} query string
|
|
18921
|
+
*/
|
|
18922
|
+
getEmbedParams() {
|
|
17447
18923
|
const { disableWorksheetChange, hideWorksheetSelector, showObjectSuggestions, dataPanelV2, hideSampleQuestions, isProductTour, hideSageAnswerHeader, hideAutocompleteSuggestions, } = this.viewConfig;
|
|
17448
18924
|
const params = this.getBaseQueryParams();
|
|
17449
18925
|
params[Param.DataPanelV2Enabled] = !!dataPanelV2;
|
|
@@ -17458,15 +18934,6 @@ let SageEmbed$1 = class SageEmbed extends V1Embed {
|
|
|
17458
18934
|
params[Param.HideSampleQuestions] = !!hideSampleQuestions;
|
|
17459
18935
|
params[Param.IsProductTour] = !!isProductTour;
|
|
17460
18936
|
params[Param.HideSageAnswerHeader] = !!hideSageAnswerHeader;
|
|
17461
|
-
return params;
|
|
17462
|
-
}
|
|
17463
|
-
/**
|
|
17464
|
-
* Constructs a map of parameters to be passed on to the
|
|
17465
|
-
* embedded Eureka or Sage search page.
|
|
17466
|
-
* @returns {string} query string
|
|
17467
|
-
*/
|
|
17468
|
-
getEmbedParams() {
|
|
17469
|
-
const params = this.getEmbedParamsObject();
|
|
17470
18937
|
return getQueryParamString(params, true);
|
|
17471
18938
|
}
|
|
17472
18939
|
/**
|
|
@@ -17576,9 +19043,11 @@ let SearchEmbed$1 = class SearchEmbed extends TsEmbed {
|
|
|
17576
19043
|
const defaultAppInitData = await super.getAppInitData();
|
|
17577
19044
|
return { ...defaultAppInitData, ...this.getSearchInitData() };
|
|
17578
19045
|
}
|
|
17579
|
-
|
|
19046
|
+
getEmbedParams() {
|
|
17580
19047
|
var _a;
|
|
17581
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
19048
|
+
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
19049
|
+
/* eslint-disable-next-line max-len */
|
|
19050
|
+
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, focusSearchBarOnRender = true, excludeRuntimeParametersfromURL, excludeSearchTokenStringFromURL, collapseSearchBar = true, } = this.viewConfig;
|
|
17582
19051
|
const queryParams = this.getBaseQueryParams();
|
|
17583
19052
|
queryParams[Param.HideActions] = [
|
|
17584
19053
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -17611,6 +19080,7 @@ let SearchEmbed$1 = class SearchEmbed extends TsEmbed {
|
|
|
17611
19080
|
queryParams[Param.HideSearchBar] = true;
|
|
17612
19081
|
}
|
|
17613
19082
|
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19083
|
+
/* eslint-disable-next-line max-len */
|
|
17614
19084
|
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
17615
19085
|
}
|
|
17616
19086
|
if (!focusSearchBarOnRender) {
|
|
@@ -17623,22 +19093,20 @@ let SearchEmbed$1 = class SearchEmbed extends TsEmbed {
|
|
|
17623
19093
|
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
17624
19094
|
}
|
|
17625
19095
|
queryParams[Param.searchEmbed] = true;
|
|
19096
|
+
/* eslint-disable-next-line max-len */
|
|
17626
19097
|
queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
|
|
17627
19098
|
queryParams[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
17628
19099
|
if (dataPanelCustomGroupsAccordionInitialState
|
|
17629
19100
|
=== DataPanelCustomColumnGroupsAccordionState$1.COLLAPSE_ALL
|
|
17630
19101
|
|| dataPanelCustomGroupsAccordionInitialState
|
|
17631
19102
|
=== DataPanelCustomColumnGroupsAccordionState$1.EXPAND_FIRST) {
|
|
19103
|
+
/* eslint-disable-next-line max-len */
|
|
17632
19104
|
queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
|
|
17633
19105
|
}
|
|
17634
19106
|
else {
|
|
19107
|
+
/* eslint-disable-next-line max-len */
|
|
17635
19108
|
queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL;
|
|
17636
19109
|
}
|
|
17637
|
-
return queryParams;
|
|
17638
|
-
}
|
|
17639
|
-
getEmbedParams() {
|
|
17640
|
-
const { runtimeParameters, runtimeFilters, excludeRuntimeParametersfromURL, excludeRuntimeFiltersfromURL, } = this.viewConfig;
|
|
17641
|
-
const queryParams = this.getEmbedParamsObject();
|
|
17642
19110
|
let query = '';
|
|
17643
19111
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
17644
19112
|
if (queryParamsString) {
|
|
@@ -17779,6 +19247,11 @@ var HomePage;
|
|
|
17779
19247
|
* It serves as the foundational version of the home page.
|
|
17780
19248
|
*/
|
|
17781
19249
|
HomePage["Modular"] = "v2";
|
|
19250
|
+
/**
|
|
19251
|
+
* ModularWithStylingChanges (v3) introduces Modular Home Experience
|
|
19252
|
+
* with styling changes.
|
|
19253
|
+
*/
|
|
19254
|
+
HomePage["ModularWithStylingChanges"] = "v3";
|
|
17782
19255
|
})(HomePage || (HomePage = {}));
|
|
17783
19256
|
/**
|
|
17784
19257
|
* Define the version of the list page
|
|
@@ -17866,7 +19339,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17866
19339
|
* embedded Liveboard or visualization.
|
|
17867
19340
|
*/
|
|
17868
19341
|
getEmbedParams() {
|
|
17869
|
-
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.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
19342
|
+
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.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;
|
|
17870
19343
|
let params = {};
|
|
17871
19344
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17872
19345
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17883,6 +19356,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17883
19356
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17884
19357
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
17885
19358
|
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
19359
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
17886
19360
|
params = this.getBaseQueryParams(params);
|
|
17887
19361
|
if (hideObjectSearch) {
|
|
17888
19362
|
params[Param.HideObjectSearch] = !!hideObjectSearch;
|
|
@@ -17950,6 +19424,12 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17950
19424
|
// To use v3 navigation, we must manually set the discoveryExperience
|
|
17951
19425
|
// settings.
|
|
17952
19426
|
params[Param.NavigationVersion] = 'v2';
|
|
19427
|
+
// Set homePageVersion to v2 by default to reset the LD flag value
|
|
19428
|
+
// for the homepageVersion.
|
|
19429
|
+
params[Param.HomepageVersion] = 'v2';
|
|
19430
|
+
// Set listpageVersion to v2 by default to reset the LD flag value
|
|
19431
|
+
// for the listpageVersion.
|
|
19432
|
+
params[Param.ListPageVersion] = ListPage.List;
|
|
17953
19433
|
if (discoveryExperience) {
|
|
17954
19434
|
// primaryNavbarVersion v3 will enabled the new left navigation
|
|
17955
19435
|
if (discoveryExperience.primaryNavbarVersion === PrimaryNavbarVersion.Sliding) {
|
|
@@ -17962,6 +19442,12 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17962
19442
|
if (discoveryExperience.homePage === HomePage.Modular) {
|
|
17963
19443
|
params[Param.ModularHomeExperienceEnabled] = true;
|
|
17964
19444
|
}
|
|
19445
|
+
// ModularWithStylingChanges (v3) introduces the styling changes
|
|
19446
|
+
// to the Modular Homepage.
|
|
19447
|
+
// v3 will be the base version of homePageVersion.
|
|
19448
|
+
if (discoveryExperience.homePage === HomePage.ModularWithStylingChanges) {
|
|
19449
|
+
params[Param.HomepageVersion] = HomePage.ModularWithStylingChanges;
|
|
19450
|
+
}
|
|
17965
19451
|
// listPageVersion v3 will enable the new list page
|
|
17966
19452
|
if (discoveryExperience.listPageVersion === ListPage.ListWithUXChanges) {
|
|
17967
19453
|
params[Param.ListPageVersion] = discoveryExperience.listPageVersion;
|
|
@@ -18265,14 +19751,9 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
18265
19751
|
* embedded Liveboard or visualization.
|
|
18266
19752
|
*/
|
|
18267
19753
|
getEmbedParams() {
|
|
18268
|
-
const params = this.getEmbedParamsObject();
|
|
18269
|
-
const queryParams = getQueryParamString(params, true);
|
|
18270
|
-
return queryParams;
|
|
18271
|
-
}
|
|
18272
|
-
getEmbedParamsObject() {
|
|
18273
19754
|
let params = {};
|
|
18274
19755
|
params = this.getBaseQueryParams(params);
|
|
18275
|
-
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;
|
|
19756
|
+
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;
|
|
18276
19757
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
18277
19758
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
18278
19759
|
if (fullHeight === true) {
|
|
@@ -18339,27 +19820,9 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
18339
19820
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18340
19821
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18341
19822
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
if (isForceRedirect) {
|
|
18346
|
-
params[Param.IsForceRedirect] = isForceRedirect;
|
|
18347
|
-
}
|
|
18348
|
-
if (dataSourceId !== undefined) {
|
|
18349
|
-
params[Param.DataSourceId] = dataSourceId;
|
|
18350
|
-
}
|
|
18351
|
-
if (isLiveboardStylingAndGroupingEnabled !== undefined) {
|
|
18352
|
-
params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
|
|
18353
|
-
}
|
|
18354
|
-
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
18355
|
-
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
18356
|
-
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
18357
|
-
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
18358
|
-
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
18359
|
-
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18360
|
-
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18361
|
-
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
18362
|
-
return params;
|
|
19823
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
19824
|
+
const queryParams = getQueryParamString(params, true);
|
|
19825
|
+
return queryParams;
|
|
18363
19826
|
}
|
|
18364
19827
|
getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
|
|
18365
19828
|
let suffix = `/embed/viz/${liveboardId}`;
|
|
@@ -18917,17 +20380,13 @@ let ConversationMessage$1 = class ConversationMessage extends TsEmbed {
|
|
|
18917
20380
|
super(container, viewConfig);
|
|
18918
20381
|
this.viewConfig = viewConfig;
|
|
18919
20382
|
}
|
|
18920
|
-
|
|
20383
|
+
getIframeSrc() {
|
|
18921
20384
|
var _a;
|
|
20385
|
+
const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
|
|
20386
|
+
const path = 'conv-assist-answer';
|
|
18922
20387
|
const queryParams = this.getBaseQueryParams();
|
|
18923
20388
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
18924
20389
|
queryParams[Param.isSpotterAgentEmbed] = true;
|
|
18925
|
-
return queryParams;
|
|
18926
|
-
}
|
|
18927
|
-
getIframeSrc() {
|
|
18928
|
-
const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
|
|
18929
|
-
const path = 'conv-assist-answer';
|
|
18930
|
-
const queryParams = this.getEmbedParamsObject();
|
|
18931
20390
|
let query = '';
|
|
18932
20391
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18933
20392
|
if (queryParamsString) {
|
|
@@ -19083,8 +20542,9 @@ let SpotterEmbed$1 = class SpotterEmbed extends TsEmbed {
|
|
|
19083
20542
|
super(container, viewConfig);
|
|
19084
20543
|
this.viewConfig = viewConfig;
|
|
19085
20544
|
}
|
|
19086
|
-
|
|
20545
|
+
getIframeSrc() {
|
|
19087
20546
|
const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
20547
|
+
const path = 'insights/conv-assist';
|
|
19088
20548
|
if (!worksheetId) {
|
|
19089
20549
|
this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
|
|
19090
20550
|
}
|
|
@@ -19105,12 +20565,6 @@ let SpotterEmbed$1 = class SpotterEmbed extends TsEmbed {
|
|
|
19105
20565
|
if (!isUndefined_1(hideSampleQuestions)) {
|
|
19106
20566
|
queryParams[Param.HideSampleQuestions] = !!hideSampleQuestions;
|
|
19107
20567
|
}
|
|
19108
|
-
return queryParams;
|
|
19109
|
-
}
|
|
19110
|
-
getIframeSrc() {
|
|
19111
|
-
const { worksheetId, searchOptions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
19112
|
-
const path = 'insights/conv-assist';
|
|
19113
|
-
const queryParams = this.getEmbedParamsObject();
|
|
19114
20568
|
let query = '';
|
|
19115
20569
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
19116
20570
|
if (queryParamsString) {
|
|
@@ -19550,4 +21004,4 @@ function useSpotterAgent(config) {
|
|
|
19550
21004
|
};
|
|
19551
21005
|
}
|
|
19552
21006
|
|
|
19553
|
-
export { Action, AppEmbed, ConversationEmbed, ConversationMessage, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, ListPageColumns, LiveboardEmbed, LogLevel, Page, PinboardEmbed, PreRenderedAppEmbed, PreRenderedConversationEmbed, PreRenderedLiveboardEmbed, PreRenderedPinboardEmbed, PreRenderedSageEmbed, PreRenderedSearchBarEmbed, PreRenderedSearchEmbed, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterEmbed, SpotterMessage, getSessionInfo, useEmbedRef, useInit, useSpotterAgent };
|
|
21007
|
+
export { Action, AppEmbed, ConversationEmbed, ConversationMessage, CustomActionsPosition, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, ListPageColumns, LiveboardEmbed, LogLevel, Page, PinboardEmbed, PreRenderedAppEmbed, PreRenderedConversationEmbed, PreRenderedLiveboardEmbed, PreRenderedPinboardEmbed, PreRenderedSageEmbed, PreRenderedSearchBarEmbed, PreRenderedSearchEmbed, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterEmbed, SpotterMessage, getSessionInfo, useEmbedRef, useInit, useSpotterAgent };
|