@flarehr/promoted-benefits-ui 1.0.205 → 1.0.207
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const _ of o)if(_.type==="childList")for(const s of _.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const _={};return o.integrity&&(_.integrity=o.integrity),o.referrerPolicy&&(_.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?_.credentials="include":o.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function r(o){if(o.ep)return;o.ep=!0;const _=n(o);fetch(o.href,_)}})();var z,h,ve,P,_e,ye,X,ge,E={},be=[],Ie=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ee=Array.isArray;function $(e,t){for(var n in t)e[n]=t[n];return e}function xe(e){var t=e.parentNode;t&&t.removeChild(e)}function Le(e,t,n){var r,o,_,s={};for(_ in t)_=="key"?r=t[_]:_=="ref"?o=t[_]:s[_]=t[_];if(arguments.length>2&&(s.children=arguments.length>3?z.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(_ in e.defaultProps)s[_]===void 0&&(s[_]=e.defaultProps[_]);return j(e,s,r,o,null)}function j(e,t,n,r,o){var _={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ve,__i:-1,__u:0};return o==null&&h.vnode!=null&&h.vnode(_),_}function N(e){return e.children}function B(e,t){this.props=e,this.context=t}function S(e,t){if(t==null)return e.__?S(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?S(e):null}function we(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return we(e)}}function Z(e){(!e.__d&&(e.__d=!0)&&P.push(e)&&!R.__r++||_e!==h.debounceRendering)&&((_e=h.debounceRendering)||ye)(R)}function R(){var e,t,n,r,o,_,s,c,l;for(P.sort(X);e=P.shift();)e.__d&&(t=P.length,r=void 0,_=(o=(n=e).__v).__e,c=[],l=[],(s=n.__P)&&((r=$({},o)).__v=o.__v+1,h.vnode&&h.vnode(r),te(s,r,o,n.__n,s.ownerSVGElement!==void 0,32&o.__u?[_]:null,c,_??S(o),!!(32&o.__u),l),r.__v=o.__v,r.__.__k[r.__i]=r,$e(c,r,l),r.__e!=_&&we(r)),P.length>t&&P.sort(X));R.__r=0}function ke(e,t,n,r,o,_,s,c,l,a,f){var i,p,u,g,k,b=r&&r.__k||be,m=t.length;for(n.__d=l,Fe(n,t,b),l=n.__d,i=0;i<m;i++)(u=n.__k[i])!=null&&typeof u!="boolean"&&typeof u!="function"&&(p=u.__i===-1?E:b[u.__i]||E,u.__i=i,te(e,u,p,o,_,s,c,l,a,f),g=u.__e,u.ref&&p.ref!=u.ref&&(p.ref&&ne(p.ref,null,u),f.push(u.ref,u.__c||g,u)),k==null&&g!=null&&(k=g),65536&u.__u||p.__k===u.__k?(g||p.__e!=l||(l=S(p)),l=Ce(u,l,e)):typeof u.type=="function"&&u.__d!==void 0?l=u.__d:g&&(l=g.nextSibling),u.__d=void 0,u.__u&=-196609);n.__d=l,n.__e=k}function Fe(e,t,n){var r,o,_,s,c,l=t.length,a=n.length,f=a,i=0;for(e.__k=[],r=0;r<l;r++)s=r+i,(o=e.__k[r]=(o=t[r])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?j(null,o,null,null,null):ee(o)?j(N,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?j(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,c=Me(o,n,s,f),o.__i=c,_=null,c!==-1&&(f--,(_=n[c])&&(_.__u|=131072)),_==null||_.__v===null?(c==-1&&i--,typeof o.type!="function"&&(o.__u|=65536)):c!==s&&(c===s+1?i++:c>s?f>l-s?i+=c-s:i--:c<s?c==s-1&&(i=c-s):i=0,c!==r+i&&(o.__u|=65536))):(_=n[s])&&_.key==null&&_.__e&&!(131072&_.__u)&&(_.__e==e.__d&&(e.__d=S(_)),K(_,_,!1),n[s]=null,f--);if(f)for(r=0;r<a;r++)(_=n[r])!=null&&!(131072&_.__u)&&(_.__e==e.__d&&(e.__d=S(_)),K(_,_))}function Ce(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=Ce(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Me(e,t,n,r){var o=e.key,_=e.type,s=n-1,c=n+1,l=t[n];if(l===null||l&&o==l.key&&_===l.type&&!(131072&l.__u))return n;if(r>(l!=null&&!(131072&l.__u)?1:0))for(;s>=0||c<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&_===l.type)return s;s--}if(c<t.length){if((l=t[c])&&!(131072&l.__u)&&o==l.key&&_===l.type)return c;c++}}return-1}function ie(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ie.test(t)?n:n+"px"}function M(e,t,n,r,o){var _;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ie(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||ie(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")_=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+_]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,_?ce:se,_)):e.removeEventListener(t,_?ce:se,_);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function se(e){if(this.l){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(h.event?h.event(e):e)}}function ce(e){if(this.l)return this.l[e.type+!0](h.event?h.event(e):e)}function te(e,t,n,r,o,_,s,c,l,a){var f,i,p,u,g,k,b,m,x,C,I,U,re,L,G,w=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),_=[c=t.__e=n.__e]),(f=h.__b)&&f(t);e:if(typeof w=="function")try{if(m=t.props,x=(f=w.contextType)&&r[f.__c],C=f?x?x.props.value:f.__:r,n.__c?b=(i=t.__c=n.__c).__=i.__E:("prototype"in w&&w.prototype.render?t.__c=i=new w(m,C):(t.__c=i=new B(m,C),i.constructor=w,i.render=je),x&&x.sub(i),i.props=m,i.state||(i.state={}),i.context=C,i.__n=r,p=i.__d=!0,i.__h=[],i._sb=[]),i.__s==null&&(i.__s=i.state),w.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=$({},i.__s)),$(i.__s,w.getDerivedStateFromProps(m,i.__s))),u=i.props,g=i.state,i.__v=t,p)w.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(w.getDerivedStateFromProps==null&&m!==u&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(m,C),!i.__e&&(i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(m,i.__s,C)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(i.props=m,i.state=i.__s,i.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(F){F&&(F.__=t)}),I=0;I<i._sb.length;I++)i.__h.push(i._sb[I]);i._sb=[],i.__h.length&&s.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(m,i.__s,C),i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(u,g,k)})}if(i.context=C,i.props=m,i.__P=e,i.__e=!1,U=h.__r,re=0,"prototype"in w&&w.prototype.render){for(i.state=i.__s,i.__d=!1,U&&U(t),f=i.render(i.props,i.state,i.context),L=0;L<i._sb.length;L++)i.__h.push(i._sb[L]);i._sb=[]}else do i.__d=!1,U&&U(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++re<25);i.state=i.__s,i.getChildContext!=null&&(r=$($({},r),i.getChildContext())),p||i.getSnapshotBeforeUpdate==null||(k=i.getSnapshotBeforeUpdate(u,g)),ke(e,ee(G=f!=null&&f.type===N&&f.key==null?f.props.children:f)?G:[G],t,n,r,o,_,s,c,l,a),i.base=t.__e,t.__u&=-161,i.__h.length&&s.push(i),b&&(i.__E=i.__=null)}catch(F){t.__v=null,l||_!=null?(t.__e=c,t.__u|=l?160:32,_[_.indexOf(c)]=null):(t.__e=n.__e,t.__k=n.__k),h.__e(F,t,n)}else _==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Oe(n.__e,t,n,r,o,_,s,l,a);(f=h.diffed)&&f(t)}function $e(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)ne(n[r],n[++r],n[++r]);h.__c&&h.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(_){_.call(o)})}catch(_){h.__e(_,o.__v)}})}function Oe(e,t,n,r,o,_,s,c,l){var a,f,i,p,u,g,k,b=n.props,m=t.props,x=t.type;if(x==="svg"&&(o=!0),_!=null){for(a=0;a<_.length;a++)if((u=_[a])&&"setAttribute"in u==!!x&&(x?u.localName===x:u.nodeType===3)){e=u,_[a]=null;break}}if(e==null){if(x===null)return document.createTextNode(m);e=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,m.is&&m),_=null,c=!1}if(x===null)b===m||c&&e.data===m||(e.data=m);else{if(_=_&&z.call(e.childNodes),b=n.props||E,!c&&_!=null)for(b={},a=0;a<e.attributes.length;a++)b[(u=e.attributes[a]).name]=u.value;for(a in b)u=b[a],a=="children"||(a=="dangerouslySetInnerHTML"?i=u:a==="key"||a in m||M(e,a,null,u,o));for(a in m)u=m[a],a=="children"?p=u:a=="dangerouslySetInnerHTML"?f=u:a=="value"?g=u:a=="checked"?k=u:a==="key"||c&&typeof u!="function"||b[a]===u||M(e,a,u,b[a],o);if(f)c||i&&(f.__html===i.__html||f.__html===e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),ke(e,ee(p)?p:[p],t,n,r,o&&x!=="foreignObject",_,s,_?_[0]:n.__k&&S(n,0),c,l),_!=null)for(a=_.length;a--;)_[a]!=null&&xe(_[a]);c||(a="value",g!==void 0&&(g!==e[a]||x==="progress"&&!g||x==="option"&&g!==b[a])&&M(e,a,g,b[a],!1),a="checked",k!==void 0&&k!==e[a]&&M(e,a,k,b[a],!1))}return e}function ne(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){h.__e(r,n)}}function K(e,t,n){var r,o;if(h.unmount&&h.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ne(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(_){h.__e(_,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&K(r[o],t,n||typeof e.type!="function");n||e.__e==null||xe(e.__e),e.__=e.__e=e.__d=void 0}function je(e,t,n){return this.constructor(e,n)}function Be(e,t,n){var r,o,_,s;h.__&&h.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,_=[],s=[],te(t,e=(!r&&n||t).__k=Le(N,null,[e]),o||E,E,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?z.call(t.childNodes):null,_,!r&&n?n:o?o.__e:t.firstChild,r,s),$e(_,e,s)}function q(e,t){var n={__c:t="__cC"+ge++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,_;return this.getChildContext||(o=[],(_={})[t]=this,this.getChildContext=function(){return _},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(function(c){c.__e=!0,Z(c)})},this.sub=function(s){o.push(s);var c=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),c&&c.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}z=be.slice,h={__e:function(e,t,n,r){for(var o,_,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((_=o.constructor)&&_.getDerivedStateFromError!=null&&(o.setState(_.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(c){e=c}throw e}},ve=0,B.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=$({},this.state),typeof e=="function"&&(e=e($({},n),this.props)),e&&$(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Z(this))},B.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Z(this))},B.prototype.render=N,P=[],ye=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,X=function(e,t){return e.__v.__b-t.__v.__b},R.__r=0,ge=0;var De=0;function d(e,t,n,r,o,_){var s,c,l={};for(c in t)c=="ref"?s=t[c]:l[c]=t[c];var a={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--De,__i:-1,__u:0,__source:o,__self:_};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return h.vnode&&h.vnode(a),a}var A,v,J,ae,Q=0,Pe=[],D=[],y=h,le=y.__b,ue=y.__r,fe=y.diffed,de=y.__c,pe=y.unmount,he=y.__;function oe(e,t){y.__h&&y.__h(v,e,Q||t),Q=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:D}),n.__[e]}function H(e){return Q=1,Ve(Se,e)}function Ve(e,t,n){var r=oe(A++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Se(void 0,t),function(c){var l=r.__N?r.__N[0]:r.__[0],a=r.t(l,c);l!==a&&(r.__N=[a,r.__[1]],r.__c.setState({}))}],r.__c=v,!v.u)){var o=function(c,l,a){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(p){return!!p.__c});if(f.every(function(p){return!p.__N}))return!_||_.call(this,c,l,a);var i=!1;return f.forEach(function(p){if(p.__N){var u=p.__[0];p.__=p.__N,p.__N=void 0,u!==p.__[0]&&(i=!0)}}),!(!i&&r.__c.props===c)&&(!_||_.call(this,c,l,a))};v.u=!0;var _=v.shouldComponentUpdate,s=v.componentWillUpdate;v.componentWillUpdate=function(c,l,a){if(this.__e){var f=_;_=void 0,o(c,l,a),_=f}s&&s.call(this,c,l,a)},v.shouldComponentUpdate=o}return r.__N||r.__}function T(e,t){var n=oe(A++,3);!y.__s&&ze(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Ne(e){var t=v.context[e.__c],n=oe(A++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(v)),t.props.value):e.__}function We(){for(var e;e=Pe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(V),e.__H.__h.forEach(Y),e.__H.__h=[]}catch(t){e.__H.__h=[],y.__e(t,e.__v)}}y.__b=function(e){v=null,le&&le(e)},y.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),he&&he(e,t)},y.__r=function(e){ue&&ue(e),A=0;var t=(v=e.__c).__H;t&&(J===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=D,n.__N=n.i=void 0})):(t.__h.forEach(V),t.__h.forEach(Y),t.__h=[],A=0)),J=v},y.diffed=function(e){fe&&fe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pe.push(t)!==1&&ae===y.requestAnimationFrame||((ae=y.requestAnimationFrame)||Re)(We)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==D&&(n.__=n.__V),n.i=void 0,n.__V=D})),J=v=null},y.__c=function(e,t){t.some(function(n){try{n.__h.forEach(V),n.__h=n.__h.filter(function(r){return!r.__||Y(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],y.__e(r,n.__v)}}),de&&de(e,t)},y.unmount=function(e){pe&&pe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{V(r)}catch(o){t=o}}),n.__H=void 0,t&&y.__e(t,n.__v))};var me=typeof requestAnimationFrame=="function";function Re(e){var t,n=function(){clearTimeout(r),me&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);me&&(t=requestAnimationFrame(n))}function V(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function Y(e){var t=v;e.__c=e.__(),v=t}function ze(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Se(e,t){return typeof t=="function"?t(e):t}let Te=q({});const Ue=e=>Te=q({...e}),qe=()=>Ne(Te),Ge=()=>{Ue({})},Je=async(e,t,n,r)=>{const o=new Headers;o.append("Content-Type","application/x-www-form-urlencoded");let _;const s=new URLSearchParams;s.append("grant_type","authorization_code"),s.append("code",t),s.append("client_id",n),s.append("redirect_uri",r);const c=await fetch(`${e}/connect/token`,{method:"POST",headers:o,body:s});return c.ok&&(_=await c.json()),_},Xe=e=>{if(e)return{accessToken:e.access_token,isLoggedIn:!!e.access_token,expiresIn:e.expires_in}},Ze=e=>new URLSearchParams(window.location.search).get(e)??void 0,Ke=async e=>{const t=Ze("code"),n=`${window.location.origin}/promoted-benefits/app/v1.0/`;if(!(!e.identityUrl||!e.clientId||!t))return Xe(await Je(e.identityUrl,t,e.clientId,n))};let He=q({});const Qe=e=>He=q({...e}),Ye=()=>Ne(He),et=async()=>{let e;const t=await fetch(`${window.location.origin}/promoted-benefits/app/v1.0/config.json`);return t.ok&&(e=await t.json()),e},Ee="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11%203C10.4477%203%2010%203.44772%2010%204C10%204.55228%2010.4477%205%2011%205H13.5858L7.29289%2011.2929C6.90237%2011.6834%206.90237%2012.3166%207.29289%2012.7071C7.68342%2013.0976%208.31658%2013.0976%208.70711%2012.7071L15%206.41421V9C15%209.55228%2015.4477%2010%2016%2010C16.5523%2010%2017%209.55228%2017%209V4C17%203.44772%2016.5523%203%2016%203H11Z'%20fill='white'/%3e%3cpath%20d='M5%205C3.89543%205%203%205.89543%203%207V15C3%2016.1046%203.89543%2017%205%2017H13C14.1046%2017%2015%2016.1046%2015%2015V12C15%2011.4477%2014.5523%2011%2014%2011C13.4477%2011%2013%2011.4477%2013%2012V15H5V7L8%207C8.55228%207%209%206.55228%209%206C9%205.44772%208.55228%205%208%205H5Z'%20fill='white'/%3e%3c/svg%3e",Ae=({path:e,children:t,className:n,onClick:r})=>e?d("a",{type:"button",href:e,className:n,onClick:r,target:"_blank",rel:"noreferrer",children:t}):d("button",{type:"button",className:n,onClick:r,children:t}),tt=({banner:e,path:t,onClick:n})=>d("div",{"data-testid":"banner",className:"font-['Inter'] p-4 bg-white flex rounded-lg gap-2 card:hidden",children:[d("div",{className:"flex-col justify-between flex flex-1",children:[d("div",{className:"flex-col gap-4 flex pb-2",children:d("div",{className:"self-stretch flex-col justify-start items-start gap-2 flex",children:[d("h1",{className:"text-blue-950 font-bold leading-7",children:e.title}),d("p",{className:"text-gray-900 text-xs leading-normal",children:e.description})]})}),d("div",{className:"justify-end",children:d(Ae,{className:"px-2 py-1 bg-blue-600 rounded-lg justify-center items-center gap-2 inline-flex text-white text-xs font-semibold leading-normal",path:t,onClick:n,children:[e.buttonText,d("img",{className:"self-center",src:Ee,alt:""})]})})]}),d("div",{className:"self-center",children:d("img",{className:"w-20 h-20",src:e.imageUrl})})]}),nt=({card:e,path:t,onClick:n})=>d("div",{"data-testid":"card",className:"p-6 bg-white rounded-lg flex-col justify-start items-center gap-5 hidden card:inline-flex",children:[d("div",{children:d("img",{className:"relative bg-white block",src:e.imageUrl})}),d("div",{className:"flex-col justify-start items-center gap-5 flex",children:[d("div",{className:"flex-col justify-start items-start gap-4 flex",children:d("div",{className:"self-stretch flex-col justify-start items-start gap-2 flex",children:[d("div",{className:"self-stretch text-blue-950 text-2xl font-bold font-['Inter'] leading-7",children:e.title}),d("div",{className:"self-stretch text-gray-900 text-base font-medium font-['Inter'] leading-normal",children:e.description})]})}),d("div",{className:"self-stretch p-4 bg-blue-600 rounded-md justify-center items-center gap-2 inline-flex",children:d(Ae,{className:"text-white text-base font-semibold font-['Inter'] leading-normal flex gap-2",path:t,onClick:n,children:[e.buttonText,d("img",{className:"self-center",src:Ee,alt:""})]})})]})]}),ot="fallback-cars-promotion",rt={title:"Benefit with Flare Cars and save",description:"In the market for a new car? We’ve got a benefit for that. Find out if you're eligible, and you could save, on average, $10,000 every year on your next car.",buttonText:"Learn more",imageUrl:"./images/flare-cars-banner.png"},_t={title:"Benefit with Flare Cars and save",description:"In the market for a new car? We’ve got a benefit for that. Find out if you're eligible, and you could save, on average, $10,000 every year on your next car.",buttonText:"Learn more",imageUrl:"./images/flare-cars-card.png"},it={type:"Public",path:"https://www.flarecars.com/"},O={id:ot,banner:rt,card:_t,action:it},st=async(e,t)=>{if(!e||!t)return W();const n=`${e}/promoted-benefits/backend`,r=await fetch(`${n}/v1.0/promotion`,{headers:{Authorization:`Bearer ${t}`,"X-APP-VERSION":"1.0.205"}});let o;if(r.ok)try{o=await r.json()}catch(_){return console.error(`Error parsing promotion response: ${_}`),W()}return!o||Object.keys(o).length===0?W():o},W=()=>({action:O.action,banner:O.banner,card:O.card,id:O.id}),ct=async(e,t,n)=>{if(!t||!e)return;const r=`${e}/promoted-benefits/backend`;await fetch(`${r}/v1.0/promotion/${n}/view`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"X-APP-VERSION":"1.0.205"}})},at=async(e,t,n)=>{if(!t||!e)return;const r=`${e}/promoted-benefits/backend`;await fetch(`${r}/v1.0/promotion/${n==null?void 0:n.id}/action`,{method:"POST",body:JSON.stringify(n==null?void 0:n.action),headers:{Authorization:`Bearer ${t}`,"X-APP-VERSION":"1.0.205"}})},lt=async(e,t)=>{let n;const r=await fetch(e,{method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});return r.ok&&(n=await r.json()),n},ut=(e,t,n,r)=>{const o=document.referrer;return`${e}/app/?token=${t}&redirectPath=${n}&referrer=${o}&promotionId=${r}`},ft=async(e,t,n,r)=>{const o=`${e==null?void 0:e.apolloBaseUrl}/benefits`;if(!o||!n||!t||!r)return;const _=await lt(`${o}/backend/v1.0/current/token`,t);if(!(!_||!_.token))return ut(o,_.token,n,r)},dt=async(e,t,n)=>{let r;switch(e.action.type.toLowerCase()){case"benefits":return r=await ft(t,n.accessToken,e.action.path,e.id),{path:void 0,onClick:()=>{const _=window.open();_&&r&&(_.location=r)}};case"public":return{path:e.action.path,onClick:void 0};default:return}},pt=()=>{const e=qe(),t=Ye(),[n,r]=H(),[o,_]=H();T(()=>{(async()=>{const c=await st(t==null?void 0:t.apolloBaseUrl,e==null?void 0:e.accessToken);r(c),ct(t.apolloBaseUrl,e.accessToken,c==null?void 0:c.id)})()},[t.apolloBaseUrl,e.accessToken]),T(()=>{if(e&&e.expiresIn){const c=1e3*e.expiresIn,l=setTimeout(()=>{const a=W();r(a),Ge()},c);return()=>clearTimeout(l)}},[n,e]),T(()=>{(async()=>n&&_(await dt(n,t,e)))()},[t,e,n]);const s=()=>{o!=null&&o.onClick&&(o==null||o.onClick()),at(t.apolloBaseUrl,e.accessToken,n)};return n?d(N,{children:[d(tt,{banner:n.banner,path:o==null?void 0:o.path,onClick:s}),d(nt,{card:n.card,path:o==null?void 0:o.path,onClick:s})]}):d(N,{})},ht=e=>{if(e){const t=1e3*e,n={sender:"flare",type:"promotionsSessionExpired"};setTimeout(()=>{window.parent.postMessage(n,"*")},t)}},mt=(e,t)=>{if(e&&t){const n=1e3*e,r=1e3*60*5,o={expiry:t,sender:"flare",type:"promotionsSessionExpiring"};setTimeout(()=>{window.parent.postMessage(o,"*")},n-r)}},vt=e=>{try{const n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=atob(n);return JSON.parse(r)}catch{return}},yt=()=>{const[e,t]=H({}),[n,r]=H(),[o,_]=H(!1);return Ue(e),T(()=>{(async()=>{const s=await et();s&&(Qe(s),r(s))})()},[]),T(()=>{(async()=>{if(!o&&n){const s=await Ke(n);s&&t(s),_(!0)}})()},[n,o]),T(()=>{if(e.expiresIn&&e.accessToken){const s=vt(e.accessToken);ht(e.expiresIn),mt(e.expiresIn,s==null?void 0:s.exp)}},[e]),o?d(pt,{}):d(N,{})};Be(d(yt,{}),document.body);
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const _ of o)if(_.type==="childList")for(const s of _.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const _={};return o.integrity&&(_.integrity=o.integrity),o.referrerPolicy&&(_.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?_.credentials="include":o.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function r(o){if(o.ep)return;o.ep=!0;const _=n(o);fetch(o.href,_)}})();var z,h,ve,P,_e,ye,X,ge,E={},be=[],Ie=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ee=Array.isArray;function $(e,t){for(var n in t)e[n]=t[n];return e}function xe(e){var t=e.parentNode;t&&t.removeChild(e)}function Le(e,t,n){var r,o,_,s={};for(_ in t)_=="key"?r=t[_]:_=="ref"?o=t[_]:s[_]=t[_];if(arguments.length>2&&(s.children=arguments.length>3?z.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(_ in e.defaultProps)s[_]===void 0&&(s[_]=e.defaultProps[_]);return j(e,s,r,o,null)}function j(e,t,n,r,o){var _={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ve,__i:-1,__u:0};return o==null&&h.vnode!=null&&h.vnode(_),_}function N(e){return e.children}function B(e,t){this.props=e,this.context=t}function S(e,t){if(t==null)return e.__?S(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?S(e):null}function we(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return we(e)}}function Z(e){(!e.__d&&(e.__d=!0)&&P.push(e)&&!R.__r++||_e!==h.debounceRendering)&&((_e=h.debounceRendering)||ye)(R)}function R(){var e,t,n,r,o,_,s,c,l;for(P.sort(X);e=P.shift();)e.__d&&(t=P.length,r=void 0,_=(o=(n=e).__v).__e,c=[],l=[],(s=n.__P)&&((r=$({},o)).__v=o.__v+1,h.vnode&&h.vnode(r),te(s,r,o,n.__n,s.ownerSVGElement!==void 0,32&o.__u?[_]:null,c,_??S(o),!!(32&o.__u),l),r.__v=o.__v,r.__.__k[r.__i]=r,$e(c,r,l),r.__e!=_&&we(r)),P.length>t&&P.sort(X));R.__r=0}function ke(e,t,n,r,o,_,s,c,l,a,f){var i,p,u,g,k,b=r&&r.__k||be,m=t.length;for(n.__d=l,Fe(n,t,b),l=n.__d,i=0;i<m;i++)(u=n.__k[i])!=null&&typeof u!="boolean"&&typeof u!="function"&&(p=u.__i===-1?E:b[u.__i]||E,u.__i=i,te(e,u,p,o,_,s,c,l,a,f),g=u.__e,u.ref&&p.ref!=u.ref&&(p.ref&&ne(p.ref,null,u),f.push(u.ref,u.__c||g,u)),k==null&&g!=null&&(k=g),65536&u.__u||p.__k===u.__k?(g||p.__e!=l||(l=S(p)),l=Ce(u,l,e)):typeof u.type=="function"&&u.__d!==void 0?l=u.__d:g&&(l=g.nextSibling),u.__d=void 0,u.__u&=-196609);n.__d=l,n.__e=k}function Fe(e,t,n){var r,o,_,s,c,l=t.length,a=n.length,f=a,i=0;for(e.__k=[],r=0;r<l;r++)s=r+i,(o=e.__k[r]=(o=t[r])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?j(null,o,null,null,null):ee(o)?j(N,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?j(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,c=Me(o,n,s,f),o.__i=c,_=null,c!==-1&&(f--,(_=n[c])&&(_.__u|=131072)),_==null||_.__v===null?(c==-1&&i--,typeof o.type!="function"&&(o.__u|=65536)):c!==s&&(c===s+1?i++:c>s?f>l-s?i+=c-s:i--:c<s?c==s-1&&(i=c-s):i=0,c!==r+i&&(o.__u|=65536))):(_=n[s])&&_.key==null&&_.__e&&!(131072&_.__u)&&(_.__e==e.__d&&(e.__d=S(_)),K(_,_,!1),n[s]=null,f--);if(f)for(r=0;r<a;r++)(_=n[r])!=null&&!(131072&_.__u)&&(_.__e==e.__d&&(e.__d=S(_)),K(_,_))}function Ce(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=Ce(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function Me(e,t,n,r){var o=e.key,_=e.type,s=n-1,c=n+1,l=t[n];if(l===null||l&&o==l.key&&_===l.type&&!(131072&l.__u))return n;if(r>(l!=null&&!(131072&l.__u)?1:0))for(;s>=0||c<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&_===l.type)return s;s--}if(c<t.length){if((l=t[c])&&!(131072&l.__u)&&o==l.key&&_===l.type)return c;c++}}return-1}function ie(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ie.test(t)?n:n+"px"}function M(e,t,n,r,o){var _;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ie(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||ie(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")_=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+_]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,_?ce:se,_)):e.removeEventListener(t,_?ce:se,_);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function se(e){if(this.l){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(h.event?h.event(e):e)}}function ce(e){if(this.l)return this.l[e.type+!0](h.event?h.event(e):e)}function te(e,t,n,r,o,_,s,c,l,a){var f,i,p,u,g,k,b,m,x,C,I,U,re,L,G,w=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),_=[c=t.__e=n.__e]),(f=h.__b)&&f(t);e:if(typeof w=="function")try{if(m=t.props,x=(f=w.contextType)&&r[f.__c],C=f?x?x.props.value:f.__:r,n.__c?b=(i=t.__c=n.__c).__=i.__E:("prototype"in w&&w.prototype.render?t.__c=i=new w(m,C):(t.__c=i=new B(m,C),i.constructor=w,i.render=je),x&&x.sub(i),i.props=m,i.state||(i.state={}),i.context=C,i.__n=r,p=i.__d=!0,i.__h=[],i._sb=[]),i.__s==null&&(i.__s=i.state),w.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=$({},i.__s)),$(i.__s,w.getDerivedStateFromProps(m,i.__s))),u=i.props,g=i.state,i.__v=t,p)w.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(w.getDerivedStateFromProps==null&&m!==u&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(m,C),!i.__e&&(i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(m,i.__s,C)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(i.props=m,i.state=i.__s,i.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(F){F&&(F.__=t)}),I=0;I<i._sb.length;I++)i.__h.push(i._sb[I]);i._sb=[],i.__h.length&&s.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(m,i.__s,C),i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(u,g,k)})}if(i.context=C,i.props=m,i.__P=e,i.__e=!1,U=h.__r,re=0,"prototype"in w&&w.prototype.render){for(i.state=i.__s,i.__d=!1,U&&U(t),f=i.render(i.props,i.state,i.context),L=0;L<i._sb.length;L++)i.__h.push(i._sb[L]);i._sb=[]}else do i.__d=!1,U&&U(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++re<25);i.state=i.__s,i.getChildContext!=null&&(r=$($({},r),i.getChildContext())),p||i.getSnapshotBeforeUpdate==null||(k=i.getSnapshotBeforeUpdate(u,g)),ke(e,ee(G=f!=null&&f.type===N&&f.key==null?f.props.children:f)?G:[G],t,n,r,o,_,s,c,l,a),i.base=t.__e,t.__u&=-161,i.__h.length&&s.push(i),b&&(i.__E=i.__=null)}catch(F){t.__v=null,l||_!=null?(t.__e=c,t.__u|=l?160:32,_[_.indexOf(c)]=null):(t.__e=n.__e,t.__k=n.__k),h.__e(F,t,n)}else _==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Oe(n.__e,t,n,r,o,_,s,l,a);(f=h.diffed)&&f(t)}function $e(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)ne(n[r],n[++r],n[++r]);h.__c&&h.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(_){_.call(o)})}catch(_){h.__e(_,o.__v)}})}function Oe(e,t,n,r,o,_,s,c,l){var a,f,i,p,u,g,k,b=n.props,m=t.props,x=t.type;if(x==="svg"&&(o=!0),_!=null){for(a=0;a<_.length;a++)if((u=_[a])&&"setAttribute"in u==!!x&&(x?u.localName===x:u.nodeType===3)){e=u,_[a]=null;break}}if(e==null){if(x===null)return document.createTextNode(m);e=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,m.is&&m),_=null,c=!1}if(x===null)b===m||c&&e.data===m||(e.data=m);else{if(_=_&&z.call(e.childNodes),b=n.props||E,!c&&_!=null)for(b={},a=0;a<e.attributes.length;a++)b[(u=e.attributes[a]).name]=u.value;for(a in b)u=b[a],a=="children"||(a=="dangerouslySetInnerHTML"?i=u:a==="key"||a in m||M(e,a,null,u,o));for(a in m)u=m[a],a=="children"?p=u:a=="dangerouslySetInnerHTML"?f=u:a=="value"?g=u:a=="checked"?k=u:a==="key"||c&&typeof u!="function"||b[a]===u||M(e,a,u,b[a],o);if(f)c||i&&(f.__html===i.__html||f.__html===e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),ke(e,ee(p)?p:[p],t,n,r,o&&x!=="foreignObject",_,s,_?_[0]:n.__k&&S(n,0),c,l),_!=null)for(a=_.length;a--;)_[a]!=null&&xe(_[a]);c||(a="value",g!==void 0&&(g!==e[a]||x==="progress"&&!g||x==="option"&&g!==b[a])&&M(e,a,g,b[a],!1),a="checked",k!==void 0&&k!==e[a]&&M(e,a,k,b[a],!1))}return e}function ne(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){h.__e(r,n)}}function K(e,t,n){var r,o;if(h.unmount&&h.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ne(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(_){h.__e(_,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&K(r[o],t,n||typeof e.type!="function");n||e.__e==null||xe(e.__e),e.__=e.__e=e.__d=void 0}function je(e,t,n){return this.constructor(e,n)}function Be(e,t,n){var r,o,_,s;h.__&&h.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,_=[],s=[],te(t,e=(!r&&n||t).__k=Le(N,null,[e]),o||E,E,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?z.call(t.childNodes):null,_,!r&&n?n:o?o.__e:t.firstChild,r,s),$e(_,e,s)}function q(e,t){var n={__c:t="__cC"+ge++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,_;return this.getChildContext||(o=[],(_={})[t]=this,this.getChildContext=function(){return _},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(function(c){c.__e=!0,Z(c)})},this.sub=function(s){o.push(s);var c=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),c&&c.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}z=be.slice,h={__e:function(e,t,n,r){for(var o,_,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((_=o.constructor)&&_.getDerivedStateFromError!=null&&(o.setState(_.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(c){e=c}throw e}},ve=0,B.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=$({},this.state),typeof e=="function"&&(e=e($({},n),this.props)),e&&$(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Z(this))},B.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Z(this))},B.prototype.render=N,P=[],ye=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,X=function(e,t){return e.__v.__b-t.__v.__b},R.__r=0,ge=0;var De=0;function d(e,t,n,r,o,_){var s,c,l={};for(c in t)c=="ref"?s=t[c]:l[c]=t[c];var a={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--De,__i:-1,__u:0,__source:o,__self:_};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return h.vnode&&h.vnode(a),a}var A,v,J,ae,Q=0,Pe=[],D=[],y=h,le=y.__b,ue=y.__r,fe=y.diffed,de=y.__c,pe=y.unmount,he=y.__;function oe(e,t){y.__h&&y.__h(v,e,Q||t),Q=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:D}),n.__[e]}function H(e){return Q=1,Ve(Se,e)}function Ve(e,t,n){var r=oe(A++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Se(void 0,t),function(c){var l=r.__N?r.__N[0]:r.__[0],a=r.t(l,c);l!==a&&(r.__N=[a,r.__[1]],r.__c.setState({}))}],r.__c=v,!v.u)){var o=function(c,l,a){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(p){return!!p.__c});if(f.every(function(p){return!p.__N}))return!_||_.call(this,c,l,a);var i=!1;return f.forEach(function(p){if(p.__N){var u=p.__[0];p.__=p.__N,p.__N=void 0,u!==p.__[0]&&(i=!0)}}),!(!i&&r.__c.props===c)&&(!_||_.call(this,c,l,a))};v.u=!0;var _=v.shouldComponentUpdate,s=v.componentWillUpdate;v.componentWillUpdate=function(c,l,a){if(this.__e){var f=_;_=void 0,o(c,l,a),_=f}s&&s.call(this,c,l,a)},v.shouldComponentUpdate=o}return r.__N||r.__}function T(e,t){var n=oe(A++,3);!y.__s&&ze(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Ne(e){var t=v.context[e.__c],n=oe(A++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(v)),t.props.value):e.__}function We(){for(var e;e=Pe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(V),e.__H.__h.forEach(Y),e.__H.__h=[]}catch(t){e.__H.__h=[],y.__e(t,e.__v)}}y.__b=function(e){v=null,le&&le(e)},y.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),he&&he(e,t)},y.__r=function(e){ue&&ue(e),A=0;var t=(v=e.__c).__H;t&&(J===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=D,n.__N=n.i=void 0})):(t.__h.forEach(V),t.__h.forEach(Y),t.__h=[],A=0)),J=v},y.diffed=function(e){fe&&fe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pe.push(t)!==1&&ae===y.requestAnimationFrame||((ae=y.requestAnimationFrame)||Re)(We)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==D&&(n.__=n.__V),n.i=void 0,n.__V=D})),J=v=null},y.__c=function(e,t){t.some(function(n){try{n.__h.forEach(V),n.__h=n.__h.filter(function(r){return!r.__||Y(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],y.__e(r,n.__v)}}),de&&de(e,t)},y.unmount=function(e){pe&&pe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{V(r)}catch(o){t=o}}),n.__H=void 0,t&&y.__e(t,n.__v))};var me=typeof requestAnimationFrame=="function";function Re(e){var t,n=function(){clearTimeout(r),me&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);me&&(t=requestAnimationFrame(n))}function V(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function Y(e){var t=v;e.__c=e.__(),v=t}function ze(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Se(e,t){return typeof t=="function"?t(e):t}let Te=q({});const Ue=e=>Te=q({...e}),qe=()=>Ne(Te),Ge=()=>{Ue({})},Je=async(e,t,n,r)=>{const o=new Headers;o.append("Content-Type","application/x-www-form-urlencoded");let _;const s=new URLSearchParams;s.append("grant_type","authorization_code"),s.append("code",t),s.append("client_id",n),s.append("redirect_uri",r);const c=await fetch(`${e}/connect/token`,{method:"POST",headers:o,body:s});return c.ok&&(_=await c.json()),_},Xe=e=>{if(e)return{accessToken:e.access_token,isLoggedIn:!!e.access_token,expiresIn:e.expires_in}},Ze=e=>new URLSearchParams(window.location.search).get(e)??void 0,Ke=async e=>{const t=Ze("code"),n=`${window.location.origin}/promoted-benefits/app/v1.0/`;if(!(!e.identityUrl||!e.clientId||!t))return Xe(await Je(e.identityUrl,t,e.clientId,n))};let He=q({});const Qe=e=>He=q({...e}),Ye=()=>Ne(He),et=async()=>{let e;const t=await fetch(`${window.location.origin}/promoted-benefits/app/v1.0/config.json`);return t.ok&&(e=await t.json()),e},Ee="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11%203C10.4477%203%2010%203.44772%2010%204C10%204.55228%2010.4477%205%2011%205H13.5858L7.29289%2011.2929C6.90237%2011.6834%206.90237%2012.3166%207.29289%2012.7071C7.68342%2013.0976%208.31658%2013.0976%208.70711%2012.7071L15%206.41421V9C15%209.55228%2015.4477%2010%2016%2010C16.5523%2010%2017%209.55228%2017%209V4C17%203.44772%2016.5523%203%2016%203H11Z'%20fill='white'/%3e%3cpath%20d='M5%205C3.89543%205%203%205.89543%203%207V15C3%2016.1046%203.89543%2017%205%2017H13C14.1046%2017%2015%2016.1046%2015%2015V12C15%2011.4477%2014.5523%2011%2014%2011C13.4477%2011%2013%2011.4477%2013%2012V15H5V7L8%207C8.55228%207%209%206.55228%209%206C9%205.44772%208.55228%205%208%205H5Z'%20fill='white'/%3e%3c/svg%3e",Ae=({path:e,children:t,className:n,onClick:r})=>e?d("a",{type:"button",href:e,className:n,onClick:r,target:"_blank",rel:"noreferrer",children:t}):d("button",{type:"button",className:n,onClick:r,children:t}),tt=({banner:e,path:t,onClick:n})=>d("div",{"data-testid":"banner",className:"font-['Inter'] p-4 bg-white flex rounded-lg gap-2 card:hidden",children:[d("div",{className:"flex-col justify-between flex flex-1",children:[d("div",{className:"flex-col gap-4 flex pb-2",children:d("div",{className:"self-stretch flex-col justify-start items-start gap-2 flex",children:[d("h1",{className:"text-blue-950 font-bold leading-7",children:e.title}),d("p",{className:"text-gray-900 text-xs leading-normal",children:e.description})]})}),d("div",{className:"justify-end",children:d(Ae,{className:"px-2 py-1 bg-blue-600 rounded-lg justify-center items-center gap-2 inline-flex text-white text-xs font-semibold leading-normal",path:t,onClick:n,children:[e.buttonText,d("img",{className:"self-center",src:Ee,alt:""})]})})]}),d("div",{className:"self-center",children:d("img",{className:"w-20 h-20",src:e.imageUrl})})]}),nt=({card:e,path:t,onClick:n})=>d("div",{"data-testid":"card",className:"p-6 bg-white rounded-lg flex-col justify-start items-center gap-5 hidden card:inline-flex",children:[d("div",{children:d("img",{className:"relative bg-white block",src:e.imageUrl})}),d("div",{className:"flex-col justify-start items-center gap-5 flex",children:[d("div",{className:"flex-col justify-start items-start gap-4 flex",children:d("div",{className:"self-stretch flex-col justify-start items-start gap-2 flex",children:[d("div",{className:"self-stretch text-blue-950 text-2xl font-bold font-['Inter'] leading-7",children:e.title}),d("div",{className:"self-stretch text-gray-900 text-base font-medium font-['Inter'] leading-normal",children:e.description})]})}),d("div",{className:"self-stretch p-4 bg-blue-600 rounded-md justify-center items-center gap-2 inline-flex",children:d(Ae,{className:"text-white text-base font-semibold font-['Inter'] leading-normal flex gap-2",path:t,onClick:n,children:[e.buttonText,d("img",{className:"self-center",src:Ee,alt:""})]})})]})]}),ot="fallback-cars-promotion",rt={title:"Benefit with Flare Cars and save",description:"In the market for a new car? We’ve got a benefit for that. Find out if you're eligible, and you could save, on average, $10,000 every year on your next car.",buttonText:"Learn more",imageUrl:"./images/flare-cars-banner.png"},_t={title:"Benefit with Flare Cars and save",description:"In the market for a new car? We’ve got a benefit for that. Find out if you're eligible, and you could save, on average, $10,000 every year on your next car.",buttonText:"Learn more",imageUrl:"./images/flare-cars-card.png"},it={type:"Public",path:"https://www.flarecars.com/"},O={id:ot,banner:rt,card:_t,action:it},st=async(e,t)=>{if(!e||!t)return W();const n=`${e}/promoted-benefits/backend`,r=await fetch(`${n}/v1.0/promotion`,{headers:{Authorization:`Bearer ${t}`,"X-APP-VERSION":"1.0.207"}});let o;if(r.ok)try{o=await r.json()}catch(_){return console.error(`Error parsing promotion response: ${_}`),W()}return!o||Object.keys(o).length===0?W():o},W=()=>({action:O.action,banner:O.banner,card:O.card,id:O.id}),ct=async(e,t,n)=>{if(!t||!e)return;const r=`${e}/promoted-benefits/backend`;await fetch(`${r}/v1.0/promotion/${n}/view`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"X-APP-VERSION":"1.0.207"}})},at=async(e,t,n)=>{if(!t||!e)return;const r=`${e}/promoted-benefits/backend`;await fetch(`${r}/v1.0/promotion/${n==null?void 0:n.id}/action`,{method:"POST",body:JSON.stringify(n==null?void 0:n.action),headers:{Authorization:`Bearer ${t}`,"X-APP-VERSION":"1.0.207"}})},lt=async(e,t)=>{let n;const r=await fetch(e,{method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});return r.ok&&(n=await r.json()),n},ut=(e,t,n,r)=>{const o=document.referrer;return`${e}/app/?token=${t}&redirectPath=${n}&referrer=${o}&promotionId=${r}`},ft=async(e,t,n,r)=>{const o=`${e==null?void 0:e.apolloBaseUrl}/benefits`;if(!o||!n||!t||!r)return;const _=await lt(`${o}/backend/v1.0/current/token`,t);if(!(!_||!_.token))return ut(o,_.token,n,r)},dt=async(e,t,n)=>{let r;switch(e.action.type.toLowerCase()){case"benefits":return r=await ft(t,n.accessToken,e.action.path,e.id),{path:void 0,onClick:()=>{const _=window.open();_&&r&&(_.location=r)}};case"public":return{path:e.action.path,onClick:void 0};default:return}},pt=()=>{const e=qe(),t=Ye(),[n,r]=H(),[o,_]=H();T(()=>{(async()=>{const c=await st(t==null?void 0:t.apolloBaseUrl,e==null?void 0:e.accessToken);r(c),ct(t.apolloBaseUrl,e.accessToken,c==null?void 0:c.id)})()},[t.apolloBaseUrl,e.accessToken]),T(()=>{if(e&&e.expiresIn){const c=1e3*e.expiresIn,l=setTimeout(()=>{const a=W();r(a),Ge()},c);return()=>clearTimeout(l)}},[n,e]),T(()=>{(async()=>n&&_(await dt(n,t,e)))()},[t,e,n]);const s=()=>{o!=null&&o.onClick&&(o==null||o.onClick()),at(t.apolloBaseUrl,e.accessToken,n)};return n?d(N,{children:[d(tt,{banner:n.banner,path:o==null?void 0:o.path,onClick:s}),d(nt,{card:n.card,path:o==null?void 0:o.path,onClick:s})]}):d(N,{})},ht=e=>{if(e){const t=1e3*e,n={sender:"flare",type:"promotionsSessionExpired"};setTimeout(()=>{window.parent.postMessage(n,"*")},t)}},mt=(e,t)=>{if(e&&t){const n=1e3*e,r=1e3*60*5,o={expiry:t,sender:"flare",type:"promotionsSessionExpiring"};setTimeout(()=>{window.parent.postMessage(o,"*")},n-r)}},vt=e=>{try{const n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=atob(n);return JSON.parse(r)}catch{return}},yt=()=>{const[e,t]=H({}),[n,r]=H(),[o,_]=H(!1);return Ue(e),T(()=>{(async()=>{const s=await et();s&&(Qe(s),r(s))})()},[]),T(()=>{(async()=>{if(!o&&n){const s=await Ke(n);s&&t(s),_(!0)}})()},[n,o]),T(()=>{if(e.expiresIn&&e.accessToken){const s=vt(e.accessToken);ht(e.expiresIn),mt(e.expiresIn,s==null?void 0:s.exp)}},[e]),o?d(pt,{}):d(N,{})};Be(d(yt,{}),document.body);
|
package/dist/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
margin: 0;
|
|
10
10
|
}
|
|
11
11
|
</style>
|
|
12
|
-
<script type="module" crossorigin src="/promoted-benefits/app/v1.0/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/promoted-benefits/app/v1.0/assets/index-C1kyH-0F.js"></script>
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/promoted-benefits/app/v1.0/assets/index-CJ3Z12XG.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|