@thoughtspot/visual-embed-sdk 1.10.0 → 1.10.1
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/dist/src/auth.d.ts +18 -5
- package/dist/src/embed/base.d.ts +21 -5
- package/dist/src/embed/pinboard.d.ts +91 -0
- package/dist/src/index.d.ts +3 -2
- package/dist/src/types.d.ts +15 -0
- package/dist/src/utils/authService.d.ts +1 -0
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/utils/processData.d.ts +1 -1
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +521 -32
- package/dist/tsembed.js +519 -31
- package/lib/package.json +2 -1
- package/lib/src/auth.d.ts +18 -5
- package/lib/src/auth.js +48 -9
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +69 -11
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +21 -5
- package/lib/src/embed/base.js +64 -10
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +49 -3
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embed.spec.js +1 -1
- package/lib/src/embed/embed.spec.js.map +1 -1
- package/lib/src/embed/pinboard.d.ts +91 -0
- package/lib/src/embed/pinboard.js +110 -0
- package/lib/src/embed/pinboard.js.map +1 -0
- package/lib/src/embed/ts-embed.js +9 -10
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +16 -6
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +3 -2
- package/lib/src/index.js +3 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/test/test-utils.js +1 -1
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/types.d.ts +15 -0
- package/lib/src/types.js +10 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService.d.ts +1 -0
- package/lib/src/utils/authService.js +21 -3
- package/lib/src/utils/authService.js.map +1 -1
- package/lib/src/utils/authService.spec.js +21 -5
- package/lib/src/utils/authService.spec.js.map +1 -1
- package/lib/src/utils/plugin.d.ts +0 -0
- package/lib/src/utils/plugin.js +1 -0
- package/lib/src/utils/plugin.js.map +1 -0
- package/lib/src/utils/processData.d.ts +1 -1
- package/lib/src/utils/processData.js +37 -3
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +106 -4
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +100 -7
- package/package.json +2 -1
- package/src/auth.spec.ts +90 -11
- package/src/auth.ts +63 -13
- package/src/embed/base.spec.ts +56 -4
- package/src/embed/base.ts +83 -16
- package/src/embed/embed.spec.ts +1 -1
- package/src/embed/ts-embed.spec.ts +19 -9
- package/src/embed/ts-embed.ts +15 -12
- package/src/index.ts +5 -1
- package/src/test/test-utils.ts +1 -1
- package/src/types.ts +16 -0
- package/src/utils/authService.spec.ts +31 -5
- package/src/utils/authService.ts +27 -3
- package/src/utils/processData.spec.ts +139 -4
- package/src/utils/processData.ts +54 -4
package/dist/tsembed.js
CHANGED
|
@@ -296,6 +296,16 @@
|
|
|
296
296
|
* The ThoughtSpot auth session has expired.
|
|
297
297
|
*/
|
|
298
298
|
EmbedEvent["AuthExpire"] = "ThoughtspotAuthExpired";
|
|
299
|
+
/**
|
|
300
|
+
* ThoughtSpot failed to validate the auth session.
|
|
301
|
+
* @hidden
|
|
302
|
+
*/
|
|
303
|
+
EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
|
|
304
|
+
/**
|
|
305
|
+
* ThoughtSpot failed to validate the auth session.
|
|
306
|
+
* @hidden
|
|
307
|
+
*/
|
|
308
|
+
EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
|
|
299
309
|
/**
|
|
300
310
|
* The height of the embedded Liveboard or visualization has been computed.
|
|
301
311
|
* @return data - The height of the embedded Liveboard or visualization
|
|
@@ -8655,9 +8665,361 @@
|
|
|
8655
8665
|
}
|
|
8656
8666
|
}
|
|
8657
8667
|
|
|
8668
|
+
function createCommonjsModule(fn) {
|
|
8669
|
+
var module = { exports: {} };
|
|
8670
|
+
return fn(module, module.exports), module.exports;
|
|
8671
|
+
}
|
|
8672
|
+
|
|
8673
|
+
var eventemitter3 = createCommonjsModule(function (module) {
|
|
8674
|
+
|
|
8675
|
+
var has = Object.prototype.hasOwnProperty
|
|
8676
|
+
, prefix = '~';
|
|
8677
|
+
|
|
8678
|
+
/**
|
|
8679
|
+
* Constructor to create a storage for our `EE` objects.
|
|
8680
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
8681
|
+
*
|
|
8682
|
+
* @constructor
|
|
8683
|
+
* @private
|
|
8684
|
+
*/
|
|
8685
|
+
function Events() {}
|
|
8686
|
+
|
|
8687
|
+
//
|
|
8688
|
+
// We try to not inherit from `Object.prototype`. In some engines creating an
|
|
8689
|
+
// instance in this way is faster than calling `Object.create(null)` directly.
|
|
8690
|
+
// If `Object.create(null)` is not supported we prefix the event names with a
|
|
8691
|
+
// character to make sure that the built-in object properties are not
|
|
8692
|
+
// overridden or used as an attack vector.
|
|
8693
|
+
//
|
|
8694
|
+
if (Object.create) {
|
|
8695
|
+
Events.prototype = Object.create(null);
|
|
8696
|
+
|
|
8697
|
+
//
|
|
8698
|
+
// This hack is needed because the `__proto__` property is still inherited in
|
|
8699
|
+
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
|
|
8700
|
+
//
|
|
8701
|
+
if (!new Events().__proto__) prefix = false;
|
|
8702
|
+
}
|
|
8703
|
+
|
|
8704
|
+
/**
|
|
8705
|
+
* Representation of a single event listener.
|
|
8706
|
+
*
|
|
8707
|
+
* @param {Function} fn The listener function.
|
|
8708
|
+
* @param {*} context The context to invoke the listener with.
|
|
8709
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
8710
|
+
* @constructor
|
|
8711
|
+
* @private
|
|
8712
|
+
*/
|
|
8713
|
+
function EE(fn, context, once) {
|
|
8714
|
+
this.fn = fn;
|
|
8715
|
+
this.context = context;
|
|
8716
|
+
this.once = once || false;
|
|
8717
|
+
}
|
|
8718
|
+
|
|
8719
|
+
/**
|
|
8720
|
+
* Add a listener for a given event.
|
|
8721
|
+
*
|
|
8722
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
8723
|
+
* @param {(String|Symbol)} event The event name.
|
|
8724
|
+
* @param {Function} fn The listener function.
|
|
8725
|
+
* @param {*} context The context to invoke the listener with.
|
|
8726
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
8727
|
+
* @returns {EventEmitter}
|
|
8728
|
+
* @private
|
|
8729
|
+
*/
|
|
8730
|
+
function addListener(emitter, event, fn, context, once) {
|
|
8731
|
+
if (typeof fn !== 'function') {
|
|
8732
|
+
throw new TypeError('The listener must be a function');
|
|
8733
|
+
}
|
|
8734
|
+
|
|
8735
|
+
var listener = new EE(fn, context || emitter, once)
|
|
8736
|
+
, evt = prefix ? prefix + event : event;
|
|
8737
|
+
|
|
8738
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
8739
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
8740
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
8741
|
+
|
|
8742
|
+
return emitter;
|
|
8743
|
+
}
|
|
8744
|
+
|
|
8745
|
+
/**
|
|
8746
|
+
* Clear event by name.
|
|
8747
|
+
*
|
|
8748
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
8749
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
8750
|
+
* @private
|
|
8751
|
+
*/
|
|
8752
|
+
function clearEvent(emitter, evt) {
|
|
8753
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
8754
|
+
else delete emitter._events[evt];
|
|
8755
|
+
}
|
|
8756
|
+
|
|
8757
|
+
/**
|
|
8758
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
8759
|
+
* `EventEmitter` interface.
|
|
8760
|
+
*
|
|
8761
|
+
* @constructor
|
|
8762
|
+
* @public
|
|
8763
|
+
*/
|
|
8764
|
+
function EventEmitter() {
|
|
8765
|
+
this._events = new Events();
|
|
8766
|
+
this._eventsCount = 0;
|
|
8767
|
+
}
|
|
8768
|
+
|
|
8769
|
+
/**
|
|
8770
|
+
* Return an array listing the events for which the emitter has registered
|
|
8771
|
+
* listeners.
|
|
8772
|
+
*
|
|
8773
|
+
* @returns {Array}
|
|
8774
|
+
* @public
|
|
8775
|
+
*/
|
|
8776
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
8777
|
+
var names = []
|
|
8778
|
+
, events
|
|
8779
|
+
, name;
|
|
8780
|
+
|
|
8781
|
+
if (this._eventsCount === 0) return names;
|
|
8782
|
+
|
|
8783
|
+
for (name in (events = this._events)) {
|
|
8784
|
+
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
8785
|
+
}
|
|
8786
|
+
|
|
8787
|
+
if (Object.getOwnPropertySymbols) {
|
|
8788
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
8789
|
+
}
|
|
8790
|
+
|
|
8791
|
+
return names;
|
|
8792
|
+
};
|
|
8793
|
+
|
|
8794
|
+
/**
|
|
8795
|
+
* Return the listeners registered for a given event.
|
|
8796
|
+
*
|
|
8797
|
+
* @param {(String|Symbol)} event The event name.
|
|
8798
|
+
* @returns {Array} The registered listeners.
|
|
8799
|
+
* @public
|
|
8800
|
+
*/
|
|
8801
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
8802
|
+
var evt = prefix ? prefix + event : event
|
|
8803
|
+
, handlers = this._events[evt];
|
|
8804
|
+
|
|
8805
|
+
if (!handlers) return [];
|
|
8806
|
+
if (handlers.fn) return [handlers.fn];
|
|
8807
|
+
|
|
8808
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
8809
|
+
ee[i] = handlers[i].fn;
|
|
8810
|
+
}
|
|
8811
|
+
|
|
8812
|
+
return ee;
|
|
8813
|
+
};
|
|
8814
|
+
|
|
8815
|
+
/**
|
|
8816
|
+
* Return the number of listeners listening to a given event.
|
|
8817
|
+
*
|
|
8818
|
+
* @param {(String|Symbol)} event The event name.
|
|
8819
|
+
* @returns {Number} The number of listeners.
|
|
8820
|
+
* @public
|
|
8821
|
+
*/
|
|
8822
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
8823
|
+
var evt = prefix ? prefix + event : event
|
|
8824
|
+
, listeners = this._events[evt];
|
|
8825
|
+
|
|
8826
|
+
if (!listeners) return 0;
|
|
8827
|
+
if (listeners.fn) return 1;
|
|
8828
|
+
return listeners.length;
|
|
8829
|
+
};
|
|
8830
|
+
|
|
8831
|
+
/**
|
|
8832
|
+
* Calls each of the listeners registered for a given event.
|
|
8833
|
+
*
|
|
8834
|
+
* @param {(String|Symbol)} event The event name.
|
|
8835
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
8836
|
+
* @public
|
|
8837
|
+
*/
|
|
8838
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
8839
|
+
var evt = prefix ? prefix + event : event;
|
|
8840
|
+
|
|
8841
|
+
if (!this._events[evt]) return false;
|
|
8842
|
+
|
|
8843
|
+
var listeners = this._events[evt]
|
|
8844
|
+
, len = arguments.length
|
|
8845
|
+
, args
|
|
8846
|
+
, i;
|
|
8847
|
+
|
|
8848
|
+
if (listeners.fn) {
|
|
8849
|
+
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
|
8850
|
+
|
|
8851
|
+
switch (len) {
|
|
8852
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
8853
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
8854
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
8855
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
8856
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
8857
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
8858
|
+
}
|
|
8859
|
+
|
|
8860
|
+
for (i = 1, args = new Array(len -1); i < len; i++) {
|
|
8861
|
+
args[i - 1] = arguments[i];
|
|
8862
|
+
}
|
|
8863
|
+
|
|
8864
|
+
listeners.fn.apply(listeners.context, args);
|
|
8865
|
+
} else {
|
|
8866
|
+
var length = listeners.length
|
|
8867
|
+
, j;
|
|
8868
|
+
|
|
8869
|
+
for (i = 0; i < length; i++) {
|
|
8870
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
|
8871
|
+
|
|
8872
|
+
switch (len) {
|
|
8873
|
+
case 1: listeners[i].fn.call(listeners[i].context); break;
|
|
8874
|
+
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
|
|
8875
|
+
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
|
|
8876
|
+
case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
|
|
8877
|
+
default:
|
|
8878
|
+
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
|
|
8879
|
+
args[j - 1] = arguments[j];
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8882
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
8883
|
+
}
|
|
8884
|
+
}
|
|
8885
|
+
}
|
|
8886
|
+
|
|
8887
|
+
return true;
|
|
8888
|
+
};
|
|
8889
|
+
|
|
8890
|
+
/**
|
|
8891
|
+
* Add a listener for a given event.
|
|
8892
|
+
*
|
|
8893
|
+
* @param {(String|Symbol)} event The event name.
|
|
8894
|
+
* @param {Function} fn The listener function.
|
|
8895
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
8896
|
+
* @returns {EventEmitter} `this`.
|
|
8897
|
+
* @public
|
|
8898
|
+
*/
|
|
8899
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
8900
|
+
return addListener(this, event, fn, context, false);
|
|
8901
|
+
};
|
|
8902
|
+
|
|
8903
|
+
/**
|
|
8904
|
+
* Add a one-time listener for a given event.
|
|
8905
|
+
*
|
|
8906
|
+
* @param {(String|Symbol)} event The event name.
|
|
8907
|
+
* @param {Function} fn The listener function.
|
|
8908
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
8909
|
+
* @returns {EventEmitter} `this`.
|
|
8910
|
+
* @public
|
|
8911
|
+
*/
|
|
8912
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
8913
|
+
return addListener(this, event, fn, context, true);
|
|
8914
|
+
};
|
|
8915
|
+
|
|
8916
|
+
/**
|
|
8917
|
+
* Remove the listeners of a given event.
|
|
8918
|
+
*
|
|
8919
|
+
* @param {(String|Symbol)} event The event name.
|
|
8920
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
8921
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
8922
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
8923
|
+
* @returns {EventEmitter} `this`.
|
|
8924
|
+
* @public
|
|
8925
|
+
*/
|
|
8926
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
8927
|
+
var evt = prefix ? prefix + event : event;
|
|
8928
|
+
|
|
8929
|
+
if (!this._events[evt]) return this;
|
|
8930
|
+
if (!fn) {
|
|
8931
|
+
clearEvent(this, evt);
|
|
8932
|
+
return this;
|
|
8933
|
+
}
|
|
8934
|
+
|
|
8935
|
+
var listeners = this._events[evt];
|
|
8936
|
+
|
|
8937
|
+
if (listeners.fn) {
|
|
8938
|
+
if (
|
|
8939
|
+
listeners.fn === fn &&
|
|
8940
|
+
(!once || listeners.once) &&
|
|
8941
|
+
(!context || listeners.context === context)
|
|
8942
|
+
) {
|
|
8943
|
+
clearEvent(this, evt);
|
|
8944
|
+
}
|
|
8945
|
+
} else {
|
|
8946
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
8947
|
+
if (
|
|
8948
|
+
listeners[i].fn !== fn ||
|
|
8949
|
+
(once && !listeners[i].once) ||
|
|
8950
|
+
(context && listeners[i].context !== context)
|
|
8951
|
+
) {
|
|
8952
|
+
events.push(listeners[i]);
|
|
8953
|
+
}
|
|
8954
|
+
}
|
|
8955
|
+
|
|
8956
|
+
//
|
|
8957
|
+
// Reset the array, or remove it completely if we have no more listeners.
|
|
8958
|
+
//
|
|
8959
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
8960
|
+
else clearEvent(this, evt);
|
|
8961
|
+
}
|
|
8962
|
+
|
|
8963
|
+
return this;
|
|
8964
|
+
};
|
|
8965
|
+
|
|
8966
|
+
/**
|
|
8967
|
+
* Remove all listeners, or those of the specified event.
|
|
8968
|
+
*
|
|
8969
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
8970
|
+
* @returns {EventEmitter} `this`.
|
|
8971
|
+
* @public
|
|
8972
|
+
*/
|
|
8973
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
8974
|
+
var evt;
|
|
8975
|
+
|
|
8976
|
+
if (event) {
|
|
8977
|
+
evt = prefix ? prefix + event : event;
|
|
8978
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
8979
|
+
} else {
|
|
8980
|
+
this._events = new Events();
|
|
8981
|
+
this._eventsCount = 0;
|
|
8982
|
+
}
|
|
8983
|
+
|
|
8984
|
+
return this;
|
|
8985
|
+
};
|
|
8986
|
+
|
|
8987
|
+
//
|
|
8988
|
+
// Alias methods names because people roll like that.
|
|
8989
|
+
//
|
|
8990
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
8991
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
8992
|
+
|
|
8993
|
+
//
|
|
8994
|
+
// Expose the prefix.
|
|
8995
|
+
//
|
|
8996
|
+
EventEmitter.prefixed = prefix;
|
|
8997
|
+
|
|
8998
|
+
//
|
|
8999
|
+
// Allow `EventEmitter` to be imported as module namespace.
|
|
9000
|
+
//
|
|
9001
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
9002
|
+
|
|
9003
|
+
//
|
|
9004
|
+
// Expose the module.
|
|
9005
|
+
//
|
|
9006
|
+
{
|
|
9007
|
+
module.exports = EventEmitter;
|
|
9008
|
+
}
|
|
9009
|
+
});
|
|
9010
|
+
|
|
8658
9011
|
// eslint-disable-next-line import/no-cycle
|
|
9012
|
+
function failureLoggedFetch(url, options = {}) {
|
|
9013
|
+
return fetch(url, options).then(async (r) => {
|
|
9014
|
+
var _a;
|
|
9015
|
+
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
9016
|
+
console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
9017
|
+
}
|
|
9018
|
+
return r;
|
|
9019
|
+
});
|
|
9020
|
+
}
|
|
8659
9021
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
8660
|
-
return
|
|
9022
|
+
return failureLoggedFetch(authVerificationUrl, {
|
|
8661
9023
|
credentials: 'include',
|
|
8662
9024
|
});
|
|
8663
9025
|
}
|
|
@@ -8665,12 +9027,14 @@
|
|
|
8665
9027
|
return fetch(authEndpoint);
|
|
8666
9028
|
}
|
|
8667
9029
|
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
8668
|
-
return
|
|
9030
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
8669
9031
|
credentials: 'include',
|
|
9032
|
+
// We do not want to follow the redirect, as it starts giving a CORS error
|
|
9033
|
+
redirect: 'manual',
|
|
8670
9034
|
});
|
|
8671
9035
|
}
|
|
8672
9036
|
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
8673
|
-
return
|
|
9037
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
8674
9038
|
method: 'POST',
|
|
8675
9039
|
headers: {
|
|
8676
9040
|
'content-type': 'application/x-www-form-urlencoded',
|
|
@@ -8679,6 +9043,13 @@
|
|
|
8679
9043
|
body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`,
|
|
8680
9044
|
credentials: 'include',
|
|
8681
9045
|
});
|
|
9046
|
+
}
|
|
9047
|
+
async function fetchLogoutService(thoughtSpotHost) {
|
|
9048
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
9049
|
+
credentials: 'include',
|
|
9050
|
+
mode: 'no-cors',
|
|
9051
|
+
method: 'POST',
|
|
9052
|
+
});
|
|
8682
9053
|
}
|
|
8683
9054
|
|
|
8684
9055
|
// eslint-disable-next-line import/no-mutable-exports
|
|
@@ -8696,7 +9067,19 @@
|
|
|
8696
9067
|
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
8697
9068
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
8698
9069
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
9070
|
+
LOGOUT: '/callosum/v1/session/logout',
|
|
8699
9071
|
};
|
|
9072
|
+
(function (AuthFailureType) {
|
|
9073
|
+
AuthFailureType["SDK"] = "SDK";
|
|
9074
|
+
AuthFailureType["NO_COOKIE_ACCESS"] = "NO_COOKIE_ACCESS";
|
|
9075
|
+
AuthFailureType["EXPIRY"] = "EXPIRY";
|
|
9076
|
+
AuthFailureType["OTHER"] = "OTHER";
|
|
9077
|
+
})(exports.AuthFailureType || (exports.AuthFailureType = {}));
|
|
9078
|
+
(function (AuthStatus) {
|
|
9079
|
+
AuthStatus["FAILURE"] = "FAILURE";
|
|
9080
|
+
AuthStatus["SUCCESS"] = "SUCCESS";
|
|
9081
|
+
AuthStatus["LOGOUT"] = "LOGOUT";
|
|
9082
|
+
})(exports.AuthStatus || (exports.AuthStatus = {}));
|
|
8700
9083
|
/**
|
|
8701
9084
|
* Check if we are logged into the ThoughtSpot cluster
|
|
8702
9085
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
@@ -8716,6 +9099,17 @@
|
|
|
8716
9099
|
sessionInfo = sessionDetails;
|
|
8717
9100
|
initMixpanel(sessionInfo);
|
|
8718
9101
|
}
|
|
9102
|
+
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.' +
|
|
9103
|
+
'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
9104
|
+
let prevAuthToken = null;
|
|
9105
|
+
function alertForDuplicateToken(authtoken) {
|
|
9106
|
+
if (prevAuthToken === authtoken) {
|
|
9107
|
+
// eslint-disable-next-line no-alert
|
|
9108
|
+
alert(DUPLICATE_TOKEN_ERR);
|
|
9109
|
+
throw new Error(DUPLICATE_TOKEN_ERR);
|
|
9110
|
+
}
|
|
9111
|
+
prevAuthToken = authtoken;
|
|
9112
|
+
}
|
|
8719
9113
|
/**
|
|
8720
9114
|
* Check if we are stuck at the SSO redirect URL
|
|
8721
9115
|
*/
|
|
@@ -8741,20 +9135,22 @@
|
|
|
8741
9135
|
if (!authEndpoint && !getAuthToken) {
|
|
8742
9136
|
throw new Error('Either auth endpoint or getAuthToken function must be provided');
|
|
8743
9137
|
}
|
|
8744
|
-
|
|
8745
|
-
if (!
|
|
9138
|
+
loggedInStatus = await isLoggedIn(thoughtSpotHost);
|
|
9139
|
+
if (!loggedInStatus) {
|
|
8746
9140
|
let authToken = null;
|
|
8747
9141
|
if (getAuthToken) {
|
|
8748
9142
|
authToken = await getAuthToken();
|
|
9143
|
+
alertForDuplicateToken(authToken);
|
|
8749
9144
|
}
|
|
8750
9145
|
else {
|
|
8751
9146
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
8752
9147
|
authToken = await response.text();
|
|
8753
9148
|
}
|
|
8754
|
-
await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
8755
|
-
|
|
9149
|
+
const resp = await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
9150
|
+
// token login issues a 302 when successful
|
|
9151
|
+
loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
|
|
8756
9152
|
}
|
|
8757
|
-
loggedInStatus
|
|
9153
|
+
return loggedInStatus;
|
|
8758
9154
|
};
|
|
8759
9155
|
/**
|
|
8760
9156
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -8769,9 +9165,12 @@
|
|
|
8769
9165
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
8770
9166
|
if (!loggedIn) {
|
|
8771
9167
|
const response = await fetchBasicAuthService(thoughtSpotHost, username, password);
|
|
8772
|
-
loggedInStatus = response.
|
|
9168
|
+
loggedInStatus = response.ok;
|
|
8773
9169
|
}
|
|
8774
|
-
|
|
9170
|
+
else {
|
|
9171
|
+
loggedInStatus = true;
|
|
9172
|
+
}
|
|
9173
|
+
return loggedInStatus;
|
|
8775
9174
|
};
|
|
8776
9175
|
async function samlPopupFlow(ssoURL) {
|
|
8777
9176
|
document.body.insertAdjacentHTML('beforeend', '<div id="ts-saml-auth"></div>');
|
|
@@ -8821,6 +9220,7 @@
|
|
|
8821
9220
|
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8822
9221
|
if (embedConfig.noRedirect) {
|
|
8823
9222
|
await samlPopupFlow(ssoURL);
|
|
9223
|
+
loggedInStatus = true;
|
|
8824
9224
|
return;
|
|
8825
9225
|
}
|
|
8826
9226
|
window.location.href = ssoURL;
|
|
@@ -8835,6 +9235,7 @@
|
|
|
8835
9235
|
// bring back the page to the same URL
|
|
8836
9236
|
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8837
9237
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
9238
|
+
return loggedInStatus;
|
|
8838
9239
|
};
|
|
8839
9240
|
const doOIDCAuth = async (embedConfig) => {
|
|
8840
9241
|
const { thoughtSpotHost } = embedConfig;
|
|
@@ -8846,6 +9247,13 @@
|
|
|
8846
9247
|
// bring back the page to the same URL
|
|
8847
9248
|
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8848
9249
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
9250
|
+
return loggedInStatus;
|
|
9251
|
+
};
|
|
9252
|
+
const logout = async (embedConfig) => {
|
|
9253
|
+
const { thoughtSpotHost } = embedConfig;
|
|
9254
|
+
const response = await fetchLogoutService(thoughtSpotHost);
|
|
9255
|
+
loggedInStatus = false;
|
|
9256
|
+
return loggedInStatus;
|
|
8849
9257
|
};
|
|
8850
9258
|
/**
|
|
8851
9259
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -8863,26 +9271,55 @@
|
|
|
8863
9271
|
case exports.AuthType.Basic:
|
|
8864
9272
|
return doBasicAuth(embedConfig);
|
|
8865
9273
|
default:
|
|
8866
|
-
return Promise.resolve();
|
|
9274
|
+
return Promise.resolve(true);
|
|
8867
9275
|
}
|
|
8868
9276
|
};
|
|
8869
9277
|
|
|
8870
9278
|
/* eslint-disable import/no-mutable-exports */
|
|
8871
9279
|
let config = {};
|
|
9280
|
+
const CONFIG_DEFAULTS = {
|
|
9281
|
+
loginFailedMessage: 'Not logged in',
|
|
9282
|
+
authType: exports.AuthType.None,
|
|
9283
|
+
};
|
|
8872
9284
|
let authPromise;
|
|
9285
|
+
const getEmbedConfig = () => config;
|
|
9286
|
+
const getAuthPromise = () => authPromise;
|
|
9287
|
+
let authEE;
|
|
9288
|
+
function notifyAuthSuccess() {
|
|
9289
|
+
if (!authEE) {
|
|
9290
|
+
console.error('SDK not initialized');
|
|
9291
|
+
return;
|
|
9292
|
+
}
|
|
9293
|
+
authEE.emit(exports.AuthStatus.SUCCESS);
|
|
9294
|
+
}
|
|
9295
|
+
function notifyAuthFailure(failureType) {
|
|
9296
|
+
if (!authEE) {
|
|
9297
|
+
console.error('SDK not initialized');
|
|
9298
|
+
return;
|
|
9299
|
+
}
|
|
9300
|
+
authEE.emit(exports.AuthStatus.FAILURE, failureType);
|
|
9301
|
+
}
|
|
9302
|
+
function notifyLogout() {
|
|
9303
|
+
if (!authEE) {
|
|
9304
|
+
console.error('SDK not initialized');
|
|
9305
|
+
return;
|
|
9306
|
+
}
|
|
9307
|
+
authEE.emit(exports.AuthStatus.LOGOUT);
|
|
9308
|
+
}
|
|
8873
9309
|
/**
|
|
8874
9310
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
8875
9311
|
*/
|
|
8876
9312
|
const handleAuth = () => {
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
9313
|
+
authPromise = authenticate(config);
|
|
9314
|
+
authPromise.then((isLoggedIn) => {
|
|
9315
|
+
if (!isLoggedIn) {
|
|
9316
|
+
notifyAuthFailure(exports.AuthFailureType.SDK);
|
|
9317
|
+
}
|
|
9318
|
+
}, () => {
|
|
9319
|
+
notifyAuthFailure(exports.AuthFailureType.SDK);
|
|
9320
|
+
});
|
|
8882
9321
|
return authPromise;
|
|
8883
9322
|
};
|
|
8884
|
-
const getEmbedConfig = () => config;
|
|
8885
|
-
const getAuthPromise = () => authPromise;
|
|
8886
9323
|
/**
|
|
8887
9324
|
* Prefetches static resources from the specified URL. Web browsers can then cache the prefetched resources and serve them from the user's local disk to provide faster access to your app.
|
|
8888
9325
|
* @param url The URL provided for prefetch
|
|
@@ -8911,7 +9348,12 @@
|
|
|
8911
9348
|
* @returns authPromise Promise which resolves when authentication is complete.
|
|
8912
9349
|
*/
|
|
8913
9350
|
const init = (embedConfig) => {
|
|
8914
|
-
config =
|
|
9351
|
+
config = {
|
|
9352
|
+
...CONFIG_DEFAULTS,
|
|
9353
|
+
...embedConfig,
|
|
9354
|
+
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
9355
|
+
};
|
|
9356
|
+
authEE = new eventemitter3();
|
|
8915
9357
|
handleAuth();
|
|
8916
9358
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
8917
9359
|
authType: config.authType,
|
|
@@ -8920,7 +9362,19 @@
|
|
|
8920
9362
|
if (config.callPrefetch) {
|
|
8921
9363
|
prefetch(config.thoughtSpotHost);
|
|
8922
9364
|
}
|
|
8923
|
-
return
|
|
9365
|
+
return authEE;
|
|
9366
|
+
};
|
|
9367
|
+
function disableAutoLogin() {
|
|
9368
|
+
config.autoLogin = false;
|
|
9369
|
+
}
|
|
9370
|
+
const logout$1 = (doNotDisableAutoLogin = false) => {
|
|
9371
|
+
if (!doNotDisableAutoLogin) {
|
|
9372
|
+
disableAutoLogin();
|
|
9373
|
+
}
|
|
9374
|
+
return logout(config).then((isLoggedIn) => {
|
|
9375
|
+
notifyLogout();
|
|
9376
|
+
return isLoggedIn;
|
|
9377
|
+
});
|
|
8924
9378
|
};
|
|
8925
9379
|
let renderQueue = Promise.resolve();
|
|
8926
9380
|
/**
|
|
@@ -9006,6 +9460,7 @@
|
|
|
9006
9460
|
var _a, _b;
|
|
9007
9461
|
// Store user session details sent by app.
|
|
9008
9462
|
initSession(e.data);
|
|
9463
|
+
notifyAuthSuccess();
|
|
9009
9464
|
// Expose only allowed details (eg: userGUID) back to SDK users.
|
|
9010
9465
|
return {
|
|
9011
9466
|
...e,
|
|
@@ -9019,9 +9474,36 @@
|
|
|
9019
9474
|
if (autoLogin) {
|
|
9020
9475
|
handleAuth();
|
|
9021
9476
|
}
|
|
9477
|
+
notifyAuthFailure(exports.AuthFailureType.EXPIRY);
|
|
9478
|
+
return e;
|
|
9479
|
+
}
|
|
9480
|
+
function processNoCookieAccess(e, containerEl) {
|
|
9481
|
+
const { loginFailedMessage, suppressNoCookieAccessAlert, } = getEmbedConfig();
|
|
9482
|
+
if (!suppressNoCookieAccessAlert) {
|
|
9483
|
+
// eslint-disable-next-line no-alert
|
|
9484
|
+
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.');
|
|
9485
|
+
}
|
|
9486
|
+
// eslint-disable-next-line no-param-reassign
|
|
9487
|
+
containerEl.innerHTML = loginFailedMessage;
|
|
9488
|
+
notifyAuthFailure(exports.AuthFailureType.NO_COOKIE_ACCESS);
|
|
9489
|
+
return e;
|
|
9490
|
+
}
|
|
9491
|
+
function processAuthFailure(e, containerEl) {
|
|
9492
|
+
const { loginFailedMessage } = getEmbedConfig();
|
|
9493
|
+
// eslint-disable-next-line no-param-reassign
|
|
9494
|
+
containerEl.innerHTML = loginFailedMessage;
|
|
9495
|
+
notifyAuthFailure(exports.AuthFailureType.OTHER);
|
|
9022
9496
|
return e;
|
|
9023
9497
|
}
|
|
9024
|
-
function
|
|
9498
|
+
function processAuthLogout(e, containerEl) {
|
|
9499
|
+
const { loginFailedMessage } = getEmbedConfig();
|
|
9500
|
+
// eslint-disable-next-line no-param-reassign
|
|
9501
|
+
containerEl.innerHTML = loginFailedMessage;
|
|
9502
|
+
disableAutoLogin();
|
|
9503
|
+
notifyLogout();
|
|
9504
|
+
return e;
|
|
9505
|
+
}
|
|
9506
|
+
function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
9025
9507
|
switch (type) {
|
|
9026
9508
|
case exports.EmbedEvent.CustomAction:
|
|
9027
9509
|
return processCustomAction(e, thoughtSpotHost);
|
|
@@ -9029,6 +9511,12 @@
|
|
|
9029
9511
|
return processAuthInit(e);
|
|
9030
9512
|
case exports.EmbedEvent.AuthExpire:
|
|
9031
9513
|
return processAuthExpire(e);
|
|
9514
|
+
case exports.EmbedEvent.NoCookieAccess:
|
|
9515
|
+
return processNoCookieAccess(e, containerEl);
|
|
9516
|
+
case exports.EmbedEvent.AuthFailure:
|
|
9517
|
+
return processAuthFailure(e, containerEl);
|
|
9518
|
+
case exports.EmbedEvent.AuthLogout:
|
|
9519
|
+
return processAuthLogout(e, containerEl);
|
|
9032
9520
|
}
|
|
9033
9521
|
return e;
|
|
9034
9522
|
}
|
|
@@ -9057,7 +9545,7 @@
|
|
|
9057
9545
|
}
|
|
9058
9546
|
}
|
|
9059
9547
|
|
|
9060
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.10.
|
|
9548
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.10.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/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",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":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",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","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","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",eventemitter3:"^4.0.7","mixpanel-browser":"^2.41.0"};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","@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","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.1.0","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":"4.1.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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","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$1,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};
|
|
9061
9549
|
|
|
9062
9550
|
/**
|
|
9063
9551
|
* Copyright (c) 2022
|
|
@@ -9104,12 +9592,6 @@
|
|
|
9104
9592
|
this.isError = false;
|
|
9105
9593
|
this.viewConfig = viewConfig;
|
|
9106
9594
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
9107
|
-
if (!this.embedConfig.suppressNoCookieAccessAlert) {
|
|
9108
|
-
this.on(exports.EmbedEvent.NoCookieAccess, () => {
|
|
9109
|
-
// eslint-disable-next-line no-alert
|
|
9110
|
-
alert('Third party cookie access is blocked on this browser, please allow third party cookies for ThoughtSpot to work properly');
|
|
9111
|
-
});
|
|
9112
|
-
}
|
|
9113
9595
|
}
|
|
9114
9596
|
/**
|
|
9115
9597
|
* Gets a reference to the root DOM node where
|
|
@@ -9186,7 +9668,7 @@
|
|
|
9186
9668
|
const eventPort = this.getEventPort(event);
|
|
9187
9669
|
const eventData = this.formatEventData(event, eventType);
|
|
9188
9670
|
if (event.source === this.iFrame.contentWindow) {
|
|
9189
|
-
this.executeCallbacks(eventType,
|
|
9671
|
+
this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.el), eventPort);
|
|
9190
9672
|
}
|
|
9191
9673
|
});
|
|
9192
9674
|
}
|
|
@@ -9305,7 +9787,11 @@
|
|
|
9305
9787
|
type: exports.EmbedEvent.Init,
|
|
9306
9788
|
});
|
|
9307
9789
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
9308
|
-
(_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then(() => {
|
|
9790
|
+
(_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
9791
|
+
if (!isLoggedIn) {
|
|
9792
|
+
this.el.innerHTML = this.embedConfig.loginFailedMessage;
|
|
9793
|
+
return;
|
|
9794
|
+
}
|
|
9309
9795
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
9310
9796
|
this.iFrame =
|
|
9311
9797
|
this.iFrame || document.createElement('iframe');
|
|
@@ -9321,7 +9807,7 @@
|
|
|
9321
9807
|
this.iFrame.mozallowfullscreen = true;
|
|
9322
9808
|
const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
|
|
9323
9809
|
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
9324
|
-
const height = getCssDimension(
|
|
9810
|
+
const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
|
|
9325
9811
|
setAttributes(this.iFrame, restParams);
|
|
9326
9812
|
this.iFrame.style.width = `${width}`;
|
|
9327
9813
|
this.iFrame.style.height = `${height}`;
|
|
@@ -9355,6 +9841,7 @@
|
|
|
9355
9841
|
}).catch((error) => {
|
|
9356
9842
|
nextInQueue();
|
|
9357
9843
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED);
|
|
9844
|
+
this.el.innerHTML = this.embedConfig.loginFailedMessage;
|
|
9358
9845
|
this.handleError(error);
|
|
9359
9846
|
});
|
|
9360
9847
|
});
|
|
@@ -9926,6 +10413,7 @@
|
|
|
9926
10413
|
exports.PinboardEmbed = PinboardEmbed;
|
|
9927
10414
|
exports.SearchEmbed = SearchEmbed;
|
|
9928
10415
|
exports.init = init;
|
|
10416
|
+
exports.logout = logout$1;
|
|
9929
10417
|
exports.prefetch = prefetch;
|
|
9930
10418
|
|
|
9931
10419
|
Object.defineProperty(exports, '__esModule', { value: true });
|