@thoughtspot/visual-embed-sdk 1.31.1 → 1.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1100,6 +1100,10 @@ describe('Unit test case for ts embed', () => {
1100
1100
  });
1101
1101
 
1102
1102
  describe('V1Embed ', () => {
1103
+ beforeEach(() => {
1104
+ jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
1105
+ });
1106
+
1103
1107
  test('when isRendered is true than isError will be true', () => {
1104
1108
  spyOn(logger, 'error');
1105
1109
  const viEmbedIns = new tsEmbedInstance.V1Embed(getRootEl(), defaultViewConfig);
@@ -1111,6 +1115,18 @@ describe('Unit test case for ts embed', () => {
1111
1115
  'Please register event handlers before calling render',
1112
1116
  );
1113
1117
  });
1118
+
1119
+ test('Generates the correct url for V1Embed when V2 shell is enabled', async () => {
1120
+ const v1Embed = new LiveboardEmbed(getRootEl(), {
1121
+ ...defaultViewConfig,
1122
+ liveboardId: '123',
1123
+ enableV2Shell_experimental: true,
1124
+ });
1125
+ await v1Embed.render();
1126
+ await executeAfterWait(() => {
1127
+ expect(getIFrameSrc()).toContain('/v2/?');
1128
+ });
1129
+ });
1114
1130
  });
1115
1131
 
1116
1132
  describe('Navigate to Page API', () => {
@@ -368,7 +368,7 @@ export class TsEmbed {
368
368
  * @param query
369
369
  */
370
370
  protected getEmbedBasePath(query: string): string {
371
- let queryString = query;
371
+ let queryString = (query.startsWith('?')) ? query : `?${query}`;
372
372
  if (this.shouldEncodeUrlQueryParams) {
373
373
  queryString = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(
374
374
  queryString.substr(1),
@@ -1257,7 +1257,9 @@ export class V1Embed extends TsEmbed {
1257
1257
  const filterQuery = getFilterQuery(runtimeFilters || []);
1258
1258
  queryString = [filterQuery, queryString].filter(Boolean).join('&');
1259
1259
  }
1260
- return this.getV1EmbedBasePath(queryString);
1260
+ return (this.viewConfig.enableV2Shell_experimental)
1261
+ ? this.getEmbedBasePath(queryString)
1262
+ : this.getV1EmbedBasePath(queryString);
1261
1263
  }
1262
1264
 
1263
1265
  /**
package/src/types.ts CHANGED
@@ -588,7 +588,7 @@ export interface EmbedConfig {
588
588
  }
589
589
 
590
590
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
591
- export interface LayoutConfig {}
591
+ export interface LayoutConfig { }
592
592
 
593
593
  /**
594
594
  * Embedded iframe configuration
@@ -998,6 +998,20 @@ export interface ViewConfig {
998
998
  * @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl
999
999
  */
1000
1000
  excludeRuntimeParametersfromURL?: boolean;
1001
+ /**
1002
+ * Enable the V2 shell. This can provide performance benefits
1003
+ * due to a lighterweight shell.
1004
+ * @example
1005
+ * ```js
1006
+ * const embed = new LiveboardEmbed('#embed', {
1007
+ * liveboardId: '123',
1008
+ * enableV2Shell_experimental: true
1009
+ * });
1010
+ * ```
1011
+ * @version SDK: 1.31.2 | ThoughtSpot: 10.0.0.cl
1012
+ */
1013
+ // eslint-disable-next-line camelcase
1014
+ enableV2Shell_experimental?: boolean;
1001
1015
  }
1002
1016
 
1003
1017
  /**
@@ -4035,15 +4049,15 @@ export interface ColumnValue {
4035
4049
  [key: string]: any;
4036
4050
  };
4037
4051
  value:
4038
- | string
4039
- | number
4040
- | boolean
4041
- | {
4042
- v: {
4043
- s: number;
4044
- e: number;
4045
- };
4046
- };
4052
+ | string
4053
+ | number
4054
+ | boolean
4055
+ | {
4056
+ v: {
4057
+ s: number;
4058
+ e: number;
4059
+ };
4060
+ };
4047
4061
  }
4048
4062
 
4049
4063
  export interface VizPoint {