@jitsu/js 1.9.0-canary.583.20240115215752 → 1.9.1-canary.777.20240418125312

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/web/p.js.txt CHANGED
@@ -281,7 +281,6 @@
281
281
  step((generator = generator.apply(thisArg, _arguments || [])).next());
282
282
  });
283
283
  };
284
- const defaultScriptSrc$1 = "https://www.googletagmanager.com/gtag/js";
285
284
  const gtmPlugin = {
286
285
  id: "gtm",
287
286
  handle(config, payload) {
@@ -329,31 +328,27 @@
329
328
  }
330
329
  setGtmState("loading");
331
330
  const dlName = config.dataLayerName || "dataLayer";
332
- const dlParam = dlName !== "dataLayer" ? "&l=" + dlName : "";
333
- const previewParams = config.preview
334
- ? `&gtm_preview=${config.preview}&gtm_auth=${config.auth}&gtm_cookies_win=x`
335
- : "";
336
331
  const tagId = config.containerId;
337
- const scriptSrc = `${config.customScriptSrc || defaultScriptSrc$1}?id=${tagId}${dlParam}${previewParams}`;
338
- window[dlName] = window[dlName] || [];
339
- const gtag = function () {
340
- window[dlName].push(arguments);
341
- };
342
- window[dlName].push({
343
- user_id: payload.userId,
344
- });
345
- // @ts-ignore
346
- gtag("js", new Date());
347
- // @ts-ignore
348
- gtag("config", tagId);
349
- loadScript(scriptSrc)
350
- .then(() => {
351
- setGtmState("loaded");
352
- })
353
- .catch(e => {
354
- console.warn(`GTM (containerId=${tagId}) init failed: ${e.message}`, e);
355
- setGtmState("failed");
356
- });
332
+ (function (w, l, i) {
333
+ w[l] = w[l] || [];
334
+ w[l].push({
335
+ user_id: payload.userId,
336
+ });
337
+ w[l].push({
338
+ "gtm.start": new Date().getTime(),
339
+ event: "gtm.js",
340
+ });
341
+ const dl = l != "dataLayer" ? "&l=" + l : "";
342
+ const scriptSrc = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
343
+ loadScript(scriptSrc)
344
+ .then(() => {
345
+ setGtmState("loaded");
346
+ })
347
+ .catch(e => {
348
+ console.warn(`GTM (containerId=${tagId}) init failed: ${e.message}`, e);
349
+ setGtmState("failed");
350
+ });
351
+ })(window, dlName, tagId);
357
352
  });
358
353
  }
359
354
 
@@ -485,8 +480,7 @@
485
480
  [logrocketPlugin.id]: logrocketPlugin,
486
481
  };
487
482
 
488
- //import pkg from "../package.json";
489
- const jitsuVersion = "0.0.0";
483
+ const jitsuVersion = "2.0.0";
490
484
  const jitsuLibraryName = "@jitsu/js";
491
485
 
492
486
  const publicSuffixes = "ac,com.ac,edu.ac,gov.ac,net.ac,mil.ac,org.ac,ad,nom.ad,ae,co.ae,net.ae,org.ae,sch.ae,ac.ae,gov.ae,mil.ae,aero,af,gov.af,com.af,org.af,net.af,edu.af,ag,com.ag,org.ag,net.ag,co.ag,nom.ag,ai,off.ai,com.ai,net.ai,org.ai,al,com.al,edu.al,gov.al,mil.al,net.al,org.al,am,co.am,com.am,commune.am,net.am,org.am,ao,ed.ao,gv.ao,og.ao,co.ao,pb.ao,it.ao,aq,ar,bet.ar,com.ar,coop.ar,edu.ar,gob.ar,gov.ar,int.ar,mil.ar,musica.ar,mutual.ar,net.ar,org.ar,senasa.ar,tur.ar,arpa,e164.arpa,in-addr.arpa,ip6.arpa,iris.arpa,uri.arpa,urn.arpa,as,gov.as,asia,at,ac.at,co.at,gv.at,or.at,sth.ac.at,au,com.au,net.au,org.au,edu.au,gov.au,asn.au,id.au,act.au,nsw.au,nt.au,qld.au,sa.au,tas.au,vic.au,wa.au,aw,com.aw,ax,az,com.az,net.az,int.az,gov.az,org.az,edu.az,info.az,pp.az,mil.az,name.az,pro.az,biz.az,ba,com.ba,edu.ba,gov.ba,mil.ba,net.ba,org.ba,bb,biz.bb,co.bb,com.bb,edu.bb,gov.bb,info.bb,net.bb,org.bb,store.bb,tv.bb,bd,be,ac.be,bf,gov.bf,bg,a.bg,b.bg,c.bg,d.bg,e.bg,f.bg,g.bg,h.bg,i.bg,j.bg,k.bg,l.bg,m.bg,n.bg,o.bg,p.bg,q.bg,r.bg,s.bg,t.bg,u.bg,v.bg,w.bg,x.bg,y.bg,z.bg,0.bg,1.bg,2.bg,3.bg,4.bg,5.bg,6.bg,7.bg,8.bg,9.bg,bh,com.bh,edu.bh,net.bh,org.bh,gov.bh,bi,co.bi,com.bi,edu.bi,or.bi,org.bi,biz,bj,africa.bj,agro.bj,architectes.bj,assur.bj,avocats.bj,co.bj,com.bj,eco.bj,econo.bj,edu.bj,info.bj,loisirs.bj,money.bj,net.bj,org.bj,ote.bj,resto.bj,restaurant.bj,tourism.bj,univ.bj,bm,com.bm,edu.bm,gov.bm,net.bm,org.bm,bn,com.bn,edu.bn,gov.bn,net.bn,org.bn,bo,com.bo,edu.bo,gob.bo,int.bo,org.bo,net.bo,mil.bo,tv.bo,web.bo,br,9guacu.br,abc.br,adm.br,adv.br,agr.br,aju.br,am.br,anani.br,aparecida.br,app.br,arq.br,art.br,ato.br,b.br,barueri.br,belem.br,bhz.br,bib.br,bio.br,blog.br,bmd.br,boavista.br,bsb.br,campinagrande.br,campinas.br,caxias.br,cim.br,cng.br,cnt.br,com.br,contagem.br,coop.br,coz.br,cri.br,cuiaba.br,curitiba.br,def.br,des.br,det.br,dev.br,ecn.br,eco.br,edu.br,emp.br,enf.br,eng.br,esp.br,etc.br,eti.br,far.br,feira.br,flog.br,floripa.br,fm.br,fnd.br,fortal.br,fot.br,foz.br,fst.br,g12.br,geo.br,ggf.br,goiania.br,gov.br,gru.br,imb.br,ind.br,inf.br,jab.br,jampa.br,jdf.br,joinville.br,jor.br,jus.br,leg.br,lel.br,log.br,londrina.br,macapa.br,maceio.br,manaus.br,maringa.br,mat.br,med.br,mil.br,morena.br,mp.br,mus.br,natal.br,net.br,niteroi.br,nom.br,not.br,ntr.br,odo.br,ong.br,org.br,osasco.br,palmas.br,poa.br,ppg.br,pro.br,psc.br,psi.br,pvh.br,qsl.br,radio.br,rec.br,recife.br,rep.br,ribeirao.br,rio.br,riobranco.br,riopreto.br,salvador.br,sampa.br,santamaria.br,santoandre.br,saobernardo.br,saogonca.br,seg.br,sjc.br,slg.br,slz.br,sorocaba.br,srv.br,taxi.br,tc.br,tec.br,teo.br,the.br,tmp.br,trd.br,tur.br,tv.br,udi.br,vet.br,vix.br,vlog.br,wiki.br,zlg.br,bs,com.bs,net.bs,org.bs,edu.bs,gov.bs,bt,com.bt,edu.bt,gov.bt,net.bt,org.bt,bv,bw,co.bw,org.bw,by,gov.by,mil.by,com.by,of.by,bz,com.bz,net.bz,org.bz,edu.bz,gov.bz,ca,ab.ca,bc.ca,mb.ca,nb.ca,nf.ca,nl.ca,ns.ca,nt.ca,nu.ca,on.ca,pe.ca,qc.ca,sk.ca,yk.ca,gc.ca,cat,cc,cd,gov.cd,cf,cg,ch,ci,org.ci,or.ci,com.ci,co.ci,edu.ci,ed.ci,ac.ci,net.ci,go.ci,asso.ci,aéroport.ci,int.ci,presse.ci,md.ci,gouv.ci,ck,cl,co.cl,gob.cl,gov.cl,mil.cl,cm,co.cm,com.cm,gov.cm,net.cm,cn,ac.cn,com.cn,edu.cn,gov.cn,net.cn,org.cn,mil.cn,co,arts.co,com.co,edu.co,firm.co,gov.co,info.co,int.co,mil.co,net.co,nom.co,org.co,rec.co,web.co,com,coop,cr,ac.cr,co.cr,ed.cr,fi.cr,go.cr,or.cr,sa.cr,cu,com.cu,edu.cu,org.cu,net.cu,gov.cu,inf.cu,cv,com.cv,edu.cv,int.cv,nome.cv,org.cv,cw,com.cw,edu.cw,net.cw,org.cw,cx,gov.cx,cy,ac.cy,biz.cy,com.cy,ekloges.cy,gov.cy,ltd.cy,mil.cy,net.cy,org.cy,press.cy,pro.cy,tm.cy,cz,de,dj,dk,dm,com.dm,net.dm,org.dm,edu.dm,gov.dm,do,art.do,com.do,edu.do,gob.do,gov.do,mil.do,net.do,org.do,sld.do,web.do,dz,art.dz,asso.dz,com.dz,edu.dz,gov.dz,org.dz,net.dz,pol.dz,soc.dz,tm.dz,ec,com.ec,info.ec,net.ec,fin.ec,k12.ec,med.ec,pro.ec,org.ec,edu.ec,gov.ec,gob.ec,mil.ec,edu,ee,edu.ee,gov.ee,riik.ee,lib.ee,med.ee,com.ee,pri.ee,aip.ee,org.ee,fie.ee,eg,com.eg,edu.eg,eun.eg,gov.eg,mil.eg,name.eg,net.eg,org.eg,sci.eg,er,es,com.es,nom.es,org.es,gob.es,edu.es,et,com.et,gov.et,org.et,edu.et,biz.et,name.et,info.et,net.et,eu,fi,aland.fi,fj,ac.fj,biz.fj,com.fj,gov.fj,info.fj,mil.fj,name.fj,net.fj,org.fj,pro.fj,fk,com.fm,edu.fm,net.fm,org.fm,fm,fo,fr,asso.fr,com.fr,gouv.fr,nom.fr,prd.fr,tm.fr,aeroport.fr,avocat.fr,avoues.fr,cci.fr,chambagri.fr,chirurgiens-dentistes.fr,experts-comptables.fr,geometre-expert.fr,greta.fr,huissier-justice.fr,medecin.fr,notaires.fr,pharmacien.fr,port.fr,veterinaire.fr,ga,gb,edu.gd,gov.gd,gd,ge,com.ge,edu.ge,gov.ge,org.ge,mil.ge,net.ge,pvt.ge,gf,gg,co.gg,net.gg,org.gg,gh,com.gh,edu.gh,gov.gh,org.gh,mil.gh,gi,com.gi,ltd.gi,gov.gi,mod.gi,edu.gi,org.gi,gl,co.gl,com.gl,edu.gl,net.gl,org.gl,gm,gn,ac.gn,com.gn,edu.gn,gov.gn,org.gn,net.gn,gov,gp,com.gp,net.gp,mobi.gp,edu.gp,org.gp,asso.gp,gq,gr,com.gr,edu.gr,net.gr,org.gr,gov.gr,gs,gt,com.gt,edu.gt,gob.gt,ind.gt,mil.gt,net.gt,org.gt,gu,com.gu,edu.gu,gov.gu,guam.gu,info.gu,net.gu,org.gu,web.gu,gw,gy,co.gy,com.gy,edu.gy,gov.gy,net.gy,org.gy,hk,com.hk,edu.hk,gov.hk,idv.hk,net.hk,org.hk,hm,hn,com.hn,edu.hn,org.hn,net.hn,mil.hn,gob.hn,hr,iz.hr,from.hr,name.hr,com.hr,ht,com.ht,shop.ht,firm.ht,info.ht,adult.ht,net.ht,pro.ht,org.ht,med.ht,art.ht,coop.ht,pol.ht,asso.ht,edu.ht,rel.ht,gouv.ht,perso.ht,hu,co.hu,info.hu,org.hu,priv.hu,sport.hu,tm.hu,2000.hu,agrar.hu,bolt.hu,casino.hu,city.hu,erotica.hu,erotika.hu,film.hu,forum.hu,games.hu,hotel.hu,ingatlan.hu,jogasz.hu,konyvelo.hu,lakas.hu,media.hu,news.hu,reklam.hu,sex.hu,shop.hu,suli.hu,szex.hu,tozsde.hu,utazas.hu,video.hu,id,ac.id,biz.id,co.id,desa.id,go.id,mil.id,my.id,net.id,or.id,ponpes.id,sch.id,web.id,ie,gov.ie,il,ac.il,co.il,gov.il,idf.il,k12.il,muni.il,net.il,org.il,im,ac.im,co.im,com.im,ltd.co.im,net.im,org.im,plc.co.im,tt.im,tv.im,in,5g.in,6g.in,ac.in,ai.in,am.in,bihar.in,biz.in,business.in,ca.in,cn.in,co.in,com.in,coop.in,cs.in,delhi.in,dr.in,edu.in,er.in,firm.in,gen.in,gov.in,gujarat.in,ind.in,info.in,int.in,internet.in,io.in,me.in,mil.in,net.in,nic.in,org.in,pg.in,post.in,pro.in,res.in,travel.in,tv.in,uk.in,up.in,us.in,info,int,eu.int,io,com.io,iq,gov.iq,edu.iq,mil.iq,com.iq,org.iq,net.iq,ir,ac.ir,co.ir,gov.ir,id.ir,net.ir,org.ir,sch.ir,is,net.is,com.is,edu.is,gov.is,org.is,int.is,it,gov.it,edu.it,je,co.je,net.je,org.je,jm,jo,com.jo,org.jo,net.jo,edu.jo,sch.jo,gov.jo,mil.jo,name.jo,jobs,jp,ac.jp,ad.jp,co.jp,ed.jp,go.jp,gr.jp,lg.jp,ne.jp,or.jp,ke,ac.ke,co.ke,go.ke,info.ke,me.ke,mobi.ke,ne.ke,or.ke,sc.ke,kg,org.kg,net.kg,com.kg,edu.kg,gov.kg,mil.kg,kh,ki,edu.ki,biz.ki,net.ki,org.ki,gov.ki,info.ki,com.ki,km,org.km,nom.km,gov.km,prd.km,tm.km,edu.km,mil.km,ass.km,com.km,kn,net.kn,org.kn,edu.kn,gov.kn,kp,com.kp,edu.kp,gov.kp,org.kp,rep.kp,tra.kp,kr,ac.kr,co.kr,es.kr,go.kr,hs.kr,kg.kr,mil.kr,ms.kr,ne.kr,or.kr,pe.kr,re.kr,sc.kr,kw,com.kw,edu.kw,emb.kw,gov.kw,ind.kw,net.kw,org.kw,ky,com.ky,edu.ky,net.ky,org.ky,kz,org.kz,edu.kz,net.kz,gov.kz,mil.kz,com.kz,la,int.la,net.la,info.la,edu.la,gov.la,per.la,com.la,org.la,lb,com.lb,edu.lb,gov.lb,net.lb,org.lb,lc,com.lc,net.lc,co.lc,org.lc,edu.lc,gov.lc,li,lk,gov.lk,sch.lk,net.lk,int.lk,com.lk,org.lk,edu.lk,ngo.lk,soc.lk,web.lk,ltd.lk,assn.lk,grp.lk,hotel.lk,ac.lk,lr,com.lr,edu.lr,gov.lr,org.lr,net.lr,ls,ac.ls,biz.ls,co.ls,edu.ls,gov.ls,info.ls,net.ls,org.ls,sc.ls,lt,gov.lt,lu,lv,com.lv,edu.lv,gov.lv,org.lv,mil.lv,id.lv,net.lv,asn.lv,conf.lv,ly,com.ly,net.ly,gov.ly,plc.ly,edu.ly,sch.ly,med.ly,org.ly,id.ly,ma,co.ma,net.ma,gov.ma,org.ma,ac.ma,press.ma,mc,tm.mc,asso.mc,md,me,co.me,net.me,org.me,edu.me,ac.me,gov.me,its.me,priv.me,mg,org.mg,nom.mg,gov.mg,prd.mg,tm.mg,edu.mg,mil.mg,com.mg,co.mg,mh,mil,mk,com.mk,org.mk,net.mk,edu.mk,gov.mk,inf.mk,name.mk,ml,com.ml,edu.ml,gouv.ml,gov.ml,net.ml,org.ml,presse.ml,mm,mn,gov.mn,edu.mn,org.mn,mo,com.mo,net.mo,org.mo,edu.mo,gov.mo,mobi,mp,mq,mr,gov.mr,ms,com.ms,edu.ms,gov.ms,net.ms,org.ms,mt,com.mt,edu.mt,net.mt,org.mt,mu,com.mu,net.mu,org.mu,gov.mu,ac.mu,co.mu,or.mu,museum,mv,aero.mv,biz.mv,com.mv,coop.mv,edu.mv,gov.mv,info.mv,int.mv,mil.mv,museum.mv,name.mv,net.mv,org.mv,pro.mv,mw,ac.mw,biz.mw,co.mw,com.mw,coop.mw,edu.mw,gov.mw,int.mw,museum.mw,net.mw,org.mw,mx,com.mx,org.mx,gob.mx,edu.mx,net.mx,my,biz.my,com.my,edu.my,gov.my,mil.my,name.my,net.my,org.my,mz,ac.mz,adv.mz,co.mz,edu.mz,gov.mz,mil.mz,net.mz,org.mz,na,info.na,pro.na,name.na,school.na,or.na,dr.na,us.na,mx.na,ca.na,in.na,cc.na,tv.na,ws.na,mobi.na,co.na,com.na,org.na,name,nc,asso.nc,nom.nc,ne,net,nf,com.nf,net.nf,per.nf,rec.nf,web.nf,arts.nf,firm.nf,info.nf,other.nf,store.nf,ng,com.ng,edu.ng,gov.ng,i.ng,mil.ng,mobi.ng,name.ng,net.ng,org.ng,sch.ng,ni,ac.ni,biz.ni,co.ni,com.ni,edu.ni,gob.ni,in.ni,info.ni,int.ni,mil.ni,net.ni,nom.ni,org.ni,web.ni,nl,no,fhs.no,vgs.no,fylkesbibl.no,folkebibl.no,museum.no,idrett.no,priv.no,mil.no,stat.no,dep.no,kommune.no,herad.no,np,nr,biz.nr,info.nr,gov.nr,edu.nr,org.nr,net.nr,com.nr,nu,nz,ac.nz,co.nz,cri.nz,geek.nz,gen.nz,govt.nz,health.nz,iwi.nz,kiwi.nz,maori.nz,mil.nz,māori.nz,net.nz,org.nz,parliament.nz,school.nz,om,co.om,com.om,edu.om,gov.om,med.om,museum.om,net.om,org.om,pro.om,onion,org,pa,ac.pa,gob.pa,com.pa,org.pa,sld.pa,edu.pa,net.pa,ing.pa,abo.pa,med.pa,nom.pa,pe,edu.pe,gob.pe,nom.pe,mil.pe,org.pe,com.pe,net.pe,pf,com.pf,org.pf,edu.pf,pg,ph,com.ph,net.ph,org.ph,gov.ph,edu.ph,ngo.ph,mil.ph,i.ph,pk,com.pk,net.pk,edu.pk,org.pk,fam.pk,biz.pk,web.pk,gov.pk,gob.pk,gok.pk,gon.pk,gop.pk,gos.pk,info.pk,pl,com.pl,net.pl,org.pl,aid.pl,agro.pl,atm.pl,auto.pl,biz.pl,edu.pl,gmina.pl,gsm.pl,info.pl,mail.pl,miasta.pl,media.pl,mil.pl,nieruchomosci.pl,nom.pl,pc.pl,powiat.pl,priv.pl,realestate.pl,rel.pl,sex.pl,shop.pl,sklep.pl,sos.pl,szkola.pl,targi.pl,tm.pl,tourism.pl,travel.pl,turystyka.pl,pm,pn,gov.pn,co.pn,org.pn,edu.pn,net.pn,post,pr,com.pr,net.pr,org.pr,gov.pr,edu.pr,isla.pr,pro.pr,biz.pr,info.pr,name.pr,est.pr,prof.pr,ac.pr,pro,aaa.pro,aca.pro,acct.pro,avocat.pro,bar.pro,cpa.pro,eng.pro,jur.pro,law.pro,med.pro,recht.pro,ps,edu.ps,gov.ps,sec.ps,plo.ps,com.ps,org.ps,net.ps,pt,net.pt,gov.pt,org.pt,edu.pt,int.pt,publ.pt,com.pt,nome.pt,pw,co.pw,ne.pw,or.pw,ed.pw,go.pw,belau.pw,py,com.py,coop.py,edu.py,gov.py,mil.py,net.py,org.py,qa,com.qa,edu.qa,gov.qa,mil.qa,name.qa,net.qa,org.qa,sch.qa,re,asso.re,com.re,nom.re,ro,arts.ro,com.ro,firm.ro,info.ro,nom.ro,nt.ro,org.ro,rec.ro,store.ro,tm.ro,www.ro,rs,ac.rs,co.rs,edu.rs,gov.rs,in.rs,org.rs,ru,rw,ac.rw,co.rw,coop.rw,gov.rw,mil.rw,net.rw,org.rw,sa,com.sa,net.sa,org.sa,gov.sa,med.sa,pub.sa,edu.sa,sch.sa,sb,com.sb,edu.sb,gov.sb,net.sb,org.sb,sc,com.sc,gov.sc,net.sc,org.sc,edu.sc,sd,com.sd,net.sd,org.sd,edu.sd,med.sd,tv.sd,gov.sd,info.sd,se,a.se,ac.se,b.se,bd.se,brand.se,c.se,d.se,e.se,f.se,fh.se,fhsk.se,fhv.se,g.se,h.se,i.se,k.se,komforb.se,kommunalforbund.se,komvux.se,l.se,lanbib.se,m.se,n.se,naturbruksgymn.se,o.se,org.se,p.se,parti.se,pp.se,press.se,r.se,s.se,t.se,tm.se,u.se,w.se,x.se,y.se,z.se,sg,com.sg,net.sg,org.sg,gov.sg,edu.sg,per.sg,sh,com.sh,net.sh,gov.sh,org.sh,mil.sh,si,sj,sk,sl,com.sl,net.sl,edu.sl,gov.sl,org.sl,sm,sn,art.sn,com.sn,edu.sn,gouv.sn,org.sn,perso.sn,univ.sn,so,com.so,edu.so,gov.so,me.so,net.so,org.so,sr,ss,biz.ss,com.ss,edu.ss,gov.ss,me.ss,net.ss,org.ss,sch.ss,st,co.st,com.st,consulado.st,edu.st,embaixada.st,mil.st,net.st,org.st,principe.st,saotome.st,store.st,su,sv,com.sv,edu.sv,gob.sv,org.sv,red.sv,sx,gov.sx,sy,edu.sy,gov.sy,net.sy,mil.sy,com.sy,org.sy,sz,co.sz,ac.sz,org.sz,tc,td,tel,tf,tg,th,ac.th,co.th,go.th,in.th,mi.th,net.th,or.th,tj,ac.tj,biz.tj,co.tj,com.tj,edu.tj,go.tj,gov.tj,int.tj,mil.tj,name.tj,net.tj,nic.tj,org.tj,test.tj,web.tj,tk,tl,gov.tl,tm,com.tm,co.tm,org.tm,net.tm,nom.tm,gov.tm,mil.tm,edu.tm,tn,com.tn,ens.tn,fin.tn,gov.tn,ind.tn,info.tn,intl.tn,mincom.tn,nat.tn,net.tn,org.tn,perso.tn,tourism.tn,to,com.to,gov.to,net.to,org.to,edu.to,mil.to,tr,av.tr,bbs.tr,bel.tr,biz.tr,com.tr,dr.tr,edu.tr,gen.tr,gov.tr,info.tr,mil.tr,k12.tr,kep.tr,name.tr,net.tr,org.tr,pol.tr,tel.tr,tsk.tr,tv.tr,web.tr,nc.tr,tt,co.tt,com.tt,org.tt,net.tt,biz.tt,info.tt,pro.tt,int.tt,coop.tt,jobs.tt,mobi.tt,travel.tt,museum.tt,aero.tt,name.tt,gov.tt,edu.tt,tv,tw,edu.tw,gov.tw,mil.tw,com.tw,net.tw,org.tw,idv.tw,game.tw,ebiz.tw,club.tw,tz,ac.tz,co.tz,go.tz,hotel.tz,info.tz,me.tz,mil.tz,mobi.tz,ne.tz,or.tz,sc.tz,tv.tz,ua,com.ua,edu.ua,gov.ua,in.ua,net.ua,org.ua,ug,co.ug,or.ug,ac.ug,sc.ug,go.ug,ne.ug,com.ug,org.ug,uk,ac.uk,co.uk,gov.uk,ltd.uk,me.uk,net.uk,nhs.uk,org.uk,plc.uk,police.uk,us,dni.us,fed.us,isa.us,kids.us,nsn.us,ak.us,al.us,ar.us,as.us,az.us,ca.us,co.us,ct.us,dc.us,de.us,fl.us,ga.us,gu.us,hi.us,ia.us,id.us,il.us,in.us,ks.us,ky.us,la.us,ma.us,md.us,me.us,mi.us,mn.us,mo.us,ms.us,mt.us,nc.us,nd.us,ne.us,nh.us,nj.us,nm.us,nv.us,ny.us,oh.us,ok.us,or.us,pa.us,pr.us,ri.us,sc.us,sd.us,tn.us,tx.us,ut.us,vi.us,vt.us,va.us,wa.us,wi.us,wv.us,wy.us,uy,com.uy,edu.uy,gub.uy,mil.uy,net.uy,org.uy,uz,co.uz,com.uz,net.uz,org.uz,va,vc,com.vc,net.vc,org.vc,gov.vc,mil.vc,edu.vc,ve,arts.ve,bib.ve,co.ve,com.ve,e12.ve,edu.ve,firm.ve,gob.ve,gov.ve,info.ve,int.ve,mil.ve,net.ve,nom.ve,org.ve,rar.ve,rec.ve,store.ve,tec.ve,web.ve,vg,vi,co.vi,com.vi,k12.vi,net.vi,org.vi,vn,ac.vn,ai.vn,biz.vn,com.vn,edu.vn,gov.vn,health.vn,id.vn,info.vn,int.vn,io.vn,name.vn,net.vn,org.vn,pro.vn,vu,com.vu,edu.vu,net.vu,org.vu,wf,ws,com.ws,net.ws,org.ws,gov.ws,edu.ws,yt,ye,com.ye,edu.ye,gov.ye,net.ye,mil.ye,org.ye,ac.za,agric.za,alt.za,co.za,edu.za,gov.za,grondar.za,law.za,mil.za,net.za,ngo.za,nic.za,nis.za,nom.za,org.za,school.za,tm.za,web.za,zm,ac.zm,biz.zm,co.zm,com.zm,edu.zm,gov.zm,info.zm,mil.zm,net.zm,org.zm,sch.zm,zw,ac.zw,co.zw,gov.zw,mil.zw,org.zw".split(",");
@@ -513,6 +507,469 @@
513
507
  }
514
508
  }
515
509
 
510
+ class Processor {
511
+ constructor(options) {
512
+ this.selfOptions = options || {};
513
+ this.pipes = {};
514
+ }
515
+ options(options) {
516
+ if (options) {
517
+ this.selfOptions = options;
518
+ }
519
+ return this.selfOptions;
520
+ }
521
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
522
+ pipe(name, pipeArg) {
523
+ let pipe = pipeArg;
524
+ if (typeof name === "string") {
525
+ if (typeof pipe === "undefined") {
526
+ return this.pipes[name];
527
+ }
528
+ else {
529
+ this.pipes[name] = pipe;
530
+ }
531
+ }
532
+ if (name && name.name) {
533
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
534
+ pipe = name;
535
+ if (pipe.processor === this) {
536
+ return pipe;
537
+ }
538
+ this.pipes[pipe.name] = pipe;
539
+ }
540
+ pipe.processor = this;
541
+ return pipe;
542
+ }
543
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
544
+ process(input, pipe) {
545
+ let context = input;
546
+ context.options = this.options();
547
+ let nextPipe = pipe || input.pipe || "default";
548
+ let lastPipe;
549
+ while (nextPipe) {
550
+ if (typeof context.nextAfterChildren !== "undefined") {
551
+ // children processed and coming back to parent
552
+ context.next = context.nextAfterChildren;
553
+ context.nextAfterChildren = null;
554
+ }
555
+ if (typeof nextPipe === "string") {
556
+ nextPipe = this.pipe(nextPipe);
557
+ }
558
+ nextPipe.process(context);
559
+ lastPipe = nextPipe;
560
+ nextPipe = null;
561
+ if (context) {
562
+ if (context.next) {
563
+ context = context.next;
564
+ nextPipe = context.pipe || lastPipe;
565
+ }
566
+ }
567
+ }
568
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
569
+ return context.hasResult ? context.result : undefined;
570
+ }
571
+ }
572
+
573
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
574
+ class Pipe {
575
+ constructor(name) {
576
+ this.name = name;
577
+ this.filters = [];
578
+ }
579
+ process(input) {
580
+ if (!this.processor) {
581
+ throw new Error("add this pipe to a processor before using it");
582
+ }
583
+ const debug = this.debug;
584
+ const length = this.filters.length;
585
+ const context = input;
586
+ for (let index = 0; index < length; index++) {
587
+ const filter = this.filters[index];
588
+ if (debug) {
589
+ this.log(`filter: ${filter.filterName}`);
590
+ }
591
+ filter(context);
592
+ if (typeof context === "object" && context.exiting) {
593
+ context.exiting = false;
594
+ break;
595
+ }
596
+ }
597
+ if (!context.next && this.resultCheck) {
598
+ this.resultCheck(context);
599
+ }
600
+ }
601
+ log(msg) {
602
+ console.log(`[jsondiffpatch] ${this.name} pipe, ${msg}`);
603
+ }
604
+ append(...args) {
605
+ this.filters.push(...args);
606
+ return this;
607
+ }
608
+ prepend(...args) {
609
+ this.filters.unshift(...args);
610
+ return this;
611
+ }
612
+ indexOf(filterName) {
613
+ if (!filterName) {
614
+ throw new Error("a filter name is required");
615
+ }
616
+ for (let index = 0; index < this.filters.length; index++) {
617
+ const filter = this.filters[index];
618
+ if (filter.filterName === filterName) {
619
+ return index;
620
+ }
621
+ }
622
+ throw new Error(`filter not found: ${filterName}`);
623
+ }
624
+ list() {
625
+ return this.filters.map(f => f.filterName);
626
+ }
627
+ after(filterName, ...params) {
628
+ const index = this.indexOf(filterName);
629
+ this.filters.splice(index + 1, 0, ...params);
630
+ return this;
631
+ }
632
+ before(filterName, ...params) {
633
+ const index = this.indexOf(filterName);
634
+ this.filters.splice(index, 0, ...params);
635
+ return this;
636
+ }
637
+ replace(filterName, ...params) {
638
+ const index = this.indexOf(filterName);
639
+ this.filters.splice(index, 1, ...params);
640
+ return this;
641
+ }
642
+ remove(filterName) {
643
+ const index = this.indexOf(filterName);
644
+ this.filters.splice(index, 1);
645
+ return this;
646
+ }
647
+ clear() {
648
+ this.filters.length = 0;
649
+ return this;
650
+ }
651
+ shouldHaveResult(should) {
652
+ if (should === false) {
653
+ this.resultCheck = null;
654
+ return;
655
+ }
656
+ if (this.resultCheck) {
657
+ return;
658
+ }
659
+ this.resultCheck = context => {
660
+ if (!context.hasResult) {
661
+ console.log(context);
662
+ const error = new Error(`${this.name} failed`);
663
+ error.noResult = true;
664
+ throw error;
665
+ }
666
+ };
667
+ return this;
668
+ }
669
+ }
670
+
671
+ class Context {
672
+ setResult(result) {
673
+ this.result = result;
674
+ this.hasResult = true;
675
+ return this;
676
+ }
677
+ exit() {
678
+ this.exiting = true;
679
+ return this;
680
+ }
681
+ push(child, name) {
682
+ child.parent = this;
683
+ if (typeof name !== "undefined") {
684
+ child.childName = name;
685
+ }
686
+ child.root = this.root || this;
687
+ child.options = child.options || this.options;
688
+ if (!this.children) {
689
+ this.children = [child];
690
+ this.nextAfterChildren = this.next || null;
691
+ this.next = child;
692
+ }
693
+ else {
694
+ this.children[this.children.length - 1].next = child;
695
+ this.children.push(child);
696
+ }
697
+ child.next = this;
698
+ return this;
699
+ }
700
+ }
701
+
702
+ class DiffContext extends Context {
703
+ constructor(left, right) {
704
+ super();
705
+ this.left = left;
706
+ this.right = right;
707
+ this.pipe = "diff";
708
+ }
709
+ setResult(result) {
710
+ return super.setResult(result);
711
+ }
712
+ }
713
+
714
+ class PatchContext extends Context {
715
+ constructor(left, delta) {
716
+ super();
717
+ this.left = left;
718
+ this.delta = delta;
719
+ this.pipe = "patch";
720
+ }
721
+ }
722
+
723
+ function arrayEquals(a, b) {
724
+ if (a.length !== b.length) {
725
+ return false;
726
+ }
727
+ for (let i = 0; i < a.length; i++) {
728
+ if (a[i] !== b[i]) {
729
+ return false;
730
+ }
731
+ }
732
+ return true;
733
+ }
734
+ const diffFilter$1 = function trivialMatchesDiffFilter(context) {
735
+ if (context.left === context.right) {
736
+ context.setResult(undefined).exit();
737
+ return;
738
+ }
739
+ if (typeof context.left === "undefined") {
740
+ if (typeof context.right === "function") {
741
+ throw new Error("functions are not supported");
742
+ }
743
+ context.setResult([context.right]).exit();
744
+ return;
745
+ }
746
+ if (typeof context.right === "undefined") {
747
+ context.setResult([context.left, 0, 0]).exit();
748
+ return;
749
+ }
750
+ if (typeof context.left === "function" || typeof context.right === "function") {
751
+ throw new Error("functions are not supported");
752
+ }
753
+ context.leftType = context.left === null ? "null" : typeof context.left;
754
+ context.rightType = context.right === null ? "null" : typeof context.right;
755
+ if (context.leftType !== context.rightType) {
756
+ context.setResult([context.left, context.right]).exit();
757
+ return;
758
+ }
759
+ if (context.leftType === "boolean" || context.leftType === "number" || context.leftType === "string") {
760
+ context.setResult([context.left, context.right]).exit();
761
+ return;
762
+ }
763
+ if (context.leftType === "object") {
764
+ context.leftIsArray = Array.isArray(context.left);
765
+ }
766
+ if (context.rightType === "object") {
767
+ context.rightIsArray = Array.isArray(context.right);
768
+ }
769
+ if (context.leftIsArray !== context.rightIsArray) {
770
+ context.setResult([context.left, context.right]).exit();
771
+ return;
772
+ }
773
+ if (context.leftIsArray && context.rightIsArray) {
774
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
775
+ if (arrayEquals(context.left, context.right)) {
776
+ context.setResult(undefined).exit();
777
+ return;
778
+ }
779
+ else {
780
+ context.setResult([context.left, context.right]).exit();
781
+ return;
782
+ }
783
+ }
784
+ if (context.left instanceof RegExp) {
785
+ if (context.right instanceof RegExp) {
786
+ context.setResult([context.left.toString(), context.right.toString()]).exit();
787
+ }
788
+ else {
789
+ context.setResult([context.left, context.right]).exit();
790
+ }
791
+ }
792
+ };
793
+ diffFilter$1.filterName = "trivial";
794
+ const patchFilter$1 = function trivialMatchesPatchFilter(context) {
795
+ if (typeof context.delta === "undefined") {
796
+ context.setResult(context.left).exit();
797
+ return;
798
+ }
799
+ context.nested = !Array.isArray(context.delta);
800
+ if (context.nested) {
801
+ return;
802
+ }
803
+ const nonNestedDelta = context.delta;
804
+ if (nonNestedDelta.length === 1) {
805
+ context.setResult(nonNestedDelta[0]).exit();
806
+ return;
807
+ }
808
+ if (nonNestedDelta.length === 2) {
809
+ if (context.left instanceof RegExp) {
810
+ const regexArgs = /^\/(.*)\/([gimyu]+)$/.exec(nonNestedDelta[1]);
811
+ if (regexArgs) {
812
+ context.setResult(new RegExp(regexArgs[1], regexArgs[2])).exit();
813
+ return;
814
+ }
815
+ }
816
+ context.setResult(nonNestedDelta[1]).exit();
817
+ return;
818
+ }
819
+ if (nonNestedDelta.length === 3 && nonNestedDelta[2] === 0) {
820
+ context.setResult(undefined).exit();
821
+ }
822
+ };
823
+ patchFilter$1.filterName = "trivial";
824
+
825
+ const collectChildrenDiffFilter = context => {
826
+ if (!context || !context.children) {
827
+ return;
828
+ }
829
+ const length = context.children.length;
830
+ let child;
831
+ let result = context.result;
832
+ for (let index = 0; index < length; index++) {
833
+ child = context.children[index];
834
+ if (typeof child.result === "undefined") {
835
+ continue;
836
+ }
837
+ result = result || {};
838
+ result[child.childName] = child.result;
839
+ }
840
+ if (result && context.leftIsArray) {
841
+ result._t = "a";
842
+ }
843
+ context.setResult(result).exit();
844
+ };
845
+ collectChildrenDiffFilter.filterName = "collectChildren";
846
+ const objectsDiffFilter = context => {
847
+ if (context.leftIsArray || context.leftType !== "object") {
848
+ return;
849
+ }
850
+ const left = context.left;
851
+ const right = context.right;
852
+ let name;
853
+ let child;
854
+ const propertyFilter = context.options.propertyFilter;
855
+ for (name in left) {
856
+ if (!Object.prototype.hasOwnProperty.call(left, name)) {
857
+ continue;
858
+ }
859
+ if (propertyFilter && !propertyFilter(name, context)) {
860
+ continue;
861
+ }
862
+ child = new DiffContext(left[name], right[name]);
863
+ context.push(child, name);
864
+ }
865
+ for (name in right) {
866
+ if (!Object.prototype.hasOwnProperty.call(right, name)) {
867
+ continue;
868
+ }
869
+ if (propertyFilter && !propertyFilter(name, context)) {
870
+ continue;
871
+ }
872
+ if (typeof left[name] === "undefined") {
873
+ child = new DiffContext(undefined, right[name]);
874
+ context.push(child, name);
875
+ }
876
+ }
877
+ if (!context.children || context.children.length === 0) {
878
+ context.setResult(undefined).exit();
879
+ return;
880
+ }
881
+ context.exit();
882
+ };
883
+ objectsDiffFilter.filterName = "objects";
884
+ const patchFilter = function nestedPatchFilter(context) {
885
+ if (!context.nested) {
886
+ return;
887
+ }
888
+ const nestedDelta = context.delta;
889
+ if (nestedDelta._t) {
890
+ return;
891
+ }
892
+ const objectDelta = nestedDelta;
893
+ let name;
894
+ let child;
895
+ for (name in objectDelta) {
896
+ child = new PatchContext(context.left[name], objectDelta[name]);
897
+ context.push(child, name);
898
+ }
899
+ context.exit();
900
+ };
901
+ patchFilter.filterName = "objects";
902
+ const collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {
903
+ if (!context || !context.children) {
904
+ return;
905
+ }
906
+ const deltaWithChildren = context.delta;
907
+ if (deltaWithChildren._t) {
908
+ return;
909
+ }
910
+ const object = context.left;
911
+ const length = context.children.length;
912
+ let child;
913
+ for (let index = 0; index < length; index++) {
914
+ child = context.children[index];
915
+ const property = child.childName;
916
+ if (Object.prototype.hasOwnProperty.call(context.left, property) && child.result === undefined) {
917
+ delete object[property];
918
+ }
919
+ else if (object[property] !== child.result) {
920
+ object[property] = child.result;
921
+ }
922
+ }
923
+ context.setResult(object).exit();
924
+ };
925
+ collectChildrenPatchFilter.filterName = "collectChildren";
926
+
927
+ const diffFilter = function datesDiffFilter(context) {
928
+ if (context.left instanceof Date) {
929
+ if (context.right instanceof Date) {
930
+ if (context.left.getTime() !== context.right.getTime()) {
931
+ context.setResult([context.left, context.right]);
932
+ }
933
+ else {
934
+ context.setResult(undefined);
935
+ }
936
+ }
937
+ else {
938
+ context.setResult([context.left, context.right]);
939
+ }
940
+ context.exit();
941
+ }
942
+ else if (context.right instanceof Date) {
943
+ context.setResult([context.left, context.right]).exit();
944
+ }
945
+ };
946
+ diffFilter.filterName = "dates";
947
+
948
+ class DiffPatcher {
949
+ constructor(options) {
950
+ this.processor = new Processor(options);
951
+ this.processor.pipe(new Pipe("diff")
952
+ .append(collectChildrenDiffFilter, diffFilter$1, diffFilter, objectsDiffFilter)
953
+ .shouldHaveResult());
954
+ this.processor.pipe(new Pipe("patch")
955
+ .append(collectChildrenPatchFilter, patchFilter$1, patchFilter)
956
+ .shouldHaveResult());
957
+ }
958
+ options(options) {
959
+ return this.processor.options(options);
960
+ }
961
+ diff(left, right) {
962
+ return this.processor.process(new DiffContext(left, right));
963
+ }
964
+ patch(left, delta) {
965
+ return this.processor.process(new PatchContext(left, delta));
966
+ }
967
+ }
968
+
969
+ function create(options) {
970
+ return new DiffPatcher(options);
971
+ }
972
+
516
973
  /* global analytics */
517
974
  var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
518
975
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -523,6 +980,7 @@
523
980
  step((generator = generator.apply(thisArg, _arguments || [])).next());
524
981
  });
525
982
  };
983
+ const diff = create();
526
984
  const defaultConfig = {
527
985
  /* Your segment writeKey */
528
986
  writeKey: null,
@@ -533,6 +991,7 @@
533
991
  echoEvents: false,
534
992
  cookieDomain: undefined,
535
993
  runtime: undefined,
994
+ fetchTimeoutMs: undefined,
536
995
  s2s: undefined,
537
996
  };
538
997
  const parseQuery = (qs) => {
@@ -833,13 +1292,22 @@
833
1292
  delete withContext.options;
834
1293
  return withContext;
835
1294
  }
1295
+ function isDiff(obj) {
1296
+ const keys = Object.keys(obj);
1297
+ return keys.length === 1 && keys[0] === "__diff";
1298
+ }
836
1299
  function processDestinations(destinations, method, originalEvent, debug, analyticsInstance) {
837
1300
  return __awaiter$1(this, void 0, void 0, function* () {
838
1301
  const promises = [];
839
1302
  for (const destination of destinations) {
840
1303
  let newEvents = [originalEvent];
841
1304
  if (destination.newEvents) {
842
- newEvents = destination.newEvents.map(e => (e === "same" ? originalEvent : e));
1305
+ try {
1306
+ newEvents = destination.newEvents.map(e => e === "same" ? originalEvent : isDiff(e) ? diff.patch(originalEvent, e.__diff) : e);
1307
+ }
1308
+ catch (e) {
1309
+ console.error(`[JITSU] Error applying '${destination.id}' changes to event: ${e === null || e === void 0 ? void 0 : e.message}`, e);
1310
+ }
843
1311
  }
844
1312
  const credentials = Object.assign(Object.assign({}, destination.credentials), destination.options);
845
1313
  if (destination.deviceOptions.type === "internal-plugin") {
@@ -942,6 +1410,12 @@
942
1410
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
943
1411
  // }
944
1412
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store, s2s);
1413
+ const abortController = jitsuConfig.fetchTimeoutMs ? new AbortController() : undefined;
1414
+ const abortTimeout = jitsuConfig.fetchTimeoutMs
1415
+ ? setTimeout(() => {
1416
+ abortController.abort();
1417
+ }, jitsuConfig.fetchTimeoutMs)
1418
+ : undefined;
945
1419
  const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": jitsuConfig.writeKey } : {};
946
1420
  let fetchResult;
947
1421
  try {
@@ -949,7 +1423,11 @@
949
1423
  method: "POST",
950
1424
  headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, authHeader), debugHeader),
951
1425
  body: JSON.stringify(adjustedPayload),
1426
+ signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
952
1427
  });
1428
+ if (abortTimeout) {
1429
+ clearTimeout(abortTimeout);
1430
+ }
953
1431
  }
954
1432
  catch (e) {
955
1433
  throw new Error(`Calling ${url} failed: ${e.message}`);
@@ -1177,15 +1655,15 @@
1177
1655
  }, setAnonymousId: (id) => {
1178
1656
  if (opts.debug) {
1179
1657
  console.log("[JITSU DEBUG] Setting anonymous id to " + id);
1180
- //Workaround for analytics.js bug. Underlying setAnonymousId doesn't work set the id immediately,
1181
- //so we got to it manually here. See https://github.com/jitsucom/jitsu/issues/1060
1182
- storage.setItem("__anon_id", id);
1183
- const userState = analytics.user();
1184
- if (userState) {
1185
- userState.anonymousId = id;
1186
- }
1187
- analytics.setAnonymousId(id);
1188
1658
  }
1659
+ //Workaround for analytics.js bug. Underlying setAnonymousId doesn't work set the id immediately,
1660
+ //so we got to it manually here. See https://github.com/jitsucom/jitsu/issues/1060
1661
+ storage.setItem("__anon_id", id);
1662
+ const userState = analytics.user();
1663
+ if (userState) {
1664
+ userState.anonymousId = id;
1665
+ }
1666
+ analytics.setAnonymousId(id);
1189
1667
  }, group(groupId, traits, options, callback) {
1190
1668
  return __awaiter(this, void 0, void 0, function* () {
1191
1669
  const results = [];
@@ -1248,6 +1726,23 @@
1248
1726
  .map(name => name.substring("data-".length))
1249
1727
  .reduce((res, name) => (Object.assign(Object.assign({}, res), { [snakeToCamel(name)]: getParser(snakeToCamel(name))(scriptElement.getAttribute(`data-${name}`)) })), {});
1250
1728
  }
1729
+ function runCallback(callback, jitsu) {
1730
+ if (typeof callback === "function") {
1731
+ callback(jitsu);
1732
+ }
1733
+ else if (Array.isArray(callback) && typeof callback[0] === "string") {
1734
+ const [method, ...args] = callback;
1735
+ if (typeof jitsu[method] === "function") {
1736
+ jitsu[method](...args);
1737
+ }
1738
+ else {
1739
+ console.warn(`Method ${method} is not supported, ignoring callback`);
1740
+ }
1741
+ }
1742
+ else {
1743
+ console.warn(`Invalid jitsu queue callback`, callback);
1744
+ }
1745
+ }
1251
1746
  (function () {
1252
1747
  function readJitsuOptions() {
1253
1748
  const scriptElement = window.document.currentScript;
@@ -1297,7 +1792,7 @@
1297
1792
  }
1298
1793
  callbackQueue.forEach((callback) => {
1299
1794
  try {
1300
- callback(jitsu);
1795
+ runCallback(callback, jitsu);
1301
1796
  }
1302
1797
  catch (e) {
1303
1798
  console.warn(`Error processing callback from Jitsu queue`, e);