PageSourceSearch

https://cdn.shipplay.com/vite/assets/refresh-feature-flags-DCm2R0xh.js

js shipplay.com collected 2026-09-26 08:40:22 UTC 4,634 bytes, 2 lines download raw bytes

1import{E as f,f as w,u as O,r as h,S as u,h as d,j as X,k as R}from"./braze-ZUQKpMm-.js";import"./preload-helper-CnIRovmK.js";class T{constructor(e){this.properties=e,this.properties=e||{}}Oo(e,t,i){const n=this.properties[e];return n==null?(this.Ko(e),null):t(n)?n.value:(this.Lo(i),null)}getStringProperty(e){return this.Oo(e,this.Qo,"string")}getNumberProperty(e){return this.Oo(e,this.Ro,"number")}getBooleanProperty(e){return this.Oo(e,this.Xo,"boolean")}getImageProperty(e){return this.Oo(e,this.Yo,"image")}getJsonProperty(e){return this.Oo(e,this.Zo,"jsonobject")}getTimestampProperty(e){return this.Oo(e,this.tp,"datetime")}Lo(e){f.info(`Property is not of type ${e}.`)}Ko(e){f.info(`${e} not found in properties.`)}Qo(e){return e.type==="string"&&typeof e.value=="string"}Ro(e){return e.type==="number"&&typeof e.value=="number"}Xo(e){return e.type==="boolean"&&typeof e.value=="boolean"}Yo(e){return e.type==="image"&&typeof e.value=="string"}Zo(e){return e.type==="jsonobject"&&typeof e.value=="object"&&e.value.constructor==Object}tp(e){return e.type==="datetime"&&typeof e.value=="number"}}class r extends T{constructor(e,t=!1,i={},n){super(i),this.id=e,this.enabled=t,this.trackingString=n,this.id=e,this.enabled=t,this.trackingString=n}dt(){const e={};return e[r.ss.rs]=this.id,e[r.ss.Fe]=this.enabled,e[r.ss.we]=this.properties,e[r.ss.xe]=this.trackingString,e}}r.ss={rs:"id",Fe:"e",we:"pr",xe:"fts"},r.ui={rs:"id",Fe:"enabled",we:"properties",xe:"fts"};function k(s){if(s[r.ui.rs]&&typeof s[r.ui.Fe]=="boolean")return new r(s[r.ui.rs],s[r.ui.Fe],s[r.ui.we],s[r.ui.xe]);f.info(`Unable to create feature flag from ${JSON.stringify(s,null,2)}`)}function N(s){if(s[r.ss.rs]&&typeof s[r.ss.Fe]=="boolean")return new r(s[r.ss.rs],s[r.ss.Fe],s[r.ss.we],s[r.ss.xe]);f.info(`Unable to deserialize feature flag from ${JSON.stringify(s,null,2)}`)}class x extends w{constructor(e,t,i,n){super(),this.h=e,this.B=t,this.j=i,this.C=n,this.je=[],this.ye=0,this.h=e,this.B=t,this.j=i,this.C=n,this.Ce=null,this.Re=new O,this.S=10,this.T=null,this.I=null,h.q(this.Re)}N(e){var t;if(!((t=this.h)===null||t===void 0)&&t.Te()&&e!=null&&e.feature_flags){this.je=[];for(const i of e.feature_flags){const n=k(i);n&&this.je.push(n)}this.ye=new Date().getTime(),this.De(),this.Re.L(this.je)}}Ie(){let e={};this.j&&(e=this.j.lt(u.ct.Se));const t={};for(const i in e){const n=N(e[i]);n&&(t[n.id]=n)}return t}qe(){var e;return((e=this.j)===null||e===void 0?void 0:e.lt(u.ct.Ne))||{}}ze(e){this.j&&this.j.ft(u.ct.Ne,e)}St(e){return this.Re.wt(e)}refreshFeatureFlags(e,t,i=!1,n=!0){const c=()=>{typeof t=="function"&&t(),this.Re.L(this.je)};if(!this.Ue(i))return!this.Ce&&this.h&&(this.Ce=this.h.$e(()=>{this.refreshFeatureFlags(e,t)})),void c();const g=this.B;if(!g)return void c();n&&this.X();const v=g.$({},!0),m=g.A(v,d.H.ke);let y=!1;g.J(v,(j=-1)=>{const l=this.B;if(!l)return void c();const F=new Date().valueOf();d.K(this.j,d.H.ke,F),j!==-1&&m.push(["X-Braze-Req-Tokens-Remaining",j.toString()]),X.O({url:`${l.V()}/feature_flags/sync`,headers:m,data:v,W:p=>{if(!l.Y(v,p,m))return y=!0,void c();l.Z(),this.N(p),y=!1,typeof e=="function"&&e()},error:p=>{l._(p,"retrieving feature flags"),y=!0,c()},tt:(p,S)=>{let b;if(y){let a=this.T;(a==null||a<1e3*this.S)&&(a=1e3*this.S),b=Math.min(3e5,R(1e3*this.S,3*a))}l.st(S,()=>{this.refreshFeatureFlags(e,t,i,!0)},d.H.ke,a=>this.it(a),()=>this.X(),b)}})},d.H.ke,t)}X(){this.I!=null&&(clearTimeout(this.I),this.I=null)}it(e){this.X(),this.I=e}Ue(e){if(!this.h)return!1;if(!e){const t=this.h.Be();if(t==null)return!1;let i=!1;if(!isNaN(t)){if(t===-1)return f.info("Feature flag refreshes not allowed"),!1;i=new Date().getTime()>=(this.ye||0)+1e3*t}if(!i)return f.info(`Feature flag refreshes were rate limited to ${t} seconds`),!1}return this.h.Te()}Me(){var e;return((e=this.j)===null||e===void 0?void 0:e.lt(u.ct.Xe))||null}_e(){var e,t;(e=this.j)===null||e===void 0||e.ft(u.ct.Xe,(t=this.C)===null||t===void 0?void 0:t.bt())}Ae(){var e;const t=(e=this.C)===null||e===void 0?void 0:e.bt(),i=this.Me();return i==null||t===i}De(){if(!this.j)return;const e={};for(const t of this.je){const i=t.dt();e[t.id]=i}this.j.ft(u.ct.Se,e),this.j.ft(u.ct.Ee,this.ye),this._e()}changeUser(){this.X()}clearData(){this.X()}}const o={i:!1,provider:null,o:()=>(o.t(),o.provider||(o.provider=new x(h.l(),h.m(),h.p(),h.u()),h.v(o.provider)),o.provider),t:()=>{o.i||(h.g(o),o.i=!0)},destroy:()=>{o.provider=null,o.i=!1}};function B(s,e,t=!1){if(h.rr())return o.o().refreshFeatureFlags(s,e,t)}function $(s,e){B(s,e)}export{B as default,$ as refreshFeatureFlags};
2//# sourceMappingURL=refresh-feature-flags-DCm2R0xh.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.