@fullstory/snippet
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -184,7 +184,7 @@ // Generated by dts-bundle-generator v8.0.0 | ||
[V2OperationName.TrackEvent]: void; | ||
[V2OperationName.GetSession]: string; | ||
[V2OperationName.GetSession]: string | null | undefined; | ||
[V2OperationName.Init]: void; | ||
[V2OperationName.Log]: void; | ||
[V2OperationName.Source]: void; | ||
[V2OperationName.Observe]: ObserveEventRegisterCallback | void; | ||
[V2OperationName.Observe]: ObserveEventRegisterCallback | null | undefined; | ||
[V2OperationName.Restart]: void; | ||
@@ -199,4 +199,8 @@ [V2OperationName.SetIdentity]: void; | ||
}; | ||
export type V2OperationAsyncReturnTypes = V2OperationReturnTypes & { | ||
[V2OperationName.GetSession]: string; | ||
[V2OperationName.Observe]: ObserveEventRegisterCallback; | ||
}; | ||
export interface ApiV2 extends ApiV1 { | ||
<Op extends V2Operation = V2Operation>(operation: `${Op}Async`, options?: V2OperationOptions[Op], source?: string): Promise<V2OperationReturnTypes[Op]>; | ||
<Op extends V2Operation = V2Operation>(operation: `${Op}Async`, options?: V2OperationOptions[Op], source?: string): Promise<V2OperationAsyncReturnTypes[Op]>; | ||
<Op extends V2Operation = V2Operation>(operation: Op, options?: V2OperationOptions[Op], source?: string): V2OperationReturnTypes[Op]; | ||
@@ -203,0 +207,0 @@ } |
@@ -193,2 +193,10 @@ // DO NOT ADD ANY NEW IMPORTS HERE. | ||
})(AjaxLegibility || (AjaxLegibility = {})); | ||
var HttpRequestState; | ||
(function (HttpRequestState) { | ||
HttpRequestState[HttpRequestState["UNSET"] = 0] = "UNSET"; | ||
HttpRequestState[HttpRequestState["OK"] = 1] = "OK"; | ||
HttpRequestState[HttpRequestState["ABORTED"] = 2] = "ABORTED"; | ||
HttpRequestState[HttpRequestState["OPAQUE"] = 3] = "OPAQUE"; | ||
HttpRequestState[HttpRequestState["ERROR"] = 4] = "ERROR"; | ||
})(HttpRequestState || (HttpRequestState = {})); | ||
/** | ||
@@ -499,108 +507,189 @@ * Values from the browser Performance API, for use with | ||
wnd = _ref$wnd === void 0 ? window : _ref$wnd; | ||
!function (m, n, e, t, l, o, g, y) { | ||
var s, | ||
f, | ||
a = function (h) { | ||
return !(h in m) || (m.console && m.console.log && m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'), !1); | ||
}(e); | ||
function j(b) { | ||
var h, | ||
d = []; | ||
function k() { | ||
h && (d.forEach(function (b) { | ||
var d; | ||
(function (win, doc, fsNamespace, tagName, fsScript, script, api, rejector) { | ||
var valid = function checkNamespace(fsNamespace) { | ||
if (!(fsNamespace in win)) { | ||
return true; | ||
} | ||
if (win.console && win.console.log) { | ||
win.console.log("FullStory namespace conflict. Please set window[\"_fs_namespace\"]."); | ||
} | ||
return false; | ||
}(fsNamespace); | ||
if (!valid) return; | ||
function makeThenable(callback) { | ||
var waiters = []; | ||
var resolution; | ||
function flush() { | ||
if (!resolution) { | ||
return; | ||
} | ||
waiters.forEach(function (waiter) { | ||
var result; | ||
try { | ||
d = b[h[0]] && b[h[0]](h[1]); | ||
} catch (h) { | ||
return void (b[3] && b[3](h)); | ||
result = waiter[resolution[0]] && waiter[resolution[0]](resolution[1]); | ||
} catch (error) { | ||
waiter[3] && waiter[3](error); | ||
return; | ||
} | ||
d && d.then ? d.then(b[2], b[3]) : b[2] && b[2](d); | ||
}), d.length = 0); | ||
if (result && result.then) { | ||
result.then(waiter[2], waiter[3]); | ||
} else { | ||
waiter[2] && waiter[2](result); | ||
} | ||
}); | ||
waiters.length = 0; | ||
} | ||
function r(b) { | ||
return function (d) { | ||
h || (h = [b, d], k()); | ||
function makeHandler(which) { | ||
return function (value) { | ||
if (resolution) { | ||
return; | ||
} | ||
resolution = [which, value]; | ||
flush(); | ||
}; | ||
} | ||
return b(r(0), r(1)), { | ||
then: function then(b, h) { | ||
return j(function (r, c) { | ||
d.push([b, h, r, c]), k(); | ||
}); | ||
} | ||
callback(makeHandler(0), makeHandler(1)); | ||
function _then(onFulfilled, onRejected) { | ||
return makeThenable(function (nextResolve, nextReject) { | ||
waiters.push([onFulfilled, onRejected, nextResolve, nextReject]); | ||
flush(); | ||
}); | ||
} | ||
return { | ||
then: _then | ||
}; | ||
} | ||
a && (g = m[e] = function () { | ||
var b = function b(_b2, d, k, r) { | ||
function c(c, i) { | ||
h(_b2, d, k, c, i, r); | ||
api = win[fsNamespace] = function createV2API() { | ||
var FS = function FS(action, options, source, apiVersion) { | ||
apiVersion = apiVersion || 2; | ||
function setResolve(resolve, reject) { | ||
api(action, options, source, resolve, reject, apiVersion); | ||
} | ||
r = r || 2; | ||
var i, | ||
u = /Async$/; | ||
return u.test(_b2) ? (_b2 = _b2.replace(u, ""), "function" == typeof Promise ? new Promise(c) : j(c)) : h(_b2, d, k, i, i, r); | ||
var re = /Async$/; | ||
if (re.test(action)) { | ||
action = action.replace(re, ''); | ||
// @ts-ignore | ||
if (typeof Promise === 'function') { | ||
// @ts-ignore | ||
return new Promise(setResolve); | ||
} | ||
return makeThenable(setResolve); | ||
} | ||
var _undefined; | ||
return api(action, options, source, _undefined, _undefined, apiVersion); | ||
}; | ||
function h(h, d, k, r, c, i) { | ||
return b._api ? b._api(h, d, k, r, c, i) : (b.q && b.q.push([h, d, k, r, c, i]), null); | ||
function api(op, args, source, resolve, reject, apiVersion) { | ||
// Once fs.js is bootstrapped, we have access to ._api which | ||
// handles pushing deferred methods into the queue internally. | ||
if (FS._api) { | ||
return FS._api(op, args, source, resolve, reject, apiVersion); | ||
} | ||
if (FS.q) { | ||
FS.q.push([op, args, source, resolve, reject, apiVersion]); | ||
} | ||
return null; | ||
} | ||
return b.q = [], b; | ||
}(), y = function y(b) { | ||
function h(h) { | ||
"function" == typeof h[4] && h[4](new Error(b)); | ||
} | ||
var d = g.q; | ||
if (d) { | ||
for (var k = 0; k < d.length; k++) h(d[k]); | ||
d.length = 0, d.push = h; | ||
} | ||
}, function () { | ||
(o = n.createElement(t)).async = !0, o.crossOrigin = "anonymous", o.src = "https://" + l, o.onerror = function () { | ||
y("Error loading " + l); | ||
FS.q = []; | ||
return FS; | ||
}(); | ||
rejector = function createRejector() { | ||
// Returns a function called on the error handler of the fs.js script tag. | ||
// Its purpose is to reject all pending and future asynchronous api calls. | ||
// The 4th argument to any api operation is always the reject function if it | ||
// has been called with the "Async" modifier. | ||
return function (reason) { | ||
function doReject(operation) { | ||
if (typeof operation[4] === 'function') { | ||
operation[4](new Error(reason)); | ||
} | ||
} | ||
var q = api.q; | ||
if (q) { | ||
for (var i = 0; i < q.length; i++) { | ||
doReject(q[i]); | ||
} | ||
q.length = 0; | ||
q.push = doReject; | ||
} | ||
}; | ||
var b = n.getElementsByTagName(t)[0]; | ||
b.parentNode.insertBefore(o, b); | ||
}(), function () { | ||
function b() {} | ||
function h(b, h, d) { | ||
g(b, h, d, 1); | ||
}(); | ||
(function insertScript() { | ||
script = doc.createElement(tagName); | ||
script.async = true; | ||
script.crossOrigin = 'anonymous'; | ||
script.src = 'https://' + fsScript; | ||
script.onerror = function () { | ||
rejector('Error loading ' + fsScript); | ||
}; | ||
var firstScript = doc.getElementsByTagName(tagName)[0]; | ||
firstScript.parentNode.insertBefore(script, firstScript); | ||
})(); | ||
(function translateV1API() { | ||
function noop() {} | ||
function callAPI(action, option, source) { | ||
api(action, option, source, 1); | ||
} | ||
function d(b, d, k) { | ||
h("setProperties", { | ||
type: b, | ||
properties: d | ||
}, k); | ||
function setProperties(scope, props, source) { | ||
callAPI('setProperties', { | ||
type: scope, | ||
properties: props | ||
}, source); | ||
} | ||
function k(b, h) { | ||
d("user", b, h); | ||
function setUserProperties(props, source) { | ||
setProperties('user', props, source); | ||
} | ||
function r(b, h, d) { | ||
k({ | ||
uid: b | ||
}, d), h && k(h, d); | ||
function identify(uid, customVars, source) { | ||
setUserProperties({ | ||
uid: uid | ||
}, source); | ||
if (customVars) { | ||
setUserProperties(customVars, source); | ||
} | ||
} | ||
g.identify = r, g.setUserVars = k, g.identifyAccount = b, g.clearUserCookie = b, g.setVars = d, g.event = function (b, d, k) { | ||
h("trackEvent", { | ||
name: b, | ||
properties: d | ||
}, k); | ||
}, g.anonymize = function () { | ||
r(!1); | ||
}, g.shutdown = function () { | ||
h("shutdown"); | ||
}, g.restart = function () { | ||
h("restart"); | ||
}, g.log = function (b, d) { | ||
h("log", { | ||
level: b, | ||
msg: d | ||
api.identify = identify; | ||
api.setUserVars = setUserProperties; | ||
api.identifyAccount = noop; | ||
api.clearUserCookie = noop; | ||
api.setVars = setProperties; | ||
api.event = function (eventName, eventProps, source) { | ||
callAPI('trackEvent', { | ||
name: eventName, | ||
properties: eventProps | ||
}, source); | ||
}; | ||
api.anonymize = function () { | ||
identify(false); | ||
}; | ||
api.shutdown = function () { | ||
callAPI('shutdown'); | ||
}; | ||
api.restart = function () { | ||
callAPI('restart'); | ||
}; | ||
api.log = function (level, msg) { | ||
callAPI('log', { | ||
level: level, | ||
msg: msg | ||
}); | ||
}, g.consent = function (b) { | ||
h("setIdentity", { | ||
consent: !arguments.length || b | ||
}; | ||
api.consent = function (userConsents) { | ||
callAPI('setIdentity', { | ||
consent: !arguments.length || userConsents | ||
}); | ||
}; | ||
}(), s = "fetch", f = "XMLHttpRequest", g._w = {}, g._w[f] = m[f], g._w[s] = m[s], m[s] && (m[s] = function () { | ||
return g._w[s].apply(this, arguments); | ||
}), g._v = "2.0.0"); | ||
}(wnd, wnd.document, wnd._fs_namespace, "script", wnd._fs_script); | ||
})(); | ||
(function snapshotGlobals() { | ||
var f = 'fetch'; | ||
var xhr = 'XMLHttpRequest'; | ||
api._w = {}; | ||
api._w[xhr] = win[xhr]; | ||
api._w[f] = win[f]; | ||
if (win[f]) { | ||
win[f] = function () { | ||
return api._w[f].apply(this, arguments); | ||
}; | ||
} | ||
})(); | ||
api._v = "2.0.0"; | ||
})(wnd, wnd.document, wnd['_fs_namespace'], 'script', wnd['_fs_script']); | ||
}; | ||
@@ -607,0 +696,0 @@ var executeSnippetV1 = function executeSnippetV1() { |
@@ -195,2 +195,10 @@ 'use strict'; | ||
})(AjaxLegibility || (AjaxLegibility = {})); | ||
var HttpRequestState; | ||
(function (HttpRequestState) { | ||
HttpRequestState[HttpRequestState["UNSET"] = 0] = "UNSET"; | ||
HttpRequestState[HttpRequestState["OK"] = 1] = "OK"; | ||
HttpRequestState[HttpRequestState["ABORTED"] = 2] = "ABORTED"; | ||
HttpRequestState[HttpRequestState["OPAQUE"] = 3] = "OPAQUE"; | ||
HttpRequestState[HttpRequestState["ERROR"] = 4] = "ERROR"; | ||
})(HttpRequestState || (HttpRequestState = {})); | ||
/** | ||
@@ -501,108 +509,189 @@ * Values from the browser Performance API, for use with | ||
wnd = _ref$wnd === void 0 ? window : _ref$wnd; | ||
!function (m, n, e, t, l, o, g, y) { | ||
var s, | ||
f, | ||
a = function (h) { | ||
return !(h in m) || (m.console && m.console.log && m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'), !1); | ||
}(e); | ||
function j(b) { | ||
var h, | ||
d = []; | ||
function k() { | ||
h && (d.forEach(function (b) { | ||
var d; | ||
(function (win, doc, fsNamespace, tagName, fsScript, script, api, rejector) { | ||
var valid = function checkNamespace(fsNamespace) { | ||
if (!(fsNamespace in win)) { | ||
return true; | ||
} | ||
if (win.console && win.console.log) { | ||
win.console.log("FullStory namespace conflict. Please set window[\"_fs_namespace\"]."); | ||
} | ||
return false; | ||
}(fsNamespace); | ||
if (!valid) return; | ||
function makeThenable(callback) { | ||
var waiters = []; | ||
var resolution; | ||
function flush() { | ||
if (!resolution) { | ||
return; | ||
} | ||
waiters.forEach(function (waiter) { | ||
var result; | ||
try { | ||
d = b[h[0]] && b[h[0]](h[1]); | ||
} catch (h) { | ||
return void (b[3] && b[3](h)); | ||
result = waiter[resolution[0]] && waiter[resolution[0]](resolution[1]); | ||
} catch (error) { | ||
waiter[3] && waiter[3](error); | ||
return; | ||
} | ||
d && d.then ? d.then(b[2], b[3]) : b[2] && b[2](d); | ||
}), d.length = 0); | ||
if (result && result.then) { | ||
result.then(waiter[2], waiter[3]); | ||
} else { | ||
waiter[2] && waiter[2](result); | ||
} | ||
}); | ||
waiters.length = 0; | ||
} | ||
function r(b) { | ||
return function (d) { | ||
h || (h = [b, d], k()); | ||
function makeHandler(which) { | ||
return function (value) { | ||
if (resolution) { | ||
return; | ||
} | ||
resolution = [which, value]; | ||
flush(); | ||
}; | ||
} | ||
return b(r(0), r(1)), { | ||
then: function then(b, h) { | ||
return j(function (r, c) { | ||
d.push([b, h, r, c]), k(); | ||
}); | ||
} | ||
callback(makeHandler(0), makeHandler(1)); | ||
function _then(onFulfilled, onRejected) { | ||
return makeThenable(function (nextResolve, nextReject) { | ||
waiters.push([onFulfilled, onRejected, nextResolve, nextReject]); | ||
flush(); | ||
}); | ||
} | ||
return { | ||
then: _then | ||
}; | ||
} | ||
a && (g = m[e] = function () { | ||
var b = function b(_b2, d, k, r) { | ||
function c(c, i) { | ||
h(_b2, d, k, c, i, r); | ||
api = win[fsNamespace] = function createV2API() { | ||
var FS = function FS(action, options, source, apiVersion) { | ||
apiVersion = apiVersion || 2; | ||
function setResolve(resolve, reject) { | ||
api(action, options, source, resolve, reject, apiVersion); | ||
} | ||
r = r || 2; | ||
var i, | ||
u = /Async$/; | ||
return u.test(_b2) ? (_b2 = _b2.replace(u, ""), "function" == typeof Promise ? new Promise(c) : j(c)) : h(_b2, d, k, i, i, r); | ||
var re = /Async$/; | ||
if (re.test(action)) { | ||
action = action.replace(re, ''); | ||
// @ts-ignore | ||
if (typeof Promise === 'function') { | ||
// @ts-ignore | ||
return new Promise(setResolve); | ||
} | ||
return makeThenable(setResolve); | ||
} | ||
var _undefined; | ||
return api(action, options, source, _undefined, _undefined, apiVersion); | ||
}; | ||
function h(h, d, k, r, c, i) { | ||
return b._api ? b._api(h, d, k, r, c, i) : (b.q && b.q.push([h, d, k, r, c, i]), null); | ||
function api(op, args, source, resolve, reject, apiVersion) { | ||
// Once fs.js is bootstrapped, we have access to ._api which | ||
// handles pushing deferred methods into the queue internally. | ||
if (FS._api) { | ||
return FS._api(op, args, source, resolve, reject, apiVersion); | ||
} | ||
if (FS.q) { | ||
FS.q.push([op, args, source, resolve, reject, apiVersion]); | ||
} | ||
return null; | ||
} | ||
return b.q = [], b; | ||
}(), y = function y(b) { | ||
function h(h) { | ||
"function" == typeof h[4] && h[4](new Error(b)); | ||
} | ||
var d = g.q; | ||
if (d) { | ||
for (var k = 0; k < d.length; k++) h(d[k]); | ||
d.length = 0, d.push = h; | ||
} | ||
}, function () { | ||
(o = n.createElement(t)).async = !0, o.crossOrigin = "anonymous", o.src = "https://" + l, o.onerror = function () { | ||
y("Error loading " + l); | ||
FS.q = []; | ||
return FS; | ||
}(); | ||
rejector = function createRejector() { | ||
// Returns a function called on the error handler of the fs.js script tag. | ||
// Its purpose is to reject all pending and future asynchronous api calls. | ||
// The 4th argument to any api operation is always the reject function if it | ||
// has been called with the "Async" modifier. | ||
return function (reason) { | ||
function doReject(operation) { | ||
if (typeof operation[4] === 'function') { | ||
operation[4](new Error(reason)); | ||
} | ||
} | ||
var q = api.q; | ||
if (q) { | ||
for (var i = 0; i < q.length; i++) { | ||
doReject(q[i]); | ||
} | ||
q.length = 0; | ||
q.push = doReject; | ||
} | ||
}; | ||
var b = n.getElementsByTagName(t)[0]; | ||
b.parentNode.insertBefore(o, b); | ||
}(), function () { | ||
function b() {} | ||
function h(b, h, d) { | ||
g(b, h, d, 1); | ||
}(); | ||
(function insertScript() { | ||
script = doc.createElement(tagName); | ||
script.async = true; | ||
script.crossOrigin = 'anonymous'; | ||
script.src = 'https://' + fsScript; | ||
script.onerror = function () { | ||
rejector('Error loading ' + fsScript); | ||
}; | ||
var firstScript = doc.getElementsByTagName(tagName)[0]; | ||
firstScript.parentNode.insertBefore(script, firstScript); | ||
})(); | ||
(function translateV1API() { | ||
function noop() {} | ||
function callAPI(action, option, source) { | ||
api(action, option, source, 1); | ||
} | ||
function d(b, d, k) { | ||
h("setProperties", { | ||
type: b, | ||
properties: d | ||
}, k); | ||
function setProperties(scope, props, source) { | ||
callAPI('setProperties', { | ||
type: scope, | ||
properties: props | ||
}, source); | ||
} | ||
function k(b, h) { | ||
d("user", b, h); | ||
function setUserProperties(props, source) { | ||
setProperties('user', props, source); | ||
} | ||
function r(b, h, d) { | ||
k({ | ||
uid: b | ||
}, d), h && k(h, d); | ||
function identify(uid, customVars, source) { | ||
setUserProperties({ | ||
uid: uid | ||
}, source); | ||
if (customVars) { | ||
setUserProperties(customVars, source); | ||
} | ||
} | ||
g.identify = r, g.setUserVars = k, g.identifyAccount = b, g.clearUserCookie = b, g.setVars = d, g.event = function (b, d, k) { | ||
h("trackEvent", { | ||
name: b, | ||
properties: d | ||
}, k); | ||
}, g.anonymize = function () { | ||
r(!1); | ||
}, g.shutdown = function () { | ||
h("shutdown"); | ||
}, g.restart = function () { | ||
h("restart"); | ||
}, g.log = function (b, d) { | ||
h("log", { | ||
level: b, | ||
msg: d | ||
api.identify = identify; | ||
api.setUserVars = setUserProperties; | ||
api.identifyAccount = noop; | ||
api.clearUserCookie = noop; | ||
api.setVars = setProperties; | ||
api.event = function (eventName, eventProps, source) { | ||
callAPI('trackEvent', { | ||
name: eventName, | ||
properties: eventProps | ||
}, source); | ||
}; | ||
api.anonymize = function () { | ||
identify(false); | ||
}; | ||
api.shutdown = function () { | ||
callAPI('shutdown'); | ||
}; | ||
api.restart = function () { | ||
callAPI('restart'); | ||
}; | ||
api.log = function (level, msg) { | ||
callAPI('log', { | ||
level: level, | ||
msg: msg | ||
}); | ||
}, g.consent = function (b) { | ||
h("setIdentity", { | ||
consent: !arguments.length || b | ||
}; | ||
api.consent = function (userConsents) { | ||
callAPI('setIdentity', { | ||
consent: !arguments.length || userConsents | ||
}); | ||
}; | ||
}(), s = "fetch", f = "XMLHttpRequest", g._w = {}, g._w[f] = m[f], g._w[s] = m[s], m[s] && (m[s] = function () { | ||
return g._w[s].apply(this, arguments); | ||
}), g._v = "2.0.0"); | ||
}(wnd, wnd.document, wnd._fs_namespace, "script", wnd._fs_script); | ||
})(); | ||
(function snapshotGlobals() { | ||
var f = 'fetch'; | ||
var xhr = 'XMLHttpRequest'; | ||
api._w = {}; | ||
api._w[xhr] = win[xhr]; | ||
api._w[f] = win[f]; | ||
if (win[f]) { | ||
win[f] = function () { | ||
return api._w[f].apply(this, arguments); | ||
}; | ||
} | ||
})(); | ||
api._v = "2.0.0"; | ||
})(wnd, wnd.document, wnd['_fs_namespace'], 'script', wnd['_fs_script']); | ||
}; | ||
@@ -609,0 +698,0 @@ var executeSnippetV1 = function executeSnippetV1() { |
{ | ||
"name": "@fullstory/snippet", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "FullStory snippet source", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79662
1929