Wrap sprig init in check for window
This commit is contained in:
parent
91da39370f
commit
4162cca3ff
|
@ -5,7 +5,7 @@
|
||||||
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'
|
||||||
|
|
||||||
if (ENV_CONFIG.domain === PROD_CONFIG.domain) {
|
if (ENV_CONFIG.domain === PROD_CONFIG.domain && typeof window !== 'undefined') {
|
||||||
try {
|
try {
|
||||||
;(function (l, e, a, p) {
|
;(function (l, e, a, p) {
|
||||||
if (window.Sprig) return
|
if (window.Sprig) return
|
||||||
|
@ -20,6 +20,7 @@ if (ENV_CONFIG.domain === PROD_CONFIG.domain) {
|
||||||
a.async = 1
|
a.async = 1
|
||||||
a.src = e + '?id=' + S.appId
|
a.src = e + '?id=' + S.appId
|
||||||
p = l.getElementsByTagName('script')[0]
|
p = l.getElementsByTagName('script')[0]
|
||||||
|
ENV_CONFIG.domain === PROD_CONFIG.domain &&
|
||||||
p.parentNode.insertBefore(a, p)
|
p.parentNode.insertBefore(a, p)
|
||||||
})(document, 'https://cdn.sprig.com/shim.js', ENV_CONFIG.sprigEnvironmentId)
|
})(document, 'https://cdn.sprig.com/shim.js', ENV_CONFIG.sprigEnvironmentId)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user