@thoughtspot/visual-embed-sdk 1.26.1 → 1.26.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.
Files changed (267) hide show
  1. package/cjs/package.json +2 -2
  2. package/cjs/src/auth.d.ts +0 -12
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +16 -54
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/auth.spec.d.ts.map +1 -1
  7. package/cjs/src/auth.spec.js +42 -32
  8. package/cjs/src/auth.spec.js.map +1 -1
  9. package/cjs/src/authToken.d.ts +4 -0
  10. package/cjs/src/authToken.d.ts.map +1 -0
  11. package/cjs/src/authToken.js +61 -0
  12. package/cjs/src/authToken.js.map +1 -0
  13. package/cjs/src/embed/TsEmbed.d.ts +302 -0
  14. package/cjs/src/embed/TsEmbed.d.ts.map +1 -0
  15. package/cjs/src/embed/TsEmbed.js +851 -0
  16. package/cjs/src/embed/TsEmbed.js.map +1 -0
  17. package/cjs/src/embed/base.d.ts +0 -9
  18. package/cjs/src/embed/base.d.ts.map +1 -1
  19. package/cjs/src/embed/base.js +21 -44
  20. package/cjs/src/embed/base.js.map +1 -1
  21. package/cjs/src/embed/base.spec.js +15 -14
  22. package/cjs/src/embed/base.spec.js.map +1 -1
  23. package/cjs/src/embed/embedConfig.d.ts +18 -0
  24. package/cjs/src/embed/embedConfig.d.ts.map +1 -0
  25. package/cjs/src/embed/embedConfig.js +25 -0
  26. package/cjs/src/embed/embedConfig.js.map +1 -0
  27. package/cjs/src/embed/search.d.ts.map +1 -1
  28. package/cjs/src/embed/search.js +3 -1
  29. package/cjs/src/embed/search.js.map +1 -1
  30. package/cjs/src/embed/searchEmbed-basic-auth.spec.js +3 -2
  31. package/cjs/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
  32. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  33. package/cjs/src/embed/ts-embed.js +5 -3
  34. package/cjs/src/embed/ts-embed.js.map +1 -1
  35. package/cjs/src/embed/ts-embed.spec.js +58 -49
  36. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  37. package/cjs/src/index.d.ts +2 -1
  38. package/cjs/src/index.d.ts.map +1 -1
  39. package/cjs/src/index.js +2 -1
  40. package/cjs/src/index.js.map +1 -1
  41. package/cjs/src/tokenizedFetch.d.ts +2 -0
  42. package/cjs/src/tokenizedFetch.d.ts.map +1 -0
  43. package/cjs/src/tokenizedFetch.js +20 -0
  44. package/cjs/src/tokenizedFetch.js.map +1 -0
  45. package/cjs/src/types.d.ts +6 -0
  46. package/cjs/src/types.d.ts.map +1 -1
  47. package/cjs/src/types.js.map +1 -1
  48. package/cjs/src/utils/answerService.d.ts +10 -0
  49. package/cjs/src/utils/answerService.d.ts.map +1 -0
  50. package/cjs/src/utils/answerService.js +61 -0
  51. package/cjs/src/utils/answerService.js.map +1 -0
  52. package/cjs/src/utils/answerService.spec.d.ts +2 -0
  53. package/cjs/src/utils/answerService.spec.d.ts.map +1 -0
  54. package/cjs/src/utils/answerService.spec.js +31 -0
  55. package/cjs/src/utils/answerService.spec.js.map +1 -0
  56. package/cjs/src/utils/authService/authService.d.ts +45 -0
  57. package/cjs/src/utils/authService/authService.d.ts.map +1 -0
  58. package/cjs/src/utils/authService/authService.js +115 -0
  59. package/cjs/src/utils/authService/authService.js.map +1 -0
  60. package/cjs/src/utils/authService/authService.spec.d.ts +2 -0
  61. package/cjs/src/utils/authService/authService.spec.d.ts.map +1 -0
  62. package/cjs/src/utils/authService/authService.spec.js +82 -0
  63. package/cjs/src/utils/authService/authService.spec.js.map +1 -0
  64. package/cjs/src/utils/authService/index.d.ts +3 -0
  65. package/cjs/src/utils/authService/index.d.ts.map +1 -0
  66. package/cjs/src/utils/authService/index.js +14 -0
  67. package/cjs/src/utils/authService/index.js.map +1 -0
  68. package/cjs/src/utils/authService/tokenisedAuthSerice.d.ts +11 -0
  69. package/cjs/src/utils/authService/tokenisedAuthSerice.d.ts.map +1 -0
  70. package/cjs/src/utils/authService/tokenisedAuthSerice.js +44 -0
  71. package/cjs/src/utils/authService/tokenisedAuthSerice.js.map +1 -0
  72. package/cjs/src/utils/authService/tokenizedAuthService.d.ts +11 -0
  73. package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +1 -0
  74. package/cjs/src/utils/authService/tokenizedAuthService.js +44 -0
  75. package/cjs/src/utils/authService/tokenizedAuthService.js.map +1 -0
  76. package/cjs/src/utils/authService.d.ts +12 -1
  77. package/cjs/src/utils/authService.d.ts.map +1 -1
  78. package/cjs/src/utils/authService.js +32 -16
  79. package/cjs/src/utils/authService.js.map +1 -1
  80. package/cjs/src/utils/authService.spec.js +3 -4
  81. package/cjs/src/utils/authService.spec.js.map +1 -1
  82. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  83. package/cjs/src/utils/graphql/answerService/answerService.js +2 -1
  84. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  85. package/cjs/src/utils/graphql/answerService/answerService.spec.js +15 -3
  86. package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  87. package/cjs/src/utils/graphql/graphql-request.spec.d.ts +2 -0
  88. package/cjs/src/utils/graphql/graphql-request.spec.d.ts.map +1 -0
  89. package/cjs/src/utils/graphql/graphql-request.spec.js +39 -0
  90. package/cjs/src/utils/graphql/graphql-request.spec.js.map +1 -0
  91. package/cjs/src/utils/logger.d.ts +28 -0
  92. package/cjs/src/utils/logger.d.ts.map +1 -0
  93. package/cjs/src/utils/logger.js +82 -0
  94. package/cjs/src/utils/logger.js.map +1 -0
  95. package/cjs/src/utils/processData.d.ts.map +1 -1
  96. package/cjs/src/utils/processData.js +5 -4
  97. package/cjs/src/utils/processData.js.map +1 -1
  98. package/cjs/src/utils/processData.spec.js +8 -7
  99. package/cjs/src/utils/processData.spec.js.map +1 -1
  100. package/dist/src/auth.d.ts +0 -12
  101. package/dist/src/auth.d.ts.map +1 -1
  102. package/dist/src/auth.spec.d.ts.map +1 -1
  103. package/dist/src/authToken.d.ts +4 -0
  104. package/dist/src/authToken.d.ts.map +1 -0
  105. package/dist/src/embed/base.d.ts +0 -9
  106. package/dist/src/embed/base.d.ts.map +1 -1
  107. package/dist/src/embed/embedConfig.d.ts +18 -0
  108. package/dist/src/embed/embedConfig.d.ts.map +1 -0
  109. package/dist/src/embed/search.d.ts.map +1 -1
  110. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  111. package/dist/src/index.d.ts +2 -1
  112. package/dist/src/index.d.ts.map +1 -1
  113. package/dist/src/tokenizedFetch.d.ts +2 -0
  114. package/dist/src/tokenizedFetch.d.ts.map +1 -0
  115. package/dist/src/types.d.ts +6 -0
  116. package/dist/src/types.d.ts.map +1 -1
  117. package/dist/src/utils/answerService.d.ts +10 -0
  118. package/dist/src/utils/answerService.d.ts.map +1 -0
  119. package/dist/src/utils/answerService.spec.d.ts +2 -0
  120. package/dist/src/utils/answerService.spec.d.ts.map +1 -0
  121. package/dist/src/utils/authService/authService.d.ts +45 -0
  122. package/dist/src/utils/authService/authService.d.ts.map +1 -0
  123. package/dist/src/utils/authService/authService.spec.d.ts +2 -0
  124. package/dist/src/utils/authService/authService.spec.d.ts.map +1 -0
  125. package/dist/src/utils/authService/index.d.ts +3 -0
  126. package/dist/src/utils/authService/index.d.ts.map +1 -0
  127. package/dist/src/utils/authService/tokenisedAuthSerice.d.ts +11 -0
  128. package/dist/src/utils/authService/tokenisedAuthSerice.d.ts.map +1 -0
  129. package/dist/src/utils/authService/tokenizedAuthService.d.ts +11 -0
  130. package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -0
  131. package/dist/src/utils/authService.d.ts +12 -1
  132. package/dist/src/utils/authService.d.ts.map +1 -1
  133. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  134. package/dist/src/utils/graphql/graphql-request.spec.d.ts +2 -0
  135. package/dist/src/utils/graphql/graphql-request.spec.d.ts.map +1 -0
  136. package/dist/src/utils/logger.d.ts +28 -0
  137. package/dist/src/utils/logger.d.ts.map +1 -0
  138. package/dist/src/utils/processData.d.ts.map +1 -1
  139. package/dist/tsembed-react.es.js +201 -140
  140. package/dist/tsembed-react.js +201 -140
  141. package/dist/tsembed.es.js +230 -171
  142. package/dist/tsembed.js +230 -171
  143. package/dist/visual-embed-sdk-react-full.d.ts +23 -21
  144. package/dist/visual-embed-sdk-react.d.ts +23 -21
  145. package/dist/visual-embed-sdk.d.ts +23 -21
  146. package/lib/package.json +2 -2
  147. package/lib/src/auth.d.ts +0 -12
  148. package/lib/src/auth.d.ts.map +1 -1
  149. package/lib/src/auth.js +11 -48
  150. package/lib/src/auth.js.map +1 -1
  151. package/lib/src/auth.spec.d.ts.map +1 -1
  152. package/lib/src/auth.spec.js +42 -32
  153. package/lib/src/auth.spec.js.map +1 -1
  154. package/lib/src/authToken.d.ts +4 -0
  155. package/lib/src/authToken.d.ts.map +1 -0
  156. package/lib/src/authToken.js +56 -0
  157. package/lib/src/authToken.js.map +1 -0
  158. package/lib/src/embed/TsEmbed.d.ts +302 -0
  159. package/lib/src/embed/TsEmbed.d.ts.map +1 -0
  160. package/lib/src/embed/TsEmbed.js +847 -0
  161. package/lib/src/embed/TsEmbed.js.map +1 -0
  162. package/lib/src/embed/base.d.ts +0 -9
  163. package/lib/src/embed/base.d.ts.map +1 -1
  164. package/lib/src/embed/base.js +21 -43
  165. package/lib/src/embed/base.js.map +1 -1
  166. package/lib/src/embed/base.spec.js +15 -14
  167. package/lib/src/embed/base.spec.js.map +1 -1
  168. package/lib/src/embed/embedConfig.d.ts +18 -0
  169. package/lib/src/embed/embedConfig.d.ts.map +1 -0
  170. package/lib/src/embed/embedConfig.js +20 -0
  171. package/lib/src/embed/embedConfig.js.map +1 -0
  172. package/lib/src/embed/search.d.ts.map +1 -1
  173. package/lib/src/embed/search.js +4 -2
  174. package/lib/src/embed/search.js.map +1 -1
  175. package/lib/src/embed/searchEmbed-basic-auth.spec.js +3 -2
  176. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
  177. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  178. package/lib/src/embed/ts-embed.js +4 -2
  179. package/lib/src/embed/ts-embed.js.map +1 -1
  180. package/lib/src/embed/ts-embed.spec.js +58 -49
  181. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  182. package/lib/src/index.d.ts +2 -1
  183. package/lib/src/index.d.ts.map +1 -1
  184. package/lib/src/index.js +2 -1
  185. package/lib/src/index.js.map +1 -1
  186. package/lib/src/tokenizedFetch.d.ts +2 -0
  187. package/lib/src/tokenizedFetch.d.ts.map +1 -0
  188. package/lib/src/tokenizedFetch.js +16 -0
  189. package/lib/src/tokenizedFetch.js.map +1 -0
  190. package/lib/src/types.d.ts +6 -0
  191. package/lib/src/types.d.ts.map +1 -1
  192. package/lib/src/types.js.map +1 -1
  193. package/lib/src/utils/answerService.d.ts +10 -0
  194. package/lib/src/utils/answerService.d.ts.map +1 -0
  195. package/lib/src/utils/answerService.js +57 -0
  196. package/lib/src/utils/answerService.js.map +1 -0
  197. package/lib/src/utils/answerService.spec.d.ts +2 -0
  198. package/lib/src/utils/answerService.spec.d.ts.map +1 -0
  199. package/lib/src/utils/answerService.spec.js +29 -0
  200. package/lib/src/utils/answerService.spec.js.map +1 -0
  201. package/lib/src/utils/authService/authService.d.ts +45 -0
  202. package/lib/src/utils/authService/authService.d.ts.map +1 -0
  203. package/lib/src/utils/authService/authService.js +107 -0
  204. package/lib/src/utils/authService/authService.js.map +1 -0
  205. package/lib/src/utils/authService/authService.spec.d.ts +2 -0
  206. package/lib/src/utils/authService/authService.spec.d.ts.map +1 -0
  207. package/lib/src/utils/authService/authService.spec.js +80 -0
  208. package/lib/src/utils/authService/authService.spec.js.map +1 -0
  209. package/lib/src/utils/authService/index.d.ts +3 -0
  210. package/lib/src/utils/authService/index.d.ts.map +1 -0
  211. package/lib/src/utils/authService/index.js +3 -0
  212. package/lib/src/utils/authService/index.js.map +1 -0
  213. package/lib/src/utils/authService/tokenisedAuthSerice.d.ts +11 -0
  214. package/lib/src/utils/authService/tokenisedAuthSerice.d.ts.map +1 -0
  215. package/lib/src/utils/authService/tokenisedAuthSerice.js +39 -0
  216. package/lib/src/utils/authService/tokenisedAuthSerice.js.map +1 -0
  217. package/lib/src/utils/authService/tokenizedAuthService.d.ts +11 -0
  218. package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +1 -0
  219. package/lib/src/utils/authService/tokenizedAuthService.js +39 -0
  220. package/lib/src/utils/authService/tokenizedAuthService.js.map +1 -0
  221. package/lib/src/utils/authService.d.ts +12 -1
  222. package/lib/src/utils/authService.d.ts.map +1 -1
  223. package/lib/src/utils/authService.js +26 -10
  224. package/lib/src/utils/authService.js.map +1 -1
  225. package/lib/src/utils/authService.spec.js +1 -2
  226. package/lib/src/utils/authService.spec.js.map +1 -1
  227. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  228. package/lib/src/utils/graphql/answerService/answerService.js +2 -1
  229. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  230. package/lib/src/utils/graphql/answerService/answerService.spec.js +14 -3
  231. package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  232. package/lib/src/utils/graphql/graphql-request.spec.d.ts +2 -0
  233. package/lib/src/utils/graphql/graphql-request.spec.d.ts.map +1 -0
  234. package/lib/src/utils/graphql/graphql-request.spec.js +36 -0
  235. package/lib/src/utils/graphql/graphql-request.spec.js.map +1 -0
  236. package/lib/src/utils/logger.d.ts +28 -0
  237. package/lib/src/utils/logger.d.ts.map +1 -0
  238. package/lib/src/utils/logger.js +75 -0
  239. package/lib/src/utils/logger.js.map +1 -0
  240. package/lib/src/utils/processData.d.ts.map +1 -1
  241. package/lib/src/utils/processData.js +4 -3
  242. package/lib/src/utils/processData.js.map +1 -1
  243. package/lib/src/utils/processData.spec.js +8 -7
  244. package/lib/src/utils/processData.spec.js.map +1 -1
  245. package/lib/src/visual-embed-sdk.d.ts +28 -22
  246. package/package.json +2 -2
  247. package/src/auth.spec.ts +77 -63
  248. package/src/auth.ts +12 -55
  249. package/src/authToken.ts +66 -0
  250. package/src/embed/base.spec.ts +18 -17
  251. package/src/embed/base.ts +26 -51
  252. package/src/embed/embedConfig.ts +23 -0
  253. package/src/embed/search.ts +10 -10
  254. package/src/embed/searchEmbed-basic-auth.spec.ts +3 -2
  255. package/src/embed/ts-embed.spec.ts +87 -75
  256. package/src/embed/ts-embed.ts +11 -20
  257. package/src/index.ts +8 -2
  258. package/src/tokenizedFetch.ts +18 -0
  259. package/src/types.ts +34 -23
  260. package/src/utils/{authService.spec.ts → authService/authService.spec.ts} +2 -3
  261. package/src/utils/{authService.ts → authService/authService.ts} +29 -34
  262. package/src/utils/authService/index.ts +9 -0
  263. package/src/utils/authService/tokenizedAuthService.ts +40 -0
  264. package/src/utils/graphql/answerService/answerService.spec.ts +16 -4
  265. package/src/utils/graphql/answerService/answerService.ts +2 -1
  266. package/src/utils/processData.spec.ts +19 -16
  267. package/src/utils/processData.ts +3 -2
@@ -4998,6 +4998,201 @@ function isEqual(value, other) {
4998
4998
 
4999
4999
  var isEqual_1 = isEqual;
5000
5000
 
5001
+ const EndPoints = {
5002
+ AUTH_VERIFICATION: '/callosum/v1/session/info',
5003
+ SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
5004
+ OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
5005
+ TOKEN_LOGIN: '/callosum/v1/session/login/token',
5006
+ BASIC_LOGIN: '/callosum/v1/session/login',
5007
+ LOGOUT: '/callosum/v1/session/logout',
5008
+ EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
5009
+ EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
5010
+ IS_ACTIVE: '/callosum/v1/session/isactive',
5011
+ };
5012
+ /**
5013
+ *
5014
+ * @param url
5015
+ * @param options
5016
+ */
5017
+ function failureLoggedFetch(url, options = {}) {
5018
+ return fetch(url, options).then(async (r) => {
5019
+ var _a;
5020
+ if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
5021
+ console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
5022
+ }
5023
+ return r;
5024
+ });
5025
+ }
5026
+ /**
5027
+ * Service to validate a auth token against a ThoughtSpot host.
5028
+ *
5029
+ * @param thoughtSpotHost : ThoughtSpot host to verify the token against.
5030
+ * @param authToken : Auth token to verify.
5031
+ */
5032
+ async function verifyTokenService(thoughtSpotHost, authToken) {
5033
+ const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
5034
+ try {
5035
+ const res = await fetch(authVerificationUrl, {
5036
+ headers: {
5037
+ Authorization: `Bearer ${authToken}`,
5038
+ 'x-requested-by': 'ThoughtSpot',
5039
+ },
5040
+ credentials: 'omit',
5041
+ });
5042
+ return res.ok;
5043
+ }
5044
+ catch (e) {
5045
+ console.error(`Token Verification Service failed : ${e.message}`);
5046
+ }
5047
+ return false;
5048
+ }
5049
+ /**
5050
+ *
5051
+ * @param authEndpoint
5052
+ */
5053
+ async function fetchAuthTokenService(authEndpoint) {
5054
+ return fetch(authEndpoint);
5055
+ }
5056
+ /**
5057
+ *
5058
+ * @param thoughtSpotHost
5059
+ * @param username
5060
+ * @param authToken
5061
+ */
5062
+ async function fetchAuthService(thoughtSpotHost, username, authToken) {
5063
+ return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
5064
+ credentials: 'include',
5065
+ // We do not want to follow the redirect, as it starts giving a CORS
5066
+ // error
5067
+ redirect: 'manual',
5068
+ });
5069
+ }
5070
+ /**
5071
+ *
5072
+ * @param thoughtSpotHost
5073
+ * @param username
5074
+ * @param authToken
5075
+ */
5076
+ async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
5077
+ return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
5078
+ method: 'POST',
5079
+ headers: {
5080
+ 'content-type': 'application/x-www-form-urlencoded',
5081
+ 'x-requested-by': 'ThoughtSpot',
5082
+ },
5083
+ body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
5084
+ credentials: 'include',
5085
+ // We do not want to follow the redirect, as it starts giving a CORS
5086
+ // error
5087
+ redirect: 'manual',
5088
+ });
5089
+ }
5090
+ /**
5091
+ *
5092
+ * @param thoughtSpotHost
5093
+ * @param username
5094
+ * @param password
5095
+ */
5096
+ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
5097
+ return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
5098
+ method: 'POST',
5099
+ headers: {
5100
+ 'content-type': 'application/x-www-form-urlencoded',
5101
+ 'x-requested-by': 'ThoughtSpot',
5102
+ },
5103
+ body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
5104
+ credentials: 'include',
5105
+ });
5106
+ }
5107
+
5108
+ const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
5109
+ + 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
5110
+ const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
5111
+ let cachedAuthToken = null;
5112
+ // This method can be used to get the authToken using the embedConfig
5113
+ const getAuthenticationToken = async (embedConfig) => {
5114
+ if (cachedAuthToken) {
5115
+ let isCachedTokenStillValid;
5116
+ try {
5117
+ isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
5118
+ }
5119
+ catch {
5120
+ isCachedTokenStillValid = false;
5121
+ }
5122
+ if (isCachedTokenStillValid)
5123
+ return cachedAuthToken;
5124
+ }
5125
+ const { authEndpoint, getAuthToken } = embedConfig;
5126
+ let authToken = null;
5127
+ if (getAuthToken) {
5128
+ authToken = await getAuthToken();
5129
+ }
5130
+ else {
5131
+ const response = await fetchAuthTokenService(authEndpoint);
5132
+ authToken = await response.text();
5133
+ }
5134
+ // this will throw error if the token is not valid
5135
+ await validateAuthToken(embedConfig, authToken);
5136
+ cachedAuthToken = authToken;
5137
+ return authToken;
5138
+ };
5139
+ const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
5140
+ try {
5141
+ const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
5142
+ if (isTokenValid)
5143
+ return true;
5144
+ }
5145
+ catch {
5146
+ return false;
5147
+ }
5148
+ if (cachedAuthToken && cachedAuthToken === authToken) {
5149
+ if (!embedConfig.suppressErrorAlerts && !suppressAlert) {
5150
+ // eslint-disable-next-line no-alert
5151
+ alert(DUPLICATE_TOKEN_ERR);
5152
+ }
5153
+ throw new Error(DUPLICATE_TOKEN_ERR);
5154
+ }
5155
+ else {
5156
+ throw new Error(INVALID_TOKEN_ERR);
5157
+ }
5158
+ };
5159
+ const resetCachedAuthToken = () => {
5160
+ cachedAuthToken = null;
5161
+ };
5162
+
5163
+ let config = {};
5164
+ /**
5165
+ * Gets the configuration embed was initialized with.
5166
+ *
5167
+ * @returns {@link EmbedConfig} The configuration embed was initialized with.
5168
+ * @version SDK: 1.19.0 | ThoughtSpot: *
5169
+ * @group Global methods
5170
+ */
5171
+ const getEmbedConfig = () => config;
5172
+ /**
5173
+ * Sets the configuration embed was initialized with.
5174
+ *
5175
+ * @param newConfig The configuration to set.
5176
+ * @version SDK: 1.27.0 | ThoughtSpot: *
5177
+ * @group Global methods
5178
+ */
5179
+ const setEmbedConfig = (newConfig) => {
5180
+ config = newConfig;
5181
+ };
5182
+
5183
+ const tokenizedFetch = async (input, init) => {
5184
+ const embedConfig = getEmbedConfig();
5185
+ if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
5186
+ return fetch(input, init);
5187
+ }
5188
+ const req = new Request(input, init);
5189
+ const authToken = await getAuthenticationToken(embedConfig);
5190
+ if (authToken) {
5191
+ req.headers.append('Authorization', `Bearer ${authToken}`);
5192
+ }
5193
+ return fetch(req);
5194
+ };
5195
+
5001
5196
  /**
5002
5197
  *
5003
5198
  * @param root0
@@ -5246,7 +5441,7 @@ class AnswerService {
5246
5441
  */
5247
5442
  async fetchCSVBlob(userLocale = 'en-us', includeInfo = false) {
5248
5443
  const fetchUrl = this.getFetchCSVBlobUrl(userLocale, includeInfo);
5249
- return fetch(fetchUrl, {
5444
+ return tokenizedFetch(fetchUrl, {
5250
5445
  credentials: 'include',
5251
5446
  });
5252
5447
  }
@@ -12090,14 +12285,13 @@ function uniq(array) {
12090
12285
 
12091
12286
  var uniq_1 = uniq;
12092
12287
 
12093
- // eslint-disable-next-line import/no-cycle
12094
12288
  /**
12095
12289
  *
12096
12290
  * @param url
12097
12291
  * @param options
12098
12292
  */
12099
- function failureLoggedFetch(url, options = {}) {
12100
- return fetch(url, options).then(async (r) => {
12293
+ function tokenisedFailureLoggedFetch(url, options = {}) {
12294
+ return tokenizedFetch(url, options).then(async (r) => {
12101
12295
  var _a;
12102
12296
  if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
12103
12297
  console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
@@ -12110,81 +12304,7 @@ function failureLoggedFetch(url, options = {}) {
12110
12304
  * @param authVerificationUrl
12111
12305
  */
12112
12306
  function fetchSessionInfoService(authVerificationUrl) {
12113
- return failureLoggedFetch(authVerificationUrl, {
12114
- credentials: 'include',
12115
- });
12116
- }
12117
- /**
12118
- * Service to validate a auth token against a ThoughtSpot host.
12119
- *
12120
- * @param thoughtSpotHost : ThoughtSpot host to verify the token against.
12121
- * @param authToken : Auth token to verify.
12122
- */
12123
- function verifyTokenService(thoughtSpotHost, authToken) {
12124
- const authVerificationUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
12125
- return fetch(authVerificationUrl, {
12126
- headers: {
12127
- Authorization: `Bearer ${authToken}`,
12128
- 'x-requested-by': 'ThoughtSpot',
12129
- },
12130
- credentials: 'omit',
12131
- });
12132
- }
12133
- /**
12134
- *
12135
- * @param authEndpoint
12136
- */
12137
- async function fetchAuthTokenService(authEndpoint) {
12138
- return fetch(authEndpoint);
12139
- }
12140
- /**
12141
- *
12142
- * @param thoughtSpotHost
12143
- * @param username
12144
- * @param authToken
12145
- */
12146
- async function fetchAuthService(thoughtSpotHost, username, authToken) {
12147
- return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
12148
- credentials: 'include',
12149
- // We do not want to follow the redirect, as it starts giving a CORS
12150
- // error
12151
- redirect: 'manual',
12152
- });
12153
- }
12154
- /**
12155
- *
12156
- * @param thoughtSpotHost
12157
- * @param username
12158
- * @param authToken
12159
- */
12160
- async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
12161
- return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
12162
- method: 'POST',
12163
- headers: {
12164
- 'content-type': 'application/x-www-form-urlencoded',
12165
- 'x-requested-by': 'ThoughtSpot',
12166
- },
12167
- body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
12168
- credentials: 'include',
12169
- // We do not want to follow the redirect, as it starts giving a CORS
12170
- // error
12171
- redirect: 'manual',
12172
- });
12173
- }
12174
- /**
12175
- *
12176
- * @param thoughtSpotHost
12177
- * @param username
12178
- * @param password
12179
- */
12180
- async function fetchBasicAuthService(thoughtSpotHost, username, password) {
12181
- return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
12182
- method: 'POST',
12183
- headers: {
12184
- 'content-type': 'application/x-www-form-urlencoded',
12185
- 'x-requested-by': 'ThoughtSpot',
12186
- },
12187
- body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
12307
+ return tokenisedFailureLoggedFetch(authVerificationUrl, {
12188
12308
  credentials: 'include',
12189
12309
  });
12190
12310
  }
@@ -12193,7 +12313,7 @@ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
12193
12313
  * @param thoughtSpotHost
12194
12314
  */
12195
12315
  async function fetchLogoutService(thoughtSpotHost) {
12196
- return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
12316
+ return tokenisedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
12197
12317
  credentials: 'include',
12198
12318
  method: 'POST',
12199
12319
  headers: {
@@ -12215,17 +12335,6 @@ const sessionInfoPromise = new Promise((resolve) => {
12215
12335
  });
12216
12336
  let releaseVersion = '';
12217
12337
  const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
12218
- const EndPoints = {
12219
- AUTH_VERIFICATION: '/callosum/v1/session/info',
12220
- SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
12221
- OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
12222
- TOKEN_LOGIN: '/callosum/v1/session/login/token',
12223
- BASIC_LOGIN: '/callosum/v1/session/login',
12224
- LOGOUT: '/callosum/v1/session/logout',
12225
- EXECUTE_TML: '/api/rest/2.0/metadata/tml/import',
12226
- EXPORT_TML: '/api/rest/2.0/metadata/tml/export',
12227
- IS_ACTIVE: '/callosum/v1/session/isactive',
12228
- };
12229
12338
  /**
12230
12339
  * Enum for auth failure types. This is the parameter passed to the listner
12231
12340
  * of {@link AuthStatus.FAILURE}.
@@ -12392,21 +12501,6 @@ function getReleaseVersion() {
12392
12501
  function getSessionInfo() {
12393
12502
  return sessionInfoPromise;
12394
12503
  }
12395
- const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
12396
- + 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
12397
- let prevAuthToken = null;
12398
- /**
12399
- *
12400
- * @param authtoken
12401
- */
12402
- function alertForDuplicateToken(authtoken) {
12403
- if (prevAuthToken === authtoken) {
12404
- // eslint-disable-next-line no-alert
12405
- alert(DUPLICATE_TOKEN_ERR);
12406
- throw new Error(DUPLICATE_TOKEN_ERR);
12407
- }
12408
- prevAuthToken = authtoken;
12409
- }
12410
12504
  /**
12411
12505
  * Check if we are stuck at the SSO redirect URL
12412
12506
  */
@@ -12424,19 +12518,6 @@ function removeSSORedirectUrlMarker() {
12424
12518
  // that creates an issue.
12425
12519
  window.location.hash = window.location.hash.replace(SSO_REDIRECTION_MARKER_GUID, '');
12426
12520
  }
12427
- const getAuthenticationToken = async (embedConfig) => {
12428
- const { authEndpoint, getAuthToken } = embedConfig;
12429
- let authToken = null;
12430
- if (getAuthToken) {
12431
- authToken = await getAuthToken();
12432
- alertForDuplicateToken(authToken);
12433
- }
12434
- else {
12435
- const response = await fetchAuthTokenService(authEndpoint);
12436
- authToken = await response.text();
12437
- }
12438
- return authToken;
12439
- };
12440
12521
  /**
12441
12522
  * Perform token based authentication
12442
12523
  *
@@ -12477,16 +12558,17 @@ const doCookielessTokenAuth = async (embedConfig) => {
12477
12558
  if (!authEndpoint && !getAuthToken) {
12478
12559
  throw new Error('Either auth endpoint or getAuthToken function must be provided');
12479
12560
  }
12561
+ let authSuccess = false;
12480
12562
  try {
12481
12563
  const authToken = await getAuthenticationToken(embedConfig);
12482
- const response = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
12483
- if (!response.ok)
12484
- return false;
12564
+ if (authToken) {
12565
+ authSuccess = true;
12566
+ }
12485
12567
  }
12486
- catch (e) {
12487
- return false;
12568
+ catch {
12569
+ authSuccess = false;
12488
12570
  }
12489
- return true;
12571
+ return authSuccess;
12490
12572
  };
12491
12573
  /**
12492
12574
  * Perform basic authentication to the ThoughtSpot cluster using the cluster
@@ -12604,7 +12686,8 @@ const doOIDCAuth = async (embedConfig) => {
12604
12686
  };
12605
12687
  const logout = async (embedConfig) => {
12606
12688
  const { thoughtSpotHost } = embedConfig;
12607
- const response = await fetchLogoutService(thoughtSpotHost);
12689
+ await fetchLogoutService(thoughtSpotHost);
12690
+ resetCachedAuthToken();
12608
12691
  loggedInStatus = false;
12609
12692
  return loggedInStatus;
12610
12693
  };
@@ -12636,27 +12719,18 @@ const authenticate = async (embedConfig) => {
12636
12719
  };
12637
12720
 
12638
12721
  /* eslint-disable camelcase */
12639
- let config = {};
12640
12722
  const CONFIG_DEFAULTS = {
12641
12723
  loginFailedMessage: 'Not logged in',
12642
12724
  authTriggerText: 'Authorize',
12643
12725
  authType: AuthType.None,
12644
12726
  };
12645
12727
  let authPromise;
12646
- /**
12647
- * Gets the configuration embed was initialized with.
12648
- *
12649
- * @returns {@link EmbedConfig} The configuration embed was initialized with.
12650
- * @version SDK: 1.19.0 | ThoughtSpot: *
12651
- * @group Global methods
12652
- */
12653
- const getEmbedConfig = () => config;
12654
12728
  const getAuthPromise = () => authPromise;
12655
12729
  /**
12656
12730
  * Perform authentication on the ThoughtSpot app as applicable.
12657
12731
  */
12658
12732
  const handleAuth = () => {
12659
- authPromise = authenticate(config);
12733
+ authPromise = authenticate(getEmbedConfig());
12660
12734
  authPromise.then((isLoggedIn) => {
12661
12735
  if (!isLoggedIn) {
12662
12736
  notifyAuthFailure(AuthFailureType.SDK);
@@ -12692,7 +12766,7 @@ const prefetch = (url, prefetchFeatures) => {
12692
12766
  }
12693
12767
  else {
12694
12768
  const features = prefetchFeatures || [PrefetchFeatures.FullApp];
12695
- let hostUrl = url || config.thoughtSpotHost;
12769
+ let hostUrl = url || getEmbedConfig().thoughtSpotHost;
12696
12770
  hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
12697
12771
  uniq_1(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach((prefetchUrl, index) => {
12698
12772
  const iFrame = document.createElement('iframe');
@@ -12758,16 +12832,15 @@ function backwardCompat(embedConfig) {
12758
12832
  const init = (embedConfig) => {
12759
12833
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
12760
12834
  sanity(embedConfig);
12761
- config = {
12835
+ setEmbedConfig(backwardCompat({
12762
12836
  ...CONFIG_DEFAULTS,
12763
12837
  ...embedConfig,
12764
12838
  thoughtSpotHost: getThoughtSpotHost(embedConfig),
12765
- };
12766
- config = backwardCompat(config);
12839
+ }));
12767
12840
  const authEE = new eventemitter3();
12768
12841
  setAuthEE(authEE);
12769
12842
  handleAuth();
12770
- const { password, ...configToTrack } = config;
12843
+ const { password, ...configToTrack } = getEmbedConfig();
12771
12844
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
12772
12845
  ...configToTrack,
12773
12846
  usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
@@ -12776,8 +12849,8 @@ const init = (embedConfig) => {
12776
12849
  usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
12777
12850
  usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
12778
12851
  });
12779
- if (config.callPrefetch) {
12780
- prefetch(config.thoughtSpotHost);
12852
+ if (getEmbedConfig().callPrefetch) {
12853
+ prefetch(getEmbedConfig().thoughtSpotHost);
12781
12854
  }
12782
12855
  return authEE;
12783
12856
  };
@@ -12785,7 +12858,7 @@ const init = (embedConfig) => {
12785
12858
  *
12786
12859
  */
12787
12860
  function disableAutoLogin() {
12788
- config.autoLogin = false;
12861
+ getEmbedConfig().autoLogin = false;
12789
12862
  }
12790
12863
  /**
12791
12864
  * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
@@ -12803,7 +12876,7 @@ const logout$1 = (doNotDisableAutoLogin = false) => {
12803
12876
  if (!doNotDisableAutoLogin) {
12804
12877
  disableAutoLogin();
12805
12878
  }
12806
- return logout(config).then((isLoggedIn) => {
12879
+ return logout(getEmbedConfig()).then((isLoggedIn) => {
12807
12880
  notifyLogout();
12808
12881
  return isLoggedIn;
12809
12882
  });
@@ -12816,7 +12889,7 @@ let renderQueue = Promise.resolve();
12816
12889
  * @param fn The function being registered
12817
12890
  */
12818
12891
  const renderInQueue = (fn) => {
12819
- const { queueMultiRenders = false } = config;
12892
+ const { queueMultiRenders = false } = getEmbedConfig();
12820
12893
  if (queueMultiRenders) {
12821
12894
  renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
12822
12895
  return renderQueue;
@@ -12848,30 +12921,23 @@ const renderInQueue = (fn) => {
12848
12921
  * @group Global methods
12849
12922
  */
12850
12923
  const executeTML = async (data) => {
12851
- const { thoughtSpotHost, authType } = config;
12852
12924
  try {
12853
- sanity(config);
12925
+ sanity(getEmbedConfig());
12854
12926
  }
12855
12927
  catch (err) {
12856
12928
  return Promise.reject(err);
12857
12929
  }
12858
- let authToken = '';
12859
- if (authType === AuthType.TrustedAuthTokenCookieless) {
12860
- authToken = await getAuthenticationToken(config);
12861
- }
12930
+ const { thoughtSpotHost, authType } = getEmbedConfig();
12862
12931
  const headers = {
12863
12932
  'Content-Type': 'application/json',
12864
12933
  'x-requested-by': 'ThoughtSpot',
12865
12934
  };
12866
- if (authToken) {
12867
- headers.Authorization = `Bearer ${authToken}`;
12868
- }
12869
12935
  const payload = {
12870
12936
  metadata_tmls: data.metadata_tmls,
12871
12937
  import_policy: data.import_policy || 'PARTIAL',
12872
12938
  create_new: data.create_new || false,
12873
12939
  };
12874
- return fetch(`${thoughtSpotHost}${EndPoints.EXECUTE_TML}`, {
12940
+ return tokenizedFetch(`${thoughtSpotHost}${EndPoints.EXECUTE_TML}`, {
12875
12941
  method: 'POST',
12876
12942
  headers,
12877
12943
  body: JSON.stringify(payload),
@@ -12914,14 +12980,13 @@ const executeTML = async (data) => {
12914
12980
  console.error(error);
12915
12981
  });
12916
12982
  * ```
12917
- *
12918
12983
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
12919
12984
  * @group Global methods
12920
12985
  */
12921
12986
  const exportTML = async (data) => {
12922
- const { thoughtSpotHost, authType } = config;
12987
+ const { thoughtSpotHost, authType } = getEmbedConfig();
12923
12988
  try {
12924
- sanity(config);
12989
+ sanity(getEmbedConfig());
12925
12990
  }
12926
12991
  catch (err) {
12927
12992
  return Promise.reject(err);
@@ -12932,18 +12997,11 @@ const exportTML = async (data) => {
12932
12997
  export_fqn: data.export_fqn || false,
12933
12998
  edoc_format: data.edoc_format || 'YAML',
12934
12999
  };
12935
- let authToken = '';
12936
- if (authType === AuthType.TrustedAuthTokenCookieless) {
12937
- authToken = await getAuthenticationToken(config);
12938
- }
12939
13000
  const headers = {
12940
13001
  'Content-Type': 'application/json',
12941
13002
  'x-requested-by': 'ThoughtSpot',
12942
13003
  };
12943
- if (authToken) {
12944
- headers.Authorization = `Bearer ${authToken}`;
12945
- }
12946
- return fetch(`${thoughtSpotHost}${EndPoints.EXPORT_TML}`, {
13004
+ return tokenizedFetch(`${thoughtSpotHost}${EndPoints.EXPORT_TML}`, {
12947
13005
  method: 'POST',
12948
13006
  headers,
12949
13007
  body: JSON.stringify(payload),
@@ -12996,9 +13054,9 @@ function processAuthInit(e) {
12996
13054
  * @param containerEl
12997
13055
  */
12998
13056
  function processNoCookieAccess(e, containerEl) {
12999
- const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, } = getEmbedConfig();
13057
+ const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, suppressErrorAlerts, } = getEmbedConfig();
13000
13058
  if (!ignoreNoCookieAccess) {
13001
- if (!suppressNoCookieAccessAlert) {
13059
+ if (!suppressNoCookieAccessAlert && !suppressErrorAlerts) {
13002
13060
  // eslint-disable-next-line no-alert
13003
13061
  alert('Third party cookie access is blocked on this browser, please allow third party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.');
13004
13062
  }
@@ -13116,7 +13174,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
13116
13174
  });
13117
13175
  }
13118
13176
 
13119
- var name="@thoughtspot/visual-embed-sdk";var version="1.26.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-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","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","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"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.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":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.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:"2.30.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","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"43 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};
13177
+ var name="@thoughtspot/visual-embed-sdk";var version="1.26.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-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","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","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"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.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":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.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:"2.30.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","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"44 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};
13120
13178
 
13121
13179
  /**
13122
13180
  * Copyright (c) 2022
@@ -14665,7 +14723,8 @@ class SearchEmbed extends TsEmbed {
14665
14723
  const src = this.getIFrameSrc(answerId);
14666
14724
  this.renderIFrame(src);
14667
14725
  getAuthPromise().then(() => {
14668
- if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
14726
+ if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning
14727
+ || getEmbedConfig().suppressErrorAlerts)) {
14669
14728
  alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
14670
14729
  }
14671
14730
  });