@frak-labs/components 1.0.7 → 1.0.8-beta.20a3d2fa
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.L6HcKGUv.js +178 -0
- package/cdn/ButtonShare.sH7UeE5a.js +1 -0
- package/cdn/{ButtonWallet.B0buPR_z.js → ButtonWallet.Cm8Qzz45.js} +1 -1
- package/cdn/{GiftIcon.eRNTGQ_r.js → GiftIcon.DnSW4dJQ.js} +1 -1
- package/cdn/{OpenInAppButton.Dgb-qhM8.js → OpenInAppButton.CTBE114K.js} +1 -1
- package/cdn/PostPurchase.fx6VasmG.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/embeddedWallet.CDUxjdX2.js +1 -0
- package/cdn/{formatReward.B1ZyoceC.js → formatReward.Cmg_Q___.js} +1 -1
- package/cdn/loader.js +1 -1
- package/cdn/replay-V6FXES7X.CNozpSRg.js +1 -0
- package/cdn/{useGlobalComponents.TG9kIYSc.js → useGlobalComponents.pjgSwLk9.js} +1 -1
- package/cdn/{useLightDomStyles.tjNBKcOr.js → useLightDomStyles.2RQE6Iby.js} +1 -1
- package/cdn/usePlacement.CRfzWKVY.js +58 -0
- package/cdn/{useReward.BtBpuMwt.js → useReward.cZ7bx5ND.js} +1 -1
- package/dist/{GiftIcon-BIp9FTJs.js → GiftIcon-WEWSJ8kV.js} +1 -1
- package/dist/banner.d.ts +1 -2
- package/dist/banner.js +3 -3
- package/dist/buttonShare.d.ts +17 -15
- package/dist/buttonShare.js +16 -14
- package/dist/buttonWallet.d.ts +1 -2
- package/dist/buttonWallet.js +1 -1
- package/dist/openInApp.d.ts +1 -3
- package/dist/openInApp.js +2 -2
- package/dist/postPurchase.d.ts +1 -2
- package/dist/postPurchase.js +3 -3
- package/dist/{useLightDomStyles-C8giLInY.js → useLightDomStyles-Xi52h2yV.js} +1 -1
- package/dist/{usePlacement-5kbU3BKj.js → usePlacement-SHVjZ5IW.js} +55 -18
- package/package.json +3 -3
- package/cdn/Banner.CcOWT4lZ.js +0 -178
- package/cdn/ButtonShare.C3yHDv8Z.js +0 -1
- package/cdn/PostPurchase.BYxnAEyn.js +0 -89
- package/cdn/embeddedWallet.BS-9u4Be.js +0 -1
- package/cdn/replay-V6FXES7X.BoL9fAjx.js +0 -1
- package/cdn/usePlacement.BgMXY5CX.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,_,v={},y=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,x=Array.isArray;function S(e,t){for(var n in t)e[n]=t[n];return e}function C(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function w(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 T(e,s,r,a,null)}function T(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 E(e){return e.children}function D(e,t){this.props=e,this.context=t}function O(e,t){if(t==null)return e.__?O(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`?O(e):null}function k(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=S({},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??O(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,oe(r,o,i),t.__e=t.__=null,o.__e!=n&&A(o)}}function A(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}),A(e)}function j(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!M.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(M)}function M(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,k(e)}finally{s.length=M.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,b=r&&r.__k||y,x=t.length;for(c=te(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||v,p.__i=d,g=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)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?(c=ne(p,c,e,_),_&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function te(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]=T(null,o,null,null,null):x(o)?o=e.__k[a]=T(E,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=T(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=ie(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=O(s)),le(s,s));return r}function ne(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=ne(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=O(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function re(e,t){return t||=[],e==null||typeof e==`boolean`||(x(e)?e.some(function(e){re(e,t)}):t.push(e)),t}function ie(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 N(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||b.test(t)?n:n+`px`}function P(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||N(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||N(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(m,`$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[p]=r[p]:(n[p]=h,e.addEventListener(t,a?_:g,a)):e.removeEventListener(t,a?_:g,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 ae(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[f]==null)t[f]=h++;else if(t[f]<n[p])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,g,_,v,b,w,T,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(v=t.props,b=M.prototype&&M.prototype.render,w=(d=M.contextType)&&r[d.__c],T=d?w?w.props.value:d.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new M(v,T):(t.__c=f=new D(v,T),f.constructor=M,f.render=ue),w&&w.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=S({},f.__s)),S(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)b&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,T),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,T)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),y.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,T),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=T,f.props=v,f.__P=e,f.__e=!1,O=a.__r,k=0,b)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),y.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=S(S({},r),f.getChildContext())),b&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===E&&d.key==null?se(d.props.children):d,c=ee(e,x(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),_&&(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--;)C(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=ce(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 oe(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 se(e){return typeof e!=`object`||!e||e.__b>0?e:x(e)?e.map(se):e.constructor===void 0?S({},e):null}function ce(e,t,n,r,o,s,c,l,u){var d,f,p,m,h,g,_,y=n.props||v,b=t.props,S=t.type;if(S==`svg`?o=`http://www.w3.org/2000/svg`:S==`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((h=s[d])&&`setAttribute`in h==!!S&&(S?h.localName==S:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(b);e=document.createElementNS(o,S,b.is&&b),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(S==null)y===b||l&&e.data==b||(e.data=b);else{if(s=S==`textarea`&&b.defaultValue!=null?null:s&&i.call(e.childNodes),!l&&s!=null)for(y={},d=0;d<e.attributes.length;d++)y[(h=e.attributes[d]).name]=h.value;for(d in y)h=y[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in b||d==`value`&&`defaultValue`in b||d==`checked`&&`defaultChecked`in b||P(e,d,null,h,o);for(d in b)h=b[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?_=h:l&&typeof h!=`function`||y[d]===h||P(e,d,h,y[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,x(m)?m:[m],t,n,r,S==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&O(n,0),l,u),s!=null)for(d=s.length;d--;)C(s[d]);l&&S!=`textarea`||(d=`value`,S==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||S==`progress`&&!g||S==`option`&&g!=y[d])&&P(e,d,g,y[d],o),d=`checked`,_!=null&&_!=e[d]&&P(e,d,_,y[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 le(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]&&le(r[i],t,n||typeof e.type!=`function`);n||C(e.__e),e.__c=e.__=e.__e=void 0}function ue(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=w(E,null,[e]),o||v,v,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),oe(s,e,c)}function de(e,t){R(e,t,de)}function fe(e,t,n){var r,a,o,s,c=S({},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),T(e.type,c,r||e.key,a||e.ref,null)}i=y.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,D.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=S({},this.state);typeof e==`function`&&(e=e(S({},n),this.props)),e&&S(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),j(this))},D.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),j(this))},D.prototype.render=E,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},M.__r=0,d=Math.random().toString(8),f=`__d`+d,p=`__a`+d,m=/(PointerCapture)$|Capture$/i,h=0,g=ae(!1),_=ae(!0);function z(){return z=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},z.apply(this,arguments)}function B(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 pe=[`context`,`children`],me=[`useFragment`];function he(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(){_e.call(this,r)},i.prototype.attributeChangedCallback=ve,i.prototype.disconnectedCallback=ye,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 ge(e){this.getChildContext=function(){return e.context};var t=e.children;return fe(t,B(e,pe))}function _e(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=w(ge,z({},this._props,{context:t.detail.context}),xe(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?de:R)(this._vdom,this._root)}function V(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function ve(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[V(e)]=n,this._vdom=fe(this._vdom,r),R(this._vdom,this._root)}}function ye(){R(this._vdom=null,this._root)}function be(e,t){var n=this,r=e.useFragment,i=B(e,me);return w(r?E:`slot`,z({},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 xe(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[V(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=xe(s[a],null,n),l=s[a].slot;l?i[l]=w(be,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?w(be,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),w(t||e.nodeName.toLowerCase(),i,d)}function Se(t,r,i=[],a={shadow:!0}){typeof window<`u`&&(e(n),customElements.get(r)||he(t,r,i,a))}var Ce=0;Array.isArray;function we(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:--Ce,__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 H,U,W,Te,G=0,Ee=[],K=a,De=K.__b,Oe=K.__r,ke=K.diffed,Ae=K.__c,je=K.unmount,Me=K.__;function q(e,t){K.__h&&K.__h(U,e,G||t),G=0;var n=U.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return G=1,Ne(ze,e)}function Ne(e,t,n){var r=q(H++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ze(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=U,!U.__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};U.__f=!0;var a=U.shouldComponentUpdate,o=U.componentWillUpdate;U.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)},U.shouldComponentUpdate=i}return r.__N||r.__}function Y(e,t){var n=q(H++,3);!K.__s&&Re(n.__H,t)&&(n.__=e,n.u=t,U.__H.__h.push(n))}function Pe(e){return G=5,X(function(){return{current:e}},[])}function X(e,t){var n=q(H++,7);return Re(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Fe(e,t){return G=8,X(function(){return e},t)}function Ie(){for(var e;e=Ee.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Q),t.__h.some($),t.__h=[]}catch(n){t.__h=[],K.__e(n,e.__v)}}}K.__b=function(e){U=null,De&&De(e)},K.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Me&&Me(e,t)},K.__r=function(e){Oe&&Oe(e),H=0;var t=(U=e.__c).__H;t&&(W===U?(t.__h=[],U.__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=[],H=0)),W=U},K.diffed=function(e){ke&&ke(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ee.push(t)!==1&&Te===K.requestAnimationFrame||((Te=K.requestAnimationFrame)||Le)(Ie)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),W=U=null},K.__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=[],K.__e(n,e.__v)}}),Ae&&Ae(e,t)},K.unmount=function(e){je&&je(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&&K.__e(t,n.__v))};var Z=typeof requestAnimationFrame==`function`;function Le(e){var t,n=function(){clearTimeout(r),Z&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Z&&(t=requestAnimationFrame(n))}function Q(e){var t=U,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),U=t}function $(e){var t=U;e.__c=e.__(),U=t}function Re(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ze(e,t){return typeof t==`function`?t(e):t}function Be(){let[e,n]=J(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:r.isResolved),[i,a]=J(()=>r.getConfig().hidden??!1),[o,s]=J(()=>!!window.FrakSetup?.client);return Y(()=>{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 Ve=`
|
|
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 He(e,t){return t?`${Ve}\n${e}\n${t}`:`${Ve}\n${e}`}const Ue=`
|
|
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 We(e){return r.getConfig().placements?.[e]}function Ge(e){let[t,n]=J(0);return Y(()=>{let e=e=>{n(e=>e+1)};return window.addEventListener(`frak:config`,e),n(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),X(()=>e?We(e):void 0,[e,t])}export{Pe as a,Fe as c,Se as d,D as f,a as g,w as h,Be as i,Y as l,E as m,He as n,X as o,re as p,Ue as r,J as s,Ge as t,we as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,h as t,
|
|
1
|
+
import{c as e,h as t,v as n}from"./loader.js";import{l as r,s as i}from"./usePlacement.CRfzWKVY.js";import{n as a}from"./formatReward.Cmg_Q___.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.2/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,5 +1,4 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/Banner/types.d.ts
|
|
5
4
|
/**
|
|
@@ -123,7 +122,7 @@ declare function Banner({
|
|
|
123
122
|
preview,
|
|
124
123
|
previewMode,
|
|
125
124
|
allowInappRedirect
|
|
126
|
-
}: BannerProps):
|
|
125
|
+
}: BannerProps): import("preact").JSX.Element | null;
|
|
127
126
|
//#endregion
|
|
128
127
|
//#region src/components/Banner/index.d.ts
|
|
129
128
|
/**
|
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-SHVjZ5IW.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-Xi52h2yV.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-WEWSJ8kV.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,5 +1,4 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/ButtonShare/types.d.ts
|
|
5
4
|
/**
|
|
@@ -9,8 +8,13 @@ import * as _$preact from "preact";
|
|
|
9
8
|
type ButtonShareProps = {
|
|
10
9
|
placement?: string;
|
|
11
10
|
/**
|
|
12
|
-
* Text to display on the button
|
|
13
|
-
*
|
|
11
|
+
* Text to display on the button.
|
|
12
|
+
*
|
|
13
|
+
* Including the placeholder `{REWARD}` (e.g. `Share and earn up to \{REWARD\}!`)
|
|
14
|
+
* opts the button into the live reward flow: the SDK fetches the
|
|
15
|
+
* estimated reward and substitutes the placeholder. When no reward is
|
|
16
|
+
* available, `noRewardText` is used as a fallback (or the placeholder is
|
|
17
|
+
* stripped if no fallback is provided).
|
|
14
18
|
* @defaultValue `"Share and earn!"`
|
|
15
19
|
*/
|
|
16
20
|
text?: string;
|
|
@@ -19,12 +23,8 @@ type ButtonShareProps = {
|
|
|
19
23
|
*/
|
|
20
24
|
classname?: string;
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
useReward?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Fallback text if the reward isn't found
|
|
26
|
+
* Fallback text when `text` contains the `{REWARD}` placeholder but no
|
|
27
|
+
* reward is available.
|
|
28
28
|
*/
|
|
29
29
|
noRewardText?: string;
|
|
30
30
|
/**
|
|
@@ -78,15 +78,18 @@ type ButtonShareProps = {
|
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
80
80
|
* @example
|
|
81
|
-
*
|
|
81
|
+
* Embedding the live reward amount. Include `{REWARD}` in `text` and the
|
|
82
|
+
* SDK fetches + substitutes the estimated reward at render time. Provide
|
|
83
|
+
* `no-reward-text` as a fallback when no reward is available:
|
|
82
84
|
* ```html
|
|
83
|
-
* <frak-button-share
|
|
85
|
+
* <frak-button-share text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!"></frak-button-share>
|
|
84
86
|
* ```
|
|
85
87
|
*
|
|
86
88
|
* @example
|
|
87
|
-
*
|
|
89
|
+
* Same as above, scoped to a specific interaction type so the reward
|
|
90
|
+
* estimate matches that flow:
|
|
88
91
|
* ```html
|
|
89
|
-
* <frak-button-share
|
|
92
|
+
* <frak-button-share text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!" target-interaction="custom.customerMeeting"></frak-button-share>
|
|
90
93
|
* ```
|
|
91
94
|
*
|
|
92
95
|
* @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the sharing-page flow
|
|
@@ -96,12 +99,11 @@ declare function ButtonShare({
|
|
|
96
99
|
placement: placementId,
|
|
97
100
|
text,
|
|
98
101
|
classname,
|
|
99
|
-
useReward: rawUseReward,
|
|
100
102
|
noRewardText,
|
|
101
103
|
targetInteraction,
|
|
102
104
|
clickAction: rawClickAction,
|
|
103
105
|
preview
|
|
104
|
-
}: ButtonShareProps):
|
|
106
|
+
}: ButtonShareProps): import("preact").JSX.Element | null;
|
|
105
107
|
//#endregion
|
|
106
108
|
//#region src/components/ButtonShare/index.d.ts
|
|
107
109
|
/**
|
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-SHVjZ5IW.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-Xi52h2yV.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";
|
|
@@ -35,21 +35,24 @@ import { jsx } from "preact/jsx-runtime";
|
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
|
-
*
|
|
38
|
+
* Embedding the live reward amount. Include `{REWARD}` in `text` and the
|
|
39
|
+
* SDK fetches + substitutes the estimated reward at render time. Provide
|
|
40
|
+
* `no-reward-text` as a fallback when no reward is available:
|
|
39
41
|
* ```html
|
|
40
|
-
* <frak-button-share
|
|
42
|
+
* <frak-button-share text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!"></frak-button-share>
|
|
41
43
|
* ```
|
|
42
44
|
*
|
|
43
45
|
* @example
|
|
44
|
-
*
|
|
46
|
+
* Same as above, scoped to a specific interaction type so the reward
|
|
47
|
+
* estimate matches that flow:
|
|
45
48
|
* ```html
|
|
46
|
-
* <frak-button-share
|
|
49
|
+
* <frak-button-share text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!" target-interaction="custom.customerMeeting"></frak-button-share>
|
|
47
50
|
* ```
|
|
48
51
|
*
|
|
49
52
|
* @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the sharing-page flow
|
|
50
53
|
* @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
|
|
51
54
|
*/
|
|
52
|
-
function ButtonShare({ placement: placementId, text = "Share and earn!", classname = "",
|
|
55
|
+
function ButtonShare({ placement: placementId, text = "Share and earn!", classname = "", noRewardText, targetInteraction, clickAction: rawClickAction, preview }) {
|
|
53
56
|
const isPreview = !!preview;
|
|
54
57
|
const placement = usePlacement(placementId);
|
|
55
58
|
const globalComponents = useGlobalComponents();
|
|
@@ -58,16 +61,16 @@ function ButtonShare({ placement: placementId, text = "Share and earn!", classna
|
|
|
58
61
|
const resolvedTargetInteraction = useMemo(() => placement?.targetInteraction !== void 0 ? placement.targetInteraction : targetInteraction, [placement?.targetInteraction, targetInteraction]);
|
|
59
62
|
const resolvedText = componentConfig?.text ?? text;
|
|
60
63
|
const resolvedNoRewardText = componentConfig?.noRewardText ?? noRewardText;
|
|
61
|
-
const
|
|
64
|
+
const wantsReward = useMemo(() => resolvedText.includes("{REWARD}"), [resolvedText]);
|
|
62
65
|
const resolvedClickAction = useMemo(() => componentConfig?.clickAction ?? rawClickAction ?? "sharing-page", [componentConfig?.clickAction, rawClickAction]);
|
|
63
66
|
const { shouldRender, isHidden, isClientReady } = useClientReady();
|
|
64
|
-
const { reward } = useReward(
|
|
67
|
+
const { reward } = useReward(wantsReward && isClientReady, resolvedTargetInteraction);
|
|
65
68
|
const btnText = useMemo(() => {
|
|
66
|
-
if (!
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
69
|
+
if (!wantsReward) return resolvedText;
|
|
70
|
+
if (reward) return applyRewardPlaceholder(resolvedText, reward);
|
|
71
|
+
return resolvedNoRewardText ?? applyRewardPlaceholder(resolvedText, void 0);
|
|
69
72
|
}, [
|
|
70
|
-
|
|
73
|
+
wantsReward,
|
|
71
74
|
resolvedText,
|
|
72
75
|
resolvedNoRewardText,
|
|
73
76
|
reward
|
|
@@ -113,7 +116,6 @@ registerWebComponent(ButtonShare, "frak-button-share", [
|
|
|
113
116
|
"placement",
|
|
114
117
|
"classname",
|
|
115
118
|
"clickAction",
|
|
116
|
-
"useReward",
|
|
117
119
|
"noRewardText",
|
|
118
120
|
"targetInteraction",
|
|
119
121
|
"preview"
|
package/dist/buttonWallet.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/ButtonWallet/types.d.ts
|
|
5
4
|
/**
|
|
@@ -70,7 +69,7 @@ declare function ButtonWallet({
|
|
|
70
69
|
classname,
|
|
71
70
|
useReward: rawUseReward,
|
|
72
71
|
targetInteraction
|
|
73
|
-
}: ButtonWalletProps):
|
|
72
|
+
}: ButtonWalletProps): import("preact").JSX.Element | null;
|
|
74
73
|
//#endregion
|
|
75
74
|
//#region src/components/ButtonWallet/index.d.ts
|
|
76
75
|
/**
|
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-SHVjZ5IW.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,5 +1,3 @@
|
|
|
1
|
-
import * as _$preact from "preact";
|
|
2
|
-
|
|
3
1
|
//#region src/components/OpenInAppButton/types.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The props type for {@link OpenInAppButton}.
|
|
@@ -49,7 +47,7 @@ declare function OpenInAppButton({
|
|
|
49
47
|
placement: placementId,
|
|
50
48
|
text,
|
|
51
49
|
classname
|
|
52
|
-
}: OpenInAppButtonProps):
|
|
50
|
+
}: OpenInAppButtonProps): import("preact").JSX.Element | null;
|
|
53
51
|
//#endregion
|
|
54
52
|
//#region src/components/OpenInAppButton/index.d.ts
|
|
55
53
|
/**
|
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-SHVjZ5IW.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-Xi52h2yV.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,5 +1,4 @@
|
|
|
1
1
|
import { SharingPageProduct } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/PostPurchase/types.d.ts
|
|
5
4
|
/**
|
|
@@ -143,7 +142,7 @@ declare function PostPurchase({
|
|
|
143
142
|
previewVariant,
|
|
144
143
|
products,
|
|
145
144
|
imageUrl
|
|
146
|
-
}: PostPurchaseProps):
|
|
145
|
+
}: PostPurchaseProps): import("preact").JSX.Element | null;
|
|
147
146
|
//#endregion
|
|
148
147
|
//#region src/components/PostPurchase/index.d.ts
|
|
149
148
|
/**
|
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-SHVjZ5IW.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-Xi52h2yV.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-WEWSJ8kV.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";
|
|
@@ -17,6 +17,43 @@ 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
|
|
20
57
|
//#region src/utils/sharingPageProducts.ts
|
|
21
58
|
/**
|
|
22
59
|
* Whether `value` is a syntactically valid URL with an `http(s):` scheme.
|
|
@@ -176,7 +213,7 @@ function initFrakSdk() {
|
|
|
176
213
|
async function doInit() {
|
|
177
214
|
if (!window.FrakSetup?.config) throw new Error("[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.");
|
|
178
215
|
console.log("[Frak SDK] Starting initialization");
|
|
179
|
-
const client = await setupClient({ config: window.FrakSetup.config });
|
|
216
|
+
const client = await setupClient({ config: withDynamicPreload(window.FrakSetup.config) });
|
|
180
217
|
if (!client) throw new Error("[Frak SDK] Failed to create client");
|
|
181
218
|
window.FrakSetup.client = client;
|
|
182
219
|
console.log("[Frak SDK] Client initialized successfully");
|
|
@@ -185,24 +222,24 @@ async function doInit() {
|
|
|
185
222
|
handleActionQueryParam();
|
|
186
223
|
}
|
|
187
224
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
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).
|
|
225
|
+
* Inject a dynamically-computed `preload` list when the caller hasn't set
|
|
226
|
+
* one explicitly.
|
|
201
227
|
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
228
|
+
* Rationale: the listener iframe warms Ring 1/Ring 2 chunks based on the
|
|
229
|
+
* `#preload=...` hash. The components CDN entry can detect which Frak
|
|
230
|
+
* components are actually on the page and avoid the warm-up cost when none
|
|
231
|
+
* are mounted. An explicit `config.preload` (including `[]`) is respected
|
|
232
|
+
* as an escape hatch.
|
|
233
|
+
*/
|
|
234
|
+
function withDynamicPreload(config) {
|
|
235
|
+
if (config.preload !== void 0) return config;
|
|
236
|
+
return {
|
|
237
|
+
...config,
|
|
238
|
+
preload: detectListenerPreloads()
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Check the query param contain params for an auto opening of the frak modal
|
|
206
243
|
*/
|
|
207
244
|
function handleActionQueryParam() {
|
|
208
245
|
const url = new URL(window.location.href);
|
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.8-beta.20a3d2fa",
|
|
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.3-beta.20a3d2fa",
|
|
90
|
+
"@frak-labs/frame-connector": "0.2.0-beta.20a3d2fa",
|
|
91
91
|
"preact": "^10.29.0",
|
|
92
92
|
"preact-custom-element": "^4.6.0",
|
|
93
93
|
"@frak-labs/design-system": "0.0.0"
|