turn off sprig on dev

This commit is contained in:
mantikoros 2022-10-05 18:36:32 -05:00
parent 81fb2456bd
commit a149777c0e

View File

@ -5,30 +5,32 @@
import { ENV_CONFIG } from 'common/envs/constants' import { ENV_CONFIG } from 'common/envs/constants'
import { PROD_CONFIG } from 'common/envs/prod' import { PROD_CONFIG } from 'common/envs/prod'
try { if (ENV_CONFIG.domain === PROD_CONFIG.domain) {
;(function (l, e, a, p) { try {
if (window.Sprig) return ;(function (l, e, a, p) {
window.Sprig = function (...args) { if (window.Sprig) return
S._queue.push(args) window.Sprig = function (...args) {
} S._queue.push(args)
const S = window.Sprig }
S.appId = a const S = window.Sprig
S._queue = [] S.appId = a
window.UserLeap = S S._queue = []
a = l.createElement('script') window.UserLeap = S
a.async = 1 a = l.createElement('script')
a.src = e + '?id=' + S.appId a.async = 1
p = l.getElementsByTagName('script')[0] a.src = e + '?id=' + S.appId
ENV_CONFIG.domain === PROD_CONFIG.domain && p.parentNode.insertBefore(a, p) p = l.getElementsByTagName('script')[0]
})(document, 'https://cdn.sprig.com/shim.js', ENV_CONFIG.sprigEnvironmentId) p.parentNode.insertBefore(a, p)
} catch (error) { })(document, 'https://cdn.sprig.com/shim.js', ENV_CONFIG.sprigEnvironmentId)
console.log('Error initializing Sprig, please complain to Barak', error) } catch (error) {
console.log('Error initializing Sprig, please complain to Barak', error)
}
} }
export function setUserId(userId: string): void { export function setUserId(userId: string): void {
window.Sprig('setUserId', userId) if (window.Sprig) window.Sprig('setUserId', userId)
} }
export function setAttributes(attributes: Record<string, unknown>): void { export function setAttributes(attributes: Record<string, unknown>): void {
window.Sprig('setAttributes', attributes) if (window.Sprig) window.Sprig('setAttributes', attributes)
} }