@frak-labs/components 1.0.8-beta.20a3d2fa → 1.0.9
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/cdn/Banner.CcOWT4lZ.js +178 -0
- package/cdn/{ButtonShare.sH7UeE5a.js → ButtonShare.D9-F0jJJ.js} +1 -1
- package/cdn/{ButtonWallet.Cm8Qzz45.js → ButtonWallet.B0buPR_z.js} +1 -1
- package/cdn/{GiftIcon.DnSW4dJQ.js → GiftIcon.eRNTGQ_r.js} +1 -1
- package/cdn/{OpenInAppButton.CTBE114K.js → OpenInAppButton.Dgb-qhM8.js} +1 -1
- package/cdn/PostPurchase.BYxnAEyn.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/embeddedWallet.BS-9u4Be.js +1 -0
- package/cdn/{formatReward.Cmg_Q___.js → formatReward.B1ZyoceC.js} +1 -1
- package/cdn/loader.js +1 -1
- package/cdn/replay-V6FXES7X.BoL9fAjx.js +1 -0
- package/cdn/{useGlobalComponents.pjgSwLk9.js → useGlobalComponents.TG9kIYSc.js} +1 -1
- package/cdn/{useLightDomStyles.2RQE6Iby.js → useLightDomStyles.tjNBKcOr.js} +1 -1
- package/cdn/usePlacement.BgMXY5CX.js +58 -0
- package/cdn/{useReward.cZ7bx5ND.js → useReward.BtBpuMwt.js} +1 -1
- package/dist/{GiftIcon-WEWSJ8kV.js → GiftIcon-BIp9FTJs.js} +1 -1
- package/dist/banner.d.ts +2 -1
- package/dist/banner.js +3 -3
- package/dist/buttonShare.d.ts +2 -1
- package/dist/buttonShare.js +2 -2
- package/dist/buttonWallet.d.ts +2 -1
- package/dist/buttonWallet.js +1 -1
- package/dist/openInApp.d.ts +3 -1
- package/dist/openInApp.js +2 -2
- package/dist/postPurchase.d.ts +2 -1
- package/dist/postPurchase.js +3 -3
- package/dist/{useLightDomStyles-Xi52h2yV.js → useLightDomStyles-CgAkUlb_.js} +1 -1
- package/dist/{usePlacement-SHVjZ5IW.js → usePlacement-rmDVnK7X.js} +31 -64
- package/package.json +3 -3
- package/cdn/Banner.L6HcKGUv.js +0 -178
- package/cdn/PostPurchase.fx6VasmG.js +0 -89
- package/cdn/embeddedWallet.CDUxjdX2.js +0 -1
- package/cdn/replay-V6FXES7X.CNozpSRg.js +0 -1
- package/cdn/usePlacement.CRfzWKVY.js +0 -58
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{C as e,n as t,t as n,y as r}from"./loader.js";var i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,t,n){var r,a,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?i.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return S(e,s,r,a,null)}function S(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++o,__i:-1,__u:0};return i==null&&a.vnode!=null&&a.vnode(s),s}function C(e){return e.children}function w(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(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`?T(e):null}function E(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=y({},t);o.__v=t.__v+1,a.vnode&&a.vnode(o),F(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??T(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,re(r,o,i),t.__e=t.__=null,o.__e!=n&&D(o)}}function D(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),D(e)}function O(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!k.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(k)}function k(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,E(e)}finally{s.length=k.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y,b=r&&r.__k||g,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||h,p.__i=d,v=F(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&L(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),(y=!!(4&p.__u))||f.__k===p.__k?c=j(p,c,e,y):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=S(null,o,null,null,null):v(o)?o=e.__k[a]=S(C,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=S(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=T(s)),oe(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t){return t||=[],e==null||typeof e==`boolean`||(v(e)?e.some(function(e){M(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ne(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||_.test(t)?n:n+`px`}function N(e,t,n,r,i){var a,o;n: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||ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ne(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)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!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function P(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=f++;else if(t.t<n.u)return;return n(a.event?a.event(t):t)}}}function F(e,t,n,r,i,o,s,c,l,u){var d,f,p,m,h,_,x,S,T,E,D,O,k,A,j,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=a.__b)&&d(t);n:if(typeof M==`function`)try{if(S=t.props,T=M.prototype&&M.prototype.render,E=(d=M.contextType)&&r[d.__c],D=d?E?E.props.value:d.__:r,n.__c?x=(f=t.__c=n.__c).__=f.__E:(T?t.__c=f=new M(S,D):(t.__c=f=new w(S,D),f.constructor=M,f.render=se),E&&E.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,M.getDerivedStateFromProps(S,f.__s))),m=f.props,h=f.state,f.__v=t,p)T&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&M.getDerivedStateFromProps==null&&S!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,D),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(S,f.__s,D)){t.__v!=n.__v&&(f.props=S,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,_)})}if(f.context=D,f.props=S,f.__P=e,f.__e=!1,O=a.__r,k=0,T)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),g.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=y(y({},r),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===C&&d.key==null?ie(d.props.children):d,c=ee(e,v(A)?A:[A],t,n,r,i,o,s,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||o!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(j=o.length;j--;)b(o[j]);I(t)}else t.__e=n.__e,t.__k=n.__k,e.then||I(t);a.__e(e,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ae(n.__e,t,n,r,i,o,s,l,u);return(d=a.diffed)&&d(t),128&t.__u?void 0:c}function I(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(I))}function re(e,t,n){for(var r=0;r<n.length;r++)L(n[r],n[++r],n[++r]);a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function ie(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ie):y({},e)}function ae(e,t,n,r,o,s,c,l,u){var d,f,p,m,g,_,y,x=n.props||h,S=t.props,C=t.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(S);e=document.createElementNS(o,C,S.is&&S),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(C==null)x===S||l&&e.data==S||(e.data=S);else{if(s&&=i.call(e.childNodes),!l&&s!=null)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||N(e,d,null,g,o);for(d in S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||x[d]===g||N(e,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,v(m)?m:[m],t,n,r,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&T(n,0),l,u),s!=null)for(d=s.length;d--;)b(s[d]);l||(d=`value`,C==`progress`&&_==null?e.removeAttribute(`value`):_!=null&&(_!==e[d]||C==`progress`&&!_||C==`option`&&_!=x[d])&&N(e,d,_,x[d],o),d=`checked`,y!=null&&y!=e[d]&&N(e,d,y,x[d],o))}return e}function L(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){a.__e(e,n)}}function oe(e,t,n){var r,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||L(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&oe(r[i],t,n||typeof e.type!=`function`);n||b(e.__e),e.__c=e.__=e.__e=void 0}function se(e,t,n){return this.constructor(e,n)}function R(e,t,n){var r,o,s,c;t==document&&(t=document.documentElement),a.__&&a.__(e,t),o=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],F(t,e=(!r&&n||t).__k=x(C,null,[e]),o||h,h,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,s,!r&&n?n:o?o.__e:t.firstChild,r,c),re(s,e,c)}function ce(e,t){R(e,t,ce)}function z(e,t,n){var r,a,o,s,c=y({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?a=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?i.call(arguments,2):n),S(e.type,c,r||e.key,a||e.ref,null)}i=g.slice,a={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},o=0,w.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},w.prototype.render=C,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},k.__r=0,d=/(PointerCapture)$|Capture$/i,f=0,p=P(!1),m=P(!0);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}function V(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var le=[`context`,`children`],ue=[`useFragment`];function de(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){pe.call(this,r)},i.prototype.attributeChangedCallback=me,i.prototype.disconnectedCallback=he,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function fe(e){this.getChildContext=function(){return e.context};var t=e.children;return z(t,V(e,le))}function pe(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(fe,B({},this._props,{context:t.detail.context}),_e(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ce:R)(this._vdom,this._root)}function H(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function me(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[H(e)]=n,this._vdom=z(this._vdom,r),R(this._vdom,this._root)}}function he(){R(this._vdom=null,this._root)}function ge(e,t){var n=this,r=e.useFragment,i=V(e,ue);return x(r?C:`slot`,B({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function _e(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[H(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=_e(s[a],null,n),l=s[a].slot;l?i[l]=x(ge,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?x(ge,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),x(t||e.nodeName.toLowerCase(),i,d)}function ve(t,r,i=[],a={shadow:!0}){typeof window<`u`&&(e(n),customElements.get(r)||de(t,r,i,a))}var ye=0;Array.isArray;function be(e,t,n,r,i,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ye,__i:-1,__u:0,__source:i,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return a.vnode&&a.vnode(u),u}var U,W,G,xe,K=0,Se=[],q=a,Ce=q.__b,we=q.__r,Te=q.diffed,Ee=q.__c,De=q.unmount,Oe=q.__;function J(e,t){q.__h&&q.__h(W,e,K||t),K=0;var n=W.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return K=1,ke(Ie,e)}function ke(e,t,n){var r=J(U++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ie(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};W.__f=!0;var a=W.shouldComponentUpdate,o=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},W.shouldComponentUpdate=i}return r.__N||r.__}function X(e,t){var n=J(U++,3);!q.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,W.__H.__h.push(n))}function Ae(e){return K=5,Z(function(){return{current:e}},[])}function Z(e,t){var n=J(U++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function je(e,t){return K=8,Z(function(){return e},t)}function Me(){for(var e;e=Se.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Q),t.__h.some($),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}q.__b=function(e){W=null,Ce&&Ce(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Oe&&Oe(e,t)},q.__r=function(e){we&&we(e),U=0;var t=(W=e.__c).__H;t&&(G===W?(t.__h=[],W.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Q),t.__h.some($),t.__h=[],U=0)),G=W},q.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&xe===q.requestAnimationFrame||((xe=q.requestAnimationFrame)||Pe)(Me)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),G=W=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(Q),e.__h=e.__h.filter(function(e){return!e.__||$(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],q.__e(n,e.__v)}}),Ee&&Ee(e,t)},q.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Q(e)}catch(e){t=e}}),n.__H=void 0,t&&q.__e(t,n.__v))};var Ne=typeof requestAnimationFrame==`function`;function Pe(e){var t,n=function(){clearTimeout(r),Ne&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ne&&(t=requestAnimationFrame(n))}function Q(e){var t=W,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),W=t}function $(e){var t=W;e.__c=e.__(),W=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ie(e,t){return typeof t==`function`?t(e):t}function Le(){let[e,n]=Y(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:r.isResolved),[i,a]=Y(()=>r.getConfig().hidden??!1),[o,s]=Y(()=>!!window.FrakSetup?.client);return X(()=>{let e=r.getConfig();e.isResolved&&(n(!0),a(e.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&n(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return t(`add`,o),()=>{window.removeEventListener(`frak:config`,i),t(`remove`,o)}},[]),{shouldRender:e,isHidden:i,isClientReady:o}}const Re=`
|
|
2
|
+
:host {
|
|
3
|
+
display: contents;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:host([hidden]) {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.button:disabled {
|
|
11
|
+
opacity: 0.7;
|
|
12
|
+
cursor: default;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.button__fadeIn {
|
|
16
|
+
animation: frak-fadeIn 300ms ease-in;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes frak-fadeIn {
|
|
20
|
+
from {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
to {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;function ze(e,t){return t?`${Re}\n${e}\n${t}`:`${Re}\n${e}`}const Be=`
|
|
29
|
+
:where(frak-button-share, frak-open-in-app) {
|
|
30
|
+
display: contents;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:where(frak-button-share .button, frak-open-in-app .button) {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
gap: 10px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
|
|
41
|
+
opacity: 0.7;
|
|
42
|
+
cursor: default;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
|
|
46
|
+
animation: frak-fadeIn 300ms ease-in;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes frak-fadeIn {
|
|
50
|
+
from {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
to {
|
|
55
|
+
opacity: 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;function Ve(e){return r.getConfig().placements?.[e]}function He(e){let[t,n]=Y(0);return X(()=>{let e=e=>{n(e=>e+1)};return window.addEventListener(`frak:config`,e),n(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),Z(()=>e?Ve(e):void 0,[e,t])}export{Ae as a,je as c,ve as d,M as f,w as g,a as h,Le as i,X as l,C as m,ze as n,Z as o,x as p,Be as r,Y as s,He as t,be as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,h as t,
|
|
1
|
+
import{c as e,h as t,p as n}from"./loader.js";import{l as r,s as i}from"./usePlacement.BgMXY5CX.js";import{n as a}from"./formatReward.B1ZyoceC.js";function o(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`tiered`:return e.tiers.reduce((e,n)=>Math.max(e,n.amount[t]),0);case`percentage`:return 0}}function s({rewards:e},r,i){let s=(i?e.filter(e=>e.interactionTypeKey===i):e).map(e=>e.referrer).filter(e=>e!==void 0);if(s.length===0)return;let c=n(t(r)),l=s[0],u=o(l,c);for(let e=1;e<s.length;e++){let t=o(s[e],c);t>u&&(l=s[e],u=t)}if(u<=0){let e=s.find(e=>e.payoutType===`percentage`);if(!e)return;l=e}return a(l,r)}function c(t,n){let[a,o]=i(void 0);return r(()=>{if(!t)return;let r=window.FrakSetup?.client;r&&e(r).then(e=>{let t=r.config.metadata?.currency,i=s(e,t,n);i&&o(i)}).catch(()=>{})},[t,n]),{reward:a}}export{c as t};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "preact/hooks";
|
|
2
2
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
3
3
|
import { Component, Fragment as Fragment$1, createElement, options, toChildArray } from "preact";
|
|
4
|
-
//#region ../../node_modules/.bun/preact@10.29.
|
|
4
|
+
//#region ../../node_modules/.bun/preact@10.29.0/node_modules/preact/compat/dist/compat.module.js
|
|
5
5
|
function g(n, t) {
|
|
6
6
|
for (var e in t) n[e] = t[e];
|
|
7
7
|
return n;
|
package/dist/banner.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
+
import * as _$preact from "preact";
|
|
2
3
|
|
|
3
4
|
//#region src/components/Banner/types.d.ts
|
|
4
5
|
/**
|
|
@@ -122,7 +123,7 @@ declare function Banner({
|
|
|
122
123
|
preview,
|
|
123
124
|
previewMode,
|
|
124
125
|
allowInappRedirect
|
|
125
|
-
}: BannerProps):
|
|
126
|
+
}: BannerProps): _$preact.JSX.Element | null;
|
|
126
127
|
//#endregion
|
|
127
128
|
//#region src/components/Banner/index.d.ts
|
|
128
129
|
/**
|
package/dist/banner.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-rmDVnK7X.js";
|
|
2
2
|
import { t as useGlobalComponents } from "./useGlobalComponents-mSs9unyN.js";
|
|
3
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-CgAkUlb_.js";
|
|
4
4
|
import { t as useReward } from "./useReward-ClVShg45.js";
|
|
5
|
-
import { a as ExternalLinkIcon, i as LogoFrakWithName, n as cssSource$3, o as CloseCircleIcon, r as WarningIcon, t as GiftIcon } from "./GiftIcon-
|
|
5
|
+
import { a as ExternalLinkIcon, i as LogoFrakWithName, n as cssSource$3, o as CloseCircleIcon, r as WarningIcon, t as GiftIcon } from "./GiftIcon-BIp9FTJs.js";
|
|
6
6
|
import { isInAppBrowser, redirectToExternalBrowser, trackEvent } from "@frak-labs/core-sdk";
|
|
7
7
|
import { REFERRAL_SUCCESS_EVENT, getMergeToken } from "@frak-labs/core-sdk/actions";
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
package/dist/buttonShare.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
+
import * as _$preact from "preact";
|
|
2
3
|
|
|
3
4
|
//#region src/components/ButtonShare/types.d.ts
|
|
4
5
|
/**
|
|
@@ -103,7 +104,7 @@ declare function ButtonShare({
|
|
|
103
104
|
targetInteraction,
|
|
104
105
|
clickAction: rawClickAction,
|
|
105
106
|
preview
|
|
106
|
-
}: ButtonShareProps):
|
|
107
|
+
}: ButtonShareProps): _$preact.JSX.Element | null;
|
|
107
108
|
//#endregion
|
|
108
109
|
//#region src/components/ButtonShare/index.d.ts
|
|
109
110
|
/**
|
package/dist/buttonShare.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, s as openSharingPage, t as usePlacement } from "./usePlacement-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, s as openSharingPage, t as usePlacement } from "./usePlacement-rmDVnK7X.js";
|
|
2
2
|
import { t as openEmbeddedWallet } from "./embeddedWallet-By3_p5Xc.js";
|
|
3
3
|
import { t as useGlobalComponents } from "./useGlobalComponents-mSs9unyN.js";
|
|
4
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
4
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-CgAkUlb_.js";
|
|
5
5
|
import { t as applyRewardPlaceholder } from "./formatReward-Cf2KpA3x.js";
|
|
6
6
|
import { t as useReward } from "./useReward-ClVShg45.js";
|
|
7
7
|
import { trackEvent } from "@frak-labs/core-sdk";
|
package/dist/buttonWallet.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
+
import * as _$preact from "preact";
|
|
2
3
|
|
|
3
4
|
//#region src/components/ButtonWallet/types.d.ts
|
|
4
5
|
/**
|
|
@@ -69,7 +70,7 @@ declare function ButtonWallet({
|
|
|
69
70
|
classname,
|
|
70
71
|
useReward: rawUseReward,
|
|
71
72
|
targetInteraction
|
|
72
|
-
}: ButtonWalletProps):
|
|
73
|
+
}: ButtonWalletProps): _$preact.JSX.Element | null;
|
|
73
74
|
//#endregion
|
|
74
75
|
//#region src/components/ButtonWallet/index.d.ts
|
|
75
76
|
/**
|
package/dist/buttonWallet.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, n as buildStyleContent, t as usePlacement } from "./usePlacement-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, n as buildStyleContent, t as usePlacement } from "./usePlacement-rmDVnK7X.js";
|
|
2
2
|
import { t as openEmbeddedWallet } from "./embeddedWallet-By3_p5Xc.js";
|
|
3
3
|
import { t as useReward } from "./useReward-ClVShg45.js";
|
|
4
4
|
import { useEffect, useMemo, useState } from "preact/hooks";
|
package/dist/openInApp.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as _$preact from "preact";
|
|
2
|
+
|
|
1
3
|
//#region src/components/OpenInAppButton/types.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* The props type for {@link OpenInAppButton}.
|
|
@@ -47,7 +49,7 @@ declare function OpenInAppButton({
|
|
|
47
49
|
placement: placementId,
|
|
48
50
|
text,
|
|
49
51
|
classname
|
|
50
|
-
}: OpenInAppButtonProps):
|
|
52
|
+
}: OpenInAppButtonProps): _$preact.JSX.Element | null;
|
|
51
53
|
//#endregion
|
|
52
54
|
//#region src/components/OpenInAppButton/index.d.ts
|
|
53
55
|
/**
|
package/dist/openInApp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-rmDVnK7X.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-CgAkUlb_.js";
|
|
3
3
|
import { DEEP_LINK_SCHEME, isMobile, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
|
|
4
4
|
import { useMemo } from "preact/hooks";
|
|
5
5
|
import { jsx } from "preact/jsx-runtime";
|
package/dist/postPurchase.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SharingPageProduct } from "@frak-labs/core-sdk";
|
|
2
|
+
import * as _$preact from "preact";
|
|
2
3
|
|
|
3
4
|
//#region src/components/PostPurchase/types.d.ts
|
|
4
5
|
/**
|
|
@@ -142,7 +143,7 @@ declare function PostPurchase({
|
|
|
142
143
|
previewVariant,
|
|
143
144
|
products,
|
|
144
145
|
imageUrl
|
|
145
|
-
}: PostPurchaseProps):
|
|
146
|
+
}: PostPurchaseProps): _$preact.JSX.Element | null;
|
|
146
147
|
//#endregion
|
|
147
148
|
//#region src/components/PostPurchase/index.d.ts
|
|
148
149
|
/**
|
package/dist/postPurchase.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, o as sanitizeProductList, s as openSharingPage, t as usePlacement } from "./usePlacement-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, o as sanitizeProductList, s as openSharingPage, t as usePlacement } from "./usePlacement-rmDVnK7X.js";
|
|
2
2
|
import { t as useGlobalComponents } from "./useGlobalComponents-mSs9unyN.js";
|
|
3
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-CgAkUlb_.js";
|
|
4
4
|
import { n as formatEstimatedReward, t as applyRewardPlaceholder } from "./formatReward-Cf2KpA3x.js";
|
|
5
|
-
import { i as LogoFrakWithName, n as cssSource$2, t as GiftIcon } from "./GiftIcon-
|
|
5
|
+
import { i as LogoFrakWithName, n as cssSource$2, t as GiftIcon } from "./GiftIcon-BIp9FTJs.js";
|
|
6
6
|
import { trackEvent } from "@frak-labs/core-sdk";
|
|
7
7
|
import { getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import register from "preact-custom-element";
|
|
2
2
|
import * as coreSdkIndex from "@frak-labs/core-sdk";
|
|
3
|
-
import { decompressJsonFromB64, sdkConfigStore, setupClient, trackEvent, withCache } from "@frak-labs/core-sdk";
|
|
3
|
+
import { decompressJsonFromB64, deleteQueryParamCaseInsensitive, getQueryParamCaseInsensitive, sdkConfigStore, setupClient, trackEvent, withCache } from "@frak-labs/core-sdk";
|
|
4
4
|
import * as coreSdkActions from "@frak-labs/core-sdk/actions";
|
|
5
5
|
import { displaySharingPage } from "@frak-labs/core-sdk/actions";
|
|
6
6
|
import { useEffect, useMemo, useState } from "preact/hooks";
|
|
@@ -17,43 +17,6 @@ async function openSharingPage(targetInteraction, placement, options) {
|
|
|
17
17
|
}, placement);
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
-
//#region src/utils/dom/detectListenerPreloads.ts
|
|
21
|
-
/**
|
|
22
|
-
* Tags that count as "Frak components" for the purpose of preload detection.
|
|
23
|
-
*
|
|
24
|
-
* Kept in sync with the registry in `bootstrap/loader.ts#COMPONENTS_MAP` —
|
|
25
|
-
* any new public custom element should be added here too so the iframe
|
|
26
|
-
* preload hash reflects the user's actual page surface.
|
|
27
|
-
*/
|
|
28
|
-
const FRAK_COMPONENT_SELECTOR = [
|
|
29
|
-
"frak-button-share",
|
|
30
|
-
"frak-button-wallet",
|
|
31
|
-
"frak-open-in-app",
|
|
32
|
-
"frak-post-purchase",
|
|
33
|
-
"frak-banner"
|
|
34
|
-
].join(",");
|
|
35
|
-
/**
|
|
36
|
-
* Dynamically compute the iframe preload list based on which Frak components
|
|
37
|
-
* are present in the current document.
|
|
38
|
-
*
|
|
39
|
-
* Behaviour:
|
|
40
|
-
* - No `frak-*` element on the page → `[]` (caller should skip the
|
|
41
|
-
* `#preload=...` hash entirely so the listener doesn't warm chunks no one
|
|
42
|
-
* will use).
|
|
43
|
-
* - At least one `frak-*` element → `["sharing"]`. Every public component
|
|
44
|
-
* eventually opens the sharing flow (directly via `<frak-button-share>` or
|
|
45
|
-
* indirectly via wallet/post-purchase/banner CTAs), so a single hint
|
|
46
|
-
* covers the whole surface without bloating the iframe URL.
|
|
47
|
-
*
|
|
48
|
-
* Called once during {@link initFrakSdk}, before {@link setupClient} creates
|
|
49
|
-
* the iframe. Dynamically-mounted components (added after init) still work —
|
|
50
|
-
* the listener loads handlers on demand — they just skip the warm-up.
|
|
51
|
-
*/
|
|
52
|
-
function detectListenerPreloads() {
|
|
53
|
-
if (typeof document === "undefined") return [];
|
|
54
|
-
return document.querySelector(FRAK_COMPONENT_SELECTOR) !== null ? ["sharing"] : [];
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
20
|
//#region src/utils/sharingPageProducts.ts
|
|
58
21
|
/**
|
|
59
22
|
* Whether `value` is a syntactically valid URL with an `http(s):` scheme.
|
|
@@ -213,7 +176,7 @@ function initFrakSdk() {
|
|
|
213
176
|
async function doInit() {
|
|
214
177
|
if (!window.FrakSetup?.config) throw new Error("[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.");
|
|
215
178
|
console.log("[Frak SDK] Starting initialization");
|
|
216
|
-
const client = await setupClient({ config:
|
|
179
|
+
const client = await setupClient({ config: window.FrakSetup.config });
|
|
217
180
|
if (!client) throw new Error("[Frak SDK] Failed to create client");
|
|
218
181
|
window.FrakSetup.client = client;
|
|
219
182
|
console.log("[Frak SDK] Client initialized successfully");
|
|
@@ -222,36 +185,40 @@ async function doInit() {
|
|
|
222
185
|
handleActionQueryParam();
|
|
223
186
|
}
|
|
224
187
|
/**
|
|
225
|
-
*
|
|
226
|
-
* one explicitly.
|
|
188
|
+
* Check the query param for an auto-opening of the Frak sharing page.
|
|
227
189
|
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
*
|
|
190
|
+
* Supported params (all optional except `frakAction`):
|
|
191
|
+
* - `frakAction=share` triggers the auto-open.
|
|
192
|
+
* - `link` overrides the URL the sharing page generates outbound shares for.
|
|
193
|
+
* When omitted, the listener falls back to the merchant domain.
|
|
194
|
+
* - `products` is a base64-encoded compressed JSON payload of
|
|
195
|
+
* `SharingPageProduct[]` — produced by `compressJsonToB64(productsArray)`
|
|
196
|
+
* on the sender side (e.g. a Klaviyo email template). Used by
|
|
197
|
+
* post-purchase emails to surface the items the customer just bought as
|
|
198
|
+
* product cards on the sharing page.
|
|
199
|
+
* - `placement` lets the caller scope backend-driven CSS / config to a
|
|
200
|
+
* specific placement (mirrors the prop on the components).
|
|
201
|
+
*
|
|
202
|
+
* The four params are stripped from the URL via `history.replaceState` as
|
|
203
|
+
* soon as they are read, so refreshes / shares of the current URL do not
|
|
204
|
+
* re-trigger the auto-open. Matches the `fmt` (merge token) and `sso`
|
|
205
|
+
* cleanup patterns elsewhere in the SDK.
|
|
206
|
+
*
|
|
207
|
+
* Param keys and the `frakAction` keyword value are matched case-insensitively
|
|
208
|
+
* because some email tools and browsers lowercase the whole URL in transit
|
|
209
|
+
* (e.g. `?FrakAction=Share` → `?frakaction=share`).
|
|
243
210
|
*/
|
|
244
211
|
function handleActionQueryParam() {
|
|
245
212
|
const url = new URL(window.location.href);
|
|
246
|
-
if (url.searchParams
|
|
213
|
+
if (getQueryParamCaseInsensitive(url.searchParams, "frakAction")?.toLowerCase() !== "share") return;
|
|
247
214
|
console.log("[Frak SDK] Auto open share via query param");
|
|
248
|
-
const link = url.searchParams
|
|
249
|
-
const placement = url.searchParams
|
|
250
|
-
const products = decodeProductsParam(url.searchParams
|
|
251
|
-
url.searchParams
|
|
252
|
-
url.searchParams
|
|
253
|
-
url.searchParams
|
|
254
|
-
url.searchParams
|
|
215
|
+
const link = getQueryParamCaseInsensitive(url.searchParams, "link") ?? void 0;
|
|
216
|
+
const placement = getQueryParamCaseInsensitive(url.searchParams, "placement") ?? void 0;
|
|
217
|
+
const products = decodeProductsParam(getQueryParamCaseInsensitive(url.searchParams, "products"));
|
|
218
|
+
deleteQueryParamCaseInsensitive(url.searchParams, "frakAction");
|
|
219
|
+
deleteQueryParamCaseInsensitive(url.searchParams, "link");
|
|
220
|
+
deleteQueryParamCaseInsensitive(url.searchParams, "placement");
|
|
221
|
+
deleteQueryParamCaseInsensitive(url.searchParams, "products");
|
|
255
222
|
window.history.replaceState({}, "", url.toString());
|
|
256
223
|
openSharingPage(void 0, placement, {
|
|
257
224
|
link,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "1.0.
|
|
14
|
+
"version": "1.0.9",
|
|
15
15
|
"description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"publish": "echo 'Publishing components...'"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@frak-labs/core-sdk": "1.1.
|
|
90
|
-
"@frak-labs/frame-connector": "0.2.0
|
|
89
|
+
"@frak-labs/core-sdk": "1.1.4",
|
|
90
|
+
"@frak-labs/frame-connector": "0.2.0",
|
|
91
91
|
"preact": "^10.29.0",
|
|
92
92
|
"preact-custom-element": "^4.6.0",
|
|
93
93
|
"@frak-labs/design-system": "0.0.0"
|
package/cdn/Banner.L6HcKGUv.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import{T as e,b as t,d as n,m as r,s as i,u as a}from"./loader.js";import{a as o,c as s,d as c,i as l,l as u,o as d,s as f,t as ee,u as p}from"./usePlacement.CRfzWKVY.js";import{a as m,i as h,n as g,r as te,t as _}from"./GiftIcon.DnSW4dJQ.js";import{t as v}from"./useGlobalComponents.pjgSwLk9.js";import{t as y}from"./useLightDomStyles.2RQE6Iby.js";import{t as ne}from"./useReward.cZ7bx5ND.js";var b=`inAppBanner_body__1ibpiy75`,x=`inAppBanner_closeButton__1ibpiy78`,S=`inAppBanner_container__1ibpiy71`,C=`inAppBanner_cta__1ibpiy77`,w=`inAppBanner_description__1ibpiy76`,T=`inAppBanner_header__1ibpiy72`,E=`inAppBanner_iconWrapper__1ibpiy73`,D=`inAppBanner_title__1ibpiy74`;function O({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return p(`div`,{className:`${S}${o?` ${o}`:``}`,role:`alert`,children:[p(`div`,{className:T,children:[p(`span`,{className:`${E}${s?.icon?` ${s.icon}`:``}`,children:p(g,{width:20,height:20})}),p(`p`,{className:`${D}${s?.title?` ${s.title}`:``}`,children:e})]}),p(`div`,{className:b,children:[p(`p`,{className:`${w}${s?.description?` ${s.description}`:``}`,children:t}),p(`button`,{type:`button`,className:`${C}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,p(h,{width:14,height:14})]})]}),p(`button`,{type:`button`,className:`${x}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:p(m,{width:16,height:16})})]})}var k=`Banner_frakLogo__1gnumzia`,A=`Banner_iconSvg__1gnumzi2`,j=`Banner_referral__1gnumzi3 reset_base__1831jhd0 Banner_rootBase__1gnumzi1`,M=`Banner_referralBody__1gnumzi6`,re=`Banner_referralCta__1gnumzi9 sharedBaseCss_buttonReset__7cswil0`,ie=`Banner_referralDescription__1gnumzi8 reset_base__1831jhd0`,N=`Banner_referralIconWrapper__1gnumzi4`,P=`Banner_referralImage__1gnumzi5`,F=`Banner_referralTitle__1gnumzi7 reset_base__1831jhd0`;function I({placement:c,classname:m=``,interaction:h,referralTitle:g,referralDescription:b,referralCta:x,inappTitle:S,inappDescription:C,inappCta:w,imageUrl:T,preview:E,previewMode:D,allowInappRedirect:I}){let L=!!E,R=D===`inapp`?`inapp`:`referral`,z=I===!0||I===`true`,B=ee(c),{shouldRender:V,isHidden:H,isClientReady:U}=l();y(`frak-banner`,c,B?.components?.banner?.css,`@keyframes inAppBanner_fadeIn__1ibpiy70 {
|
|
2
|
-
from {
|
|
3
|
-
opacity: 0;
|
|
4
|
-
transform: translateY(-4px);
|
|
5
|
-
}
|
|
6
|
-
to {
|
|
7
|
-
opacity: 1;
|
|
8
|
-
transform: translateY(0);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
.inAppBanner_container__1ibpiy71 {
|
|
12
|
-
position: fixed;
|
|
13
|
-
top: max(8px, env(safe-area-inset-top));
|
|
14
|
-
left: 16px;
|
|
15
|
-
right: 16px;
|
|
16
|
-
z-index: 1000;
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: column;
|
|
19
|
-
gap: 4px;
|
|
20
|
-
padding: 12px 16px;
|
|
21
|
-
padding-right: 32px;
|
|
22
|
-
border-radius: 12px;
|
|
23
|
-
background-color: #000000CC;
|
|
24
|
-
backdrop-filter: blur(12px);
|
|
25
|
-
-webkit-backdrop-filter: blur(12px);
|
|
26
|
-
color: #ffffff;
|
|
27
|
-
animation: inAppBanner_fadeIn__1ibpiy70 300ms ease-out;
|
|
28
|
-
}
|
|
29
|
-
.inAppBanner_header__1ibpiy72 {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
gap: 8px;
|
|
33
|
-
}
|
|
34
|
-
.inAppBanner_iconWrapper__1ibpiy73 {
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
width: 20px;
|
|
37
|
-
height: 20px;
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
color: #ffffff;
|
|
42
|
-
}
|
|
43
|
-
.inAppBanner_title__1ibpiy74 {
|
|
44
|
-
margin: 0;
|
|
45
|
-
padding: 0;
|
|
46
|
-
font-size: 16px;
|
|
47
|
-
font-weight: 500;
|
|
48
|
-
line-height: 26px;
|
|
49
|
-
color: var(--text-onAction__pbq4ak6);
|
|
50
|
-
}
|
|
51
|
-
.inAppBanner_body__1ibpiy75 {
|
|
52
|
-
display: flex;
|
|
53
|
-
flex-wrap: wrap;
|
|
54
|
-
align-items: baseline;
|
|
55
|
-
gap: 0 4px;
|
|
56
|
-
}
|
|
57
|
-
.inAppBanner_description__1ibpiy76 {
|
|
58
|
-
margin: 0;
|
|
59
|
-
padding: 0;
|
|
60
|
-
font-size: 14px;
|
|
61
|
-
color: var(--text-onAction__pbq4ak6);
|
|
62
|
-
line-height: 22px;
|
|
63
|
-
opacity: 0.96;
|
|
64
|
-
}
|
|
65
|
-
.inAppBanner_cta__1ibpiy77 {
|
|
66
|
-
all: unset;
|
|
67
|
-
display: inline-flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: 4px;
|
|
70
|
-
color: #2BB2FF;
|
|
71
|
-
font-size: 14px;
|
|
72
|
-
font-weight: 600;
|
|
73
|
-
text-decoration: underline;
|
|
74
|
-
text-underline-offset: 2px;
|
|
75
|
-
cursor: pointer;
|
|
76
|
-
}
|
|
77
|
-
.inAppBanner_cta__1ibpiy77:focus-visible {
|
|
78
|
-
outline: 2px solid #2BB2FF;
|
|
79
|
-
outline-offset: 2px;
|
|
80
|
-
border-radius: 4px;
|
|
81
|
-
}
|
|
82
|
-
.inAppBanner_closeButton__1ibpiy78 {
|
|
83
|
-
all: unset;
|
|
84
|
-
position: absolute;
|
|
85
|
-
top: 8px;
|
|
86
|
-
right: 8px;
|
|
87
|
-
width: 28px;
|
|
88
|
-
height: 28px;
|
|
89
|
-
display: flex;
|
|
90
|
-
align-items: center;
|
|
91
|
-
justify-content: center;
|
|
92
|
-
border-radius: 9999px;
|
|
93
|
-
color: rgba(255, 255, 255, 0.6);
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
}
|
|
96
|
-
.inAppBanner_closeButton__1ibpiy78:focus-visible {
|
|
97
|
-
outline: 2px solid #ffffff;
|
|
98
|
-
outline-offset: 2px;
|
|
99
|
-
}@keyframes Banner_fadeIn__1gnumzi0 {
|
|
100
|
-
from {
|
|
101
|
-
opacity: 0;
|
|
102
|
-
transform: translateY(-4px);
|
|
103
|
-
}
|
|
104
|
-
to {
|
|
105
|
-
opacity: 1;
|
|
106
|
-
transform: translateY(0);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
.Banner_rootBase__1gnumzi1 {
|
|
110
|
-
position: relative;
|
|
111
|
-
display: flex;
|
|
112
|
-
animation: Banner_fadeIn__1gnumzi0 300ms ease-out;
|
|
113
|
-
}
|
|
114
|
-
.Banner_iconSvg__1gnumzi2 {
|
|
115
|
-
width: 100%;
|
|
116
|
-
height: 100%;
|
|
117
|
-
}
|
|
118
|
-
.Banner_referral__1gnumzi3 {
|
|
119
|
-
flex-direction: row;
|
|
120
|
-
align-items: center;
|
|
121
|
-
gap: 16px;
|
|
122
|
-
padding: 16px;
|
|
123
|
-
background-color: #ffffff;
|
|
124
|
-
color: var(--text-primary__pbq4ak0);
|
|
125
|
-
border: 1px solid var(--border-default__pbq4akv);
|
|
126
|
-
border-radius: 12px;
|
|
127
|
-
}
|
|
128
|
-
.Banner_referralIconWrapper__1gnumzi4 {
|
|
129
|
-
flex-shrink: 0;
|
|
130
|
-
align-self: flex-start;
|
|
131
|
-
display: flex;
|
|
132
|
-
align-items: center;
|
|
133
|
-
justify-content: center;
|
|
134
|
-
width: 40px;
|
|
135
|
-
height: 40px;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
}
|
|
138
|
-
.Banner_referralImage__1gnumzi5 {
|
|
139
|
-
max-width: 100%;
|
|
140
|
-
max-height: 100%;
|
|
141
|
-
width: auto;
|
|
142
|
-
height: auto;
|
|
143
|
-
object-fit: contain;
|
|
144
|
-
display: block;
|
|
145
|
-
}
|
|
146
|
-
.Banner_referralBody__1gnumzi6 {
|
|
147
|
-
flex: 1;
|
|
148
|
-
min-width: 0;
|
|
149
|
-
}
|
|
150
|
-
.Banner_referralTitle__1gnumzi7 {
|
|
151
|
-
font-size: 16px;
|
|
152
|
-
font-weight: 600;
|
|
153
|
-
color: var(--text-primary__pbq4ak0);
|
|
154
|
-
line-height: 22px;
|
|
155
|
-
}
|
|
156
|
-
.Banner_referralDescription__1gnumzi8 {
|
|
157
|
-
margin-bottom: 8px;
|
|
158
|
-
font-size: 14px;
|
|
159
|
-
color: #979797;
|
|
160
|
-
line-height: 22px;
|
|
161
|
-
}
|
|
162
|
-
.Banner_referralCta__1gnumzi9 {
|
|
163
|
-
display: inline-block;
|
|
164
|
-
padding: 8px 16px;
|
|
165
|
-
border: 1px solid #000000;
|
|
166
|
-
border-radius: 9999px;
|
|
167
|
-
color: var(--text-primary__pbq4ak0);
|
|
168
|
-
font-size: 10px;
|
|
169
|
-
font-weight: 700;
|
|
170
|
-
line-height: 12px;
|
|
171
|
-
text-transform: uppercase;
|
|
172
|
-
}
|
|
173
|
-
.Banner_frakLogo__1gnumzia {
|
|
174
|
-
position: absolute;
|
|
175
|
-
right: 16px;
|
|
176
|
-
bottom: 12px;
|
|
177
|
-
pointer-events: none;
|
|
178
|
-
}`,e);let[W,G]=f(!1),[K,q]=f(()=>L?R:z&&n?`inapp`:null),J=o(null);u(()=>{L&&q(R)},[L,R]);let{reward:Y}=ne(K===`referral`&&U,h),[X,ae]=f(null);u(()=>{let e=window.FrakSetup?.client;K!==`inapp`||L||!U||!e||i(e).then(e=>ae(e)).catch(()=>{})},[K,L,U]),u(()=>{L||!K||W||J.current!==K&&U&&(t(window.FrakSetup?.client,`banner_impression`,{placement:c,variant:K,has_reward:K===`referral`?!!Y:void 0}),J.current=K)},[K,W,U,L,c]),u(()=>{if(L||K===`inapp`)return;let e=()=>q(`referral`);return window.addEventListener(a,e),()=>window.removeEventListener(a,e)},[L,K]);let Z=s(async()=>{if(L)return;if(t(window.FrakSetup?.client,`banner_resolved`,{placement:c,variant:K??`referral`,outcome:`clicked`}),K===`referral`){G(!0);return}let e=X;if(!e&&window.FrakSetup?.client)try{e=await i(window.FrakSetup?.client)}catch{}let n=window.location.href;if(e){let t=new URL(n);t.searchParams.set(`fmt`,e),n=t.toString()}r(n)},[L,K,X,c]),oe=s(()=>{L||(t(window.FrakSetup?.client,`banner_resolved`,{placement:c,variant:K??`referral`,outcome:`dismissed`}),G(!0))},[L,K,c]),se=v(),Q=B?.components?.banner??se?.banner,$=d(()=>{if(K===`referral`){let e=Y?`Earn ${Y} on purchases on this site`:`You've been referred!`;return{title:g??Q?.referralTitle??e,description:b??Q?.referralDescription??`Earn rewards after your purchase via the Frak partner app.`,cta:x??Q?.referralCta??`Got it`}}return{title:S??Q?.inappTitle??`Open in your browser`,description:C??Q?.inappDescription??`For a better experience and to earn your rewards, open this page in your default browser.`,cta:w??Q?.inappCta??`Open browser`}},[K,Y,Q,g,b,x,S,C,w]);if(!K||!L&&(!V||H||W))return null;let ce=[j,`frak-banner`,`frak-banner--${K}`,m].filter(Boolean).join(` `);return K===`inapp`?p(O,{title:$.title,description:$.description,cta:$.cta,dismissLabel:`Dismiss`,onAction:Z,onDismiss:oe,className:[`frak-banner`,`frak-banner--inapp`,m].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):p(`div`,{class:ce,role:`alert`,children:[p(`div`,{class:`${N} frak-banner__icon`,children:T?p(`img`,{src:T,alt:``,class:P}):p(_,{class:A})}),p(`div`,{class:`${M} frak-banner__text`,children:[p(`p`,{class:`${F} frak-banner__title`,children:$.title}),p(`p`,{class:`${ie} frak-banner__description`,children:$.description}),p(`button`,{type:`button`,class:`${re} frak-banner__cta`,onClick:Z,children:$.cta})]}),p(te,{class:`${k} frak-banner__logo`,width:42,height:24})]})}c(I,`frak-banner`,[`placement`,`classname`,`interaction`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`,`imageUrl`,`allowInappRedirect`],{shadow:!1});export{I as Banner};
|