@braze/web-sdk 3.5.0 → 3.5.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/appboy.min.js +7 -7
- package/index.d.ts +4 -2
- package/package.json +1 -1
package/appboy.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Braze Web SDK v3.5.
|
|
2
|
+
* Braze Web SDK v3.5.1
|
|
3
3
|
* (c) Braze, Inc. 2022 - http://braze.com
|
|
4
4
|
* License available at https://github.com/Appboy/appboy-web-sdk/blob/master/LICENSE
|
|
5
|
-
* Compiled on 2022-
|
|
5
|
+
* Compiled on 2022-03-24
|
|
6
6
|
*/
|
|
7
7
|
(function(){(function(b,a){if("function"===typeof define&&define.amd)define([],a);else if("object"===typeof module&&module.exports){var e = a();module.exports=e;module.exports.default=e}else if(b.appboy){var d=a(),c;for(c in d)b.appboy[c]=d[c]}else b.appboy=a()})("undefined"!==typeof self?self:this,function(){var appboyInterface={};var p;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}var ca="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},da="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
|
|
8
8
|
function ea(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var fa=ea(this);function ha(a,b){if(b)a:{var c=fa;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&da(c,a,{configurable:!0,writable:!0,value:b})}}var ia;
|
|
@@ -25,7 +25,7 @@ typeof d&&d())},d):"function"===typeof d&&d()}function va(a,b,c){sa(a)&&ta(a,fun
|
|
|
25
25
|
function wa(a,b,c){sa(a)&&ta(a,function(d){if(d.objectStoreNames.contains(b)){var e=d.transaction([b],"readwrite").objectStore(b);d=e.openCursor();var f=[];d.onerror=function(){0<f.length?(a.F.info("Cursor closed midway through for "+b+" on indexedDB "+a.C.P),c(f)):a.F.error("Could not open cursor for "+b+" on indexedDB "+a.C.P)};d.onsuccess=function(g){var h=g.target.result;null!=h?(null!=h.value&&null!=h.key&&(e["delete"](h.key).onsuccess=function(){f.push(h.value)}),h.continue()):0<f.length&&c(f)}}else a.F.error("Could not retrieve objects from "+
|
|
26
26
|
b+" on indexedDB "+a.C.P+" - "+b+" is not a valid objectStore")})}
|
|
27
27
|
qa.prototype.clearData=function(){if(!sa(this))return!1;var a=[],b;for(b in this.C.G)this.C.G.hasOwnProperty(b)&&this.C.G[b]!==this.C.G.xb&&a.push(this.C.G[b]);var c=this;return ta(this,function(d){d=d.transaction(a,"readwrite");for(var e=0;e<a.length;e++)d.objectStore(a[e]).clear().onerror=function(){c.F.error("Could not clear "+this.source.name+" on indexedDB "+c.C.P)};d.onerror=function(){c.F.error("Could not clear object stores on indexedDB "+c.C.P)}})};var xa={Gd:function(a){if(void 0!==a||void 0===xa.Ea)xa.Ea=!!a;xa.He||(xa.He=!0)},Jb:function(){xa.He=!1;xa.Ea=void 0;xa.F=void 0},Td:function(a){"function"!==typeof a?xa.info("Ignoring setLogger call since logger is not a function"):(xa.Gd(),xa.F=a)},Yd:function(){xa.Gd();xa.Ea?(console.log("Disabling Appboy logging"),xa.Ea=!1):(console.log("Enabled Appboy logging"),xa.Ea=!0)},info:function(a){xa.Ea&&(a="Appboy: "+a,null!=xa.F?xa.F(a):console.log(a))},warn:function(a){xa.Ea&&(a="Appboy SDK Warning: "+
|
|
28
|
-
a+" (v3.5.
|
|
28
|
+
a+" (v3.5.1)",null!=xa.F?xa.F(a):console.warn(a))},error:function(a){xa.Ea&&(a="Appboy SDK Error: "+a+" (v3.5.1)",null!=xa.F?xa.F(a):console.error(a))}};var z={CustomEvent:"ce",eg:"p",sg:"pc",$h:"ca",fg:"i",Yc:"ie",Jf:"cci",Lf:"ccic",Hf:"ccc",If:"ccd",ve:"ss",yg:"se",dg:"si",ke:"sc",je:"sbc",cg:"sfe",Mf:"iec",lg:"lr",Df:"uae",Gf:"ci",Ff:"cc",jg:"lcaa",kg:"lcar",Of:"inc",Nf:"add",Pf:"rem",Qf:"set",zg:"sgu"},ya={$f:"feed_displayed",Kf:"content_cards_displayed"},za={ba:{P:"AppboyServiceWorkerAsyncStorage",VERSION:6,G:{Rf:"data",oe:"pushClicks",gd:"pushSubscribed",Yh:"fallbackDevice",Ef:"cardUpdates",xb:"optOut",me:"pendingData",qe:"sdkAuthenticationSignature"},
|
|
29
29
|
kb:1}},x=xa,C={Af:"allowCrawlerActivity",Rc:"baseUrl",ng:"noCookies",ee:"devicePropertyAllowlist",Vc:"devicePropertyWhitelist",Wf:"disablePushTokenMaintenance",Yf:"enableLogging",Zf:"enableSdkAuthentication",mg:"manageServiceWorkerExternally",ag:"minimumIntervalBetweenTriggerActionsInSeconds",xg:"sessionTimeoutInSeconds",Cf:"appVersion",wg:"serviceWorkerLocation",ug:"safariWebsitePushId",cd:"localization",be:"contentSecurityNonce",fe:"enableHtmlInAppMessages",Zd:"allowUserSuppliedJavascript",bg:"inAppMessageZIndex",
|
|
30
30
|
pg:"openInAppMessagesInNewTab",qg:"openNewsFeedCardsInNewTab",tg:"requireExplicitInAppMessageDismissal",Xf:"doNotLoadFontAwesome",re:"sdkFlavor",$c:"language",og:"openCardsInNewTab"};function Aa(a,b,c,d){a=Ba(a);return-1===a.indexOf(b)?(x.error(c+" Valid values from "+d+' are "'+a.join('"/"')+'".'),!1):!0}function Ca(a){return Array.isArray?Array.isArray(a):"[object Array]"===Object.prototype.toString.call(a)}function Da(a){return"[object Date]"===Object.prototype.toString.call(a)}function Ea(a){return"[object Object]"===Object.prototype.toString.call(a)}
|
|
31
31
|
function Fa(a){null==a&&(a=[]);for(var b=[],c=arguments.length,d=0,e=a.length;d<e;d++){var f=a[d];if(-1===b.indexOf(f)){var g;for(g=1;g<c&&-1!==arguments[g].indexOf(f);g++);g===c&&b.push(f)}}return b}function Ga(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c);return b}function Ba(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&void 0!==a[c]&&b.push(a[c]);return b}
|
|
@@ -210,7 +210,7 @@ c)):q&&Ca(q)?ef(d,h,g,l,b,c):null==m?(x.info("No push subscription creation date
|
|
|
210
210
|
g)})},function(){var g="Permission for push notifications was ignored.";d.Ka()&&(g+=" The browser has automatically blocked further permission requests for a period (probably 1 week).");x.info(g);"function"===typeof c&&c(!0)},function(){x.info("Permission for push notifications was denied.");"function"===typeof c&&c(!1)})}}else this.vd&&(null==a||""===a?x.error("You must supply the safariWebsitePushId argument in order to use registerAppboyPushMessages on Safari"):(e=window.safari.pushNotification.permission(a),
|
|
211
211
|
jf(this,a,e,b,c)));else x.info(this.ed)};
|
|
212
212
|
p.unsubscribe=function(a,b){var c=this;this.qa()?this.vc?navigator.serviceWorker.getRegistration().then(function(d){d&&d.pushManager.getSubscription().then(function(e){e&&(c.Fa.Sb(!0),e.unsubscribe().then(function(f){f?(x.info("Device successfully unsubscribed from push."),"function"===typeof a&&a()):(x.error("Failed to unsubscribe device from push."),"function"===typeof b&&b());c.rd||(d.unregister(),x.info("Service worker successfully unregistered."))}).catch(function(f){x.error("Push unsubscription error: "+f);
|
|
213
|
-
"function"===typeof b&&b()}))}).catch(function(e){x.error("Error unsubscribing from push: "+e);"function"===typeof b&&b()})}):this.vd&&(this.Fa.Sb(!0),x.info("Device unsubscribed from push."),"function"===typeof a&&a()):x.info(this.ed)};function Je(a,b,c,d,e,f,g){this.Nb=a||0;this.cf=b||[];this.Ve=c||[];this.mf=d||[];this.Ld=e;if(null==e||""===e)this.Ld=null;this.ra=f||null;this.Hb=g||{}}Je.prototype.A=function(){return{s:"3.5.
|
|
213
|
+
"function"===typeof b&&b()}))}).catch(function(e){x.error("Error unsubscribing from push: "+e);"function"===typeof b&&b()})}):this.vd&&(this.Fa.Sb(!0),x.info("Device unsubscribed from push."),"function"===typeof a&&a()):x.info(this.ed)};function Je(a,b,c,d,e,f,g){this.Nb=a||0;this.cf=b||[];this.Ve=c||[];this.mf=d||[];this.Ld=e;if(null==e||""===e)this.Ld=null;this.ra=f||null;this.Hb=g||{}}Je.prototype.A=function(){return{s:"3.5.1",l:this.Nb,e:this.cf,a:this.Ve,p:this.mf,m:this.Ld,v:this.ra,c:this.Hb}};function mf(a){this.b=a;this.xd=new Nb;this.Ae=new Nb;this.uc=null}function Ie(a){if(null==a.uc){var b=S(a.b,M.te);if(null!=b){var c=b.l;"3.5.1"!==b.s&&(c=0);b=new Je(c,b.e,b.a,b.p,b.m,b.v,b.c)}else b=new Je;a.uc=b}return a.uc}function lf(a,b){b=Ob(a.xd,b);a.Be&&a.xd.N(a.Be);a.Be=b}function nf(a,b){Ob(a.Ae,b)}function ib(a,b){return-1!==Ie(a).Ve.indexOf(b)};function of(a,b,c,d){this.b=a;this.f=b;this.J=c;this.Cb=1E3;d=parseFloat(d);isNaN(d)&&(d=1800);d<this.Cb/1E3&&(x.info("Specified session timeout of "+d+"s is too small, using the minimum session timeout of "+this.Cb/1E3+"s instead."),d=this.Cb/1E3);this.Lg=d}function Te(a,b,c){return new E(a.f.o(),z.yg,b,c.ia,{d:Ia(b-c.Ib)})}of.prototype.Kb=function(){var a=zb(this.b,Cb.Ta);return null==a?null:a.ia};
|
|
214
214
|
function He(a){var b=(new Date).valueOf(),c=Ie(a.J).Ld,d=S(a.b,M.hc);if(null!=d&&null==c)return!1;(c=null==d||b-d>1E3*c)&&O(a.b,M.hc,b);return c}
|
|
215
215
|
function ab(a){var b=(new Date).valueOf(),c=b+1E3*a.Lg,d=zb(a.b,Cb.Ta);if(null==d||(b-d.Ib<a.Cb?0:d.Cd<b)){var e="Generating session start event with time "+b;if(null!=d){var f=d.Ob;f-d.Ib<a.Cb&&(f=d.Ib+a.ai);d=Te(a,f,d);null==d||bb(a.b,[d]);e+=" (old session ended "+f+")"}e+=". Will expire "+c.valueOf();x.info(e);c=new Oa(pa.Ia(),c);e=new E(a.f.o(),z.ve,b,c.ia);null==e||bb(a.b,[e]);xb(a.b,Cb.Ta,c);null==S(a.b,M.hc)&&O(a.b,M.hc,b);return c.ia}d.Ob=b;d.Cd=c;xb(a.b,Cb.Ta,d);return d.ia};function pf(a,b){var c=!1;try{if(localStorage&&localStorage.getItem)try{localStorage.setItem(M.jd,!0),localStorage.getItem(M.jd)&&(localStorage.removeItem(M.jd),c=!0)}catch(e){if(("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&0<localStorage.length)c=!0;else throw e;}}catch(e){x.info("Local Storage not supported!")}var d=navigator.cookieEnabled||"cookie"in document&&(0<document.cookie.length||-1<(document.cookie="test").indexOf.call(document.cookie,"test"));b=new Mb(a,d&&!b,
|
|
216
216
|
c);return new wb(b,c?new Hb(a):new Lb)};function qf(a,b){this.J=a;this.b=b}qf.prototype.o=function(){var a=zb(this.b,Cb.lc);if(null==a)return null;var b=a.ia,c=Pa(b);if(997<c){for(;997<c;)b=b.slice(0,b.length-1),c=Pa(b);a.ia=b;xb(this.b,Cb.lc,a)}return b};qf.prototype.Sd=function(a,b){if(ib(this.J,a))return x.info('Custom Attribute "'+a+'" is blocklisted, ignoring.'),!1;var c={};c[a]=b;return cb(this,"custom",c)};function cb(a,b,c){return Fb(a.b,a.o(),b,c)}
|
|
@@ -237,13 +237,13 @@ switch(b.type){case ve.Xc:var l=Ec(b.data);if(null==l){x.error("Could not parse
|
|
|
237
237
|
Bf.prototype.pa=function(a,b,c){var d=this;if(Aa(de,a,"Cannot fire trigger action.","TriggerEvents"))if(0<this.H.lb)x.info("Trigger sync is currently in progress, awaiting sync completion before firing trigger event."),this.oc.push(arguments);else{(S(this.b,M.md)||0)>this.wd?Cf(this):Ef(this);for(var e=(new Date).valueOf(),f=e-this.Ba,g=!0,h=!0,l=[],k=0;k<this.T.length;k++){var m=this.T[k],q=e+1E3*m.ab;if((null==m.Ca||m.Rb!==se&&q-m.Ca>=1E3*m.Rb)&&(null==m.startTime||m.startTime<=e)&&(null==m.endTime||
|
|
238
238
|
m.endTime>=e)){for(var v=!1,t=0;t<m.ob.length;t++)if(fe(m.ob[t],a,b)){v=!0;break}v&&(g=!1,Hf(this,m,q,a)&&(h=!1,l.push(m)))}}if(g)x.info("Trigger event "+a+" did not match any trigger conditions.");else if(h)x.info("Ignoring "+a+" trigger event because a trigger was displayed "+f/1E3+"s ago.");else{l.sort(function(r,F){return r.priority-F.priority});var w=l.pop();null!=w&&(x.info("Firing "+w.type+" trigger action "+w.id+" from trigger event "+a+"."),Gf(this,w,e,a,c,l),0===w.ab?Ff(this,w,e,a,c,l):
|
|
239
239
|
this.na.push(setTimeout(function(){Ff(d,w,e,a,c,l)},1E3*w.ab)))}}};Bf.prototype.$a=function(a){this.T=[];Bb(this.b,M.kd);if(!a){this.oc=[];this.Ba=null;this.Y={};this.L={};for(a=0;a<this.na.length;a++)clearTimeout(this.na[a]);this.na=[];Bb(this.b,M.ad);Bb(this.b,M.fc);Bb(this.b,M.zb);Bb(this.b,M.hg);Bb(this.b,M.gg);Bb(this.b,M.ig)}};Bf.prototype.clearData=function(){this.T=[];this.Ba=null;this.Y={};this.L={};for(var a=0;a<this.na.length;a++)clearTimeout(this.na[a]);this.na=[]};
|
|
240
|
-
function Hf(a,b,c,d){if(null==a.Ba)return!0;if(d===de.V)return x.info("Ignoring minimum interval between trigger because it is a test type."),!0;b=b.kf;null==b&&(b=a.Ig);return c-a.Ba>=1E3*b}function Gf(a,b,c,d,e,f){Ef(a);a.L[b.id]=a.L[b.id]||[];var g={};g.Ec=c;g.wf=d;var h;null!=e&&(h=e.A());g.yd=h;c=[];for(d=0;d<f.length;d++)c.push(f[d].id);g.Dd=c;a.L[b.id].push(g);O(a.b,M.zb,a.L)};var If={GOOGLE_TAG_MANAGER:"gg",MPARTICLE:"mp",SEGMENT:"sg",TEALIUM:"tl",MANUAL:"manu",NPM:"npm",CDN:"wcd"};J.BrazeSdkMetadata=If;"undefined"===typeof console&&(window.console={log:function(){}});var Jf=window.Element.prototype;"function"!==typeof Jf.matches&&(Jf.matches=Jf.msMatchesSelector||Jf.mozMatchesSelector||Jf.webkitMatchesSelector||function(a){a=(this.document||this.ownerDocument).querySelectorAll(a);for(var b=0;a[b]&&a[b]!==this;)++b;return!!a[b]});
|
|
240
|
+
function Hf(a,b,c,d){if(null==a.Ba)return!0;if(d===de.V)return x.info("Ignoring minimum interval between trigger because it is a test type."),!0;b=b.kf;null==b&&(b=a.Ig);return c-a.Ba>=1E3*b}function Gf(a,b,c,d,e,f){Ef(a);a.L[b.id]=a.L[b.id]||[];var g={};g.Ec=c;g.wf=d;var h;null!=e&&(h=e.A());g.yd=h;c=[];for(d=0;d<f.length;d++)c.push(f[d].id);g.Dd=c;a.L[b.id].push(g);O(a.b,M.zb,a.L)};var If={GOOGLE_TAG_MANAGER:"gg",MPARTICLE:"mp",SEGMENT:"sg",TEALIUM:"tl",MANUAL:"manu",NPM:"npm",CDN:"wcd",SHOPIFY:"shp"};J.BrazeSdkMetadata=If;"undefined"===typeof console&&(window.console={log:function(){}});var Jf=window.Element.prototype;"function"!==typeof Jf.matches&&(Jf.matches=Jf.msMatchesSelector||Jf.mozMatchesSelector||Jf.webkitMatchesSelector||function(a){a=(this.document||this.ownerDocument).querySelectorAll(a);for(var b=0;a[b]&&a[b]!==this;)++b;return!!a[b]});
|
|
241
241
|
Element.prototype.closest||(Element.prototype.closest=function(a){var b=this;if(!document.documentElement.contains(b))return null;do{if(b.matches(a))return b;b=b.parentElement||b.parentNode}while(null!==b&&1===b.nodeType);return null});
|
|
242
242
|
if("function"!==typeof window.CustomEvent){var Kf=function(a,b){b=b||{bubbles:!1,cancelable:!1,detail:null};var c=document.createEvent("CustomEvent");c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail);return c};Kf.prototype=window.Event.prototype;window.CustomEvent=Kf};var Lf;"object"===typeof module&&module.exports?Lf=module.exports:(window.appboy||(window.appboy={}),Lf=window.appboy);var Mf=Lf;var X=new function(a){function b(n,u,y){n="The '"+n+"' "+u+" is deprecated.";y&&(n+=" Please use '"+y+"' instead.");x.warn(n)}function c(){x.Jb();V&&(Pb(L),L.K(),w.clearData(!1),w=null,D.clearData(!1),D=null,t.K(),t=null,G.K(),G=null,r.K(),r=null,q.K(),q=null,k.Jb(),H=k=null,af(A),m=f=h=A=null,I=[],l=null);Q=V=!1}function d(){if(Q)return!1;if(!V)throw Error("Appboy must be initialized before calling methods.");return!0}var e={Ug:function(n,u,y){return new rf(n,u,y)},Wg:function(n,u){return new Ze(n,
|
|
243
243
|
u)},$g:function(n,u,y,B,P,R,Y,Db,Xa,Rf){null==P&&(P={});var Ee=new qf(Xa,Y),Sf=new of(Y,Ee,Xa,P[C.xg]);return new ye(n,y,B,P[C.Cf],u,Sf,Db,Ee,Xa,Y,R,Rf)},Bc:function(){return new Nb},Xg:function(n,u){return new yf(n,u)},Vg:function(n,u,y,B){return new tf(n,u,y,B)},ah:function(n,u,y,B){return new Bf(n,u,y,B)},Zg:function(n,u,y,B,P,R,Y){null==P&&(P={});return new cf(n,u,y,B+"/safari/"+u,P[C.wg],P[C.ug],R,P[C.mg],P[C.Wf],Y)},Yg:function(n){return new $e(n)}};null==a&&(a=e);var f,g,h,l,k,m,q,v,t,w,r,
|
|
244
244
|
F,D,G,H,A,N=new Nb,L=new Nb,I=[],V=!1,Q=!1;return{Oh:function(n){return Ob(N,n)},Nh:function(n){return Ob(L,n)},Hd:function(n,u){if(V)return x.info("Braze has already been initialized with an API key."),!0;x.Gd(null!=u&&u[C.Yf]);if(null==n||""===n||"string"!==typeof n)return x.error("Braze requires a valid API key to be initialized."),!1;f=n;h=u||{};if(vb.lh&&!h[C.Af])return x.info("Ignoring activity from crawler bot "+navigator.userAgent),Q=!0,!1;g=u=pf(n,h[C.ng]||!1);var y=new Ib(null,!0);if(y.Z("ab.optOut"))return x.info("Ignoring all activity due to previous opt out"),
|
|
245
245
|
y.store("ab.optOut","This-cookie-will-expire-in-"+Jb(y)),Q=!0,!1;y=ba(Ga(h));for(var B=y.next();!B.done;B=y.next())B=B.value,-1===Ba(C).indexOf(B)&&x.warn("Ignoring unknown initialization option '"+B+"'.");y=["mparticle","wordpress","tealium"];null!=h[C.re]&&(B=h[C.re],-1!==y.indexOf(B)?l=B:x.error("Invalid sdk flavor passed: "+B));var P=[];t=a.Bc();I.push(t);w=a.Xg(t,u);P.push(w);G=a.Bc();I.push(G);y=h[C.Rc];if(null==y||""===y||"string"!==typeof y)return x.error("Braze requires a valid SDK Endpoint to be initialized. Please set the 'baseUrl' initialization option to the value of your SDK Endpoint."),
|
|
246
|
-
!1;y=y.replace(/(\.[a-z]+)[^\.]*$/i,"$1/api/v3");0!==y.indexOf("http")&&(y="https://"+y);B=h[C.ee]||h[C.Vc];h[C.Vc]&&b(C.Vc,"initialization option",C.ee);if(null!=B)if(Ca(B)){for(var R=[],Y=0;Y<B.length;Y++)Aa(Xe,B[Y],"devicePropertyAllowlist contained an invalid value.","DeviceProperties")&&R.push(B[Y]);B=R}else x.error("devicePropertyAllowlist must be an array. Defaulting to all properties."),B=null;v=a.Wg(u,B);B=new mf(u);q=a.Bc();m=a.Ug(u,h[C.Zf],q);I.push(q);k=a.$g(f,y,"3.5.
|
|
246
|
+
!1;y=y.replace(/(\.[a-z]+)[^\.]*$/i,"$1/api/v3");0!==y.indexOf("http")&&(y="https://"+y);B=h[C.ee]||h[C.Vc];h[C.Vc]&&b(C.Vc,"initialization option",C.ee);if(null!=B)if(Ca(B)){for(var R=[],Y=0;Y<B.length;Y++)Aa(Xe,B[Y],"devicePropertyAllowlist contained an invalid value.","DeviceProperties")&&R.push(B[Y]);B=R}else x.error("devicePropertyAllowlist must be an array. Defaulting to all properties."),B=null;v=a.Wg(u,B);B=new mf(u);q=a.Bc();m=a.Ug(u,h[C.Zf],q);I.push(q);k=a.$g(f,y,"3.5.1",l,h,
|
|
247
247
|
function(Db){if(V)for(var Xa=0;Xa<P.length;Xa++)P[Xa].Lb(Db)},u,v,B,m);R=h[C.ag];null==R&&(R=30);D=a.ah(R,G,u,k);P.push(D);R=!0===h[C.Zd]||!0===h[C.fe];null!=h.enableHtmlInAppMessages&&b("enableHtmlInAppMessages","initialization option","allowUserSuppliedJavascript");r=a.Bc();I.push(r);F=a.Vg(r,k,u,B,R);P.push(F);nf(B,function(){F.Na()});Se(k,function(){F.Na()});k.Hd();H=a.Zg(k.rb(),f,v,y,h,B,u);A=a.Yg(k.rb());u="Initialized ";h&&h[C.Rc]&&(u+='for the Braze backend at "'+h[C.Rc]+'" ');x.info(u+('with API key "'+
|
|
248
248
|
n+'".'));n=vb.language;u=!1;h&&(h[C.$c]&&(b(C.$c,"initialization option",C.cd),n=h[C.$c],u=!0),h[C.cd]&&(n=h[C.cd],u=!0));td(n,u);Pb(N,h);return V=!0},Jb:function(){x.info("Destroying appboy instance");g=null;c()},gh:function(n){d()&&(null==n&&x.error("getDeviceId must be supplied with a callback. e.g., appboy.getDeviceId(function(deviceId) {console.log('the device id is ' + deviceId)})"),"function"===typeof n&&n(Be(v).id))},Yd:function(){x.Yd()},Td:function(n){x.Td(n)},Lc:function(){if(d()){k.Lc(H);
|
|
249
249
|
var n=za.ba,u=new qa(n);ua(u,n.G.oe,function(y,B){function P(){D.pa(de.ne,[Y],Db)}var R=B.lastClick,Y=B.trackingString;x.info("Firing push click trigger from "+Y+" push click at "+R);var Db=We(k,R,Y);Ue(k,P,P);va(u,n.G.oe,y)});wa(u,n.G.Ef,function(y){xf(F,y)});wa(u,n.G.me,function(y){var B=k;y=ba(y);for(var P=y.next();!P.done;P=y.next())if(P=P.value,P.api_key!==B.$){var R=za.ba;(new qa(R)).setItem(R.G.me,pa.Ia(),P)}else De(B,P)})}},$a:function(n,u){if(d())if(null==n||0===n.length||n!==n)x.error("changeUser requires a non-empty userId.");
|
|
@@ -262,7 +262,7 @@ u.next())if(!Aa(If,y.value,"sdkMetadata contained an invalid value.","BrazeSdkMe
|
|
|
262
262
|
Z.initialize=X.Hd;Z.destroy=X.Jb;Z.getDeviceId=X.gh;Z.toggleAppboyLogging=X.Yd;Z.setLogger=X.Td;Z.openSession=X.Lc;Z.changeUser=X.$a;Z.getUser=X.rb;Z.requestImmediateDataFlush=X.tb;Z.requestFeedRefresh=X.Nc;Z.getCachedFeed=X.Fc;Z.subscribeToFeedUpdates=X.uf;Z.requestContentCardsRefresh=X.Na;Z.getCachedContentCards=X.pb;Z.subscribeToContentCardsUpdates=X.tf;Z.logCardImpressions=X.Ma;Z.logCardClick=X.La;Z.logCardDismissal=X.Hc;Z.logFeedDisplayed=X.jf;Z.logContentCardsDisplayed=X.hf;
|
|
263
263
|
Z.logInAppMessageImpression=X.Qb;Z.logInAppMessageClick=X.Jc;Z.logInAppMessageButtonClick=X.Ic;Z.logInAppMessageHtmlClick=X.Pb;Z.subscribeToNewInAppMessages=X.Ph;Z.subscribeToInAppMessage=X.vf;Z.removeSubscription=X.N;Z.removeAllSubscriptions=X.K;Z.logCustomEvent=X.Jd;Z.logPurchase=X.Kd;Z.isPushSupported=X.qa;Z.isPushBlocked=X.Ka;Z.isPushGranted=X.Id;Z.isPushPermissionGranted=X.Mb;Z.registerAppboyPushMessages=X.ph;Z.unregisterAppboyPushMessages=X.Uh;Z.setSdkAuthenticationSignature=X.Tb;
|
|
264
264
|
Z.subscribeToSdkAuthenticationFailures=X.Xd;Z.trackLocation=X.Sh;Z.addSdkMetadata=X.zd;Z.stopWebTracking=X.Mh;Z.disableSDK=X.bh;Z.resumeWebTracking=X.vh;Z.enableSDK=X.dh;Z.wipeData=X.Xh;Z.isDisabled=X.mh;for(var Of in Z)"object"===typeof appboyInterface?appboyInterface[Of]=Z[Of]:Mf[Of]=Z[Of];var Pf="object"===typeof appboyInterface?appboyInterface:Mf,Qf=new function(a,b){var c=!1,d=!1,e=!1,f=!1,g=null,h=null,l=null,k=null;a.Oh(function(m){function q(t){if(27===t.keyCode&&!e&&0<document.querySelectorAll(".ab-modal-interactions").length){t=document.getElementsByClassName("ab-html-message");for(var w=!1,r=0;r<t.length;r++){var F=t[r].contentWindow.document.getElementsByClassName("ab-programmatic-close-button")[0];null!=F&&(Ub(F),w=!0)}w||(t=document.querySelectorAll(".ab-modal-interactions > .ab-close-button")[0],
|
|
265
|
-
null!=t&&Ub(t))}}c=m[C.pg]||!1;d=m[C.og]||m[C.qg]||!1;e=m[C.tg]||!1;f=m[C.fe]||!1;!0===m[C.Zd]&&(f=!0);g=null;l=m[C.be]||null;k=m[C.bg]||null;m[C.Xf]||null!==document.querySelector('link[rel=stylesheet][href="https://use.fontawesome.com/7f85a56ba4.css"]')||(m=document.createElement("link"),m.setAttribute("rel","stylesheet"),m.setAttribute("href","https://use.fontawesome.com/7f85a56ba4.css"),document.getElementsByTagName("head")[0].appendChild(m));m="ab-css-definitions-"+"3.5.
|
|
265
|
+
null!=t&&Ub(t))}}c=m[C.pg]||!1;d=m[C.og]||m[C.qg]||!1;e=m[C.tg]||!1;f=m[C.fe]||!1;!0===m[C.Zd]&&(f=!0);g=null;l=m[C.be]||null;k=m[C.bg]||null;m[C.Xf]||null!==document.querySelector('link[rel=stylesheet][href="https://use.fontawesome.com/7f85a56ba4.css"]')||(m=document.createElement("link"),m.setAttribute("rel","stylesheet"),m.setAttribute("href","https://use.fontawesome.com/7f85a56ba4.css"),document.getElementsByTagName("head")[0].appendChild(m));m="ab-css-definitions-"+"3.5.1".replace(/\./g,
|
|
266
266
|
"-");if(null==document.getElementById(m)){var v=document.createElement("style");v.innerHTML=qd.$e;v.id=m;null!=l&&v.setAttribute("nonce",l);document.getElementsByTagName("head")[0].appendChild(v)}e||(document.addEventListener("keydown",q,!1),a.Nh(function(){document.removeEventListener("keydown",q)}))});return{Tg:function(){null==g&&(g=a.vf(function(m){a.display.sf(m)}));return g},sf:function(m,q,v){if(null==m)return!1;if(m instanceof Fc)return x.info("User received control for a multivariate test, logging to Braze servers."),
|
|
267
267
|
a.Qb(m),!0;if(!(m instanceof W))return!1;var t=m instanceof Qc;if(t&&!m.Th&&!f)return x.error('HTML in-app messages are disabled. Use the "allowUserSuppliedJavascript" option for appboy.initialize to enable these messages.'),a.M(m,dd.ge),!1;null==q&&(q=document.body);if(m.Ja()&&0<q.querySelectorAll(".ab-modal-interactions").length)return x.info("Cannot show in-app message '"+m.message+"' because another message is being shown."),a.M(m,dd.Bf),!1;if(bc.nh()){var w=bc.hh();if(w===bc.Sa.jc&&m.orientation===
|
|
268
268
|
Zc||w===bc.Sa.Zc&&"PORTRAIT"===m.orientation)return x.info("Not showing "+("PORTRAIT"===m.orientation?"portrait":"landscape")+" in-app message '"+m.message+"' because the screen is currently "+(w===bc.Sa.jc?"portrait":"landscape")),a.M(m,dd.rg),!1}if(!f){w=!1;if(m.buttons&&0<m.buttons.length)for(var r=m.buttons,F=0;F<r.length;F++)r[F].clickAction===$c&&(w=sd(r[F].uri));else m.clickAction===$c&&(w=sd(m.uri));if(w)return x.error('Javascript click actions are disabled. Use the "allowUserSuppliedJavascript" option for appboy.initialize to enable these actions.'),
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for appboy-web-sdk v3.5.
|
|
2
|
+
* Type definitions for appboy-web-sdk v3.5.1
|
|
3
3
|
* Project: https://github.com/Appboy/appboy-web-sdk
|
|
4
4
|
* (c) Braze, Inc. 2022 - http://braze.com
|
|
5
5
|
* License available at https://github.com/Appboy/appboy-web-sdk/blob/master/LICENSE
|
|
@@ -41,7 +41,7 @@ declare namespace appboy {
|
|
|
41
41
|
static readonly GOOGLE_TAG_MANAGER: string;
|
|
42
42
|
/** Use this tag if you have integrated the Braze Web SDK using mParticle */
|
|
43
43
|
static readonly MPARTICLE: string;
|
|
44
|
-
/**
|
|
44
|
+
/** Automatically added when loading Braze via Segment */
|
|
45
45
|
static readonly SEGMENT: string;
|
|
46
46
|
/** Use this tag if you have integrated the Braze Web SDK using Tealium */
|
|
47
47
|
static readonly TEALIUM: string;
|
|
@@ -49,6 +49,8 @@ declare namespace appboy {
|
|
|
49
49
|
static readonly NPM: string;
|
|
50
50
|
/** Use this tag if you have loaded the Braze Web SDK using Braze's CDN (js.appboycdn.com) */
|
|
51
51
|
static readonly CDN: string;
|
|
52
|
+
/** Automatically added when loading Braze via Shopify Integration */
|
|
53
|
+
static readonly SHOPIFY: string;
|
|
52
54
|
/** Use this tag if you have integrated or loaded the Braze Web SDK using none of the other methods */
|
|
53
55
|
static readonly MANUAL: string;
|
|
54
56
|
}
|