@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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.41.0
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.41.0 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -379,6 +379,15 @@
|
|
|
379
379
|
* @returns The stored value or `undefined` if the key is not found.
|
|
380
380
|
*/
|
|
381
381
|
const getValueFromWindow = (key) => { var _a; return (_a = window === null || window === void 0 ? void 0 : window[sdkWindowKey]) === null || _a === void 0 ? void 0 : _a[key]; };
|
|
382
|
+
/**
|
|
383
|
+
* Check if an array includes a string value
|
|
384
|
+
* @param arr - The array to check
|
|
385
|
+
* @param key - The string to search for
|
|
386
|
+
* @returns boolean indicating if the string is found in the array
|
|
387
|
+
*/
|
|
388
|
+
const arrayIncludesString = (arr, key) => {
|
|
389
|
+
return arr.some(item => typeof item === 'string' && item === key);
|
|
390
|
+
};
|
|
382
391
|
/**
|
|
383
392
|
* Check if the document is currently in fullscreen mode
|
|
384
393
|
*/
|
|
@@ -474,7 +483,6 @@
|
|
|
474
483
|
* the embedded app
|
|
475
484
|
* @group Authentication / Init
|
|
476
485
|
*/
|
|
477
|
-
// eslint-disable-next-line no-shadow
|
|
478
486
|
exports.AuthType = void 0;
|
|
479
487
|
(function (AuthType) {
|
|
480
488
|
/**
|
|
@@ -688,7 +696,6 @@
|
|
|
688
696
|
/**
|
|
689
697
|
* A map of the supported runtime filter operations
|
|
690
698
|
*/
|
|
691
|
-
// eslint-disable-next-line no-shadow
|
|
692
699
|
exports.RuntimeFilterOp = void 0;
|
|
693
700
|
(function (RuntimeFilterOp) {
|
|
694
701
|
/**
|
|
@@ -759,7 +766,6 @@
|
|
|
759
766
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
760
767
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
|
|
761
768
|
*/
|
|
762
|
-
// eslint-disable-next-line no-shadow
|
|
763
769
|
exports.HomepageModule = void 0;
|
|
764
770
|
(function (HomepageModule) {
|
|
765
771
|
/**
|
|
@@ -792,7 +798,6 @@
|
|
|
792
798
|
* **Note**: This option is applicable to full app embedding only.
|
|
793
799
|
* @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
|
|
794
800
|
*/
|
|
795
|
-
// eslint-disable-next-line no-shadow
|
|
796
801
|
exports.ListPageColumns = void 0;
|
|
797
802
|
(function (ListPageColumns) {
|
|
798
803
|
/**
|
|
@@ -855,7 +860,6 @@
|
|
|
855
860
|
* ```
|
|
856
861
|
* @group Events
|
|
857
862
|
*/
|
|
858
|
-
// eslint-disable-next-line no-shadow
|
|
859
863
|
exports.EmbedEvent = void 0;
|
|
860
864
|
(function (EmbedEvent) {
|
|
861
865
|
/**
|
|
@@ -1497,6 +1501,11 @@
|
|
|
1497
1501
|
* @hidden
|
|
1498
1502
|
*/
|
|
1499
1503
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
1504
|
+
/**
|
|
1505
|
+
* Internal event to clear the cached info
|
|
1506
|
+
* @hidden
|
|
1507
|
+
*/
|
|
1508
|
+
EmbedEvent["CLEAR_INFO_CACHE"] = "clearInfoCache";
|
|
1500
1509
|
/**
|
|
1501
1510
|
* Emitted when a user clicks **Show Liveboard details** on a Liveboard
|
|
1502
1511
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
@@ -1965,6 +1974,17 @@
|
|
|
1965
1974
|
* ```
|
|
1966
1975
|
*/
|
|
1967
1976
|
EmbedEvent["EmbedListenerReady"] = "EmbedListenerReady";
|
|
1977
|
+
/**
|
|
1978
|
+
* Emitted when the organization is switched.
|
|
1979
|
+
* @example
|
|
1980
|
+
* ```js
|
|
1981
|
+
* appEmbed.on(EmbedEvent.OrgSwitched, (payload) => {
|
|
1982
|
+
* console.log('payload', payload);
|
|
1983
|
+
* })
|
|
1984
|
+
* ```
|
|
1985
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
1986
|
+
*/
|
|
1987
|
+
EmbedEvent["OrgSwitched"] = "orgSwitched";
|
|
1968
1988
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
1969
1989
|
/**
|
|
1970
1990
|
* Event types that can be triggered by the host application
|
|
@@ -2019,7 +2039,6 @@
|
|
|
2019
2039
|
* ```
|
|
2020
2040
|
* @group Events
|
|
2021
2041
|
*/
|
|
2022
|
-
// eslint-disable-next-line no-shadow
|
|
2023
2042
|
exports.HostEvent = void 0;
|
|
2024
2043
|
(function (HostEvent) {
|
|
2025
2044
|
/**
|
|
@@ -3229,22 +3248,11 @@
|
|
|
3229
3248
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
3230
3249
|
*/
|
|
3231
3250
|
HostEvent["AskSpotter"] = "AskSpotter";
|
|
3232
|
-
/**
|
|
3233
|
-
* @hidden
|
|
3234
|
-
* Triggers the update of the embed params.
|
|
3235
|
-
*
|
|
3236
|
-
* @example
|
|
3237
|
-
* ```js
|
|
3238
|
-
* liveboardEmbed.trigger(HostEvent.UpdateEmbedParams, viewConfig);
|
|
3239
|
-
* ```
|
|
3240
|
-
*/
|
|
3241
|
-
HostEvent["UpdateEmbedParams"] = "updateEmbedParams";
|
|
3242
3251
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
3243
3252
|
/**
|
|
3244
3253
|
* The different visual modes that the data sources panel within
|
|
3245
3254
|
* search could appear in, such as hidden, collapsed, or expanded.
|
|
3246
3255
|
*/
|
|
3247
|
-
// eslint-disable-next-line no-shadow
|
|
3248
3256
|
exports.DataSourceVisualMode = void 0;
|
|
3249
3257
|
(function (DataSourceVisualMode) {
|
|
3250
3258
|
/**
|
|
@@ -3264,7 +3272,6 @@
|
|
|
3264
3272
|
* The query params passed down to the embedded ThoughtSpot app
|
|
3265
3273
|
* containing configuration and/or visual information.
|
|
3266
3274
|
*/
|
|
3267
|
-
// eslint-disable-next-line no-shadow
|
|
3268
3275
|
var Param;
|
|
3269
3276
|
(function (Param) {
|
|
3270
3277
|
Param["EmbedApp"] = "embedApp";
|
|
@@ -3344,6 +3351,7 @@
|
|
|
3344
3351
|
Param["Query"] = "query";
|
|
3345
3352
|
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
3346
3353
|
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
3354
|
+
Param["HomepageVersion"] = "homepageVersion";
|
|
3347
3355
|
Param["ListPageVersion"] = "listpageVersion";
|
|
3348
3356
|
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
3349
3357
|
Param["LiveboardHeaderSticky"] = "isLiveboardHeaderSticky";
|
|
@@ -3385,6 +3393,7 @@
|
|
|
3385
3393
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
3386
3394
|
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
3387
3395
|
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
3396
|
+
Param["LiveboardXLSXCSVDownload"] = "isLiveboardXLSXCSVDownloadEnabled";
|
|
3388
3397
|
})(Param || (Param = {}));
|
|
3389
3398
|
/**
|
|
3390
3399
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -3413,7 +3422,6 @@
|
|
|
3413
3422
|
* ```
|
|
3414
3423
|
* See also link:https://developers.thoughtspot.com/docs/actions[Action IDs in the SDK]
|
|
3415
3424
|
*/
|
|
3416
|
-
// eslint-disable-next-line no-shadow
|
|
3417
3425
|
exports.Action = void 0;
|
|
3418
3426
|
(function (Action) {
|
|
3419
3427
|
/**
|
|
@@ -3958,7 +3966,7 @@
|
|
|
3958
3966
|
* The Favorites icon (*) for Answers,
|
|
3959
3967
|
* Liveboard, and data objects like Worksheet, Model,
|
|
3960
3968
|
* Tables and Views.
|
|
3961
|
-
* Allows adding an object to the user
|
|
3969
|
+
* Allows adding an object to the user's favorites list.
|
|
3962
3970
|
* @example
|
|
3963
3971
|
* ```js
|
|
3964
3972
|
* disabledActions: [Action.AddToFavorites]
|
|
@@ -4685,6 +4693,26 @@
|
|
|
4685
4693
|
ContextMenuTriggerOptions["RIGHT_CLICK"] = "right-click";
|
|
4686
4694
|
ContextMenuTriggerOptions["BOTH_CLICKS"] = "both-clicks";
|
|
4687
4695
|
})(exports.ContextMenuTriggerOptions || (exports.ContextMenuTriggerOptions = {}));
|
|
4696
|
+
/**
|
|
4697
|
+
* Enum options to show custom actions at different
|
|
4698
|
+
* positions in the application.
|
|
4699
|
+
*/
|
|
4700
|
+
exports.CustomActionsPosition = void 0;
|
|
4701
|
+
(function (CustomActionsPosition) {
|
|
4702
|
+
CustomActionsPosition["PRIMARY"] = "PRIMARY";
|
|
4703
|
+
CustomActionsPosition["MENU"] = "MENU";
|
|
4704
|
+
CustomActionsPosition["CONTEXTMENU"] = "CONTEXTMENU";
|
|
4705
|
+
})(exports.CustomActionsPosition || (exports.CustomActionsPosition = {}));
|
|
4706
|
+
/**
|
|
4707
|
+
* Enum options to mention the target of the custom action.
|
|
4708
|
+
*/
|
|
4709
|
+
exports.CustomActionTarget = void 0;
|
|
4710
|
+
(function (CustomActionTarget) {
|
|
4711
|
+
CustomActionTarget["LIVEBOARD"] = "LIVEBOARD";
|
|
4712
|
+
CustomActionTarget["VIZ"] = "VIZ";
|
|
4713
|
+
CustomActionTarget["ANSWER"] = "ANSWER";
|
|
4714
|
+
CustomActionTarget["SPOTTER"] = "SPOTTER";
|
|
4715
|
+
})(exports.CustomActionTarget || (exports.CustomActionTarget = {}));
|
|
4688
4716
|
/**
|
|
4689
4717
|
* Enum options to show or suppress Visual Embed SDK and
|
|
4690
4718
|
* ThoughtSpot application logs in the console output.
|
|
@@ -5841,8 +5869,8 @@
|
|
|
5841
5869
|
var _cacheHas = cacheHas;
|
|
5842
5870
|
|
|
5843
5871
|
/** Used to compose bitmasks for value comparisons. */
|
|
5844
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5845
|
-
COMPARE_UNORDERED_FLAG$
|
|
5872
|
+
var COMPARE_PARTIAL_FLAG$5 = 1,
|
|
5873
|
+
COMPARE_UNORDERED_FLAG$3 = 2;
|
|
5846
5874
|
|
|
5847
5875
|
/**
|
|
5848
5876
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
@@ -5858,7 +5886,7 @@
|
|
|
5858
5886
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
5859
5887
|
*/
|
|
5860
5888
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
5861
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
5889
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
|
|
5862
5890
|
arrLength = array.length,
|
|
5863
5891
|
othLength = other.length;
|
|
5864
5892
|
|
|
@@ -5873,7 +5901,7 @@
|
|
|
5873
5901
|
}
|
|
5874
5902
|
var index = -1,
|
|
5875
5903
|
result = true,
|
|
5876
|
-
seen = (bitmask & COMPARE_UNORDERED_FLAG$
|
|
5904
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new _SetCache : undefined;
|
|
5877
5905
|
|
|
5878
5906
|
stack.set(array, other);
|
|
5879
5907
|
stack.set(other, array);
|
|
@@ -5965,8 +5993,8 @@
|
|
|
5965
5993
|
var _setToArray = setToArray;
|
|
5966
5994
|
|
|
5967
5995
|
/** Used to compose bitmasks for value comparisons. */
|
|
5968
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5969
|
-
COMPARE_UNORDERED_FLAG = 2;
|
|
5996
|
+
var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
5997
|
+
COMPARE_UNORDERED_FLAG$2 = 2;
|
|
5970
5998
|
|
|
5971
5999
|
/** `Object#toString` result references. */
|
|
5972
6000
|
var boolTag$2 = '[object Boolean]',
|
|
@@ -5977,14 +6005,14 @@
|
|
|
5977
6005
|
regexpTag$1 = '[object RegExp]',
|
|
5978
6006
|
setTag$3 = '[object Set]',
|
|
5979
6007
|
stringTag$1 = '[object String]',
|
|
5980
|
-
symbolTag = '[object Symbol]';
|
|
6008
|
+
symbolTag$1 = '[object Symbol]';
|
|
5981
6009
|
|
|
5982
6010
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
5983
6011
|
dataViewTag$2 = '[object DataView]';
|
|
5984
6012
|
|
|
5985
6013
|
/** Used to convert symbols to primitives and strings. */
|
|
5986
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
5987
|
-
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
6014
|
+
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
|
6015
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
5988
6016
|
|
|
5989
6017
|
/**
|
|
5990
6018
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
@@ -6041,7 +6069,7 @@
|
|
|
6041
6069
|
var convert = _mapToArray;
|
|
6042
6070
|
|
|
6043
6071
|
case setTag$3:
|
|
6044
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6072
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
6045
6073
|
convert || (convert = _setToArray);
|
|
6046
6074
|
|
|
6047
6075
|
if (object.size != other.size && !isPartial) {
|
|
@@ -6052,7 +6080,7 @@
|
|
|
6052
6080
|
if (stacked) {
|
|
6053
6081
|
return stacked == other;
|
|
6054
6082
|
}
|
|
6055
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
6083
|
+
bitmask |= COMPARE_UNORDERED_FLAG$2;
|
|
6056
6084
|
|
|
6057
6085
|
// Recursively compare objects (susceptible to call stack limits).
|
|
6058
6086
|
stack.set(object, other);
|
|
@@ -6060,7 +6088,7 @@
|
|
|
6060
6088
|
stack['delete'](object);
|
|
6061
6089
|
return result;
|
|
6062
6090
|
|
|
6063
|
-
case symbolTag:
|
|
6091
|
+
case symbolTag$1:
|
|
6064
6092
|
if (symbolValueOf) {
|
|
6065
6093
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
6066
6094
|
}
|
|
@@ -6751,7 +6779,7 @@
|
|
|
6751
6779
|
var _getAllKeys = getAllKeys;
|
|
6752
6780
|
|
|
6753
6781
|
/** Used to compose bitmasks for value comparisons. */
|
|
6754
|
-
var COMPARE_PARTIAL_FLAG$
|
|
6782
|
+
var COMPARE_PARTIAL_FLAG$3 = 1;
|
|
6755
6783
|
|
|
6756
6784
|
/** Used for built-in method references. */
|
|
6757
6785
|
var objectProto$2 = Object.prototype;
|
|
@@ -6773,7 +6801,7 @@
|
|
|
6773
6801
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
6774
6802
|
*/
|
|
6775
6803
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
6776
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6804
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
6777
6805
|
objProps = _getAllKeys(object),
|
|
6778
6806
|
objLength = objProps.length,
|
|
6779
6807
|
othProps = _getAllKeys(other),
|
|
@@ -6911,7 +6939,7 @@
|
|
|
6911
6939
|
var _getTag = getTag;
|
|
6912
6940
|
|
|
6913
6941
|
/** Used to compose bitmasks for value comparisons. */
|
|
6914
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
6942
|
+
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
6915
6943
|
|
|
6916
6944
|
/** `Object#toString` result references. */
|
|
6917
6945
|
var argsTag = '[object Arguments]',
|
|
@@ -6964,7 +6992,7 @@
|
|
|
6964
6992
|
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
6965
6993
|
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
6966
6994
|
}
|
|
6967
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
6995
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
|
|
6968
6996
|
var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),
|
|
6969
6997
|
othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');
|
|
6970
6998
|
|
|
@@ -7134,6 +7162,16 @@
|
|
|
7134
7162
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
7135
7163
|
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',
|
|
7136
7164
|
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
7165
|
+
};
|
|
7166
|
+
const CUSTOM_ACTIONS_ERROR_MESSAGE = {
|
|
7167
|
+
INVALID_ACTION_OBJECT: 'Custom Action Validation Error: Invalid action object provided',
|
|
7168
|
+
MISSING_REQUIRED_FIELDS: (id, missingFields) => `Custom Action Validation Error for '${id}': Missing required fields: ${missingFields.join(', ')}`,
|
|
7169
|
+
UNSUPPORTED_TARGET: (id, targetType) => `Custom Action Validation Error for '${id}': Target type '${targetType}' is not supported`,
|
|
7170
|
+
INVALID_POSITION: (position, targetType, supportedPositions) => `Position '${position}' is not supported for ${targetType.toLowerCase()}-level custom actions. Supported positions: ${supportedPositions}`,
|
|
7171
|
+
INVALID_METADATA_IDS: (targetType, invalidIds, supportedIds) => `Invalid metadata IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported metadata IDs: ${supportedIds}`,
|
|
7172
|
+
INVALID_DATA_MODEL_IDS: (targetType, invalidIds, supportedIds) => `Invalid data model IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported data model IDs: ${supportedIds}`,
|
|
7173
|
+
INVALID_FIELDS: (targetType, invalidFields, supportedFields) => `Invalid fields for ${targetType.toLowerCase()}-level custom actions: ${invalidFields.join(', ')}. Supported fields: ${supportedFields}`,
|
|
7174
|
+
DUPLICATE_IDS: (id, duplicateNames, keptName) => `Duplicate custom action ID '${id}' found. Actions with names '${duplicateNames.join("', '")}' will be ignored. Keeping '${keptName}'.`,
|
|
7137
7175
|
};
|
|
7138
7176
|
|
|
7139
7177
|
const EndPoints = {
|
|
@@ -7986,141 +8024,1571 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
7986
8024
|
if (columnsToRemove.length) {
|
|
7987
8025
|
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
7988
8026
|
}
|
|
7989
|
-
return unaggAnswerSession;
|
|
7990
|
-
}
|
|
7991
|
-
/**
|
|
7992
|
-
* Execute a custom graphql query in the context of the answer.
|
|
7993
|
-
* @param query graphql query
|
|
7994
|
-
* @param variables graphql variables
|
|
7995
|
-
* @returns
|
|
7996
|
-
*/
|
|
7997
|
-
async executeQuery(query, variables) {
|
|
7998
|
-
const data = await graphqlQuery({
|
|
7999
|
-
query,
|
|
8000
|
-
variables: {
|
|
8001
|
-
session: this.session,
|
|
8002
|
-
...variables,
|
|
8003
|
-
},
|
|
8004
|
-
thoughtSpotHost: this.thoughtSpotHost,
|
|
8005
|
-
isCompositeQuery: false,
|
|
8006
|
-
});
|
|
8007
|
-
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8008
|
-
return data;
|
|
8009
|
-
}
|
|
8010
|
-
/**
|
|
8011
|
-
* Get the internal session details for the answer.
|
|
8012
|
-
* @returns
|
|
8013
|
-
*/
|
|
8014
|
-
getSession() {
|
|
8015
|
-
return this.session;
|
|
8027
|
+
return unaggAnswerSession;
|
|
8028
|
+
}
|
|
8029
|
+
/**
|
|
8030
|
+
* Execute a custom graphql query in the context of the answer.
|
|
8031
|
+
* @param query graphql query
|
|
8032
|
+
* @param variables graphql variables
|
|
8033
|
+
* @returns
|
|
8034
|
+
*/
|
|
8035
|
+
async executeQuery(query, variables) {
|
|
8036
|
+
const data = await graphqlQuery({
|
|
8037
|
+
query,
|
|
8038
|
+
variables: {
|
|
8039
|
+
session: this.session,
|
|
8040
|
+
...variables,
|
|
8041
|
+
},
|
|
8042
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
8043
|
+
isCompositeQuery: false,
|
|
8044
|
+
});
|
|
8045
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8046
|
+
return data;
|
|
8047
|
+
}
|
|
8048
|
+
/**
|
|
8049
|
+
* Get the internal session details for the answer.
|
|
8050
|
+
* @returns
|
|
8051
|
+
*/
|
|
8052
|
+
getSession() {
|
|
8053
|
+
return this.session;
|
|
8054
|
+
}
|
|
8055
|
+
async getAnswer() {
|
|
8056
|
+
if (this.answer) {
|
|
8057
|
+
return this.answer;
|
|
8058
|
+
}
|
|
8059
|
+
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8060
|
+
return this.answer;
|
|
8061
|
+
}
|
|
8062
|
+
async getTML() {
|
|
8063
|
+
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8064
|
+
const edoc = object[0].edoc;
|
|
8065
|
+
const YAML = await Promise.resolve().then(function () { return index; });
|
|
8066
|
+
const parsedDoc = YAML.parse(edoc);
|
|
8067
|
+
return {
|
|
8068
|
+
answer: {
|
|
8069
|
+
...parsedDoc.answer,
|
|
8070
|
+
...this.tmlOverride,
|
|
8071
|
+
},
|
|
8072
|
+
};
|
|
8073
|
+
}
|
|
8074
|
+
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8075
|
+
const { displayMode, visualizations } = await this.getAnswer();
|
|
8076
|
+
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8077
|
+
return this.executeQuery(addVizToLiveboard, {
|
|
8078
|
+
liveboardId,
|
|
8079
|
+
vizId: viz.id,
|
|
8080
|
+
});
|
|
8081
|
+
}
|
|
8082
|
+
setTMLOverride(override) {
|
|
8083
|
+
this.tmlOverride = override;
|
|
8084
|
+
}
|
|
8085
|
+
}
|
|
8086
|
+
/**
|
|
8087
|
+
*
|
|
8088
|
+
* @param sourceDetail
|
|
8089
|
+
* @param colNames
|
|
8090
|
+
*/
|
|
8091
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
8092
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
8093
|
+
colSet[col.name.toLowerCase()] = col;
|
|
8094
|
+
return colSet;
|
|
8095
|
+
}, {});
|
|
8096
|
+
return new Set(colNames.map((colName) => {
|
|
8097
|
+
const col = cols[colName.toLowerCase()];
|
|
8098
|
+
return col.id;
|
|
8099
|
+
}));
|
|
8100
|
+
}
|
|
8101
|
+
/**
|
|
8102
|
+
*
|
|
8103
|
+
* @param selectedPoints
|
|
8104
|
+
*/
|
|
8105
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
8106
|
+
const underlyingDataPoint = [];
|
|
8107
|
+
/**
|
|
8108
|
+
*
|
|
8109
|
+
* @param colVal
|
|
8110
|
+
*/
|
|
8111
|
+
function addPointFromColVal(colVal) {
|
|
8112
|
+
var _a;
|
|
8113
|
+
const dataType = colVal.column.dataType;
|
|
8114
|
+
colVal.column.id;
|
|
8115
|
+
let dataValue;
|
|
8116
|
+
if (dataType === 'DATE') {
|
|
8117
|
+
if (Number.isFinite(colVal.value)) {
|
|
8118
|
+
dataValue = [{
|
|
8119
|
+
epochRange: {
|
|
8120
|
+
startEpoch: colVal.value,
|
|
8121
|
+
},
|
|
8122
|
+
}];
|
|
8123
|
+
// Case for custom calendar.
|
|
8124
|
+
}
|
|
8125
|
+
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8126
|
+
dataValue = [{
|
|
8127
|
+
epochRange: {
|
|
8128
|
+
startEpoch: colVal.value.v.s,
|
|
8129
|
+
endEpoch: colVal.value.v.e,
|
|
8130
|
+
},
|
|
8131
|
+
}];
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
else {
|
|
8135
|
+
dataValue = [{ value: colVal.value }];
|
|
8136
|
+
}
|
|
8137
|
+
underlyingDataPoint.push({
|
|
8138
|
+
columnId: colVal.column.id,
|
|
8139
|
+
dataValue,
|
|
8140
|
+
});
|
|
8141
|
+
}
|
|
8142
|
+
selectedPoints.forEach((p) => {
|
|
8143
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8144
|
+
});
|
|
8145
|
+
return underlyingDataPoint;
|
|
8146
|
+
}
|
|
8147
|
+
/**
|
|
8148
|
+
*
|
|
8149
|
+
* @param visualizations
|
|
8150
|
+
* @param displayMode
|
|
8151
|
+
*/
|
|
8152
|
+
function getDisplayedViz(visualizations, displayMode) {
|
|
8153
|
+
if (displayMode === 'CHART_MODE') {
|
|
8154
|
+
return visualizations.find(
|
|
8155
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8156
|
+
(viz) => viz.__typename === 'ChartViz');
|
|
8157
|
+
}
|
|
8158
|
+
return visualizations.find(
|
|
8159
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8160
|
+
(viz) => viz.__typename === 'TableViz');
|
|
8161
|
+
}
|
|
8162
|
+
|
|
8163
|
+
/** Built-in value references. */
|
|
8164
|
+
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
|
8165
|
+
|
|
8166
|
+
/**
|
|
8167
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
8168
|
+
*
|
|
8169
|
+
* @private
|
|
8170
|
+
* @param {*} value The value to check.
|
|
8171
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
8172
|
+
*/
|
|
8173
|
+
function isFlattenable(value) {
|
|
8174
|
+
return isArray_1(value) || isArguments_1(value) ||
|
|
8175
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
8176
|
+
}
|
|
8177
|
+
|
|
8178
|
+
var _isFlattenable = isFlattenable;
|
|
8179
|
+
|
|
8180
|
+
/**
|
|
8181
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
8182
|
+
*
|
|
8183
|
+
* @private
|
|
8184
|
+
* @param {Array} array The array to flatten.
|
|
8185
|
+
* @param {number} depth The maximum recursion depth.
|
|
8186
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
8187
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
8188
|
+
* @param {Array} [result=[]] The initial result value.
|
|
8189
|
+
* @returns {Array} Returns the new flattened array.
|
|
8190
|
+
*/
|
|
8191
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
8192
|
+
var index = -1,
|
|
8193
|
+
length = array.length;
|
|
8194
|
+
|
|
8195
|
+
predicate || (predicate = _isFlattenable);
|
|
8196
|
+
result || (result = []);
|
|
8197
|
+
|
|
8198
|
+
while (++index < length) {
|
|
8199
|
+
var value = array[index];
|
|
8200
|
+
if (depth > 0 && predicate(value)) {
|
|
8201
|
+
if (depth > 1) {
|
|
8202
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
8203
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
8204
|
+
} else {
|
|
8205
|
+
_arrayPush(result, value);
|
|
8206
|
+
}
|
|
8207
|
+
} else if (!isStrict) {
|
|
8208
|
+
result[result.length] = value;
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8211
|
+
return result;
|
|
8212
|
+
}
|
|
8213
|
+
|
|
8214
|
+
var _baseFlatten = baseFlatten;
|
|
8215
|
+
|
|
8216
|
+
/**
|
|
8217
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
8218
|
+
* shorthands.
|
|
8219
|
+
*
|
|
8220
|
+
* @private
|
|
8221
|
+
* @param {Array} [array] The array to iterate over.
|
|
8222
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8223
|
+
* @returns {Array} Returns the new mapped array.
|
|
8224
|
+
*/
|
|
8225
|
+
function arrayMap(array, iteratee) {
|
|
8226
|
+
var index = -1,
|
|
8227
|
+
length = array == null ? 0 : array.length,
|
|
8228
|
+
result = Array(length);
|
|
8229
|
+
|
|
8230
|
+
while (++index < length) {
|
|
8231
|
+
result[index] = iteratee(array[index], index, array);
|
|
8232
|
+
}
|
|
8233
|
+
return result;
|
|
8234
|
+
}
|
|
8235
|
+
|
|
8236
|
+
var _arrayMap = arrayMap;
|
|
8237
|
+
|
|
8238
|
+
/** `Object#toString` result references. */
|
|
8239
|
+
var symbolTag = '[object Symbol]';
|
|
8240
|
+
|
|
8241
|
+
/**
|
|
8242
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
8243
|
+
*
|
|
8244
|
+
* @static
|
|
8245
|
+
* @memberOf _
|
|
8246
|
+
* @since 4.0.0
|
|
8247
|
+
* @category Lang
|
|
8248
|
+
* @param {*} value The value to check.
|
|
8249
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
8250
|
+
* @example
|
|
8251
|
+
*
|
|
8252
|
+
* _.isSymbol(Symbol.iterator);
|
|
8253
|
+
* // => true
|
|
8254
|
+
*
|
|
8255
|
+
* _.isSymbol('abc');
|
|
8256
|
+
* // => false
|
|
8257
|
+
*/
|
|
8258
|
+
function isSymbol(value) {
|
|
8259
|
+
return typeof value == 'symbol' ||
|
|
8260
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
8261
|
+
}
|
|
8262
|
+
|
|
8263
|
+
var isSymbol_1 = isSymbol;
|
|
8264
|
+
|
|
8265
|
+
/** Used to match property names within property paths. */
|
|
8266
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
8267
|
+
reIsPlainProp = /^\w*$/;
|
|
8268
|
+
|
|
8269
|
+
/**
|
|
8270
|
+
* Checks if `value` is a property name and not a property path.
|
|
8271
|
+
*
|
|
8272
|
+
* @private
|
|
8273
|
+
* @param {*} value The value to check.
|
|
8274
|
+
* @param {Object} [object] The object to query keys on.
|
|
8275
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
8276
|
+
*/
|
|
8277
|
+
function isKey(value, object) {
|
|
8278
|
+
if (isArray_1(value)) {
|
|
8279
|
+
return false;
|
|
8280
|
+
}
|
|
8281
|
+
var type = typeof value;
|
|
8282
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
8283
|
+
value == null || isSymbol_1(value)) {
|
|
8284
|
+
return true;
|
|
8285
|
+
}
|
|
8286
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
8287
|
+
(object != null && value in Object(object));
|
|
8288
|
+
}
|
|
8289
|
+
|
|
8290
|
+
var _isKey = isKey;
|
|
8291
|
+
|
|
8292
|
+
/** Error message constants. */
|
|
8293
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
8294
|
+
|
|
8295
|
+
/**
|
|
8296
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
8297
|
+
* provided, it determines the cache key for storing the result based on the
|
|
8298
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
8299
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
8300
|
+
* is invoked with the `this` binding of the memoized function.
|
|
8301
|
+
*
|
|
8302
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
8303
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
8304
|
+
* constructor with one whose instances implement the
|
|
8305
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
8306
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
8307
|
+
*
|
|
8308
|
+
* @static
|
|
8309
|
+
* @memberOf _
|
|
8310
|
+
* @since 0.1.0
|
|
8311
|
+
* @category Function
|
|
8312
|
+
* @param {Function} func The function to have its output memoized.
|
|
8313
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
8314
|
+
* @returns {Function} Returns the new memoized function.
|
|
8315
|
+
* @example
|
|
8316
|
+
*
|
|
8317
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
8318
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
8319
|
+
*
|
|
8320
|
+
* var values = _.memoize(_.values);
|
|
8321
|
+
* values(object);
|
|
8322
|
+
* // => [1, 2]
|
|
8323
|
+
*
|
|
8324
|
+
* values(other);
|
|
8325
|
+
* // => [3, 4]
|
|
8326
|
+
*
|
|
8327
|
+
* object.a = 2;
|
|
8328
|
+
* values(object);
|
|
8329
|
+
* // => [1, 2]
|
|
8330
|
+
*
|
|
8331
|
+
* // Modify the result cache.
|
|
8332
|
+
* values.cache.set(object, ['a', 'b']);
|
|
8333
|
+
* values(object);
|
|
8334
|
+
* // => ['a', 'b']
|
|
8335
|
+
*
|
|
8336
|
+
* // Replace `_.memoize.Cache`.
|
|
8337
|
+
* _.memoize.Cache = WeakMap;
|
|
8338
|
+
*/
|
|
8339
|
+
function memoize(func, resolver) {
|
|
8340
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
8341
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
8342
|
+
}
|
|
8343
|
+
var memoized = function() {
|
|
8344
|
+
var args = arguments,
|
|
8345
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
8346
|
+
cache = memoized.cache;
|
|
8347
|
+
|
|
8348
|
+
if (cache.has(key)) {
|
|
8349
|
+
return cache.get(key);
|
|
8350
|
+
}
|
|
8351
|
+
var result = func.apply(this, args);
|
|
8352
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
8353
|
+
return result;
|
|
8354
|
+
};
|
|
8355
|
+
memoized.cache = new (memoize.Cache || _MapCache);
|
|
8356
|
+
return memoized;
|
|
8357
|
+
}
|
|
8358
|
+
|
|
8359
|
+
// Expose `MapCache`.
|
|
8360
|
+
memoize.Cache = _MapCache;
|
|
8361
|
+
|
|
8362
|
+
var memoize_1 = memoize;
|
|
8363
|
+
|
|
8364
|
+
/** Used as the maximum memoize cache size. */
|
|
8365
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
8366
|
+
|
|
8367
|
+
/**
|
|
8368
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
8369
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
8370
|
+
*
|
|
8371
|
+
* @private
|
|
8372
|
+
* @param {Function} func The function to have its output memoized.
|
|
8373
|
+
* @returns {Function} Returns the new memoized function.
|
|
8374
|
+
*/
|
|
8375
|
+
function memoizeCapped(func) {
|
|
8376
|
+
var result = memoize_1(func, function(key) {
|
|
8377
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
8378
|
+
cache.clear();
|
|
8379
|
+
}
|
|
8380
|
+
return key;
|
|
8381
|
+
});
|
|
8382
|
+
|
|
8383
|
+
var cache = result.cache;
|
|
8384
|
+
return result;
|
|
8385
|
+
}
|
|
8386
|
+
|
|
8387
|
+
var _memoizeCapped = memoizeCapped;
|
|
8388
|
+
|
|
8389
|
+
/** Used to match property names within property paths. */
|
|
8390
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
8391
|
+
|
|
8392
|
+
/** Used to match backslashes in property paths. */
|
|
8393
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
8394
|
+
|
|
8395
|
+
/**
|
|
8396
|
+
* Converts `string` to a property path array.
|
|
8397
|
+
*
|
|
8398
|
+
* @private
|
|
8399
|
+
* @param {string} string The string to convert.
|
|
8400
|
+
* @returns {Array} Returns the property path array.
|
|
8401
|
+
*/
|
|
8402
|
+
var stringToPath = _memoizeCapped(function(string) {
|
|
8403
|
+
var result = [];
|
|
8404
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
8405
|
+
result.push('');
|
|
8406
|
+
}
|
|
8407
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
8408
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
8409
|
+
});
|
|
8410
|
+
return result;
|
|
8411
|
+
});
|
|
8412
|
+
|
|
8413
|
+
var _stringToPath = stringToPath;
|
|
8414
|
+
|
|
8415
|
+
/** Used as references for various `Number` constants. */
|
|
8416
|
+
var INFINITY$1 = 1 / 0;
|
|
8417
|
+
|
|
8418
|
+
/** Used to convert symbols to primitives and strings. */
|
|
8419
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
8420
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
8421
|
+
|
|
8422
|
+
/**
|
|
8423
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
8424
|
+
* values to empty strings.
|
|
8425
|
+
*
|
|
8426
|
+
* @private
|
|
8427
|
+
* @param {*} value The value to process.
|
|
8428
|
+
* @returns {string} Returns the string.
|
|
8429
|
+
*/
|
|
8430
|
+
function baseToString(value) {
|
|
8431
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
8432
|
+
if (typeof value == 'string') {
|
|
8433
|
+
return value;
|
|
8434
|
+
}
|
|
8435
|
+
if (isArray_1(value)) {
|
|
8436
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
8437
|
+
return _arrayMap(value, baseToString) + '';
|
|
8438
|
+
}
|
|
8439
|
+
if (isSymbol_1(value)) {
|
|
8440
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
8441
|
+
}
|
|
8442
|
+
var result = (value + '');
|
|
8443
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
8444
|
+
}
|
|
8445
|
+
|
|
8446
|
+
var _baseToString = baseToString;
|
|
8447
|
+
|
|
8448
|
+
/**
|
|
8449
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
8450
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
8451
|
+
*
|
|
8452
|
+
* @static
|
|
8453
|
+
* @memberOf _
|
|
8454
|
+
* @since 4.0.0
|
|
8455
|
+
* @category Lang
|
|
8456
|
+
* @param {*} value The value to convert.
|
|
8457
|
+
* @returns {string} Returns the converted string.
|
|
8458
|
+
* @example
|
|
8459
|
+
*
|
|
8460
|
+
* _.toString(null);
|
|
8461
|
+
* // => ''
|
|
8462
|
+
*
|
|
8463
|
+
* _.toString(-0);
|
|
8464
|
+
* // => '-0'
|
|
8465
|
+
*
|
|
8466
|
+
* _.toString([1, 2, 3]);
|
|
8467
|
+
* // => '1,2,3'
|
|
8468
|
+
*/
|
|
8469
|
+
function toString$1(value) {
|
|
8470
|
+
return value == null ? '' : _baseToString(value);
|
|
8471
|
+
}
|
|
8472
|
+
|
|
8473
|
+
var toString_1 = toString$1;
|
|
8474
|
+
|
|
8475
|
+
/**
|
|
8476
|
+
* Casts `value` to a path array if it's not one.
|
|
8477
|
+
*
|
|
8478
|
+
* @private
|
|
8479
|
+
* @param {*} value The value to inspect.
|
|
8480
|
+
* @param {Object} [object] The object to query keys on.
|
|
8481
|
+
* @returns {Array} Returns the cast property path array.
|
|
8482
|
+
*/
|
|
8483
|
+
function castPath(value, object) {
|
|
8484
|
+
if (isArray_1(value)) {
|
|
8485
|
+
return value;
|
|
8486
|
+
}
|
|
8487
|
+
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
8488
|
+
}
|
|
8489
|
+
|
|
8490
|
+
var _castPath = castPath;
|
|
8491
|
+
|
|
8492
|
+
/** Used as references for various `Number` constants. */
|
|
8493
|
+
var INFINITY = 1 / 0;
|
|
8494
|
+
|
|
8495
|
+
/**
|
|
8496
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
8497
|
+
*
|
|
8498
|
+
* @private
|
|
8499
|
+
* @param {*} value The value to inspect.
|
|
8500
|
+
* @returns {string|symbol} Returns the key.
|
|
8501
|
+
*/
|
|
8502
|
+
function toKey(value) {
|
|
8503
|
+
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
8504
|
+
return value;
|
|
8505
|
+
}
|
|
8506
|
+
var result = (value + '');
|
|
8507
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
8508
|
+
}
|
|
8509
|
+
|
|
8510
|
+
var _toKey = toKey;
|
|
8511
|
+
|
|
8512
|
+
/**
|
|
8513
|
+
* The base implementation of `_.get` without support for default values.
|
|
8514
|
+
*
|
|
8515
|
+
* @private
|
|
8516
|
+
* @param {Object} object The object to query.
|
|
8517
|
+
* @param {Array|string} path The path of the property to get.
|
|
8518
|
+
* @returns {*} Returns the resolved value.
|
|
8519
|
+
*/
|
|
8520
|
+
function baseGet(object, path) {
|
|
8521
|
+
path = _castPath(path, object);
|
|
8522
|
+
|
|
8523
|
+
var index = 0,
|
|
8524
|
+
length = path.length;
|
|
8525
|
+
|
|
8526
|
+
while (object != null && index < length) {
|
|
8527
|
+
object = object[_toKey(path[index++])];
|
|
8528
|
+
}
|
|
8529
|
+
return (index && index == length) ? object : undefined;
|
|
8530
|
+
}
|
|
8531
|
+
|
|
8532
|
+
var _baseGet = baseGet;
|
|
8533
|
+
|
|
8534
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8535
|
+
var COMPARE_PARTIAL_FLAG$1 = 1,
|
|
8536
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
8537
|
+
|
|
8538
|
+
/**
|
|
8539
|
+
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
8540
|
+
*
|
|
8541
|
+
* @private
|
|
8542
|
+
* @param {Object} object The object to inspect.
|
|
8543
|
+
* @param {Object} source The object of property values to match.
|
|
8544
|
+
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
8545
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
8546
|
+
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
8547
|
+
*/
|
|
8548
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
8549
|
+
var index = matchData.length,
|
|
8550
|
+
length = index,
|
|
8551
|
+
noCustomizer = !customizer;
|
|
8552
|
+
|
|
8553
|
+
if (object == null) {
|
|
8554
|
+
return !length;
|
|
8555
|
+
}
|
|
8556
|
+
object = Object(object);
|
|
8557
|
+
while (index--) {
|
|
8558
|
+
var data = matchData[index];
|
|
8559
|
+
if ((noCustomizer && data[2])
|
|
8560
|
+
? data[1] !== object[data[0]]
|
|
8561
|
+
: !(data[0] in object)
|
|
8562
|
+
) {
|
|
8563
|
+
return false;
|
|
8564
|
+
}
|
|
8565
|
+
}
|
|
8566
|
+
while (++index < length) {
|
|
8567
|
+
data = matchData[index];
|
|
8568
|
+
var key = data[0],
|
|
8569
|
+
objValue = object[key],
|
|
8570
|
+
srcValue = data[1];
|
|
8571
|
+
|
|
8572
|
+
if (noCustomizer && data[2]) {
|
|
8573
|
+
if (objValue === undefined && !(key in object)) {
|
|
8574
|
+
return false;
|
|
8575
|
+
}
|
|
8576
|
+
} else {
|
|
8577
|
+
var stack = new _Stack;
|
|
8578
|
+
if (customizer) {
|
|
8579
|
+
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
8580
|
+
}
|
|
8581
|
+
if (!(result === undefined
|
|
8582
|
+
? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
|
|
8583
|
+
: result
|
|
8584
|
+
)) {
|
|
8585
|
+
return false;
|
|
8586
|
+
}
|
|
8587
|
+
}
|
|
8588
|
+
}
|
|
8589
|
+
return true;
|
|
8590
|
+
}
|
|
8591
|
+
|
|
8592
|
+
var _baseIsMatch = baseIsMatch;
|
|
8593
|
+
|
|
8594
|
+
/**
|
|
8595
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
8596
|
+
*
|
|
8597
|
+
* @private
|
|
8598
|
+
* @param {*} value The value to check.
|
|
8599
|
+
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
8600
|
+
* equality comparisons, else `false`.
|
|
8601
|
+
*/
|
|
8602
|
+
function isStrictComparable(value) {
|
|
8603
|
+
return value === value && !isObject_1(value);
|
|
8604
|
+
}
|
|
8605
|
+
|
|
8606
|
+
var _isStrictComparable = isStrictComparable;
|
|
8607
|
+
|
|
8608
|
+
/**
|
|
8609
|
+
* Gets the property names, values, and compare flags of `object`.
|
|
8610
|
+
*
|
|
8611
|
+
* @private
|
|
8612
|
+
* @param {Object} object The object to query.
|
|
8613
|
+
* @returns {Array} Returns the match data of `object`.
|
|
8614
|
+
*/
|
|
8615
|
+
function getMatchData(object) {
|
|
8616
|
+
var result = keys_1(object),
|
|
8617
|
+
length = result.length;
|
|
8618
|
+
|
|
8619
|
+
while (length--) {
|
|
8620
|
+
var key = result[length],
|
|
8621
|
+
value = object[key];
|
|
8622
|
+
|
|
8623
|
+
result[length] = [key, value, _isStrictComparable(value)];
|
|
8624
|
+
}
|
|
8625
|
+
return result;
|
|
8626
|
+
}
|
|
8627
|
+
|
|
8628
|
+
var _getMatchData = getMatchData;
|
|
8629
|
+
|
|
8630
|
+
/**
|
|
8631
|
+
* A specialized version of `matchesProperty` for source values suitable
|
|
8632
|
+
* for strict equality comparisons, i.e. `===`.
|
|
8633
|
+
*
|
|
8634
|
+
* @private
|
|
8635
|
+
* @param {string} key The key of the property to get.
|
|
8636
|
+
* @param {*} srcValue The value to match.
|
|
8637
|
+
* @returns {Function} Returns the new spec function.
|
|
8638
|
+
*/
|
|
8639
|
+
function matchesStrictComparable(key, srcValue) {
|
|
8640
|
+
return function(object) {
|
|
8641
|
+
if (object == null) {
|
|
8642
|
+
return false;
|
|
8643
|
+
}
|
|
8644
|
+
return object[key] === srcValue &&
|
|
8645
|
+
(srcValue !== undefined || (key in Object(object)));
|
|
8646
|
+
};
|
|
8647
|
+
}
|
|
8648
|
+
|
|
8649
|
+
var _matchesStrictComparable = matchesStrictComparable;
|
|
8650
|
+
|
|
8651
|
+
/**
|
|
8652
|
+
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
8653
|
+
*
|
|
8654
|
+
* @private
|
|
8655
|
+
* @param {Object} source The object of property values to match.
|
|
8656
|
+
* @returns {Function} Returns the new spec function.
|
|
8657
|
+
*/
|
|
8658
|
+
function baseMatches(source) {
|
|
8659
|
+
var matchData = _getMatchData(source);
|
|
8660
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
8661
|
+
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
8662
|
+
}
|
|
8663
|
+
return function(object) {
|
|
8664
|
+
return object === source || _baseIsMatch(object, source, matchData);
|
|
8665
|
+
};
|
|
8666
|
+
}
|
|
8667
|
+
|
|
8668
|
+
var _baseMatches = baseMatches;
|
|
8669
|
+
|
|
8670
|
+
/**
|
|
8671
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
8672
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
8673
|
+
*
|
|
8674
|
+
* @static
|
|
8675
|
+
* @memberOf _
|
|
8676
|
+
* @since 3.7.0
|
|
8677
|
+
* @category Object
|
|
8678
|
+
* @param {Object} object The object to query.
|
|
8679
|
+
* @param {Array|string} path The path of the property to get.
|
|
8680
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
8681
|
+
* @returns {*} Returns the resolved value.
|
|
8682
|
+
* @example
|
|
8683
|
+
*
|
|
8684
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
8685
|
+
*
|
|
8686
|
+
* _.get(object, 'a[0].b.c');
|
|
8687
|
+
* // => 3
|
|
8688
|
+
*
|
|
8689
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
8690
|
+
* // => 3
|
|
8691
|
+
*
|
|
8692
|
+
* _.get(object, 'a.b.c', 'default');
|
|
8693
|
+
* // => 'default'
|
|
8694
|
+
*/
|
|
8695
|
+
function get(object, path, defaultValue) {
|
|
8696
|
+
var result = object == null ? undefined : _baseGet(object, path);
|
|
8697
|
+
return result === undefined ? defaultValue : result;
|
|
8698
|
+
}
|
|
8699
|
+
|
|
8700
|
+
var get_1 = get;
|
|
8701
|
+
|
|
8702
|
+
/**
|
|
8703
|
+
* The base implementation of `_.hasIn` without support for deep paths.
|
|
8704
|
+
*
|
|
8705
|
+
* @private
|
|
8706
|
+
* @param {Object} [object] The object to query.
|
|
8707
|
+
* @param {Array|string} key The key to check.
|
|
8708
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
8709
|
+
*/
|
|
8710
|
+
function baseHasIn(object, key) {
|
|
8711
|
+
return object != null && key in Object(object);
|
|
8712
|
+
}
|
|
8713
|
+
|
|
8714
|
+
var _baseHasIn = baseHasIn;
|
|
8715
|
+
|
|
8716
|
+
/**
|
|
8717
|
+
* Checks if `path` exists on `object`.
|
|
8718
|
+
*
|
|
8719
|
+
* @private
|
|
8720
|
+
* @param {Object} object The object to query.
|
|
8721
|
+
* @param {Array|string} path The path to check.
|
|
8722
|
+
* @param {Function} hasFunc The function to check properties.
|
|
8723
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8724
|
+
*/
|
|
8725
|
+
function hasPath(object, path, hasFunc) {
|
|
8726
|
+
path = _castPath(path, object);
|
|
8727
|
+
|
|
8728
|
+
var index = -1,
|
|
8729
|
+
length = path.length,
|
|
8730
|
+
result = false;
|
|
8731
|
+
|
|
8732
|
+
while (++index < length) {
|
|
8733
|
+
var key = _toKey(path[index]);
|
|
8734
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
8735
|
+
break;
|
|
8736
|
+
}
|
|
8737
|
+
object = object[key];
|
|
8738
|
+
}
|
|
8739
|
+
if (result || ++index != length) {
|
|
8740
|
+
return result;
|
|
8741
|
+
}
|
|
8742
|
+
length = object == null ? 0 : object.length;
|
|
8743
|
+
return !!length && isLength_1(length) && _isIndex(key, length) &&
|
|
8744
|
+
(isArray_1(object) || isArguments_1(object));
|
|
8745
|
+
}
|
|
8746
|
+
|
|
8747
|
+
var _hasPath = hasPath;
|
|
8748
|
+
|
|
8749
|
+
/**
|
|
8750
|
+
* Checks if `path` is a direct or inherited property of `object`.
|
|
8751
|
+
*
|
|
8752
|
+
* @static
|
|
8753
|
+
* @memberOf _
|
|
8754
|
+
* @since 4.0.0
|
|
8755
|
+
* @category Object
|
|
8756
|
+
* @param {Object} object The object to query.
|
|
8757
|
+
* @param {Array|string} path The path to check.
|
|
8758
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8759
|
+
* @example
|
|
8760
|
+
*
|
|
8761
|
+
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
8762
|
+
*
|
|
8763
|
+
* _.hasIn(object, 'a');
|
|
8764
|
+
* // => true
|
|
8765
|
+
*
|
|
8766
|
+
* _.hasIn(object, 'a.b');
|
|
8767
|
+
* // => true
|
|
8768
|
+
*
|
|
8769
|
+
* _.hasIn(object, ['a', 'b']);
|
|
8770
|
+
* // => true
|
|
8771
|
+
*
|
|
8772
|
+
* _.hasIn(object, 'b');
|
|
8773
|
+
* // => false
|
|
8774
|
+
*/
|
|
8775
|
+
function hasIn(object, path) {
|
|
8776
|
+
return object != null && _hasPath(object, path, _baseHasIn);
|
|
8777
|
+
}
|
|
8778
|
+
|
|
8779
|
+
var hasIn_1 = hasIn;
|
|
8780
|
+
|
|
8781
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8782
|
+
var COMPARE_PARTIAL_FLAG = 1,
|
|
8783
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
8784
|
+
|
|
8785
|
+
/**
|
|
8786
|
+
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
8787
|
+
*
|
|
8788
|
+
* @private
|
|
8789
|
+
* @param {string} path The path of the property to get.
|
|
8790
|
+
* @param {*} srcValue The value to match.
|
|
8791
|
+
* @returns {Function} Returns the new spec function.
|
|
8792
|
+
*/
|
|
8793
|
+
function baseMatchesProperty(path, srcValue) {
|
|
8794
|
+
if (_isKey(path) && _isStrictComparable(srcValue)) {
|
|
8795
|
+
return _matchesStrictComparable(_toKey(path), srcValue);
|
|
8796
|
+
}
|
|
8797
|
+
return function(object) {
|
|
8798
|
+
var objValue = get_1(object, path);
|
|
8799
|
+
return (objValue === undefined && objValue === srcValue)
|
|
8800
|
+
? hasIn_1(object, path)
|
|
8801
|
+
: _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
8802
|
+
};
|
|
8803
|
+
}
|
|
8804
|
+
|
|
8805
|
+
var _baseMatchesProperty = baseMatchesProperty;
|
|
8806
|
+
|
|
8807
|
+
/**
|
|
8808
|
+
* This method returns the first argument it receives.
|
|
8809
|
+
*
|
|
8810
|
+
* @static
|
|
8811
|
+
* @since 0.1.0
|
|
8812
|
+
* @memberOf _
|
|
8813
|
+
* @category Util
|
|
8814
|
+
* @param {*} value Any value.
|
|
8815
|
+
* @returns {*} Returns `value`.
|
|
8816
|
+
* @example
|
|
8817
|
+
*
|
|
8818
|
+
* var object = { 'a': 1 };
|
|
8819
|
+
*
|
|
8820
|
+
* console.log(_.identity(object) === object);
|
|
8821
|
+
* // => true
|
|
8822
|
+
*/
|
|
8823
|
+
function identity(value) {
|
|
8824
|
+
return value;
|
|
8825
|
+
}
|
|
8826
|
+
|
|
8827
|
+
var identity_1 = identity;
|
|
8828
|
+
|
|
8829
|
+
/**
|
|
8830
|
+
* The base implementation of `_.property` without support for deep paths.
|
|
8831
|
+
*
|
|
8832
|
+
* @private
|
|
8833
|
+
* @param {string} key The key of the property to get.
|
|
8834
|
+
* @returns {Function} Returns the new accessor function.
|
|
8835
|
+
*/
|
|
8836
|
+
function baseProperty(key) {
|
|
8837
|
+
return function(object) {
|
|
8838
|
+
return object == null ? undefined : object[key];
|
|
8839
|
+
};
|
|
8840
|
+
}
|
|
8841
|
+
|
|
8842
|
+
var _baseProperty = baseProperty;
|
|
8843
|
+
|
|
8844
|
+
/**
|
|
8845
|
+
* A specialized version of `baseProperty` which supports deep paths.
|
|
8846
|
+
*
|
|
8847
|
+
* @private
|
|
8848
|
+
* @param {Array|string} path The path of the property to get.
|
|
8849
|
+
* @returns {Function} Returns the new accessor function.
|
|
8850
|
+
*/
|
|
8851
|
+
function basePropertyDeep(path) {
|
|
8852
|
+
return function(object) {
|
|
8853
|
+
return _baseGet(object, path);
|
|
8854
|
+
};
|
|
8855
|
+
}
|
|
8856
|
+
|
|
8857
|
+
var _basePropertyDeep = basePropertyDeep;
|
|
8858
|
+
|
|
8859
|
+
/**
|
|
8860
|
+
* Creates a function that returns the value at `path` of a given object.
|
|
8861
|
+
*
|
|
8862
|
+
* @static
|
|
8863
|
+
* @memberOf _
|
|
8864
|
+
* @since 2.4.0
|
|
8865
|
+
* @category Util
|
|
8866
|
+
* @param {Array|string} path The path of the property to get.
|
|
8867
|
+
* @returns {Function} Returns the new accessor function.
|
|
8868
|
+
* @example
|
|
8869
|
+
*
|
|
8870
|
+
* var objects = [
|
|
8871
|
+
* { 'a': { 'b': 2 } },
|
|
8872
|
+
* { 'a': { 'b': 1 } }
|
|
8873
|
+
* ];
|
|
8874
|
+
*
|
|
8875
|
+
* _.map(objects, _.property('a.b'));
|
|
8876
|
+
* // => [2, 1]
|
|
8877
|
+
*
|
|
8878
|
+
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
8879
|
+
* // => [1, 2]
|
|
8880
|
+
*/
|
|
8881
|
+
function property(path) {
|
|
8882
|
+
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
|
|
8883
|
+
}
|
|
8884
|
+
|
|
8885
|
+
var property_1 = property;
|
|
8886
|
+
|
|
8887
|
+
/**
|
|
8888
|
+
* The base implementation of `_.iteratee`.
|
|
8889
|
+
*
|
|
8890
|
+
* @private
|
|
8891
|
+
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
8892
|
+
* @returns {Function} Returns the iteratee.
|
|
8893
|
+
*/
|
|
8894
|
+
function baseIteratee(value) {
|
|
8895
|
+
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
8896
|
+
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
8897
|
+
if (typeof value == 'function') {
|
|
8898
|
+
return value;
|
|
8899
|
+
}
|
|
8900
|
+
if (value == null) {
|
|
8901
|
+
return identity_1;
|
|
8902
|
+
}
|
|
8903
|
+
if (typeof value == 'object') {
|
|
8904
|
+
return isArray_1(value)
|
|
8905
|
+
? _baseMatchesProperty(value[0], value[1])
|
|
8906
|
+
: _baseMatches(value);
|
|
8907
|
+
}
|
|
8908
|
+
return property_1(value);
|
|
8909
|
+
}
|
|
8910
|
+
|
|
8911
|
+
var _baseIteratee = baseIteratee;
|
|
8912
|
+
|
|
8913
|
+
/**
|
|
8914
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
8915
|
+
*
|
|
8916
|
+
* @private
|
|
8917
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8918
|
+
* @returns {Function} Returns the new base function.
|
|
8919
|
+
*/
|
|
8920
|
+
function createBaseFor(fromRight) {
|
|
8921
|
+
return function(object, iteratee, keysFunc) {
|
|
8922
|
+
var index = -1,
|
|
8923
|
+
iterable = Object(object),
|
|
8924
|
+
props = keysFunc(object),
|
|
8925
|
+
length = props.length;
|
|
8926
|
+
|
|
8927
|
+
while (length--) {
|
|
8928
|
+
var key = props[fromRight ? length : ++index];
|
|
8929
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
8930
|
+
break;
|
|
8931
|
+
}
|
|
8932
|
+
}
|
|
8933
|
+
return object;
|
|
8934
|
+
};
|
|
8935
|
+
}
|
|
8936
|
+
|
|
8937
|
+
var _createBaseFor = createBaseFor;
|
|
8938
|
+
|
|
8939
|
+
/**
|
|
8940
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
8941
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
8942
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
8943
|
+
*
|
|
8944
|
+
* @private
|
|
8945
|
+
* @param {Object} object The object to iterate over.
|
|
8946
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8947
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
8948
|
+
* @returns {Object} Returns `object`.
|
|
8949
|
+
*/
|
|
8950
|
+
var baseFor = _createBaseFor();
|
|
8951
|
+
|
|
8952
|
+
var _baseFor = baseFor;
|
|
8953
|
+
|
|
8954
|
+
/**
|
|
8955
|
+
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
8956
|
+
*
|
|
8957
|
+
* @private
|
|
8958
|
+
* @param {Object} object The object to iterate over.
|
|
8959
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8960
|
+
* @returns {Object} Returns `object`.
|
|
8961
|
+
*/
|
|
8962
|
+
function baseForOwn(object, iteratee) {
|
|
8963
|
+
return object && _baseFor(object, iteratee, keys_1);
|
|
8964
|
+
}
|
|
8965
|
+
|
|
8966
|
+
var _baseForOwn = baseForOwn;
|
|
8967
|
+
|
|
8968
|
+
/**
|
|
8969
|
+
* Creates a `baseEach` or `baseEachRight` function.
|
|
8970
|
+
*
|
|
8971
|
+
* @private
|
|
8972
|
+
* @param {Function} eachFunc The function to iterate over a collection.
|
|
8973
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8974
|
+
* @returns {Function} Returns the new base function.
|
|
8975
|
+
*/
|
|
8976
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
8977
|
+
return function(collection, iteratee) {
|
|
8978
|
+
if (collection == null) {
|
|
8979
|
+
return collection;
|
|
8980
|
+
}
|
|
8981
|
+
if (!isArrayLike_1(collection)) {
|
|
8982
|
+
return eachFunc(collection, iteratee);
|
|
8983
|
+
}
|
|
8984
|
+
var length = collection.length,
|
|
8985
|
+
index = fromRight ? length : -1,
|
|
8986
|
+
iterable = Object(collection);
|
|
8987
|
+
|
|
8988
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
8989
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
8990
|
+
break;
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
return collection;
|
|
8994
|
+
};
|
|
8995
|
+
}
|
|
8996
|
+
|
|
8997
|
+
var _createBaseEach = createBaseEach;
|
|
8998
|
+
|
|
8999
|
+
/**
|
|
9000
|
+
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
9001
|
+
*
|
|
9002
|
+
* @private
|
|
9003
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9004
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9005
|
+
* @returns {Array|Object} Returns `collection`.
|
|
9006
|
+
*/
|
|
9007
|
+
var baseEach = _createBaseEach(_baseForOwn);
|
|
9008
|
+
|
|
9009
|
+
var _baseEach = baseEach;
|
|
9010
|
+
|
|
9011
|
+
/**
|
|
9012
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
9013
|
+
*
|
|
9014
|
+
* @private
|
|
9015
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9016
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9017
|
+
* @returns {Array} Returns the new mapped array.
|
|
9018
|
+
*/
|
|
9019
|
+
function baseMap(collection, iteratee) {
|
|
9020
|
+
var index = -1,
|
|
9021
|
+
result = isArrayLike_1(collection) ? Array(collection.length) : [];
|
|
9022
|
+
|
|
9023
|
+
_baseEach(collection, function(value, key, collection) {
|
|
9024
|
+
result[++index] = iteratee(value, key, collection);
|
|
9025
|
+
});
|
|
9026
|
+
return result;
|
|
9027
|
+
}
|
|
9028
|
+
|
|
9029
|
+
var _baseMap = baseMap;
|
|
9030
|
+
|
|
9031
|
+
/**
|
|
9032
|
+
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
9033
|
+
* sort order of `array` and replaces criteria objects with their corresponding
|
|
9034
|
+
* values.
|
|
9035
|
+
*
|
|
9036
|
+
* @private
|
|
9037
|
+
* @param {Array} array The array to sort.
|
|
9038
|
+
* @param {Function} comparer The function to define sort order.
|
|
9039
|
+
* @returns {Array} Returns `array`.
|
|
9040
|
+
*/
|
|
9041
|
+
function baseSortBy(array, comparer) {
|
|
9042
|
+
var length = array.length;
|
|
9043
|
+
|
|
9044
|
+
array.sort(comparer);
|
|
9045
|
+
while (length--) {
|
|
9046
|
+
array[length] = array[length].value;
|
|
9047
|
+
}
|
|
9048
|
+
return array;
|
|
9049
|
+
}
|
|
9050
|
+
|
|
9051
|
+
var _baseSortBy = baseSortBy;
|
|
9052
|
+
|
|
9053
|
+
/**
|
|
9054
|
+
* Compares values to sort them in ascending order.
|
|
9055
|
+
*
|
|
9056
|
+
* @private
|
|
9057
|
+
* @param {*} value The value to compare.
|
|
9058
|
+
* @param {*} other The other value to compare.
|
|
9059
|
+
* @returns {number} Returns the sort order indicator for `value`.
|
|
9060
|
+
*/
|
|
9061
|
+
function compareAscending(value, other) {
|
|
9062
|
+
if (value !== other) {
|
|
9063
|
+
var valIsDefined = value !== undefined,
|
|
9064
|
+
valIsNull = value === null,
|
|
9065
|
+
valIsReflexive = value === value,
|
|
9066
|
+
valIsSymbol = isSymbol_1(value);
|
|
9067
|
+
|
|
9068
|
+
var othIsDefined = other !== undefined,
|
|
9069
|
+
othIsNull = other === null,
|
|
9070
|
+
othIsReflexive = other === other,
|
|
9071
|
+
othIsSymbol = isSymbol_1(other);
|
|
9072
|
+
|
|
9073
|
+
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
9074
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
9075
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
9076
|
+
(!valIsDefined && othIsReflexive) ||
|
|
9077
|
+
!valIsReflexive) {
|
|
9078
|
+
return 1;
|
|
9079
|
+
}
|
|
9080
|
+
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
9081
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
9082
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
9083
|
+
(!othIsDefined && valIsReflexive) ||
|
|
9084
|
+
!othIsReflexive) {
|
|
9085
|
+
return -1;
|
|
9086
|
+
}
|
|
9087
|
+
}
|
|
9088
|
+
return 0;
|
|
9089
|
+
}
|
|
9090
|
+
|
|
9091
|
+
var _compareAscending = compareAscending;
|
|
9092
|
+
|
|
9093
|
+
/**
|
|
9094
|
+
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
9095
|
+
* and stable sort them.
|
|
9096
|
+
*
|
|
9097
|
+
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
9098
|
+
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
9099
|
+
* of corresponding values.
|
|
9100
|
+
*
|
|
9101
|
+
* @private
|
|
9102
|
+
* @param {Object} object The object to compare.
|
|
9103
|
+
* @param {Object} other The other object to compare.
|
|
9104
|
+
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
9105
|
+
* @returns {number} Returns the sort order indicator for `object`.
|
|
9106
|
+
*/
|
|
9107
|
+
function compareMultiple(object, other, orders) {
|
|
9108
|
+
var index = -1,
|
|
9109
|
+
objCriteria = object.criteria,
|
|
9110
|
+
othCriteria = other.criteria,
|
|
9111
|
+
length = objCriteria.length,
|
|
9112
|
+
ordersLength = orders.length;
|
|
9113
|
+
|
|
9114
|
+
while (++index < length) {
|
|
9115
|
+
var result = _compareAscending(objCriteria[index], othCriteria[index]);
|
|
9116
|
+
if (result) {
|
|
9117
|
+
if (index >= ordersLength) {
|
|
9118
|
+
return result;
|
|
9119
|
+
}
|
|
9120
|
+
var order = orders[index];
|
|
9121
|
+
return result * (order == 'desc' ? -1 : 1);
|
|
9122
|
+
}
|
|
9123
|
+
}
|
|
9124
|
+
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
9125
|
+
// that causes it, under certain circumstances, to provide the same value for
|
|
9126
|
+
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
9127
|
+
// for more details.
|
|
9128
|
+
//
|
|
9129
|
+
// This also ensures a stable sort in V8 and other engines.
|
|
9130
|
+
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
9131
|
+
return object.index - other.index;
|
|
9132
|
+
}
|
|
9133
|
+
|
|
9134
|
+
var _compareMultiple = compareMultiple;
|
|
9135
|
+
|
|
9136
|
+
/**
|
|
9137
|
+
* The base implementation of `_.orderBy` without param guards.
|
|
9138
|
+
*
|
|
9139
|
+
* @private
|
|
9140
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9141
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
9142
|
+
* @param {string[]} orders The sort orders of `iteratees`.
|
|
9143
|
+
* @returns {Array} Returns the new sorted array.
|
|
9144
|
+
*/
|
|
9145
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
9146
|
+
if (iteratees.length) {
|
|
9147
|
+
iteratees = _arrayMap(iteratees, function(iteratee) {
|
|
9148
|
+
if (isArray_1(iteratee)) {
|
|
9149
|
+
return function(value) {
|
|
9150
|
+
return _baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
9151
|
+
}
|
|
9152
|
+
}
|
|
9153
|
+
return iteratee;
|
|
9154
|
+
});
|
|
9155
|
+
} else {
|
|
9156
|
+
iteratees = [identity_1];
|
|
9157
|
+
}
|
|
9158
|
+
|
|
9159
|
+
var index = -1;
|
|
9160
|
+
iteratees = _arrayMap(iteratees, _baseUnary(_baseIteratee));
|
|
9161
|
+
|
|
9162
|
+
var result = _baseMap(collection, function(value, key, collection) {
|
|
9163
|
+
var criteria = _arrayMap(iteratees, function(iteratee) {
|
|
9164
|
+
return iteratee(value);
|
|
9165
|
+
});
|
|
9166
|
+
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
9167
|
+
});
|
|
9168
|
+
|
|
9169
|
+
return _baseSortBy(result, function(object, other) {
|
|
9170
|
+
return _compareMultiple(object, other, orders);
|
|
9171
|
+
});
|
|
9172
|
+
}
|
|
9173
|
+
|
|
9174
|
+
var _baseOrderBy = baseOrderBy;
|
|
9175
|
+
|
|
9176
|
+
/**
|
|
9177
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
9178
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
9179
|
+
*
|
|
9180
|
+
* @private
|
|
9181
|
+
* @param {Function} func The function to invoke.
|
|
9182
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
9183
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
9184
|
+
* @returns {*} Returns the result of `func`.
|
|
9185
|
+
*/
|
|
9186
|
+
function apply(func, thisArg, args) {
|
|
9187
|
+
switch (args.length) {
|
|
9188
|
+
case 0: return func.call(thisArg);
|
|
9189
|
+
case 1: return func.call(thisArg, args[0]);
|
|
9190
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
9191
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
9192
|
+
}
|
|
9193
|
+
return func.apply(thisArg, args);
|
|
9194
|
+
}
|
|
9195
|
+
|
|
9196
|
+
var _apply = apply;
|
|
9197
|
+
|
|
9198
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9199
|
+
var nativeMax = Math.max;
|
|
9200
|
+
|
|
9201
|
+
/**
|
|
9202
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
9203
|
+
*
|
|
9204
|
+
* @private
|
|
9205
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9206
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9207
|
+
* @param {Function} transform The rest array transform.
|
|
9208
|
+
* @returns {Function} Returns the new function.
|
|
9209
|
+
*/
|
|
9210
|
+
function overRest(func, start, transform) {
|
|
9211
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
9212
|
+
return function() {
|
|
9213
|
+
var args = arguments,
|
|
9214
|
+
index = -1,
|
|
9215
|
+
length = nativeMax(args.length - start, 0),
|
|
9216
|
+
array = Array(length);
|
|
9217
|
+
|
|
9218
|
+
while (++index < length) {
|
|
9219
|
+
array[index] = args[start + index];
|
|
9220
|
+
}
|
|
9221
|
+
index = -1;
|
|
9222
|
+
var otherArgs = Array(start + 1);
|
|
9223
|
+
while (++index < start) {
|
|
9224
|
+
otherArgs[index] = args[index];
|
|
9225
|
+
}
|
|
9226
|
+
otherArgs[start] = transform(array);
|
|
9227
|
+
return _apply(func, this, otherArgs);
|
|
9228
|
+
};
|
|
9229
|
+
}
|
|
9230
|
+
|
|
9231
|
+
var _overRest = overRest;
|
|
9232
|
+
|
|
9233
|
+
/**
|
|
9234
|
+
* Creates a function that returns `value`.
|
|
9235
|
+
*
|
|
9236
|
+
* @static
|
|
9237
|
+
* @memberOf _
|
|
9238
|
+
* @since 2.4.0
|
|
9239
|
+
* @category Util
|
|
9240
|
+
* @param {*} value The value to return from the new function.
|
|
9241
|
+
* @returns {Function} Returns the new constant function.
|
|
9242
|
+
* @example
|
|
9243
|
+
*
|
|
9244
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
9245
|
+
*
|
|
9246
|
+
* console.log(objects);
|
|
9247
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
9248
|
+
*
|
|
9249
|
+
* console.log(objects[0] === objects[1]);
|
|
9250
|
+
* // => true
|
|
9251
|
+
*/
|
|
9252
|
+
function constant(value) {
|
|
9253
|
+
return function() {
|
|
9254
|
+
return value;
|
|
9255
|
+
};
|
|
9256
|
+
}
|
|
9257
|
+
|
|
9258
|
+
var constant_1 = constant;
|
|
9259
|
+
|
|
9260
|
+
var defineProperty = (function() {
|
|
9261
|
+
try {
|
|
9262
|
+
var func = _getNative(Object, 'defineProperty');
|
|
9263
|
+
func({}, '', {});
|
|
9264
|
+
return func;
|
|
9265
|
+
} catch (e) {}
|
|
9266
|
+
}());
|
|
9267
|
+
|
|
9268
|
+
var _defineProperty = defineProperty;
|
|
9269
|
+
|
|
9270
|
+
/**
|
|
9271
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
9272
|
+
*
|
|
9273
|
+
* @private
|
|
9274
|
+
* @param {Function} func The function to modify.
|
|
9275
|
+
* @param {Function} string The `toString` result.
|
|
9276
|
+
* @returns {Function} Returns `func`.
|
|
9277
|
+
*/
|
|
9278
|
+
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
|
9279
|
+
return _defineProperty(func, 'toString', {
|
|
9280
|
+
'configurable': true,
|
|
9281
|
+
'enumerable': false,
|
|
9282
|
+
'value': constant_1(string),
|
|
9283
|
+
'writable': true
|
|
9284
|
+
});
|
|
9285
|
+
};
|
|
9286
|
+
|
|
9287
|
+
var _baseSetToString = baseSetToString;
|
|
9288
|
+
|
|
9289
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
9290
|
+
var HOT_COUNT = 800,
|
|
9291
|
+
HOT_SPAN = 16;
|
|
9292
|
+
|
|
9293
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9294
|
+
var nativeNow = Date.now;
|
|
9295
|
+
|
|
9296
|
+
/**
|
|
9297
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
9298
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
9299
|
+
* milliseconds.
|
|
9300
|
+
*
|
|
9301
|
+
* @private
|
|
9302
|
+
* @param {Function} func The function to restrict.
|
|
9303
|
+
* @returns {Function} Returns the new shortable function.
|
|
9304
|
+
*/
|
|
9305
|
+
function shortOut(func) {
|
|
9306
|
+
var count = 0,
|
|
9307
|
+
lastCalled = 0;
|
|
9308
|
+
|
|
9309
|
+
return function() {
|
|
9310
|
+
var stamp = nativeNow(),
|
|
9311
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
9312
|
+
|
|
9313
|
+
lastCalled = stamp;
|
|
9314
|
+
if (remaining > 0) {
|
|
9315
|
+
if (++count >= HOT_COUNT) {
|
|
9316
|
+
return arguments[0];
|
|
9317
|
+
}
|
|
9318
|
+
} else {
|
|
9319
|
+
count = 0;
|
|
9320
|
+
}
|
|
9321
|
+
return func.apply(undefined, arguments);
|
|
9322
|
+
};
|
|
9323
|
+
}
|
|
9324
|
+
|
|
9325
|
+
var _shortOut = shortOut;
|
|
9326
|
+
|
|
9327
|
+
/**
|
|
9328
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
9329
|
+
*
|
|
9330
|
+
* @private
|
|
9331
|
+
* @param {Function} func The function to modify.
|
|
9332
|
+
* @param {Function} string The `toString` result.
|
|
9333
|
+
* @returns {Function} Returns `func`.
|
|
9334
|
+
*/
|
|
9335
|
+
var setToString = _shortOut(_baseSetToString);
|
|
9336
|
+
|
|
9337
|
+
var _setToString = setToString;
|
|
9338
|
+
|
|
9339
|
+
/**
|
|
9340
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
9341
|
+
*
|
|
9342
|
+
* @private
|
|
9343
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9344
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9345
|
+
* @returns {Function} Returns the new function.
|
|
9346
|
+
*/
|
|
9347
|
+
function baseRest(func, start) {
|
|
9348
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
9349
|
+
}
|
|
9350
|
+
|
|
9351
|
+
var _baseRest = baseRest;
|
|
9352
|
+
|
|
9353
|
+
/**
|
|
9354
|
+
* Checks if the given arguments are from an iteratee call.
|
|
9355
|
+
*
|
|
9356
|
+
* @private
|
|
9357
|
+
* @param {*} value The potential iteratee value argument.
|
|
9358
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
9359
|
+
* @param {*} object The potential iteratee object argument.
|
|
9360
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
9361
|
+
* else `false`.
|
|
9362
|
+
*/
|
|
9363
|
+
function isIterateeCall(value, index, object) {
|
|
9364
|
+
if (!isObject_1(object)) {
|
|
9365
|
+
return false;
|
|
9366
|
+
}
|
|
9367
|
+
var type = typeof index;
|
|
9368
|
+
if (type == 'number'
|
|
9369
|
+
? (isArrayLike_1(object) && _isIndex(index, object.length))
|
|
9370
|
+
: (type == 'string' && index in object)
|
|
9371
|
+
) {
|
|
9372
|
+
return eq_1(object[index], value);
|
|
9373
|
+
}
|
|
9374
|
+
return false;
|
|
9375
|
+
}
|
|
9376
|
+
|
|
9377
|
+
var _isIterateeCall = isIterateeCall;
|
|
9378
|
+
|
|
9379
|
+
/**
|
|
9380
|
+
* Creates an array of elements, sorted in ascending order by the results of
|
|
9381
|
+
* running each element in a collection thru each iteratee. This method
|
|
9382
|
+
* performs a stable sort, that is, it preserves the original sort order of
|
|
9383
|
+
* equal elements. The iteratees are invoked with one argument: (value).
|
|
9384
|
+
*
|
|
9385
|
+
* @static
|
|
9386
|
+
* @memberOf _
|
|
9387
|
+
* @since 0.1.0
|
|
9388
|
+
* @category Collection
|
|
9389
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9390
|
+
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
9391
|
+
* The iteratees to sort by.
|
|
9392
|
+
* @returns {Array} Returns the new sorted array.
|
|
9393
|
+
* @example
|
|
9394
|
+
*
|
|
9395
|
+
* var users = [
|
|
9396
|
+
* { 'user': 'fred', 'age': 48 },
|
|
9397
|
+
* { 'user': 'barney', 'age': 36 },
|
|
9398
|
+
* { 'user': 'fred', 'age': 30 },
|
|
9399
|
+
* { 'user': 'barney', 'age': 34 }
|
|
9400
|
+
* ];
|
|
9401
|
+
*
|
|
9402
|
+
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
9403
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
9404
|
+
*
|
|
9405
|
+
* _.sortBy(users, ['user', 'age']);
|
|
9406
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
9407
|
+
*/
|
|
9408
|
+
var sortBy = _baseRest(function(collection, iteratees) {
|
|
9409
|
+
if (collection == null) {
|
|
9410
|
+
return [];
|
|
9411
|
+
}
|
|
9412
|
+
var length = iteratees.length;
|
|
9413
|
+
if (length > 1 && _isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
9414
|
+
iteratees = [];
|
|
9415
|
+
} else if (length > 2 && _isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
9416
|
+
iteratees = [iteratees[0]];
|
|
9417
|
+
}
|
|
9418
|
+
return _baseOrderBy(collection, _baseFlatten(iteratees, 1), []);
|
|
9419
|
+
});
|
|
9420
|
+
|
|
9421
|
+
var sortBy_1 = sortBy;
|
|
9422
|
+
|
|
9423
|
+
/**
|
|
9424
|
+
* Configuration for custom action validation rules.
|
|
9425
|
+
* Defines allowed positions, metadata IDs, data model IDs, and fields for each target
|
|
9426
|
+
* type.
|
|
9427
|
+
*
|
|
9428
|
+
*/
|
|
9429
|
+
const customActionValidationConfig = {
|
|
9430
|
+
[exports.CustomActionTarget.LIVEBOARD]: {
|
|
9431
|
+
positions: [exports.CustomActionsPosition.PRIMARY, exports.CustomActionsPosition.MENU],
|
|
9432
|
+
allowedMetadataIds: ['liveboardIds'],
|
|
9433
|
+
allowedDataModelIds: [],
|
|
9434
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds'],
|
|
9435
|
+
},
|
|
9436
|
+
[exports.CustomActionTarget.VIZ]: {
|
|
9437
|
+
positions: [exports.CustomActionsPosition.MENU, exports.CustomActionsPosition.PRIMARY, exports.CustomActionsPosition.CONTEXTMENU],
|
|
9438
|
+
allowedMetadataIds: ['liveboardIds', 'vizIds', 'answerIds'],
|
|
9439
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9440
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9441
|
+
},
|
|
9442
|
+
[exports.CustomActionTarget.ANSWER]: {
|
|
9443
|
+
positions: [exports.CustomActionsPosition.MENU, exports.CustomActionsPosition.PRIMARY, exports.CustomActionsPosition.CONTEXTMENU],
|
|
9444
|
+
allowedMetadataIds: ['answerIds'],
|
|
9445
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9446
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9447
|
+
},
|
|
9448
|
+
[exports.CustomActionTarget.SPOTTER]: {
|
|
9449
|
+
positions: [exports.CustomActionsPosition.MENU, exports.CustomActionsPosition.CONTEXTMENU],
|
|
9450
|
+
allowedMetadataIds: [],
|
|
9451
|
+
allowedDataModelIds: ['modelIds'],
|
|
9452
|
+
allowedFields: ['name', 'id', 'position', 'target', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9453
|
+
},
|
|
9454
|
+
};
|
|
9455
|
+
/**
|
|
9456
|
+
* Validates a single custom action based on its target type
|
|
9457
|
+
* @param action - The custom action to validate
|
|
9458
|
+
* @param primaryActionsPerTarget - Map to track primary actions per target
|
|
9459
|
+
* @returns CustomActionValidation with isValid flag and reason string
|
|
9460
|
+
*
|
|
9461
|
+
* @hidden
|
|
9462
|
+
*/
|
|
9463
|
+
const validateCustomAction = (action, primaryActionsPerTarget) => {
|
|
9464
|
+
const { id: actionId, target: targetType, position, metadataIds, dataModelIds } = action;
|
|
9465
|
+
// Check if target type is supported
|
|
9466
|
+
if (!customActionValidationConfig[targetType]) {
|
|
9467
|
+
const errorMessage = CUSTOM_ACTIONS_ERROR_MESSAGE.UNSUPPORTED_TARGET(actionId, targetType);
|
|
9468
|
+
return { isValid: false, errors: [errorMessage] };
|
|
9469
|
+
}
|
|
9470
|
+
const config = customActionValidationConfig[targetType];
|
|
9471
|
+
const errors = [];
|
|
9472
|
+
// Validate position
|
|
9473
|
+
if (!arrayIncludesString(config.positions, position)) {
|
|
9474
|
+
const supportedPositions = config.positions.join(', ');
|
|
9475
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_POSITION(position, targetType, supportedPositions));
|
|
9476
|
+
}
|
|
9477
|
+
// Validate metadata IDs
|
|
9478
|
+
if (metadataIds) {
|
|
9479
|
+
const invalidMetadataIds = Object.keys(metadataIds).filter((key) => !arrayIncludesString(config.allowedMetadataIds, key));
|
|
9480
|
+
if (invalidMetadataIds.length > 0) {
|
|
9481
|
+
const supportedMetadataIds = config.allowedMetadataIds.length > 0 ? config.allowedMetadataIds.join(', ') : 'none';
|
|
9482
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_METADATA_IDS(targetType, invalidMetadataIds, supportedMetadataIds));
|
|
9483
|
+
}
|
|
8016
9484
|
}
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
9485
|
+
// Validate data model IDs
|
|
9486
|
+
if (dataModelIds) {
|
|
9487
|
+
const invalidDataModelIds = Object.keys(dataModelIds).filter((key) => !arrayIncludesString(config.allowedDataModelIds, key));
|
|
9488
|
+
if (invalidDataModelIds.length > 0) {
|
|
9489
|
+
const supportedDataModelIds = config.allowedDataModelIds.length > 0 ? config.allowedDataModelIds.join(', ') : 'none';
|
|
9490
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_DATA_MODEL_IDS(targetType, invalidDataModelIds, supportedDataModelIds));
|
|
8020
9491
|
}
|
|
8021
|
-
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8022
|
-
return this.answer;
|
|
8023
|
-
}
|
|
8024
|
-
async getTML() {
|
|
8025
|
-
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8026
|
-
const edoc = object[0].edoc;
|
|
8027
|
-
const YAML = await Promise.resolve().then(function () { return index; });
|
|
8028
|
-
const parsedDoc = YAML.parse(edoc);
|
|
8029
|
-
return {
|
|
8030
|
-
answer: {
|
|
8031
|
-
...parsedDoc.answer,
|
|
8032
|
-
...this.tmlOverride,
|
|
8033
|
-
},
|
|
8034
|
-
};
|
|
8035
|
-
}
|
|
8036
|
-
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8037
|
-
const { displayMode, visualizations } = await this.getAnswer();
|
|
8038
|
-
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8039
|
-
return this.executeQuery(addVizToLiveboard, {
|
|
8040
|
-
liveboardId,
|
|
8041
|
-
vizId: viz.id,
|
|
8042
|
-
});
|
|
8043
9492
|
}
|
|
8044
|
-
|
|
8045
|
-
|
|
9493
|
+
// Validate allowed fields
|
|
9494
|
+
const actionKeys = Object.keys(action);
|
|
9495
|
+
const invalidFields = actionKeys.filter((key) => !arrayIncludesString(config.allowedFields, key));
|
|
9496
|
+
if (invalidFields.length > 0) {
|
|
9497
|
+
const supportedFields = config.allowedFields.join(', ');
|
|
9498
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_FIELDS(targetType, invalidFields, supportedFields));
|
|
8046
9499
|
}
|
|
8047
|
-
|
|
9500
|
+
return {
|
|
9501
|
+
isValid: errors.length === 0,
|
|
9502
|
+
errors,
|
|
9503
|
+
};
|
|
9504
|
+
};
|
|
8048
9505
|
/**
|
|
9506
|
+
* Validates basic action structure and required fields
|
|
9507
|
+
* @param action - The action to validate
|
|
9508
|
+
* @returns Object containing validation result and missing fields
|
|
8049
9509
|
*
|
|
8050
|
-
* @
|
|
8051
|
-
* @param colNames
|
|
9510
|
+
* @hidden
|
|
8052
9511
|
*/
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
}));
|
|
8062
|
-
}
|
|
9512
|
+
const validateActionStructure = (action) => {
|
|
9513
|
+
if (!action || typeof action !== 'object') {
|
|
9514
|
+
return { isValid: false, missingFields: [] };
|
|
9515
|
+
}
|
|
9516
|
+
// Check for all missing required fields
|
|
9517
|
+
const missingFields = ['id', 'name', 'target', 'position'].filter(field => !action[field]);
|
|
9518
|
+
return { isValid: missingFields.length === 0, missingFields };
|
|
9519
|
+
};
|
|
8063
9520
|
/**
|
|
9521
|
+
* Checks for duplicate IDs among actions
|
|
9522
|
+
* @param actions - Array of actions to check
|
|
9523
|
+
* @returns Object containing filtered actions and duplicate errors
|
|
8064
9524
|
*
|
|
8065
|
-
* @
|
|
9525
|
+
* @hidden
|
|
8066
9526
|
*/
|
|
8067
|
-
|
|
8068
|
-
const
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
let dataValue;
|
|
8078
|
-
if (dataType === 'DATE') {
|
|
8079
|
-
if (Number.isFinite(colVal.value)) {
|
|
8080
|
-
dataValue = [{
|
|
8081
|
-
epochRange: {
|
|
8082
|
-
startEpoch: colVal.value,
|
|
8083
|
-
},
|
|
8084
|
-
}];
|
|
8085
|
-
// Case for custom calendar.
|
|
8086
|
-
}
|
|
8087
|
-
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8088
|
-
dataValue = [{
|
|
8089
|
-
epochRange: {
|
|
8090
|
-
startEpoch: colVal.value.v.s,
|
|
8091
|
-
endEpoch: colVal.value.v.e,
|
|
8092
|
-
},
|
|
8093
|
-
}];
|
|
8094
|
-
}
|
|
9527
|
+
const filterDuplicateIds = (actions) => {
|
|
9528
|
+
const idMap = actions.reduce((map, action) => {
|
|
9529
|
+
const list = map.get(action.id) || [];
|
|
9530
|
+
list.push(action);
|
|
9531
|
+
map.set(action.id, list);
|
|
9532
|
+
return map;
|
|
9533
|
+
}, new Map());
|
|
9534
|
+
const { actions: actionsWithUniqueIds, errors } = Array.from(idMap.entries()).reduce((acc, [id, actionsWithSameId]) => {
|
|
9535
|
+
if (actionsWithSameId.length === 1) {
|
|
9536
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
8095
9537
|
}
|
|
8096
9538
|
else {
|
|
8097
|
-
|
|
9539
|
+
// Keep the first action and add error for duplicates
|
|
9540
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
9541
|
+
const duplicateNames = actionsWithSameId.slice(1).map(action => action.name);
|
|
9542
|
+
acc.errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.DUPLICATE_IDS(id, duplicateNames, actionsWithSameId[0].name));
|
|
8098
9543
|
}
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
}
|
|
8104
|
-
selectedPoints.forEach((p) => {
|
|
8105
|
-
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8106
|
-
});
|
|
8107
|
-
return underlyingDataPoint;
|
|
8108
|
-
}
|
|
9544
|
+
return acc;
|
|
9545
|
+
}, { actions: [], errors: [] });
|
|
9546
|
+
return { actions: actionsWithUniqueIds, errors };
|
|
9547
|
+
};
|
|
8109
9548
|
/**
|
|
8110
|
-
*
|
|
8111
|
-
* @param
|
|
8112
|
-
* @
|
|
9549
|
+
* Validates and processes custom actions
|
|
9550
|
+
* @param customActions - Array of custom actions to validate
|
|
9551
|
+
* @returns Object containing valid actions and any validation errors
|
|
8113
9552
|
*/
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
9553
|
+
const getCustomActions = (customActions) => {
|
|
9554
|
+
const errors = [];
|
|
9555
|
+
if (!customActions || !Array.isArray(customActions)) {
|
|
9556
|
+
return { actions: [], errors: [] };
|
|
9557
|
+
}
|
|
9558
|
+
// Step 1: Handle invalid actions first (null, undefined, missing required
|
|
9559
|
+
// fields)
|
|
9560
|
+
const validActions = customActions.filter(action => {
|
|
9561
|
+
const validation = validateActionStructure(action);
|
|
9562
|
+
if (!validation.isValid) {
|
|
9563
|
+
if (!action || typeof action !== 'object') {
|
|
9564
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_ACTION_OBJECT);
|
|
9565
|
+
}
|
|
9566
|
+
else {
|
|
9567
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.MISSING_REQUIRED_FIELDS(action.id, validation.missingFields));
|
|
9568
|
+
}
|
|
9569
|
+
return false;
|
|
9570
|
+
}
|
|
9571
|
+
return true;
|
|
9572
|
+
});
|
|
9573
|
+
// Step 2: Check for duplicate IDs among valid actions
|
|
9574
|
+
const { actions: actionsWithUniqueIds, errors: duplicateErrors } = filterDuplicateIds(validActions);
|
|
9575
|
+
// Add duplicate errors to the errors array
|
|
9576
|
+
duplicateErrors.forEach(error => errors.push(error));
|
|
9577
|
+
// Step 3: Validate actions with unique IDs
|
|
9578
|
+
const finalValidActions = [];
|
|
9579
|
+
actionsWithUniqueIds.forEach((action) => {
|
|
9580
|
+
const { isValid, errors: validationErrors } = validateCustomAction(action);
|
|
9581
|
+
validationErrors.forEach(error => errors.push(error));
|
|
9582
|
+
if (isValid) {
|
|
9583
|
+
finalValidActions.push(action);
|
|
9584
|
+
}
|
|
9585
|
+
});
|
|
9586
|
+
const sortedActions = sortBy_1(finalValidActions, (a) => a.name.toLocaleLowerCase());
|
|
9587
|
+
return {
|
|
9588
|
+
actions: sortedActions,
|
|
9589
|
+
errors: errors,
|
|
9590
|
+
};
|
|
9591
|
+
};
|
|
8124
9592
|
|
|
8125
9593
|
/**
|
|
8126
9594
|
* Copyright (c) 2023
|
|
@@ -15814,6 +17282,13 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15814
17282
|
handleExitPresentMode();
|
|
15815
17283
|
}
|
|
15816
17284
|
}
|
|
17285
|
+
/**
|
|
17286
|
+
* Clears the cached preauth and session info.
|
|
17287
|
+
*/
|
|
17288
|
+
function processClearInfoCache() {
|
|
17289
|
+
resetCachedPreauthInfo();
|
|
17290
|
+
resetCachedSessionInfo();
|
|
17291
|
+
}
|
|
15817
17292
|
/**
|
|
15818
17293
|
*
|
|
15819
17294
|
* @param e
|
|
@@ -15920,11 +17395,13 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15920
17395
|
return processAuthLogout(e, containerEl);
|
|
15921
17396
|
case exports.EmbedEvent.ExitPresentMode:
|
|
15922
17397
|
return processExitPresentMode();
|
|
17398
|
+
case exports.EmbedEvent.CLEAR_INFO_CACHE:
|
|
17399
|
+
return processClearInfoCache();
|
|
15923
17400
|
}
|
|
15924
17401
|
return e;
|
|
15925
17402
|
}
|
|
15926
17403
|
|
|
15927
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.41.0
|
|
17404
|
+
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$1={".":{"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$1,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};
|
|
15928
17405
|
|
|
15929
17406
|
/**
|
|
15930
17407
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -16235,10 +17712,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16235
17712
|
};
|
|
16236
17713
|
this.showPreRenderByDefault = false;
|
|
16237
17714
|
/**
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
17715
|
+
* @hidden
|
|
17716
|
+
* Internal state to track if the embed container is loaded.
|
|
17717
|
+
* This is used to trigger events after the embed container is loaded.
|
|
17718
|
+
*/
|
|
16242
17719
|
this.isEmbedContainerLoaded = false;
|
|
16243
17720
|
/**
|
|
16244
17721
|
* @hidden
|
|
@@ -16297,10 +17774,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16297
17774
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
16298
17775
|
...viewConfig,
|
|
16299
17776
|
});
|
|
16300
|
-
const embedConfig = getEmbedConfig();
|
|
16301
|
-
this.embedConfig = embedConfig;
|
|
16302
17777
|
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
16303
17778
|
this.isReadyForRenderPromise = getInitPromise().then(async () => {
|
|
17779
|
+
const embedConfig = getEmbedConfig();
|
|
17780
|
+
this.embedConfig = embedConfig;
|
|
16304
17781
|
if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
|
|
16305
17782
|
this.embedConfig.authTriggerContainer = domSelector;
|
|
16306
17783
|
}
|
|
@@ -16449,6 +17926,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16449
17926
|
async getDefaultAppInitData() {
|
|
16450
17927
|
var _a, _b;
|
|
16451
17928
|
const authToken = await this.getAuthTokenForCookielessInit();
|
|
17929
|
+
const customActionsResult = getCustomActions([
|
|
17930
|
+
...(this.viewConfig.customActions || []),
|
|
17931
|
+
...(this.embedConfig.customActions || [])
|
|
17932
|
+
]);
|
|
17933
|
+
if (customActionsResult.errors.length > 0) {
|
|
17934
|
+
this.handleError({
|
|
17935
|
+
type: 'CUSTOM_ACTION_VALIDATION',
|
|
17936
|
+
message: customActionsResult.errors,
|
|
17937
|
+
});
|
|
17938
|
+
}
|
|
16452
17939
|
return {
|
|
16453
17940
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
16454
17941
|
authToken,
|
|
@@ -16466,6 +17953,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16466
17953
|
: [],
|
|
16467
17954
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
16468
17955
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
17956
|
+
customActions: customActionsResult.actions,
|
|
16469
17957
|
};
|
|
16470
17958
|
}
|
|
16471
17959
|
async getAppInitData() {
|
|
@@ -16485,11 +17973,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16485
17973
|
.join('/');
|
|
16486
17974
|
return `${basePath}#`;
|
|
16487
17975
|
}
|
|
16488
|
-
getUpdateEmbedParamsObject() {
|
|
16489
|
-
let queryParams = this.getEmbedParamsObject();
|
|
16490
|
-
queryParams = { ...this.viewConfig, ...queryParams };
|
|
16491
|
-
return queryParams;
|
|
16492
|
-
}
|
|
16493
17976
|
/**
|
|
16494
17977
|
* Common query params set for all the embed modes.
|
|
16495
17978
|
* @param queryParams
|
|
@@ -16639,13 +18122,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16639
18122
|
return path;
|
|
16640
18123
|
}
|
|
16641
18124
|
getEmbedParams() {
|
|
16642
|
-
const queryParams = this.
|
|
18125
|
+
const queryParams = this.getBaseQueryParams();
|
|
16643
18126
|
return getQueryParamString(queryParams);
|
|
16644
18127
|
}
|
|
16645
|
-
getEmbedParamsObject() {
|
|
16646
|
-
const params = this.getBaseQueryParams();
|
|
16647
|
-
return params;
|
|
16648
|
-
}
|
|
16649
18128
|
getRootIframeSrc() {
|
|
16650
18129
|
const query = this.getEmbedParams();
|
|
16651
18130
|
return this.getEmbedBasePath(query);
|
|
@@ -17206,12 +18685,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17206
18685
|
return this.preRender(true);
|
|
17207
18686
|
}
|
|
17208
18687
|
this.validatePreRenderViewConfig(this.viewConfig);
|
|
17209
|
-
logger$3.debug('triggering UpdateEmbedParams', this.viewConfig);
|
|
17210
|
-
this.executeAfterEmbedContainerLoaded(() => {
|
|
17211
|
-
this.trigger(exports.HostEvent.UpdateEmbedParams, this.getUpdateEmbedParamsObject());
|
|
17212
|
-
});
|
|
17213
18688
|
}
|
|
17214
|
-
this.beforePrerenderVisible();
|
|
17215
18689
|
if (this.el) {
|
|
17216
18690
|
this.syncPreRenderStyle();
|
|
17217
18691
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
@@ -17228,6 +18702,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17228
18702
|
this.resizeObserver.observe(this.el);
|
|
17229
18703
|
}
|
|
17230
18704
|
}
|
|
18705
|
+
this.beforePrerenderVisible();
|
|
17231
18706
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
17232
18707
|
this.subscribeToEvents();
|
|
17233
18708
|
// Setup fullscreen change handler for prerendered components
|
|
@@ -17501,6 +18976,11 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17501
18976
|
* It serves as the foundational version of the home page.
|
|
17502
18977
|
*/
|
|
17503
18978
|
HomePage["Modular"] = "v2";
|
|
18979
|
+
/**
|
|
18980
|
+
* ModularWithStylingChanges (v3) introduces Modular Home Experience
|
|
18981
|
+
* with styling changes.
|
|
18982
|
+
*/
|
|
18983
|
+
HomePage["ModularWithStylingChanges"] = "v3";
|
|
17504
18984
|
})(exports.HomePage || (exports.HomePage = {}));
|
|
17505
18985
|
/**
|
|
17506
18986
|
* Define the version of the list page
|
|
@@ -17588,7 +19068,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17588
19068
|
* embedded Liveboard or visualization.
|
|
17589
19069
|
*/
|
|
17590
19070
|
getEmbedParams() {
|
|
17591
|
-
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 = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
19071
|
+
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 = exports.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;
|
|
17592
19072
|
let params = {};
|
|
17593
19073
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17594
19074
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17605,6 +19085,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17605
19085
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17606
19086
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
17607
19087
|
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
19088
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
17608
19089
|
params = this.getBaseQueryParams(params);
|
|
17609
19090
|
if (hideObjectSearch) {
|
|
17610
19091
|
params[Param.HideObjectSearch] = !!hideObjectSearch;
|
|
@@ -17672,6 +19153,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17672
19153
|
// To use v3 navigation, we must manually set the discoveryExperience
|
|
17673
19154
|
// settings.
|
|
17674
19155
|
params[Param.NavigationVersion] = 'v2';
|
|
19156
|
+
// Set homePageVersion to v2 by default to reset the LD flag value
|
|
19157
|
+
// for the homepageVersion.
|
|
19158
|
+
params[Param.HomepageVersion] = 'v2';
|
|
19159
|
+
// Set listpageVersion to v2 by default to reset the LD flag value
|
|
19160
|
+
// for the listpageVersion.
|
|
19161
|
+
params[Param.ListPageVersion] = exports.ListPage.List;
|
|
17675
19162
|
if (discoveryExperience) {
|
|
17676
19163
|
// primaryNavbarVersion v3 will enabled the new left navigation
|
|
17677
19164
|
if (discoveryExperience.primaryNavbarVersion === exports.PrimaryNavbarVersion.Sliding) {
|
|
@@ -17684,6 +19171,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17684
19171
|
if (discoveryExperience.homePage === exports.HomePage.Modular) {
|
|
17685
19172
|
params[Param.ModularHomeExperienceEnabled] = true;
|
|
17686
19173
|
}
|
|
19174
|
+
// ModularWithStylingChanges (v3) introduces the styling changes
|
|
19175
|
+
// to the Modular Homepage.
|
|
19176
|
+
// v3 will be the base version of homePageVersion.
|
|
19177
|
+
if (discoveryExperience.homePage === exports.HomePage.ModularWithStylingChanges) {
|
|
19178
|
+
params[Param.HomepageVersion] = exports.HomePage.ModularWithStylingChanges;
|
|
19179
|
+
}
|
|
17687
19180
|
// listPageVersion v3 will enable the new list page
|
|
17688
19181
|
if (discoveryExperience.listPageVersion === exports.ListPage.ListWithUXChanges) {
|
|
17689
19182
|
params[Param.ListPageVersion] = discoveryExperience.listPageVersion;
|
|
@@ -17987,14 +19480,9 @@ query GetEurekaVizSnapshots(
|
|
|
17987
19480
|
* embedded Liveboard or visualization.
|
|
17988
19481
|
*/
|
|
17989
19482
|
getEmbedParams() {
|
|
17990
|
-
const params = this.getEmbedParamsObject();
|
|
17991
|
-
const queryParams = getQueryParamString(params, true);
|
|
17992
|
-
return queryParams;
|
|
17993
|
-
}
|
|
17994
|
-
getEmbedParamsObject() {
|
|
17995
19483
|
let params = {};
|
|
17996
19484
|
params = this.getBaseQueryParams(params);
|
|
17997
|
-
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;
|
|
19485
|
+
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;
|
|
17998
19486
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
17999
19487
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
18000
19488
|
if (fullHeight === true) {
|
|
@@ -18061,27 +19549,9 @@ query GetEurekaVizSnapshots(
|
|
|
18061
19549
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18062
19550
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18063
19551
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
if (isForceRedirect) {
|
|
18068
|
-
params[Param.IsForceRedirect] = isForceRedirect;
|
|
18069
|
-
}
|
|
18070
|
-
if (dataSourceId !== undefined) {
|
|
18071
|
-
params[Param.DataSourceId] = dataSourceId;
|
|
18072
|
-
}
|
|
18073
|
-
if (isLiveboardStylingAndGroupingEnabled !== undefined) {
|
|
18074
|
-
params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
|
|
18075
|
-
}
|
|
18076
|
-
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
18077
|
-
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
18078
|
-
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
18079
|
-
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
18080
|
-
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
18081
|
-
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18082
|
-
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18083
|
-
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
18084
|
-
return params;
|
|
19552
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
19553
|
+
const queryParams = getQueryParamString(params, true);
|
|
19554
|
+
return queryParams;
|
|
18085
19555
|
}
|
|
18086
19556
|
getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
|
|
18087
19557
|
let suffix = `/embed/viz/${liveboardId}`;
|
|
@@ -18323,9 +19793,11 @@ query GetEurekaVizSnapshots(
|
|
|
18323
19793
|
const defaultAppInitData = await super.getAppInitData();
|
|
18324
19794
|
return { ...defaultAppInitData, ...this.getSearchInitData() };
|
|
18325
19795
|
}
|
|
18326
|
-
|
|
19796
|
+
getEmbedParams() {
|
|
18327
19797
|
var _a;
|
|
18328
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
19798
|
+
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
19799
|
+
/* eslint-disable-next-line max-len */
|
|
19800
|
+
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, focusSearchBarOnRender = true, excludeRuntimeParametersfromURL, excludeSearchTokenStringFromURL, collapseSearchBar = true, } = this.viewConfig;
|
|
18329
19801
|
const queryParams = this.getBaseQueryParams();
|
|
18330
19802
|
queryParams[Param.HideActions] = [
|
|
18331
19803
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -18358,6 +19830,7 @@ query GetEurekaVizSnapshots(
|
|
|
18358
19830
|
queryParams[Param.HideSearchBar] = true;
|
|
18359
19831
|
}
|
|
18360
19832
|
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19833
|
+
/* eslint-disable-next-line max-len */
|
|
18361
19834
|
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
18362
19835
|
}
|
|
18363
19836
|
if (!focusSearchBarOnRender) {
|
|
@@ -18370,22 +19843,20 @@ query GetEurekaVizSnapshots(
|
|
|
18370
19843
|
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
18371
19844
|
}
|
|
18372
19845
|
queryParams[Param.searchEmbed] = true;
|
|
19846
|
+
/* eslint-disable-next-line max-len */
|
|
18373
19847
|
queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
|
|
18374
19848
|
queryParams[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18375
19849
|
if (dataPanelCustomGroupsAccordionInitialState
|
|
18376
19850
|
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
18377
19851
|
|| dataPanelCustomGroupsAccordionInitialState
|
|
18378
19852
|
=== DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST) {
|
|
19853
|
+
/* eslint-disable-next-line max-len */
|
|
18379
19854
|
queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
|
|
18380
19855
|
}
|
|
18381
19856
|
else {
|
|
19857
|
+
/* eslint-disable-next-line max-len */
|
|
18382
19858
|
queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
|
|
18383
19859
|
}
|
|
18384
|
-
return queryParams;
|
|
18385
|
-
}
|
|
18386
|
-
getEmbedParams() {
|
|
18387
|
-
const { runtimeParameters, runtimeFilters, excludeRuntimeParametersfromURL, excludeRuntimeFiltersfromURL, } = this.viewConfig;
|
|
18388
|
-
const queryParams = this.getEmbedParamsObject();
|
|
18389
19860
|
let query = '';
|
|
18390
19861
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18391
19862
|
if (queryParamsString) {
|
|
@@ -18441,9 +19912,15 @@ query GetEurekaVizSnapshots(
|
|
|
18441
19912
|
this.embedComponentType = 'SearchBarEmbed';
|
|
18442
19913
|
this.viewConfig = viewConfig;
|
|
18443
19914
|
}
|
|
18444
|
-
|
|
19915
|
+
/**
|
|
19916
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
19917
|
+
* loaded in the iframe
|
|
19918
|
+
* @param dataSources A list of data source GUIDs
|
|
19919
|
+
*/
|
|
19920
|
+
getIFrameSrc() {
|
|
18445
19921
|
var _a;
|
|
18446
19922
|
const { searchOptions, dataSource, dataSources, useLastSelectedSources = false, excludeSearchTokenStringFromURL, } = this.viewConfig;
|
|
19923
|
+
const path = 'search-bar-embed';
|
|
18447
19924
|
const queryParams = this.getBaseQueryParams();
|
|
18448
19925
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
18449
19926
|
if (dataSources && dataSources.length) {
|
|
@@ -18465,16 +19942,6 @@ query GetEurekaVizSnapshots(
|
|
|
18465
19942
|
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
18466
19943
|
}
|
|
18467
19944
|
queryParams[Param.searchEmbed] = true;
|
|
18468
|
-
return queryParams;
|
|
18469
|
-
}
|
|
18470
|
-
/**
|
|
18471
|
-
* Construct the URL of the embedded ThoughtSpot search to be
|
|
18472
|
-
* loaded in the iframe
|
|
18473
|
-
* @param dataSources A list of data source GUIDs
|
|
18474
|
-
*/
|
|
18475
|
-
getIFrameSrc() {
|
|
18476
|
-
const queryParams = this.getEmbedParamsObject();
|
|
18477
|
-
const path = 'search-bar-embed';
|
|
18478
19945
|
let query = '';
|
|
18479
19946
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18480
19947
|
if (queryParamsString) {
|
|
@@ -18897,17 +20364,13 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18897
20364
|
super(container, viewConfig);
|
|
18898
20365
|
this.viewConfig = viewConfig;
|
|
18899
20366
|
}
|
|
18900
|
-
|
|
20367
|
+
getIframeSrc() {
|
|
18901
20368
|
var _a;
|
|
20369
|
+
const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
|
|
20370
|
+
const path = 'conv-assist-answer';
|
|
18902
20371
|
const queryParams = this.getBaseQueryParams();
|
|
18903
20372
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
18904
20373
|
queryParams[Param.isSpotterAgentEmbed] = true;
|
|
18905
|
-
return queryParams;
|
|
18906
|
-
}
|
|
18907
|
-
getIframeSrc() {
|
|
18908
|
-
const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
|
|
18909
|
-
const path = 'conv-assist-answer';
|
|
18910
|
-
const queryParams = this.getEmbedParamsObject();
|
|
18911
20374
|
let query = '';
|
|
18912
20375
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18913
20376
|
if (queryParamsString) {
|
|
@@ -19068,8 +20531,9 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
19068
20531
|
super(container, viewConfig);
|
|
19069
20532
|
this.viewConfig = viewConfig;
|
|
19070
20533
|
}
|
|
19071
|
-
|
|
20534
|
+
getIframeSrc() {
|
|
19072
20535
|
const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
20536
|
+
const path = 'insights/conv-assist';
|
|
19073
20537
|
if (!worksheetId) {
|
|
19074
20538
|
this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
|
|
19075
20539
|
}
|
|
@@ -19090,12 +20554,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
19090
20554
|
if (!isUndefined_1(hideSampleQuestions)) {
|
|
19091
20555
|
queryParams[Param.HideSampleQuestions] = !!hideSampleQuestions;
|
|
19092
20556
|
}
|
|
19093
|
-
return queryParams;
|
|
19094
|
-
}
|
|
19095
|
-
getIframeSrc() {
|
|
19096
|
-
const { worksheetId, searchOptions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
19097
|
-
const path = 'insights/conv-assist';
|
|
19098
|
-
const queryParams = this.getEmbedParamsObject();
|
|
19099
20557
|
let query = '';
|
|
19100
20558
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
19101
20559
|
if (queryParamsString) {
|
|
@@ -19167,7 +20625,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
19167
20625
|
viewConfig.embedComponentType = 'SageEmbed';
|
|
19168
20626
|
super(domSelector, viewConfig);
|
|
19169
20627
|
}
|
|
19170
|
-
|
|
20628
|
+
/**
|
|
20629
|
+
* Constructs a map of parameters to be passed on to the
|
|
20630
|
+
* embedded Eureka or Sage search page.
|
|
20631
|
+
* @returns {string} query string
|
|
20632
|
+
*/
|
|
20633
|
+
getEmbedParams() {
|
|
19171
20634
|
const { disableWorksheetChange, hideWorksheetSelector, showObjectSuggestions, dataPanelV2, hideSampleQuestions, isProductTour, hideSageAnswerHeader, hideAutocompleteSuggestions, } = this.viewConfig;
|
|
19172
20635
|
const params = this.getBaseQueryParams();
|
|
19173
20636
|
params[Param.DataPanelV2Enabled] = !!dataPanelV2;
|
|
@@ -19182,15 +20645,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
19182
20645
|
params[Param.HideSampleQuestions] = !!hideSampleQuestions;
|
|
19183
20646
|
params[Param.IsProductTour] = !!isProductTour;
|
|
19184
20647
|
params[Param.HideSageAnswerHeader] = !!hideSageAnswerHeader;
|
|
19185
|
-
return params;
|
|
19186
|
-
}
|
|
19187
|
-
/**
|
|
19188
|
-
* Constructs a map of parameters to be passed on to the
|
|
19189
|
-
* embedded Eureka or Sage search page.
|
|
19190
|
-
* @returns {string} query string
|
|
19191
|
-
*/
|
|
19192
|
-
getEmbedParams() {
|
|
19193
|
-
const params = this.getEmbedParamsObject();
|
|
19194
20648
|
return getQueryParamString(params, true);
|
|
19195
20649
|
}
|
|
19196
20650
|
/**
|